<p>I have <strong>CFHT/MegaCam fits.fz</strong> file on which I want to do photometry. I want to <strong>split these large fits.fz file into separate CCD detector fits</strong> and then run Source Extractor on them for photometric analysis. I am not familiar with this extension. I opened this in DS9, it shows 2 headers. How do I split this file? Below is the DS9 image of it. <a href="https://i.sstatic.net/HEwIl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HEwIl.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2023-04-29T10:14:02.033Z
You're conflating two things. The ".fz" extension means the file has been compressed (https://heasarc.gsfc.nasa.gov/fitsio/fpack/); this has nothing to do with whether or not it is multi-extension. (SAOimage DS9 automatically decompresses the file when it opens it.)
Peter Erwin
CC BY-SA 4.0
2023-04-29T10:15:16.353Z
Splitting the file into separate, single-extension image files can probably best be done (these days) with the `fits` library in `astropy.io`; see, e.g., [here](https://docs.astropy.org/en/stable/io/fits/index.html).
Peter Erwin
CC BY-SA 4.0
2023-04-29T15:51:28.223Z
@PeterErwin but DS9 only displays one of them (automatically). I have extracted all the 40 fits files inside it. Can I display the mosaic of all 40 images at once, either in python or ds9?
Abhinna Sundar
CC BY-SA 4.0
2023-04-29T19:37:43.877Z
You can get DS9 to open and display all the image extensions via File -> Open as -> Multiple Extension Frames ... [this will open each image in its own frame].

You can also try File -> Open as -> Mosaic WCS ...
Peter Erwin
<photometry><fits><fits-header><ds9>
Split Multi-Extension fits file - fits.fz format
Abhinna Sundar
# Split Multi-Extension fits file - fits.fz format

(Asked by: username_0 on 2023-04-29)

I have **CFHT/MegaCam fits.fz** file on which I want to do photometry. I want to **split these large fits.fz file into separate CCD detector fits** and then run Source Extractor on them for photometric analysis. I am not familiar with this extension. I opened this in DS9, it shows 2 headers. How do I split this file? Below is the DS9 image of it. [![enter image description here](https://i.sstatic.net/HEwIl.png)](https://i.sstatic.net/HEwIl.png)

**Tags:** photometry, fits, fits-header, ds9

> **Comments:**
> **username_1**: You're conflating two things. The ".fz" extension means the file has been compressed (https://heasarc.gsfc.nasa.gov/fitsio/fpack/); this has nothing to do with whether or not it is multi-extension. (SAOimage DS9 automatically decompresses the file when it opens it.)  
> **username_1**: Splitting the file into separate, single-extension image files can probably best be done (these days) with the `fits` library in `astropy.io`; see, e.g., [here](https://docs.astropy.org/en/stable/io/fits/index.html).  
> **username_0**: @PeterErwin but DS9 only displays one of them (automatically). I have extracted all the 40 fits files inside it. Can I display the mosaic of all 40 images at once, either in python or ds9?  
> **username_1**: You can get DS9 to open and display all the image extensions via File -> Open as -> Multiple Extension Frames ... [this will open each image in its own frame].  You can also try File -> Open as -> Mosaic WCS ...  

---

## 0 answers

