A simple script to search for and download ZTF frames from the IPAC archive, convert them to TIFF, and standardize their sizes for stacking.
I have always wondered what ZTF images would look like when stacked in each separate ZTF filter: Sloan g', Sloan r', Sloan i', and then converted to RGB. For this task, I needed a way to list all images ZTF have produced for a part of the sky, download them, cut them to the same size, and do all of it with a selection of parameters such as exposure time, magnitude limit, etc. So here it is, along with a gallery section below if you want to see images I produced with this script.
1.2 Radius of search: This value along with coordinates will determine the polygon in the sky that is required to be in the image in order for it to be downloaded.
1.4 Minimum acceptable mag limit for frames: It is useful for determining the quality of each frame as mag limit is impacted by factors like humidity, moon phase, etc. when the frame was captured.
1.5 Exposure Time: Most ZTF images are 30s frames, but you can change it to 300s as ZTF also generates them from time to time.
1.6 (Optional) Amount of frames to download: If it is set to "0", the script will download all frames that meet the requirements.
2. Automatic conversion of downloaded FITS files into TIF files as it is an easier file format to work with when using image editing software.
3. Standardization of image sizes. When considering all downloaded images, it is often the case that they will vary in their sizes. For example, most images are 450x450, but some are 451x450 and some are 449x451. I don't know the exact mechanism behind it, but by using "standardize_image_sizes", you can input an edge length of the square. So, for example, you can change the size of all images to 440x440. It is important as, for example, DeepSkyStacker struggles with stacking images with different sizes.
- Clone this repository and install dependencies:
pip install -r requirements.txt
- Ensure you have Python 3, PIL (Pillow), Astropy, Requests, Pandas, and NumPy available in your environment.
- Edit the variables in main.py (coordinates, radius, exposure time, etc.) to suit your needs.
- Run the script
- The script will output your images in the output folder [it will save them as fits, tif, standardized_size tifs]
- ZTF Science Data Processing System: Masci et al. (2019)
- ZTF Technical Specifications and Survey Design: Bellm et al. (2019)
- Libraries used: re, os, glob, sys, PIL (Pillow), Astropy, NumPy, Pandas