Stacking
This notebook demonstrates how to perform image stacking using the EZPhot package. Image stacking is a fundamental technique in astronomical image processing that combines multiple exposures to improve signal-to-noise ratio and reduce noise.
1. Load Data
Use the
DataBrowserclass to query and filter imagesLoad science images for processing
💡 Optional Tip: The
SDTDataQuerierclass provides methods to sync data from a central database to your local workspace, making it easy to work with large astronomical datasets.
🔍 1.1. Sync the data with SDTDataQuerier (Optional)
[1]:
# If you connected the database, you can easily sync the data from the database.
from ezphot.utils import SDTDataQuerier
sdtquery = SDTDataQuerier()
sdtquery.help()
target_name = 'T00528'
Help for SDTDataQuerier
Public methods:
- show_obsdestdata(foldername: str, show_only_numbers: bool = False, pattern: str = '*.fits')
- show_obsdestfolder(folder_key: str = '*')
- show_obssourcedata(foldername: str, show_only_numbers: bool = False, pattern: str = '*.fits')
- show_obssourcefolder(folder_key: str = '*')
- show_scidestdata(targetname: str, show_only_numbers: bool = False, key: str = 'filter', pattern: str = '*.fits')
- show_scisourcedata(targetname: str, show_only_numbers: bool = False, key: str = 'filter', file_pattern: str = '*.fits')
- show_scisourcefolder(folder_key: str = '*')
- sync_obsdata(foldername: str, file_pattern: str = '*.fits', ignore_exists: bool = True)
- sync_scidata(targetname: str, file_pattern: str = '*.fits', ignore_exists: bool = True)
[ ]:
# sync_scidata method will run multiple rsync between Science Source directory and destination directory.
print('Source directory:', sdtquery.helper.config['SDTDATA_SCISOURCEDIR'])
print('Target directory:', sdtquery.helper.config['SDTDATA_SCIDESTDIR'])
sdtquery.sync_scidata(
targetname = target_name,
file_pattern = '*.fits',
ignore_exists = True
)
🔄 Sync Progress: The rsync process copies FITS files from the source directory to your local destination directory.
1.2. Query Data with DataBrowser
The DataBrowser class allows us to query and filter our synced data. Here we’ll explore the available keys and their values to understand what data we have access to.
[2]:
# Then, you can query your data with DataBrowser class.
# Since the data is copied to your private directory (['SCIDATA_SCIDESTDIR'](e.g. ~/ezphot/data/scidata by default) in configuration), you can use it as your own data.
# You can also use it as a context for ezphot.
from ezphot.utils import DataBrowser
dbrowser = DataBrowser('scidata')
# You can query the data with the below keys.
for key, value in dbrowser.keys.items():
print(key, value)
observatory {'7DT'}
telkey {'7DT_C361K_HIGH_1x1'}
objname {'T23189', 'T25043', 'T00596', 'T13825', 'T02874', 'T03198', 'T14574', 'T12053', 'T02595', 'T00405', 'T13722', 'T00595', 'T11112', 'T00577', 'T13559', 'T13072', 'T04803', 'T14479', 'T09373', 'T13824', 'T03704', 'T07169', 'T01701', 'T23736', 'T01428', 'T00463', 'T22614', 'T12732', 'T21742', 'T03209', 'T09040', 'T24804', 'T02452', 'T09041', 'T14354', 'T00465', 'T07128', 'T01933', 'T13558', 'T24558', 'T11971', 'T24225', 'T02072', 'T00311', 'T05281', 'T24735', 'T03458', 'T11704', 'T11764', 'T11621', 'T13257', 'T23968', 'T14918', 'T09543', 'T21343', 'T23132', 'T01501', 'T14712', 'T03051', 'T20716', 'T03580', 'T13496', 'T03377', 'T13823', 'T13707', 'T05004', 'T19684', 'T23488', 'T01580', 'T00486', 'T11622', 'T04237', 'T23977', 'T03898', 'T01161', 'T22924', 'T15696', 'T13541', 'T12025', 'T25337', 'T13520', 'T05018', 'T11148', 'T09370', 'T02349', 'T14943', 'T02535', 'T06467', 'T10228', 'T24028', 'T21733', 'T01505', 'T13557', 'T25303', 'T10856', 'T00529', 'T15434', 'T17321', 'T06269', 'T11898', 'T05634', 'T07389', 'T10452', 'T23142', 'T03073', 'T08297', 'T21330', 'T12165', 'T03364', 'T08679', 'T00409', 'T00528', 'T10413', 'T13560', 'T21610', 'T11573', 'T00915', 'T05376', 'T11109', 'T16683', 'T13280', 'T03768', 'T01631', 'T03263', 'T00527', 'T05107', 'T08643', 'T16724', 'T06914', 'T00464', 'T00290', 'T11882', 'T25223', 'T01314', 'T10627'}
telname {'7DT14', '7DT09', '7DT11', '7DT05', '7DT12', '7DT16', '7DT04', '7DT10', '7DT07', '7DT02', '7DT06', '7DT15', '7DT03', '7DT01', '7DT13', '7DT08'}
filter {'m575', 'm875', 'm600', 'r', 'm700', 'm550', 'm625', 'g', 'm475', 'm775', 'm650', 'z', 'i', 'm750', 'm725', 'm425', 'm675', 'm800', 'm450', 'm850', 'm500', 'm525', 'm825', 'm400'}
imgtype set()
obsdate set()
Let’s filter our data to find specific images. We’ll search for:
Target: T00528
Filter: m600
Pattern: Files ending with
*100.fits
[3]:
dbrowser.objname = 'T00528'
dbrowser.filter = 'm600'
dbrowser.search('*100.fits', return_type = 'path')
[INFO] Found 90 files matching '/home/hhchoi1022/ezphot/data/scidata/*/*/T00528/*/m600/*100.fits'
[3]:
['/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025855_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_234441_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_072423_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_235542_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_074036_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_235531_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_234659_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_073848_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_235138_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_235006_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250820_014852_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025519_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_233554_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_234235_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_072612_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250820_014704_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_234047_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_234118_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_062434_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250824_035027_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_074224_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_023900_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_234511_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_234454_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_233758_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_234424_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_235852_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_235224_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_061533_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_233743_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_074412_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_073512_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_233858_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_234847_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_235748_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_061157_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_061010_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_062811_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_235206_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250824_034457_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025330_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_235412_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_233916_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_073324_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_234950_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_024954_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025707_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_234135_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_235600_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_024806_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_234252_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_233728_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_235354_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_234642_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_234830_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_235720_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_234323_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_062246_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_234629_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_072800_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_061910_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250824_034646_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_234104_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_030043_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_235036_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_062622_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_235018_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_061345_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_073700_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_235704_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_024048_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_235327_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_235154_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_073136_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_024617_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_024237_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_060821_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_234306_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_234817_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_233947_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025142_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_233930_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_062058_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_072948_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_234613_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_235343_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_234801_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250820_014516_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_061721_m600_100.fits',
'/home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_235515_m600_100.fits']
[4]:
# If you wish to get the ScienceImage object,
target_imgset = dbrowser.search('*100.fits', return_type = 'science')
target_imglist = target_imgset.target_images
# If you wish to get the metadata table from the keys,
metadata_table = dbrowser.search('*100.fits', return_type = 'imginfo')
[INFO] Found 90 files matching '/home/hhchoi1022/ezphot/data/scidata/*/*/T00528/*/m600/*100.fits'
Loading Science Images: 100%|██████████| 90/90 [00:01<00:00, 56.88it/s]
[INFO] Found 90 files matching '/home/hhchoi1022/ezphot/data/scidata/*/*/T00528/*/m600/*100.fits'
Loaded 90 FITS files from /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600
Total FITS files combined: 90
[5]:
metadata_table
[5]:
| file | altitude | azimuth | ccd-temp | gain | filter | imgtype | exptime | obsdate | locdate | jd | mjd | binning | object | objctid | obsmode | specmode | note | telescop |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| str126 | str32 | str32 | str32 | str21 | str4 | str5 | str32 | str23 | str23 | str32 | str32 | str21 | str6 | str32 | str4 | str7 | str9 | str5 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025855_m600_100.fits | 43.226146 | 177.841909 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-09-06T02:58:55.000 | 2025-09-05 22:58:55.000 | 2460924.624247685 | 60924.124247685184 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_234441_m600_100.fits | 36.655996 | 166.440658 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-09-03T23:44:41.000 | 2025-09-03 19:44:41.000 | 2460922.489363426 | 60921.98936342593 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_072423_m600_100.fits | 37.102087 | 193.288747 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-09-02T07:24:23.000 | 2025-09-02 03:24:23.000 | 2460920.8085995372 | 60920.308599537035 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_235542_m600_100.fits | 36.617178 | 166.418143 | -10.0 | 2750 | m600 | LIGHT | 100.0 | 2025-08-31T23:55:42.000 | 2025-08-31 19:55:42.000 | 2460919.497013889 | 60918.99701388889 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_074036_m600_100.fits | 36.283207 | 193.763747 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-09-02T07:40:36.000 | 2025-09-02 03:40:36.000 | 2460920.819861111 | 60920.319861111115 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_235531_m600_100.fits | 37.198191 | 166.77371 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-09-03T23:55:31.000 | 2025-09-03 19:55:31.000 | 2460922.496886574 | 60921.996886574074 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250904_234659_m600_100.fits | 36.969771 | 166.628158 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-09-04T23:46:59.000 | 2025-09-04 19:46:59.000 | 2460923.4909606483 | 60922.990960648145 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_073848_m600_100.fits | 36.375758 | 193.714859 | -10.0 | 2750 | m600 | LIGHT | 100.0 | 2025-09-02T07:38:48.000 | 2025-09-02 03:38:48.000 | 2460920.818611111 | 60920.31861111111 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_235138_m600_100.fits | 37.585349 | 167.040065 | -10.0 | 2750 | m600 | LIGHT | 100.0 | 2025-09-06T23:51:38.000 | 2025-09-06 19:51:38.000 | 2460925.4941898147 | 60924.99418981482 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025142_m600_100.fits | 43.16008 | 177.297766 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-09-06T02:51:42.000 | 2025-09-05 22:51:42.000 | 2460924.619236111 | 60924.11923611111 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250831_233930_m600_100.fits | 35.782502 | 165.991377 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-08-31T23:39:30.000 | 2025-08-31 19:39:30.000 | 2460919.485763889 | 60918.985763888886 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_062058_m600_100.fits | 39.8086 | 190.860402 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-09-03T06:20:58.000 | 2025-09-03 02:20:58.000 | 2460921.7645601854 | 60921.264560185184 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250902_072948_m600_100.fits | 36.83222 | 193.456107 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-09-02T07:29:48.000 | 2025-09-02 03:29:48.000 | 2460920.812361111 | 60920.31236111111 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_234613_m600_100.fits | 37.320642 | 166.855551 | -10.0 | 2750 | m600 | LIGHT | 100.0 | 2025-09-06T23:46:13.000 | 2025-09-06 19:46:13.000 | 2460925.490428241 | 60924.990428240744 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_235343_m600_100.fits | 37.10869 | 166.715666 | -10.0 | 2750 | m600 | LIGHT | 100.0 | 2025-09-03T23:53:43.000 | 2025-09-03 19:53:43.000 | 2460922.495636574 | 60921.99563657407 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_234801_m600_100.fits | 37.409343 | 166.916094 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-09-06T23:48:01.000 | 2025-09-06 19:48:01.000 | 2460925.4916782407 | 60924.99167824074 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250820_014516_m600_100.fits | 39.528965 | 168.808433 | -10.1 | 2750 | m600 | LIGHT | 100.0 | 2025-08-20T01:45:16.000 | 2025-08-19 21:45:16.000 | 2460907.5731018516 | 60907.07310185185 | 1 | T00528 | 58b4f2a07b0246b7b9d68efb4021c28f | Spec | specall | None | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250903_061721_m600_100.fits | 39.953891 | 190.679975 | -10.0 | 2750 | m600 | LIGHT | 100.0 | 2025-09-03T06:17:21.000 | 2025-09-03 02:17:21.000 | 2460921.762048611 | 60921.26204861111 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
| /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_235515_m600_100.fits | 37.759695 | 167.168072 | -10.0 | 2750 | m600 | LIGHT | 100.0 | 2025-09-06T23:55:15.000 | 2025-09-06 19:55:15.000 | 2460925.496701389 | 60924.99670138889 | 1 | T00528 | 1d2f12912f6841dc9ad12497eef6268e | Spec | specall | S250830bp | 7DT14 |
2. Check Your Images
Now that we have loaded our data, let’s inspect the images to understand their properties and quality:
Memory Warning: Astronomical images can be large. Always use
ScienceImage.clear()to free memory when you’re done with an image.
[6]:
target_img = target_imglist[0]
target_img.show('coord')
[6]:
(<Figure size 800x600 with 2 Axes>,
<WCSAxes: title={'center': 'calib_7DT14_T00528_20250906_025855_m600_100.fits'}>)
[7]:
# [CAUTION] For memory management, NOTE the below example.
# When you run any functions that load the data, all data are stored in the memory (data_load = True).
target_img
[7]:
ScienceImage(
is_exists = True,
is_saved = True,
data_load = True,
header_load = True,
imgtype = LIGHT,
exptime = 100.0,
filter = m600,
path = /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025855_m600_100.fits,
savedir = /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600
)
Use ScienceImage.clear() to free memory when you’re done with an image:
[8]:
#To clear the memory, run ScienceImage.clear()
target_img.clear()
target_img
Cleared data and/or header from memory.
[8]:
ScienceImage(
is_exists = True,
is_saved = True,
data_load = False,
header_load = True,
imgtype = LIGHT,
exptime = 100.0,
filter = m600,
path = /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025855_m600_100.fits,
savedir = /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600
)
[9]:
# You can check the image with ds9 if X11 forward is available (via SSH)
target_img.run_ds9()
Running "ds9 -scalemode zscale -scale lock yes -frame lock image /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025855_m600_100.fits &" in the terminal...
bash: cannot set terminal process group (2263633): Inappropriate ioctl for device
bash: no job control in this shell
3. Background Estimation
Background estimation is crucial for accurate photometry and image analysis. Here we are going to repeat the procedure in :doc:example/backgroundestimation.
Estimate background using the SEP (Source Extractor Python) algorithm
Apply source masking to improve background estimation
Science Note: Background estimation removes sky brightness and instrumental effects, revealing the true astronomical sources in your images.
3.1. Background estimation
[10]:
# Calculate the background map
target_bkg = target_img.calculate_bkg(
target_srcmask = None,
target_ivpmask = None,
is_2D_bkg = True,
box_size = 128,
filter_size = 3,
save = False,
verbose = True,
visualize = True
)
# Clear the memory
target_bkg.clear(verbose = True)
Cleared data and header from memory.
3.2. Advanced Background Estimation
Sometimes the background model may include real sources like saturated stars or extended objects. In such cases, you can apply source masks to improve the background estimation.
💡 Pro Tip: Source masking helps create cleaner background models by excluding bright objects that could bias the background calculation.
3.2.1. Automatic Source Mask Generation
[11]:
target_srcmask = target_img.calculate_sourcemask(
sigma = 5.0,
mask_radius_factor = 2,
saturation_level = 50000,
save = False,
verbose = True,
visualize = True,
save_fig = False
)
Masking source... [sigma = 5.0, mask_radius_factor = 2]
[1] 3275150
application-specific initialization failed: no display name and no $DISPLAY environment variable
Unable to initialize window system.
2948 non-saturated, 13 saturated sources
2961 sources masked.
3.2.2. Re-generation of Background Map with Source Mask
[12]:
target_bkg_with_srcmask = target_img.calculate_bkg(
target_srcmask = target_srcmask,
target_ivpmask = None,
is_2D_bkg = True,
box_size = 128,
filter_size = 3,
)
External mask is loaded.
[13]:
# Write and clear the memory
target_srcmask.write()
target_bkg_with_srcmask.write()
target_srcmask.clear()
target_bkg_with_srcmask.clear()
# After writing the files, you can access to the files as attributes of the ScienceImage object.
print(target_img.bkgmap)
print(target_img.sourcemask)
Saved: /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025855_m600_100.fits.srcmask
Saved: /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025855_m600_100.fits.bkgmap
Cleared data and header from memory.
Cleared data and header from memory.
Background(
is_exists = True,
is_saved = True,
data_load = False,
header_load = True,
path = /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025855_m600_100.fits.bkgmap,
savedir = /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600
)
Mask(
is_exists = True,
is_saved = True,
data_load = False,
header_load = True,
path = /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600/calib_7DT14_T00528_20250906_025855_m600_100.fits.srcmask,
savedir = /home/hhchoi1022/ezphot/data/scidata/7DT/7DT_C361K_HIGH_1x1/T00528/7DT14/m600
)
[14]:
# Run for all target_imglist with multiprocessing
from multiprocessing import Pool
from tqdm import tqdm
def calculate_bkg(target_img):
target_srcmask = target_img.calculate_sourcemask(
sigma = 5.0,
mask_radius_factor = 2,
saturation_level = 50000,
save = True,
verbose = False,
visualize = False,
save_fig = False
)
target_img.calculate_bkg(
target_srcmask = target_srcmask,
target_ivpmask = None,
is_2D_bkg = True,
box_size = 128,
filter_size = 3,
save = True,
verbose = False,
visualize = False,
save_fig = False
)
target_srcmask.clear(verbose = False)
target_bkg.clear(verbose = False)
with Pool(processes = 16) as pool:
# Use tqdm with imap to show progress
list(tqdm(pool.imap(calculate_bkg, target_imglist),
total=len(target_imglist),
desc="Calculating backgrounds"))
Calculating backgrounds: 100%|██████████| 90/90 [05:48<00:00, 3.87s/it]
4. Image stacking
Image stacking is possible with Stack class in ezphot. There are multiple options available before stacking
Background subtraction (when target_bkglist is not None)
Zeropoint scaling to match the level of flux between multiple images (when scale == True, ZP_key must exist in the header. To update ZP information, run photometriccalibration before this process)
Image convolution to match the PSF size of multiple images (when convolve == True, seeing_key must exist in the header. To update SEEING information, run photometriccalibration before this process)
Science Note: You can also stack Background RMS map by target_bkgrmslist parameters.
4.1. Image stacking
[15]:
from ezphot.methods import Stack
stacker = Stack()
stacker.help()
Help for Stack
Public methods:
- match_seeing(target_imglist: List[Union[ezphot.imageobjects.scienceimage.ScienceImage, ezphot.imageobjects.calibrationimage.CalibrationImage]], target_errormaplist: Optional[List[ezphot.imageobjects.errormap.Errormap]] = None, target_bkglist: Optional[List[ezphot.imageobjects.background.Background]] = None, seeing_key: str = 'SEEING', kernel: str = 'gaussian', save: bool = False, overwrite: bool = False, visualize: bool = True, verbose: bool = True, **kwargs)
- match_zeropoints(target_imglist: List[Union[ezphot.imageobjects.scienceimage.ScienceImage, ezphot.imageobjects.calibrationimage.CalibrationImage]], target_errormaplist: Optional[List[ezphot.imageobjects.errormap.Errormap]] = None, method: str = 'median', zp_key: str = 'ZP_APER_1', save: bool = False, overwrite: bool = False, verbose: bool = True, n_proc: int = 8, **kwargs)
- select_quality_images(target_imglist: Union[List[ezphot.imageobjects.scienceimage.ScienceImage], List[ezphot.imageobjects.referenceimage.ReferenceImage]], min_obsdate: Union[astropy.time.core.Time, str, float] = None, max_obsdate: Union[astropy.time.core.Time, str, float] = None, seeing_key: str = 'SEEING', depth_key: str = 'UL5_APER_1', ellipticity_key: str = 'ELLIP', obsdate_key: str = 'DATE-OBS', weight_ellipticity: float = 3.0, weight_seeing: float = 1.0, weight_depth: float = 2.0, max_numbers: int = None, seeing_limit: float = 6.0, depth_limit: float = 18.0, ellipticity_limit: float = 0.3, visualize: bool = False, verbose: bool = True)
- stack_multiprocess(target_imglist: Union[List[ezphot.imageobjects.scienceimage.ScienceImage], List[ezphot.imageobjects.calibrationimage.CalibrationImage]], target_bkglist: Optional[List[ezphot.imageobjects.background.Background]] = None, target_bkgrmslist: Optional[List[ezphot.imageobjects.errormap.Errormap]] = None, target_outpath: str = None, bkgrms_outpath: str = None, combine_type: str = 'median', n_proc=4, clip_type: str = None, sigma: float = 3.0, nlow: int = 1, nhigh: int = 1, resample: bool = True, resample_type: str = 'LANCZOS3', center_ra: float = None, center_dec: float = None, pixel_scale: float = None, x_size: int = None, y_size: int = None, scale: bool = True, scale_type: str = 'min', zp_key: str = 'ZP_APER_1', convolve: bool = False, seeing_key: str = 'SEEING', kernel: str = 'gaussian', verbose: bool = True, save: bool = True)
- stack_swarp(target_imglist: Union[List[ezphot.imageobjects.scienceimage.ScienceImage], List[ezphot.imageobjects.calibrationimage.CalibrationImage]], target_bkglist: Optional[List[ezphot.imageobjects.background.Background]] = None, target_errormaplist: Optional[List[ezphot.imageobjects.errormap.Errormap]] = None, target_outpath: str = None, errormap_outpath: str = None, combine_type: str = 'median', resample: bool = False, resample_type: str = 'LANCZOS3', center_ra: float = None, center_dec: float = None, pixel_scale: float = None, x_size: int = None, y_size: int = None, scale: bool = False, scale_type: str = 'min', zp_key: str = 'ZP_APER_1', convolve: bool = False, seeing_key: str = 'SEEING', kernel: str = 'gaussian', save: bool = True, verbose: bool = True, **kwargs)
[16]:
target_imglist = target_imgset.target_images
target_bkglist = target_imgset.bkgmap
stacked_img, _ = stacker.stack_multiprocess(
target_imglist = target_imglist,
target_bkglist = target_bkglist,
n_proc = 16,
scale = False,
convolve = False,
save = True,
verbose = False,
)
Loading bkgmap: 100%|██████████| 90/90 [00:02<00:00, 44.82it/s]
Subtracting background...: 100%|█████████████████████████████████| 90/90 [04:58]
Performing image reprojection...: 100%|██████████████████████████| 90/90 [02:22]
Combining...: 100%|██████████████████████████████████████████████| 16/16 [02:15]
[17]:
target_img.show()
stacked_img.show()
[17]:
(<Figure size 800x600 with 2 Axes>,
<Axes: title={'center': 'calib_7DT14_T00528_20250906_025855_m600_100.com.fits'}, xlabel='X pixel', ylabel='Y pixel'>)
4.2. Image and Background RMS stacking
[18]:
from multiprocessing import Pool
from tqdm import tqdm
from ezphot.methods import Preprocess
preprocessor = Preprocess()
def calculate_bkgrms(target_img):
mbias = preprocessor.get_masterframe_from_image(target_img, 'BIAS', 60)[0]
mdark = preprocessor.get_masterframe_from_image(target_img, 'DARK', 60)[0]
mflat = preprocessor.get_masterframe_from_image(target_img, 'FLAT', 60)[0]
target_bkgrms = target_img.calculate_bkgrms_from_propagation(
target_bkg = target_img.bkgmap,
mbias = mbias,
mdark = mdark,
mflat = mflat,
mflaterr = None,
save = True,
verbose = False,
visualize = False,
save_fig = False
)
target_bkgrms.clear(verbose = False)
mbias.clear(verbose = False)
mdark.clear(verbose = False)
mflat.clear(verbose = False)
with Pool(processes = 16) as pool:
# Use tqdm with imap to show progress
target_bkgrmslist = list(tqdm(pool.imap(calculate_bkgrms, target_imglist),
total=len(target_imglist),
desc="Calculating background RMS"))
Calculating background RMS: 100%|██████████| 90/90 [02:36<00:00, 1.74s/it]
[19]:
from ezphot.methods import Stack
stacker = Stack()
stacker.help()
Help for Stack
Public methods:
- match_seeing(target_imglist: List[Union[ezphot.imageobjects.scienceimage.ScienceImage, ezphot.imageobjects.calibrationimage.CalibrationImage]], target_errormaplist: Optional[List[ezphot.imageobjects.errormap.Errormap]] = None, target_bkglist: Optional[List[ezphot.imageobjects.background.Background]] = None, seeing_key: str = 'SEEING', kernel: str = 'gaussian', save: bool = False, overwrite: bool = False, visualize: bool = True, verbose: bool = True, **kwargs)
- match_zeropoints(target_imglist: List[Union[ezphot.imageobjects.scienceimage.ScienceImage, ezphot.imageobjects.calibrationimage.CalibrationImage]], target_errormaplist: Optional[List[ezphot.imageobjects.errormap.Errormap]] = None, method: str = 'median', zp_key: str = 'ZP_APER_1', save: bool = False, overwrite: bool = False, verbose: bool = True, n_proc: int = 8, **kwargs)
- select_quality_images(target_imglist: Union[List[ezphot.imageobjects.scienceimage.ScienceImage], List[ezphot.imageobjects.referenceimage.ReferenceImage]], min_obsdate: Union[astropy.time.core.Time, str, float] = None, max_obsdate: Union[astropy.time.core.Time, str, float] = None, seeing_key: str = 'SEEING', depth_key: str = 'UL5_APER_1', ellipticity_key: str = 'ELLIP', obsdate_key: str = 'DATE-OBS', weight_ellipticity: float = 3.0, weight_seeing: float = 1.0, weight_depth: float = 2.0, max_numbers: int = None, seeing_limit: float = 6.0, depth_limit: float = 18.0, ellipticity_limit: float = 0.3, visualize: bool = False, verbose: bool = True)
- stack_multiprocess(target_imglist: Union[List[ezphot.imageobjects.scienceimage.ScienceImage], List[ezphot.imageobjects.calibrationimage.CalibrationImage]], target_bkglist: Optional[List[ezphot.imageobjects.background.Background]] = None, target_bkgrmslist: Optional[List[ezphot.imageobjects.errormap.Errormap]] = None, target_outpath: str = None, bkgrms_outpath: str = None, combine_type: str = 'median', n_proc=4, clip_type: str = None, sigma: float = 3.0, nlow: int = 1, nhigh: int = 1, resample: bool = True, resample_type: str = 'LANCZOS3', center_ra: float = None, center_dec: float = None, pixel_scale: float = None, x_size: int = None, y_size: int = None, scale: bool = True, scale_type: str = 'min', zp_key: str = 'ZP_APER_1', convolve: bool = False, seeing_key: str = 'SEEING', kernel: str = 'gaussian', verbose: bool = True, save: bool = True)
- stack_swarp(target_imglist: Union[List[ezphot.imageobjects.scienceimage.ScienceImage], List[ezphot.imageobjects.calibrationimage.CalibrationImage]], target_bkglist: Optional[List[ezphot.imageobjects.background.Background]] = None, target_errormaplist: Optional[List[ezphot.imageobjects.errormap.Errormap]] = None, target_outpath: str = None, errormap_outpath: str = None, combine_type: str = 'median', resample: bool = False, resample_type: str = 'LANCZOS3', center_ra: float = None, center_dec: float = None, pixel_scale: float = None, x_size: int = None, y_size: int = None, scale: bool = False, scale_type: str = 'min', zp_key: str = 'ZP_APER_1', convolve: bool = False, seeing_key: str = 'SEEING', kernel: str = 'gaussian', save: bool = True, verbose: bool = True, **kwargs)
[20]:
target_imglist = target_imgset.target_images
target_bkglist = target_imgset.bkgmap
target_bkgrmslist = target_imgset.bkgrms
stacked_img, stacked_bkgrms = stacker.stack_multiprocess(
target_imglist = target_imglist,
target_bkglist = target_bkglist,
target_bkgrmslist = target_bkgrmslist,
n_proc = 16,
scale = False,
convolve = False,
save = True,
verbose = False,
)
Loading bkgrms: 100%|██████████| 90/90 [00:01<00:00, 66.88it/s]
Subtracting background...: 100%|█████████████████████████████████| 90/90 [03:31]
Performing image/bkgrms reprojection...: 100%|███████████████████| 90/90 [05:23]
Combining...: 100%|██████████████████████████████████████████████| 16/16 [04:38]
[21]:
stacked_img.show()
stacked_bkgrms.show()
4.3. Image stacking with convolution or ZP scaling
When images have information about PSF size or zeropoints in the header, you can stack images with convolution or ZP scaling.
To update the header, please refer Example Photometric Calibration.
You can apply FWHM matching and ZP matching after running photometric_calibration process.
[22]:
for target_img in target_imglist:
print("ZP of ", target_img.path.name, ":", target_img.header['ZP_APER_1'])
ZP of calib_7DT14_T00528_20250906_025855_m600_100.fits : 26.302696857378585
ZP of calib_7DT14_T00528_20250903_234441_m600_100.fits : 26.21969918892981
ZP of calib_7DT14_T00528_20250902_072423_m600_100.fits : 26.24222441668575
ZP of calib_7DT14_T00528_20250831_235542_m600_100.fits : 26.20522598075139
ZP of calib_7DT14_T00528_20250902_074036_m600_100.fits : 26.213725328142672
ZP of calib_7DT14_T00528_20250903_235531_m600_100.fits : 26.270388015374934
ZP of calib_7DT14_T00528_20250904_234659_m600_100.fits : 26.30584164781407
ZP of calib_7DT14_T00528_20250902_073848_m600_100.fits : 26.242540486447524
ZP of calib_7DT14_T00528_20250906_235138_m600_100.fits : 26.295210312679732
ZP of calib_7DT14_T00528_20250903_235006_m600_100.fits : 26.258317512974056
ZP of calib_7DT14_T00528_20250820_014852_m600_100.fits : 26.11652441668575
ZP of calib_7DT14_T00528_20250906_025519_m600_100.fits : 26.230477911415278
ZP of calib_7DT14_T00528_20250831_233554_m600_100.fits : 26.238168716540233
ZP of calib_7DT14_T00528_20250906_234235_m600_100.fits : 26.30307177617626
ZP of calib_7DT14_T00528_20250902_072612_m600_100.fits : 26.252441647814074
ZP of calib_7DT14_T00528_20250820_014704_m600_100.fits : 26.178230270608047
ZP of calib_7DT14_T00528_20250906_234047_m600_100.fits : 26.29125896545197
ZP of calib_7DT14_T00528_20250831_234118_m600_100.fits : 26.23400610659055
ZP of calib_7DT14_T00528_20250903_062434_m600_100.fits : 24.605461692873902
ZP of calib_7DT14_T00528_20250824_035027_m600_100.fits : 26.30448289751072
ZP of calib_7DT14_T00528_20250902_074224_m600_100.fits : 26.242640486447527
ZP of calib_7DT14_T00528_20250906_023900_m600_100.fits : 26.214925244590894
ZP of calib_7DT14_T00528_20250904_234511_m600_100.fits : 26.312582897510723
ZP of calib_7DT14_T00528_20250831_234454_m600_100.fits : 26.22972532814267
ZP of calib_7DT14_T00528_20250904_233758_m600_100.fits : 26.27408837845578
ZP of calib_7DT14_T00528_20250906_234424_m600_100.fits : 26.318184319241197
ZP of calib_7DT14_T00528_20250906_235852_m600_100.fits : 26.344660947513198
ZP of calib_7DT14_T00528_20250904_235224_m600_100.fits : 26.31132815203487
ZP of calib_7DT14_T00528_20250903_061533_m600_100.fits : 24.965025980751392
ZP of calib_7DT14_T00528_20250831_233743_m600_100.fits : 26.234954112826696
ZP of calib_7DT14_T00528_20250902_074412_m600_100.fits : 26.245543504480782
ZP of calib_7DT14_T00528_20250902_073512_m600_100.fits : 26.25369176485851
ZP of calib_7DT14_T00528_20250906_233858_m600_100.fits : 26.291544578308816
ZP of calib_7DT14_T00528_20250904_234847_m600_100.fits : 26.311038304935693
ZP of calib_7DT14_T00528_20250904_235748_m600_100.fits : 26.32026275277385
ZP of calib_7DT14_T00528_20250903_061157_m600_100.fits : 25.450461692873905
ZP of calib_7DT14_T00528_20250903_061010_m600_100.fits : 25.490234219588785
ZP of calib_7DT14_T00528_20250903_062811_m600_100.fits : 25.047082695257377
ZP of calib_7DT14_T00528_20250831_235206_m600_100.fits : 26.22225237840509
ZP of calib_7DT14_T00528_20250824_034457_m600_100.fits : 26.317317512974057
ZP of calib_7DT14_T00528_20250906_025330_m600_100.fits : 26.248359283044888
ZP of calib_7DT14_T00528_20250904_235412_m600_100.fits : 26.322940486447525
ZP of calib_7DT14_T00528_20250903_233916_m600_100.fits : 26.25226717377567
ZP of calib_7DT14_T00528_20250902_073324_m600_100.fits : 26.226849725949748
ZP of calib_7DT14_T00528_20250906_234950_m600_100.fits : 26.332431833813047
ZP of calib_7DT14_T00528_20250906_024954_m600_100.fits : 26.29193816856953
ZP of calib_7DT14_T00528_20250906_025707_m600_100.fits : 26.29992703889766
ZP of calib_7DT14_T00528_20250904_234135_m600_100.fits : 26.315435643032117
ZP of calib_7DT14_T00528_20250904_235600_m600_100.fits : 26.30633816856953
ZP of calib_7DT14_T00528_20250906_024806_m600_100.fits : 26.216982246916942
ZP of calib_7DT14_T00528_20250903_234252_m600_100.fits : 26.29713749017276
ZP of calib_7DT14_T00528_20250903_233728_m600_100.fits : 26.2838001679936
ZP of calib_7DT14_T00528_20250831_235354_m600_100.fits : 26.20706592694515
ZP of calib_7DT14_T00528_20250831_234642_m600_100.fits : 26.216440486447524
ZP of calib_7DT14_T00528_20250831_234830_m600_100.fits : 26.224973688029216
ZP of calib_7DT14_T00528_20250903_235720_m600_100.fits : 26.27922598075139
ZP of calib_7DT14_T00528_20250904_234323_m600_100.fits : 26.296406453007954
ZP of calib_7DT14_T00528_20250903_062246_m600_100.fits : 24.66472441668575
ZP of calib_7DT14_T00528_20250903_234629_m600_100.fits : 26.198907223810693
ZP of calib_7DT14_T00528_20250902_072800_m600_100.fits : 26.233032451566636
ZP of calib_7DT14_T00528_20250903_061910_m600_100.fits : 24.994403584064557
ZP of calib_7DT14_T00528_20250824_034646_m600_100.fits : 26.30697541117014
ZP of calib_7DT14_T00528_20250903_234104_m600_100.fits : 26.293043935163617
ZP of calib_7DT14_T00528_20250906_030043_m600_100.fits : 26.264139107148132
ZP of calib_7DT14_T00528_20250904_235036_m600_100.fits : 26.325061691979123
ZP of calib_7DT14_T00528_20250903_062622_m600_100.fits : 24.76338185947862
ZP of calib_7DT14_T00528_20250831_235018_m600_100.fits : 26.221285643032115
ZP of calib_7DT14_T00528_20250903_061345_m600_100.fits : 25.308712320612262
ZP of calib_7DT14_T00528_20250902_073700_m600_100.fits : 26.226940486447525
ZP of calib_7DT14_T00528_20250906_235704_m600_100.fits : 26.30767313799261
ZP of calib_7DT14_T00528_20250906_024048_m600_100.fits : 26.1940192490328
ZP of calib_7DT14_T00528_20250906_235327_m600_100.fits : 26.306696924078878
ZP of calib_7DT14_T00528_20250903_235154_m600_100.fits : 26.29832355972206
ZP of calib_7DT14_T00528_20250902_073136_m600_100.fits : 26.243882907295095
ZP of calib_7DT14_T00528_20250906_024617_m600_100.fits : 26.25463513504254
ZP of calib_7DT14_T00528_20250906_024237_m600_100.fits : 26.175730009862782
ZP of calib_7DT14_T00528_20250903_060821_m600_100.fits : 25.505981859478617
ZP of calib_7DT14_T00528_20250831_234306_m600_100.fits : 26.23755324772913
ZP of calib_7DT14_T00528_20250903_234817_m600_100.fits : 26.264714052388488
ZP of calib_7DT14_T00528_20250904_233947_m600_100.fits : 26.31241232061226
ZP of calib_7DT14_T00528_20250906_025142_m600_100.fits : 26.257597910236665
ZP of calib_7DT14_T00528_20250831_233930_m600_100.fits : 26.238203138082184
ZP of calib_7DT14_T00528_20250903_062058_m600_100.fits : 24.679768368649007
ZP of calib_7DT14_T00528_20250902_072948_m600_100.fits : 26.245645361147492
ZP of calib_7DT14_T00528_20250906_234613_m600_100.fits : 26.32508260546474
ZP of calib_7DT14_T00528_20250903_235343_m600_100.fits : 26.263458965451967
ZP of calib_7DT14_T00528_20250906_234801_m600_100.fits : 26.325570606184456
ZP of calib_7DT14_T00528_20250820_014516_m600_100.fits : 26.203662889377775
ZP of calib_7DT14_T00528_20250903_061721_m600_100.fits : 24.81032529706954
ZP of calib_7DT14_T00528_20250906_235515_m600_100.fits : 26.309037490172763
[23]:
stacked_img, stackged_bkgrms = stacker.stack_multiprocess(
target_imglist = target_imglist,
target_bkglist = target_bkglist,
target_bkgrmslist = target_bkgrmslist,
n_proc = 16,
scale = True, # If you want to apply ZP matching, set scale = True
scale_type = 'min',
zp_key = 'ZP_APER_1',
convolve = False, # If you want to apply FWHM matching, set convolve = True
save = True,
verbose = False,
)
Subtracting background...: 100%|█████████████████████████████████| 90/90 [05:06]
Matching ZP...: 100%|████████████████████████████████████████████| 90/90 [05:03]
Performing image/bkgrms reprojection...: 100%|███████████████████| 90/90 [05:10]
Combining...: 100%|██████████████████████████████████████████████| 16/16 [04:08]
[24]:
stacked_img.show()
stacked_bkgrms.show()
4.4. Image stacking with the selected image
If you wish to select with the absolute criteria
Seeing: < 3
Depth: > 17.0
Ellipticity: < 0.3
[25]:
selected_imglist = stacker.select_quality_images(
target_imglist = target_imglist,
min_obsdate = None,
max_obsdate = None,
seeing_key = 'SEEING',
depth_key = 'UL5SKY_APER_1',
ellipticity_key = 'ELLIP',
obsdate_key = 'DATE-OBS',
weight_ellipticity = 0.0, # 0.0 means no weight
weight_seeing = 0.0, # 0.0 means no weight
weight_depth = 0.0, # 0.0 means no weight
max_numbers = None, # Set max_nunbers to None to select all images
seeing_limit = 3.0,
depth_limit = 17.0,
ellipticity_limit = 0.3,
visualize = True,
verbose = True,
)
Querying images...: 100%|████████████████████████████████████████| 90/90 [00:00]
If you wish to select top 30 images with the relative weight
weight_seeing: 3
weight_depth: 1
weight_ellipticity: 2
[26]:
selected_imglist = stacker.select_quality_images(
target_imglist = target_imglist,
min_obsdate = None,
max_obsdate = None,
seeing_key = 'SEEING',
depth_key = 'UL5SKY_APER_1',
ellipticity_key = 'ELLIP',
obsdate_key = 'DATE-OBS',
weight_ellipticity = 2.0,
weight_seeing = 3.0,
weight_depth = 1.0,
max_numbers = 30,
seeing_limit = 99,
depth_limit = 0,
ellipticity_limit = 1,
visualize = True,
verbose = True,
)
Querying images...: 100%|████████████████████████████████████████| 90/90 [00:00]
[27]:
from ezphot.imageobjects import ImageSet
selected_imgset = ImageSet(selected_imglist)
selected_imglist = selected_imgset.target_images
selected_bkglist = selected_imgset.bkgmap
selected_bkgrmslist = selected_imgset.bkgrms
Loading bkgmap: 100%|██████████| 30/30 [00:00<00:00, 54.44it/s]
Loading bkgrms: 100%|██████████| 30/30 [00:00<00:00, 66.60it/s]
[30]:
stacked_img_selected, stackged_bkgrms_selected = stacker.stack_multiprocess(
target_imglist = selected_imglist,
target_bkglist = selected_bkglist,
target_bkgrmslist = selected_bkgrmslist,
n_proc = 16,
scale = True, # If you want to apply ZP matching, set scale = True
scale_type = 'min',
zp_key = 'ZP_APER_1',
convolve = False, # If you want to apply FWHM matching, set convolve = True
save = True,
verbose = False,
)
Subtracting background...: 100%|█████████████████████████████████| 30/30 [01:32]
Matching ZP...: 100%|████████████████████████████████████████████| 30/30 [01:42]
Performing image/bkgrms reprojection...: 100%|███████████████████| 30/30 [03:18]
Combining...: 100%|██████████████████████████████████████████████| 16/16 [01:33]
[33]:
stacked_img_selected.show()
stackged_bkgrms_selected.show()