SExtractor Photometry of MACS 0717#

This TA class note is based on Jeong Hwan Lee’s TAO-2022 TA class note.

  • Purpose of this exercise: Let’s find sources in the images and plot a color-magnitude diagram

    • Example galaxy cluster: \(\color{blue}{\text{MACS J0717.5+3745}}\) (z=0.545)

    • Filters: HST/ACS F606W(V) and F814W(I)

    • There are two FITS images: M0717_F606W.fits, M0717_F814W.fits

  • Process: Extract sources → classify stars & galaxies → draw color-magnitude diagrams of the galaxies

- What is Source Extractor (SExtractor)?#

  • A program for automated detection and photometry of sources in FITS image files (Bertin & Arnouts 1996)

  • Specialized for reduction of large-scale galaxy survey data but can perform reasonably well on moderately crowded star fields.

  • Manuals:

    • User’s Manual ver.2.13 - E. Bertin (difficult to follow for beginners)

    • SExtractor for Dummies - B. Holwerda (a friendlier version)

- Running SExtractor#

  • Input files: FITS image, configuration file, parameter file

  • Output files: source catalog, FITS check images

  • running command: sextractor \(\color{blue}{\text{[FITS image]}}\) -c \(\color{red}{\text{[configuration file]}}\) -[output parameter1][value1] -[output parameter2][value2] …

    • Ex) sextractor \(\color{blue}{\text{M0717\_F814W.fits}}\) -c \(\color{red}{\text{config.txt}}\) -CATALOG_NAME 814.cat (…)

- Input parameters#

  • \(\color{blue}{\textbf{FITS image:}}\) single extension or multi-extension

  • \(\color{red}{\textbf{Configuration file:}}\) list of parameters and their values given by the user

    • example is given by ‘/usr/share/sextractor/default.sex’ (it is a default configuration file)

    • Catalog:

      • CATALOG_NAME: name of the output catalog (*.cat)

      • PARAMETERS_NAME: name of the file containing catalog contents (*.param)

    • Extraction:

      • DETECT_MINAREA: min. # of pixels above threshold → 5(default)

      • DETECT_THRESH: 1.5\(\sigma\) (default)

      • ANALYSIS_THRESH: 1.5\(\sigma\) (usually same as DETECT_THRESH)

    • Photometry:

      • SATUR_LEVEL: pixel level above which it is considered saturated

      • MAG_ZEROPOINT: magnitude zero point

      • GAIN: effective gain [e-/ADU] (only affects the magnitude error)

      • PIXEL_SCALE: [arcsec/pixel]

    • Star/Galaxy Separation:

      • SEEING_FWHM: FWHM of stars in arcsec (use DAOPHOT/imexam to estimate)

    • Background:

      • BACK_SIZE: set size of background mesh for background estimation [pixels]

    • Check Image:

      • CHECKIMAGE_TYPE: types of check images to output (recommended: APERTURES)

      • CHECKIMAGE_NAME: names of check images

  • \(\textbf{Parameter file:}\) list of parameters to extract to output catalog

    • check ‘/usr/share/sextractor/default.param’ for explanations of each parameter (total 400 parameters)

    • one column consisting of the parameter names
      X_IMAGE
      Y_IMAGE
      NUMBER
      MAG_AUTO
      MAGERR_AUTO

# read default configuration file: '/usr/share/sextractor/default.sex'
SEXDIR = '/opt/homebrew/opt/sextractor/share/sextractor/' # put the path to your sextractor directory here


for line in open(SEXDIR+'default.sex', 'r').readlines():
    line = line.strip()
    print(line)
# Default configuration file for SExtractor 2.12.4
# EB 2010-10-10
#

#-------------------------------- Catalog ------------------------------------

CATALOG_NAME     test.cat       # name of the output catalog
CATALOG_TYPE     ASCII_HEAD     # NONE,ASCII,ASCII_HEAD, ASCII_SKYCAT,
# ASCII_VOTABLE, FITS_1.0 or FITS_LDAC
PARAMETERS_NAME  default.param  # name of the file containing catalog contents

#------------------------------- Extraction ----------------------------------

DETECT_TYPE      CCD            # CCD (linear) or PHOTO (with gamma correction)
DETECT_MINAREA   3              # min. # of pixels above threshold

DETECT_THRESH    1.5            # <sigmas> or <threshold>,<ZP> in mag.arcsec-2
ANALYSIS_THRESH  1.5            # <sigmas> or <threshold>,<ZP> in mag.arcsec-2

FILTER           Y              # apply filter for detection (Y or N)?
FILTER_NAME      default.conv   # name of the file containing the filter

DEBLEND_NTHRESH  32             # Number of deblending sub-thresholds
DEBLEND_MINCONT  0.005          # Minimum contrast parameter for deblending

CLEAN            Y              # Clean spurious detections? (Y or N)?
CLEAN_PARAM      1.0            # Cleaning efficiency

#-------------------------------- WEIGHTing ----------------------------------

WEIGHT_TYPE      NONE           # type of WEIGHTing: NONE, BACKGROUND,
# MAP_RMS, MAP_VAR or MAP_WEIGHT
WEIGHT_IMAGE     weight.fits    # weight-map filename

#-------------------------------- FLAGging -----------------------------------

FLAG_IMAGE       flag.fits      # filename for an input FLAG-image
FLAG_TYPE        OR             # flag pixel combination: OR, AND, MIN, MAX
# or MOST

#------------------------------ Photometry -----------------------------------

PHOT_APERTURES   5              # MAG_APER aperture diameter(s) in pixels
PHOT_AUTOPARAMS  2.5, 3.5       # MAG_AUTO parameters: <Kron_fact>,<min_radius>
PHOT_PETROPARAMS 2.0, 3.5       # MAG_PETRO parameters: <Petrosian_fact>,
# <min_radius>
PHOT_AUTOAPERS   0.0,0.0        # <estimation>,<measurement> minimum apertures
# for MAG_AUTO and MAG_PETRO

SATUR_LEVEL      50000.0        # level (in ADUs) at which arises saturation
SATUR_KEY        SATURATE       # keyword for saturation level (in ADUs)

MAG_ZEROPOINT    0.0            # magnitude zero-point
MAG_GAMMA        4.0            # gamma of emulsion (for photographic scans)
GAIN             0.0            # detector gain in e-/ADU
GAIN_KEY         GAIN           # keyword for detector gain in e-/ADU
PIXEL_SCALE      1.0            # size of pixel in arcsec (0=use FITS WCS info)

#------------------------- Star/Galaxy Separation ----------------------------

SEEING_FWHM      1.2            # stellar FWHM in arcsec
STARNNW_NAME     default.nnw    # Neural-Network_Weight table filename

#------------------------------ Background -----------------------------------

BACK_TYPE        AUTO           # AUTO or MANUAL
BACK_VALUE       0.0            # Default background value in MANUAL mode
BACK_SIZE        64             # Background mesh: <size> or <width>,<height>
BACK_FILTERSIZE  3              # Background filter: <size> or <width>,<height>

#------------------------------ Check Image ----------------------------------

CHECKIMAGE_TYPE  NONE           # can be NONE, BACKGROUND, BACKGROUND_RMS,
# MINIBACKGROUND, MINIBACK_RMS, -BACKGROUND,
# FILTERED, OBJECTS, -OBJECTS, SEGMENTATION,
# or APERTURES
CHECKIMAGE_NAME  check.fits     # Filename for the check-image

#--------------------- Memory (change with caution!) -------------------------

MEMORY_OBJSTACK  3000           # number of objects in stack
MEMORY_PIXSTACK  300000         # number of pixels in stack
MEMORY_BUFSIZE   1024           # number of lines in buffer

#------------------------------- ASSOCiation ---------------------------------

ASSOC_NAME       sky.list       # name of the ASCII file to ASSOCiate
ASSOC_DATA       2,3,4          # columns of the data to replicate (0=all)
ASSOC_PARAMS     2,3,4          # columns of xpos,ypos[,mag]
ASSOC_RADIUS     2.0            # cross-matching radius (pixels)
ASSOC_TYPE       NEAREST        # ASSOCiation method: FIRST, NEAREST, MEAN,
# MAG_MEAN, SUM, MAG_SUM, MIN or MAX
ASSOCSELEC_TYPE  MATCHED        # ASSOC selection type: ALL, MATCHED or -MATCHED

#----------------------------- Miscellaneous ---------------------------------

VERBOSE_TYPE     NORMAL         # can be QUIET, NORMAL or FULL
HEADER_SUFFIX    .head          # Filename extension for additional headers
WRITE_XML        N              # Write XML file (Y/N)?
XML_NAME         sex.xml        # Filename for XML output
XSL_URL          file:///usr/local/share/sextractor/sextractor.xsl
# Filename for XSL style-sheet
# read parameter list file: '/usr/share/sextractor/default.param'
SEXDIR = '/opt/homebrew/opt/sextractor/share/sextractor/' # put the path to your sextractor directory here

for line in open(SEXDIR+'default.param', 'r').readlines():
    line = line.strip()
    print(line)
#NUMBER                   Running object number
#EXT_NUMBER               FITS extension number
#FLUX_ISO                 Isophotal flux                                            [count]
#FLUXERR_ISO              RMS error for isophotal flux                              [count]
#MAG_ISO                  Isophotal magnitude                                       [mag]
#MAGERR_ISO               RMS error for isophotal magnitude                         [mag]
#FLUX_ISOCOR              Corrected isophotal flux                                  [count]
#FLUXERR_ISOCOR           RMS error for corrected isophotal flux                    [count]
#MAG_ISOCOR               Corrected isophotal magnitude                             [mag]
#MAGERR_ISOCOR            RMS error for corrected isophotal magnitude               [mag]
#FLUX_APER                Flux vector within fixed circular aperture(s)             [count]
#FLUXERR_APER             RMS error vector for aperture flux(es)                    [count]
#MAG_APER                 Fixed aperture magnitude vector                           [mag]
#MAGERR_APER              RMS error vector for fixed aperture mag.                  [mag]
#FLUX_AUTO                Flux within a Kron-like elliptical aperture               [count]
#FLUXERR_AUTO             RMS error for AUTO flux                                   [count]
#MAG_AUTO                 Kron-like elliptical aperture magnitude                   [mag]
#MAGERR_AUTO              RMS error for AUTO magnitude                              [mag]
#FLUX_PETRO               Flux within a Petrosian-like elliptical aperture          [count]
#FLUXERR_PETRO            RMS error for PETROsian flux                              [count]
#MAG_PETRO                Petrosian-like elliptical aperture magnitude              [mag]
#MAGERR_PETRO             RMS error for PETROsian magnitude                         [mag]
#FLUX_BEST                Best of FLUX_AUTO and FLUX_ISOCOR                         [count]
#FLUXERR_BEST             RMS error for BEST flux                                   [count]
#MAG_BEST                 Best of MAG_AUTO and MAG_ISOCOR                           [mag]
#MAGERR_BEST              RMS error for MAG_BEST                                    [mag]
#FLUX_WIN                 Gaussian-weighted flux                                    [count]
#FLUXERR_WIN              RMS error for WIN flux                                    [count]
#MAG_WIN                  Gaussian-weighted magnitude                               [mag]
#MAGERR_WIN               RMS error for MAG_WIN                                     [mag]
#FLUX_SOMFIT              Flux derived from SOM fit                                 [count]
#FLUXERR_SOMFIT           RMS error for SOMFIT flux                                 [count]
#MAG_SOMFIT               Magnitude derived from SOM fit                            [mag]
#MAGERR_SOMFIT            Magnitude error derived from SOM fit                      [mag]
#ERROR_SOMFIT             Reduced Chi-square error of the SOM fit
#VECTOR_SOMFIT            Position vector of the winning SOM node
#KRON_RADIUS              Kron apertures in units of A or B
#PETRO_RADIUS             Petrosian apertures in units of A or B
#BACKGROUND               Background at centroid position                           [count]
#THRESHOLD                Detection threshold above background                      [count]
#FLUX_MAX                 Peak flux above background                                [count]
#ISOAREA_IMAGE            Isophotal area above Analysis threshold                   [pixel**2]
#ISOAREAF_IMAGE           Isophotal area (filtered) above Detection threshold       [pixel**2]
#XMIN_IMAGE               Minimum x-coordinate among detected pixels                [pixel]
#YMIN_IMAGE               Minimum y-coordinate among detected pixels                [pixel]
#XMAX_IMAGE               Maximum x-coordinate among detected pixels                [pixel]
#YMAX_IMAGE               Maximum y-coordinate among detected pixels                [pixel]
#XPEAK_IMAGE              x-coordinate of the brightest pixel                       [pixel]
#YPEAK_IMAGE              y-coordinate of the brightest pixel                       [pixel]
#XPEAK_FOCAL              Focal-plane x coordinate of the brightest pixel
#YPEAK_FOCAL              Focal-plane y coordinate of the brightest pixel
#XPEAK_WORLD              World-x coordinate of the brightest pixel                 [deg]
#YPEAK_WORLD              World-y coordinate of the brightest pixel                 [deg]
#ALPHAPEAK_SKY            Right ascension of brightest pix (native)                 [deg]
#DELTAPEAK_SKY            Declination of brightest pix (native)                     [deg]
#ALPHAPEAK_J2000          Right ascension of brightest pix (J2000)                  [deg]
#DELTAPEAK_J2000          Declination of brightest pix (J2000)                      [deg]
#ALPHAPEAK_B1950          Right ascension of brightest pix (B1950)                  [deg]
#DELTAPEAK_B1950          Declination of brightest pix (B1950)                      [deg]
#X_IMAGE                  Object position along x                                   [pixel]
#Y_IMAGE                  Object position along y                                   [pixel]
#X_IMAGE_DBL              Object position along x (double precision)                [pixel]
#Y_IMAGE_DBL              Object position along y (double precision)                [pixel]
#X_FOCAL                  Barycenter position along focal-plane x axis
#Y_FOCAL                  Barycenter position along focal-plane y axis
#X_WORLD                  Barycenter position along world x axis                    [deg]
#Y_WORLD                  Barycenter position along world y axis                    [deg]
#X_MAMA                   Barycenter position along MAMA x axis                     [m**(-6)]
#Y_MAMA                   Barycenter position along MAMA y axis                     [m**(-6)]
#ALPHA_SKY                Right ascension of barycenter (native)                    [deg]
#DELTA_SKY                Declination of barycenter (native)                        [deg]
#ALPHA_J2000              Right ascension of barycenter (J2000)                     [deg]
#DELTA_J2000              Declination of barycenter (J2000)                         [deg]
#ALPHA_B1950              Right ascension of barycenter (B1950)                     [deg]
#DELTA_B1950              Declination of barycenter (B1950)                         [deg]
#X2_IMAGE                 Variance along x                                          [pixel**2]
#Y2_IMAGE                 Variance along y                                          [pixel**2]
#XY_IMAGE                 Covariance between x and y                                [pixel**2]
#X2_WORLD                 Variance along X-WORLD (alpha)                            [deg**2]
#Y2_WORLD                 Variance along Y-WORLD (delta)                            [deg**2]
#XY_WORLD                 Covariance between X-WORLD and Y-WORLD                    [deg**2]
#CXX_IMAGE                Cxx object ellipse parameter                              [pixel**(-2)]
#CYY_IMAGE                Cyy object ellipse parameter                              [pixel**(-2)]
#CXY_IMAGE                Cxy object ellipse parameter                              [pixel**(-2)]
#CXX_WORLD                Cxx object ellipse parameter (WORLD units)                [deg**(-2)]
#CYY_WORLD                Cyy object ellipse parameter (WORLD units)                [deg**(-2)]
#CXY_WORLD                Cxy object ellipse parameter (WORLD units)                [deg**(-2)]
#A_IMAGE                  Profile RMS along major axis                              [pixel]
#B_IMAGE                  Profile RMS along minor axis                              [pixel]
#THETA_IMAGE              Position angle (CCW/x)                                    [deg]
#A_WORLD                  Profile RMS along major axis (world units)                [deg]
#B_WORLD                  Profile RMS along minor axis (world units)                [deg]
#THETA_WORLD              Position angle (CCW/world-x)                              [deg]
#THETA_SKY                Position angle (east of north) (native)                   [deg]
#THETA_J2000              Position angle (east of north) (J2000)                    [deg]
#THETA_B1950              Position angle (east of north) (B1950)                    [deg]
#ERRX2_IMAGE              Variance of position along x                              [pixel**2]
#ERRY2_IMAGE              Variance of position along y                              [pixel**2]
#ERRXY_IMAGE              Covariance of position between x and y                    [pixel**2]
#ERRX2_WORLD              Variance of position along X-WORLD (alpha)                [deg**2]
#ERRY2_WORLD              Variance of position along Y-WORLD (delta)                [deg**2]
#ERRXY_WORLD              Covariance of position X-WORLD/Y-WORLD                    [deg**2]
#ERRCXX_IMAGE             Cxx error ellipse parameter                               [pixel**(-2)]
#ERRCYY_IMAGE             Cyy error ellipse parameter                               [pixel**(-2)]
#ERRCXY_IMAGE             Cxy error ellipse parameter                               [pixel**(-2)]
#ERRCXX_WORLD             Cxx error ellipse parameter (WORLD units)                 [deg**(-2)]
#ERRCYY_WORLD             Cyy error ellipse parameter (WORLD units)                 [deg**(-2)]
#ERRCXY_WORLD             Cxy error ellipse parameter (WORLD units)                 [deg**(-2)]
#ERRA_IMAGE               RMS position error along major axis                       [pixel]
#ERRB_IMAGE               RMS position error along minor axis                       [pixel]
#ERRTHETA_IMAGE           Error ellipse position angle (CCW/x)                      [deg]
#ERRA_WORLD               World RMS position error along major axis                 [deg]
#ERRB_WORLD               World RMS position error along minor axis                 [deg]
#ERRTHETA_WORLD           Error ellipse pos. angle (CCW/world-x)                    [deg]
#ERRTHETA_SKY             Native error ellipse pos. angle (east of north)           [deg]
#ERRTHETA_J2000           J2000 error ellipse pos. angle (east of north)            [deg]
#ERRTHETA_B1950           B1950 error ellipse pos. angle (east of north)            [deg]
#XWIN_IMAGE               Windowed position estimate along x                        [pixel]
#YWIN_IMAGE               Windowed position estimate along y                        [pixel]
#XWIN_FOCAL               Windowed position along focal-plane x axis
#YWIN_FOCAL               Windowed position along focal-plane y axis
#XWIN_WORLD               Windowed position along world x axis                      [deg]
#YWIN_WORLD               Windowed position along world y axis                      [deg]
#ALPHAWIN_SKY             Windowed right ascension  (native)                        [deg]
#DELTAWIN_SKY             Windowed declination (native)                             [deg]
#ALPHAWIN_J2000           Windowed right ascension (J2000)                          [deg]
#DELTAWIN_J2000           windowed declination (J2000)                              [deg]
#ALPHAWIN_B1950           Windowed right ascension (B1950)                          [deg]
#DELTAWIN_B1950           Windowed declination (B1950)                              [deg]
#X2WIN_IMAGE              Windowed variance along x                                 [pixel**2]
#Y2WIN_IMAGE              Windowed variance along y                                 [pixel**2]
#XYWIN_IMAGE              Windowed covariance between x and y                       [pixel**2]
#X2WIN_WORLD              Windowed variance along X-WORLD (alpha)                   [deg**2]
#Y2WIN_WORLD              Windowed variance along Y-WORLD (delta)                   [deg**2]
#XYWIN_WORLD              Windowed covariance between X-WORLD and Y-WORLD           [deg**2]
#CXXWIN_IMAGE             Windowed Cxx object ellipse parameter                     [pixel**(-2)]
#CYYWIN_IMAGE             Windowed Cyy object ellipse parameter                     [pixel**(-2)]
#CXYWIN_IMAGE             Windowed Cxy object ellipse parameter                     [pixel**(-2)]
#CXXWIN_WORLD             Windowed Cxx object ellipse parameter (WORLD units)       [deg**(-2)]
#CYYWIN_WORLD             Windowed Cyy object ellipse parameter (WORLD units)       [deg**(-2)]
#CXYWIN_WORLD             Windowed Cxy object ellipse parameter (WORLD units)       [deg**(-2)]
#AWIN_IMAGE               Windowed profile RMS along major axis                     [pixel]
#BWIN_IMAGE               Windowed profile RMS along minor axis                     [pixel]
#THETAWIN_IMAGE           Windowed position angle (CCW/x)                           [deg]
#AWIN_WORLD               Windowed profile RMS along major axis (world units)       [deg]
#BWIN_WORLD               Windowed profile RMS along minor axis (world units)       [deg]
#THETAWIN_WORLD           Windowed position angle (CCW/world-x)                     [deg]
#THETAWIN_SKY             Windowed position angle (east of north) (native)          [deg]
#THETAWIN_J2000           Windowed position angle (east of north) (J2000)           [deg]
#THETAWIN_B1950           Windowed position angle (east of north) (B1950)           [deg]
#ERRX2WIN_IMAGE           Variance of windowed pos along x                          [pixel**2]
#ERRY2WIN_IMAGE           Variance of windowed pos along y                          [pixel**2]
#ERRXYWIN_IMAGE           Covariance of windowed pos between x and y                [pixel**2]
#ERRX2WIN_WORLD           Variance of windowed pos along X-WORLD (alpha)            [deg**2]
#ERRY2WIN_WORLD           Variance of windowed pos along Y-WORLD (delta)            [deg**2]
#ERRXYWIN_WORLD           Covariance of windowed pos X-WORLD/Y-WORLD                [deg**2]
#ERRCXXWIN_IMAGE          Cxx windowed error ellipse parameter                      [pixel**(-2)]
#ERRCYYWIN_IMAGE          Cyy windowed error ellipse parameter                      [pixel**(-2)]
#ERRCXYWIN_IMAGE          Cxy windowed error ellipse parameter                      [pixel**(-2)]
#ERRCXXWIN_WORLD          Cxx windowed error ellipse parameter (WORLD units)        [deg**(-2)]
#ERRCYYWIN_WORLD          Cyy windowed error ellipse parameter (WORLD units)        [deg**(-2)]
#ERRCXYWIN_WORLD          Cxy windowed error ellipse parameter (WORLD units)        [deg**(-2)]
#ERRAWIN_IMAGE            RMS windowed pos error along major axis                   [pixel]
#ERRBWIN_IMAGE            RMS windowed pos error along minor axis                   [pixel]
#ERRTHETAWIN_IMAGE        Windowed error ellipse pos angle (CCW/x)                  [deg]
#ERRAWIN_WORLD            World RMS windowed pos error along major axis             [deg]
#ERRBWIN_WORLD            World RMS windowed pos error along minor axis             [deg]
#ERRTHETAWIN_WORLD        Windowed error ellipse pos. angle (CCW/world-x)           [deg]
#ERRTHETAWIN_SKY          Native windowed error ellipse pos. angle (east of north)  [deg]
#ERRTHETAWIN_J2000        J2000 windowed error ellipse pos. angle (east of north)   [deg]
#ERRTHETAWIN_B1950        B1950 windowed error ellipse pos. angle (east of north)   [deg]
#NITER_WIN                Number of iterations for WIN centering
#MU_THRESHOLD             Detection threshold above background                      [mag * arcsec**(-2)]
#MU_MAX                   Peak surface brightness above background                  [mag * arcsec**(-2)]
#ISOAREA_WORLD            Isophotal area above Analysis threshold                   [deg**2]
#ISOAREAF_WORLD           Isophotal area (filtered) above Detection threshold       [deg**2]
#ISO0                     Isophotal area at level 0                                 [pixel**2]
#ISO1                     Isophotal area at level 1                                 [pixel**2]
#ISO2                     Isophotal area at level 2                                 [pixel**2]
#ISO3                     Isophotal area at level 3                                 [pixel**2]
#ISO4                     Isophotal area at level 4                                 [pixel**2]
#ISO5                     Isophotal area at level 5                                 [pixel**2]
#ISO6                     Isophotal area at level 6                                 [pixel**2]
#ISO7                     Isophotal area at level 7                                 [pixel**2]
#FLAGS                    Extraction flags
#FLAGS_WEIGHT             Weighted extraction flags
#FLAGS_WIN                Flags for WINdowed parameters
#IMAFLAGS_ISO             FLAG-image flags OR'ed over the iso. profile
#NIMAFLAGS_ISO            Number of flagged pixels entering IMAFLAGS_ISO
#NLOWWEIGHT_ISO           Nb of pixels with low weight over the iso. profile
#NLOWDWEIGHT_ISO          Nb of pixels with low det. weight over the iso. profile
#FWHM_IMAGE               FWHM assuming a gaussian core                             [pixel]
#FWHM_WORLD               FWHM assuming a gaussian core                             [deg]
#ELONGATION               A_IMAGE/B_IMAGE
#ELLIPTICITY              1 - B_IMAGE/A_IMAGE
#POLAR_IMAGE              (A_IMAGE^2 - B_IMAGE^2)/(A_IMAGE^2 + B_IMAGE^2)
#POLAR_WORLD              (A_WORLD^2 - B_WORLD^2)/(A_WORLD^2 + B_WORLD^2)
#POLARWIN_IMAGE           (AWIN^2 - BWIN^2)/(AWIN^2 + BWIN^2)
#POLARWIN_WORLD           (AWIN^2 - BWIN^2)/(AWIN^2 + BWIN^2)
#CLASS_STAR               S/G classifier output
#VIGNET                   Pixel data around detection                               [count]
#VIGNET_SHIFT             Pixel data around detection, corrected for shift          [count]
#VECTOR_ASSOC             ASSOCiated parameter vector
#NUMBER_ASSOC             Number of ASSOCiated IDs
#THRESHOLDMAX             Maximum threshold possible for detection                  [count]
#FLUX_GROWTH              Cumulated growth-curve                                    [count]
#FLUX_GROWTHSTEP          Step for growth-curves                                    [pixel]
#MAG_GROWTH               Cumulated magnitude growth-curve                          [mag]
#MAG_GROWTHSTEP           Step for growth-curves                                    [pixel]
#FLUX_RADIUS              Fraction-of-light radii                                   [pixel]
#XPSF_IMAGE               X coordinate from PSF-fitting                             [pixel]
#YPSF_IMAGE               Y coordinate from PSF-fitting                             [pixel]
#XPSF_WORLD               PSF position along world x axis                           [deg]
#YPSF_WORLD               PSF position along world y axis                           [deg]
#ALPHAPSF_SKY             Right ascension of the fitted PSF (native)                [deg]
#DELTAPSF_SKY             Declination of the fitted PSF (native)                    [deg]
#ALPHAPSF_J2000           Right ascension of the fitted PSF (J2000)                 [deg]
#DELTAPSF_J2000           Declination of the fitted PSF (J2000)                     [deg]
#ALPHAPSF_B1950           Right ascension of the fitted PSF (B1950)                 [deg]
#DELTAPSF_B1950           Declination of the fitted PSF (B1950)                     [deg]
#FLUX_PSF                 Flux from PSF-fitting                                     [count]
#FLUXERR_PSF              RMS flux error for PSF-fitting                            [count]
#MAG_PSF                  Magnitude from PSF-fitting                                [mag]
#MAGERR_PSF               RMS magnitude error from PSF-fitting                      [mag]
#NITER_PSF                Number of iterations for PSF-fitting
#CHI2_PSF                 Reduced chi2 from PSF-fitting
#ERRX2PSF_IMAGE           Variance of PSF position along x                          [pixel**2]
#ERRY2PSF_IMAGE           Variance of PSF position along y                          [pixel**2]
#ERRXYPSF_IMAGE           Covariance of PSF position between x and y                [pixel**2]
#ERRX2PSF_WORLD           Variance of PSF position along X-WORLD (alpha)            [deg**2]
#ERRY2PSF_WORLD           Variance of PSF position along Y-WORLD (delta)            [deg**2]
#ERRXYPSF_WORLD           Covariance of PSF position X-WORLD/Y-WORLD                [deg**2]
#ERRCXXPSF_IMAGE          Cxx PSF error ellipse parameter                           [pixel**(-2)]
#ERRCYYPSF_IMAGE          Cyy PSF error ellipse parameter                           [pixel**(-2)]
#ERRCXYPSF_IMAGE          Cxy PSF error ellipse parameter                           [pixel**(-2)]
#ERRCXXPSF_WORLD          Cxx PSF error ellipse parameter (WORLD units)             [deg**(-2)]
#ERRCYYPSF_WORLD          Cyy PSF error ellipse parameter (WORLD units)             [deg**(-2)]
#ERRCXYPSF_WORLD          Cxy PSF error ellipse parameter (WORLD units)             [deg**(-2)]
#ERRAPSF_IMAGE            PSF RMS position error along major axis                   [pixel]
#ERRBPSF_IMAGE            PSF RMS position error along minor axis                   [pixel]
#ERRTHETAPSF_IMAGE        PSF error ellipse position angle (CCW/x)                  [deg]
#ERRAPSF_WORLD            World PSF RMS position error along major axis             [pixel]
#ERRBPSF_WORLD            World PSF RMS position error along minor axis             [pixel]
#ERRTHETAPSF_WORLD        PSF error ellipse pos. angle (CCW/world-x)                [deg]
#ERRTHETAPSF_SKY          Native PSF error ellipse pos. angle (east of north)       [deg]
#ERRTHETAPSF_J2000        J2000 PSF error ellipse pos. angle (east of north)        [deg]
#ERRTHETAPSF_B1950        B1950 PSF error ellipse pos. angle (east of north)        [deg]
#DURATION_ANALYSIS        Duration of analysis for this source                      [s]
#VECTOR_MODEL             Model-fitting coefficients
#VECTOR_MODELERR          Model-fitting coefficient uncertainties
#MATRIX_MODELERR          Model-fitting covariance matrix
#CHI2_MODEL               Reduced Chi2 of the fit
#FLAGS_MODEL              Model-fitting flags
#NITER_MODEL              Number of iterations for model-fitting
#FLUX_MODEL               Flux from model-fitting                                   [count]
#FLUXERR_MODEL            RMS error on model-fitting flux                           [count]
#MAG_MODEL                Magnitude from model-fitting                              [mag]
#MAGERR_MODEL             RMS error on model-fitting magnitude                      [mag]
#FLUX_MAX_MODEL           Peak model flux above background                          [count]
#FLUX_EFF_MODEL           Effective model flux above background                     [count]
#FLUX_MEAN_MODEL          Mean effective model flux above background                [count]
#MU_MAX_MODEL             Peak model surface brightness above background            [mag * arcsec**(-2)]
#MU_EFF_MODEL             Effective model surface brightness above background       [mag * arcsec**(-2)]
#MU_MEAN_MODEL            Mean effective model surface brightness above background  [mag * arcsec**(-2)]
#XMODEL_IMAGE             X coordinate from model-fitting                           [pixel]
#YMODEL_IMAGE             Y coordinate from model-fitting                           [pixel]
#XFOCAL_WORLD             Fitted position along focal-plane x axis
#YFOCAL_WORLD             Fitted position along focal-plane y axis
#XMODEL_WORLD             Fitted position along world x axis                        [deg]
#YMODEL_WORLD             Fitted position along world y axis                        [deg]
#ALPHAMODEL_SKY           Fitted position along right ascension  (native)           [deg]
#DELTAMODEL_SKY           Fitted position along declination (native)                [deg]
#ALPHAMODEL_J2000         Fitted position along right ascension (J2000)             [deg]
#DELTAMODEL_J2000         Fitted position along declination (J2000)                 [deg]
#ALPHAMODEL_B1950         Fitted position along right ascension (B1950)             [deg]
#DELTAMODEL_B1950         Fitted position along declination (B1950)                 [deg]
#ERRX2MODEL_IMAGE         Variance of fitted position along x                       [pixel**2]
#ERRY2MODEL_IMAGE         Variance of fitted position along y                       [pixel**2]
#ERRXYMODEL_IMAGE         Covariance of fitted position between x and y             [pixel**2]
#ERRX2MODEL_WORLD         Variance of fitted position along X-WORLD (alpha)         [deg**2]
#ERRY2MODEL_WORLD         Variance of fitted position along Y-WORLD (delta)         [deg**2]
#ERRXYMODEL_WORLD         Covariance of fitted position X-WORLD/Y-WORLD             [deg**2]
#ERRCXXMODEL_IMAGE        Cxx error ellipse parameter of fitted position            [pixel**(-2)]
#ERRCYYMODEL_IMAGE        Cyy error ellipse parameter of fitted position            [pixel**(-2)]
#ERRCXYMODEL_IMAGE        Cxy error ellipse parameter of fitted position            [pixel**(-2)]
#ERRCXXMODEL_WORLD        Cxx fitted error ellipse parameter (WORLD units)          [deg**(-2)]
#ERRCYYMODEL_WORLD        Cyy fitted error ellipse parameter (WORLD units)          [deg**(-2)]
#ERRCXYMODEL_WORLD        Cxy fitted error ellipse parameter (WORLD units)          [deg**(-2)]
#ERRAMODEL_IMAGE          RMS error of fitted position along major axis             [pixel]
#ERRBMODEL_IMAGE          RMS error of fitted position along minor axis             [pixel]
#ERRTHETAMODEL_IMAGE      Error ellipse pos.angle of fitted position (CCW/x)        [deg]
#ERRAMODEL_WORLD          World RMS error of fitted position along major axis       [deg]
#ERRBMODEL_WORLD          World RMS error of fitted position along minor axis       [deg]
#ERRTHETAMODEL_WORLD      Error ellipse pos.angle of fitted position (CCW/world-x)  [deg]
#ERRTHETAMODEL_SKY        Native fitted error ellipse pos. angle (east of north)    [deg]
#ERRTHETAMODEL_J2000      J2000 fitted error ellipse pos. angle (east of north)     [deg]
#ERRTHETAMODEL_B1950      B1950 fitted error ellipse pos. angle (east of north)     [deg]
#X2MODEL_IMAGE            Variance along x from model-fitting                       [pixel**2]
#Y2MODEL_IMAGE            Variance along y from model-fitting                       [pixel**2]
#XYMODEL_IMAGE            Covariance between x and y from model-fitting             [pixel**2]
#ELLIP1MODEL_IMAGE        Ellipticity component from model-fitting
#ELLIP2MODEL_IMAGE        Ellipticity component from model-fitting
#POLAR1MODEL_IMAGE        Ellipticity component (quadratic) from model-fitting
#POLAR2MODEL_IMAGE        Ellipticity component (quadratic) from model-fitting
#ELLIP1ERRMODEL_IMAGE     Ellipticity component std.error from model-fitting
#ELLIP2ERRMODEL_IMAGE     Ellipticity component std.error from model-fitting
#ELLIPCORRMODEL_IMAGE     Corr.coeff between ellip.components from model-fitting
#POLAR1ERRMODEL_IMAGE     Polarisation component std.error from model-fitting
#POLAR2ERRMODEL_IMAGE     Polarisation component std.error from model-fitting
#POLARCORRMODEL_IMAGE     Corr.coeff between polar. components from fitting
#X2MODEL_WORLD            Variance along X-WORLD (alpha) from model-fitting         [deg**2]
#Y2MODEL_WORLD            Variance along Y_WORLD (delta) from model-fitting         [deg**2]
#XYMODEL_WORLD            Covariance between X-WORLD and Y-WORLD from model-fitting [deg**2]
#ELLIP1MODEL_WORLD        Ellipticity component from model-fitting
#ELLIP2MODEL_WORLD        Ellipticity component from model-fitting
#POLAR1MODEL_WORLD        Polarisation component from model-fitting
#POLAR2MODEL_WORLD        Polarisation component from model-fitting
#ELLIP1ERRMODEL_WORLD     Ellipticity component std.error from model-fitting
#ELLIP2ERRMODEL_WORLD     Ellipticity component std.error from model-fitting
#ELLIPCORRMODEL_WORLD     Corr.coeff between ellip.components from model-fitting
#POLAR1ERRMODEL_WORLD     Polarisation component std.error from model-fitting
#POLAR2ERRMODEL_WORLD     Polarisation component std.error from model-fitting
#POLARCORRMODEL_WORLD     Corr.coeff between polar. components from fitting
#CXXMODEL_IMAGE           Cxx ellipse parameter from model-fitting                  [pixel**(-2)]
#CYYMODEL_IMAGE           Cyy ellipse parameter from model-fittinh                  [pixel**(-2)]
#CXYMODEL_IMAGE           Cxy ellipse parameter from model-fitting                  [pixel**(-2)]
#CXXMODEL_WORLD           Cxx ellipse parameter (WORLD) from model-fitting          [deg**(-2)]
#CYYMODEL_WORLD           Cyy ellipse parameter (WORLD) from model-fitting          [deg**(-2)]
#CXYMODEL_WORLD           Cxy ellipse parameter (WORLD) from model-fitting          [deg**(-2)]
#AMODEL_IMAGE             Model RMS along major axis                                [pixel]
#BMODEL_IMAGE             Model RMS along minor axis                                [pixel]
#THETAMODEL_IMAGE         Model position angle (CCW/x)                              [deg]
#AMODEL_WORLD             Model RMS along major axis (WORLD units)                  [deg]
#BMODEL_WORLD             Model RMS along minor axis (WORLD units)                  [deg]
#THETAMODEL_WORLD         Model position angle (CCW/WORLD-x)                        [deg]
#THETAMODEL_SKY           Model position angle (east of north) (native)             [deg]
#THETAMODEL_J2000         Model position angle (east of north) (J2000)              [deg]
#THETAMODEL_B1950         Model position angle (east of north) (B1950)              [deg]
#SPREAD_MODEL             Spread parameter from model-fitting
#SPREADERR_MODEL          Spread parameter error from model-fitting
#FLUX_BACKOFFSET          Background offset from fitting                            [count]
#FLUXERR_BACKOFFSET       RMS error on fitted background offset                     [count]
#FLUX_POINTSOURCE         Point source flux from fitting                            [count]
#FLUXERR_POINTSOURCE      RMS error on fitted point source total flux               [count]
#MAG_POINTSOURCE          Point source total magnitude from fitting                 [mag]
#MAGERR_POINTSOURCE       RMS error on fitted point source total magnitude          [mag]
#FLUX_SPHEROID            Spheroid total flux from fitting                          [count]
#FLUXERR_SPHEROID         RMS error on fitted spheroid total flux                   [count]
#MAG_SPHEROID             Spheroid total magnitude from fitting                     [mag]
#MAGERR_SPHEROID          RMS error on fitted spheroid total magnitude              [mag]
#FLUX_MAX_SPHEROID        Peak spheroid flux above background                       [count]
#FLUX_EFF_SPHEROID        Effective spheroid flux above background                  [count]
#FLUX_MEAN_SPHEROID       Mean effective spheroid flux above background             [count]
#MU_MAX_SPHEROID          Peak spheroid surface brightness above background         [mag * arcsec**(-2)]
#MU_EFF_SPHEROID          Effective spheroid surface brightness above background    [mag * arcsec**(-2)]
#MU_MEAN_SPHEROID         Mean effective spheroid surface brightness above backgrou [mag * arcsec**(-2)]
#SPHEROID_REFF_IMAGE      Spheroid effective radius from fitting                    [pixel]
#SPHEROID_REFFERR_IMAGE   RMS error on fitted spheroid effective radius             [pixel]
#SPHEROID_REFF_WORLD      Spheroid effective radius from fitting                    [deg]
#SPHEROID_REFFERR_WORLD   RMS error on fitted spheroid effective radius             [deg]
#SPHEROID_ASPECT_IMAGE    Spheroid aspect ratio from fitting
#SPHEROID_ASPECTERR_IMAGE RMS error on fitted spheroid aspect ratio
#SPHEROID_ASPECT_WORLD    Spheroid aspect ratio from fitting
#SPHEROID_ASPECTERR_WORLD RMS error on fitted spheroid aspect ratio
#SPHEROID_THETA_IMAGE     Spheroid position angle (CCW/x) from fitting              [deg]
#SPHEROID_THETAERR_IMAGE  RMS error on spheroid position angle                      [deg]
#SPHEROID_THETA_WORLD     Spheroid position angle (CCW/world-x)                     [deg]
#SPHEROID_THETAERR_WORLD  RMS error on spheroid position angle                      [deg]
#SPHEROID_THETA_SKY       Spheroid position angle (east of north, native)           [deg]
#SPHEROID_THETA_J2000     Spheroid position angle (east of north, J2000)            [deg]
#SPHEROID_THETA_B1950     Spheroid position angle (east of north, B1950)            [deg]
#SPHEROID_SERSICN         Spheroid Sersic index from fitting
#SPHEROID_SERSICNERR      RMS error on fitted spheroid Sersic index
#FLUX_DISK                Disk total flux from fitting                              [count]
#FLUXERR_DISK             RMS error on fitted disk total flux                       [count]
#MAG_DISK                 Disk total magnitude from fitting                         [mag]
#MAGERR_DISK              RMS error on fitted disk total magnitude                  [mag]
#FLUX_MAX_DISK            Peak disk flux above background                           [count]
#FLUX_EFF_DISK            Effective disk flux above background                      [count]
#FLUX_MEAN_DISK           Mean effective disk flux above background                 [count]
#MU_MAX_DISK              Peak disk surface brightness above background             [mag * arcsec**(-2)]
#MU_EFF_DISK              Effective disk surface brightness above background        [mag * arcsec**(-2)]
#MU_MEAN_DISK             Mean effective disk surface brightness above background   [mag * arcsec**(-2)]
#DISK_SCALE_IMAGE         Disk scalelength from fitting                             [pixel]
#DISK_SCALEERR_IMAGE      RMS error on fitted disk scalelength                      [pixel]
#DISK_SCALE_WORLD         Disk scalelength from fitting (world coords)              [deg]
#DISK_SCALEERR_WORLD      RMS error on fitted disk scalelength (world coords)       [deg]
#DISK_ASPECT_IMAGE        Disk aspect ratio from fitting
#DISK_ASPECTERR_IMAGE     RMS error on fitted disk aspect ratio
#DISK_ASPECT_WORLD        Disk aspect ratio from fitting
#DISK_ASPECTERR_WORLD     RMS error on disk aspect ratio
#DISK_INCLINATION         Disk inclination from fitting                             [deg]
#DISK_INCLINATIONERR      RMS error on disk inclination from fitting                [deg]
#DISK_THETA_IMAGE         Disk position angle (CCW/x) from fitting                  [deg]
#DISK_THETAERR_IMAGE      RMS error on fitted disk position angle                   [deg]
#DISK_THETA_WORLD         Disk position angle (CCW/world-x)                         [deg]
#DISK_THETAERR_WORLD      RMS error on disk position angle                          [deg]
#DISK_THETA_SKY           Disk position angle (east of north, native)               [deg]
#DISK_THETA_J2000         Disk position angle (east of north, J2000)                [deg]
#DISK_THETA_B1950         Disk position angle (east of north, B1950)                [deg]

- Output parameters#

  • \(\textbf{Source catalog}\)

  • \(\textbf{FITS check images}\)

  • \(\textbf{CLASS\_STAR:}\) can be used to separate point sources and extended sources

0. Importing Necessary Packages#

# Printing the versions of packages
from importlib_metadata import version
for pkg in ['numpy', 'matplotlib', 'astropy', 'pandas']:
    print(pkg+": ver "+version(pkg))
numpy: ver 1.26.4
matplotlib: ver 3.8.0
astropy: ver 5.3.4
pandas: ver 2.2.1
%config InlineBackend.figure_format = 'retina'
# importing necessary modules
import numpy as np
import glob, os
from matplotlib import pyplot as plt
from astropy.io import fits
from astropy.visualization import ZScaleInterval
import pandas as pd
command = 'sex' # use 'sextractor' or 'source-extractor', depending on your installation.

1. Writing Input Files#

1) Image list#

dir_img = "Images/"
band = ["F606W", "F814W"]
imglist = sorted(glob.glob(dir_img+"*.fits"))
imglist
['Images/M0717_F606W.fits', 'Images/M0717_F814W.fits']
hdu_606 = fits.open(imglist[0])
hdu_814 = fits.open(imglist[1])

interval = ZScaleInterval()
vmin_606, vmax_606 = interval.get_limits(hdu_606[0].data)
vmin_814, vmax_814 = interval.get_limits(hdu_814[0].data)

fig, axes = plt.subplots(1,2, figsize=(10, 4))
axes[0].imshow(hdu_606[0].data, vmin=vmin_606, vmax=vmax_606)
axes[0].set_title('M0717 [F606W]')
axes[1].imshow(hdu_814[0].data, vmin=vmin_814, vmax=vmax_814)
axes[1].set_title('M0717 [F814W]')
plt.show()

2) Configuration file#

config_name = "config.txt"
os.system(command+" -dd > "+config_name)
0

3) Output parameter file#

param_name = "output.param"
f = open(param_name, "w")
f.write("X_IMAGE\n")    # Object position along x [pixel]
f.write("Y_IMAGE\n")    # Object position along y [pixel]
f.write("NUMBER\n")    # Object number
f.write("MAG_AUTO\n")    # Kron-like elliptical aperture magnitude [mag]
f.write("MAGERR_AUTO\n")    # RMS error for MAG_AUTO    [mag]
f.write("KRON_RADIUS\n")    # Kron apertures in units of A or B
f.write("BACKGROUND\n")    # Background at centroid position
f.write("ALPHA_J2000\n")    # Right ascension of object center (J2000)
f.write("DELTA_J2000\n")    # Declination of object center (J2000)
f.write("A_IMAGE\n")    # Along major axis
f.write("B_IMAGE\n")    # Along minor axis
f.write("THETA_IMAGE\n")    # Position angle
f.write("MU_MAX\n")    # Peak surface brightness above background
f.write("FLAGS\n")    # Extraction flags
f.write("FWHM_IMAGE\n")    # FWHM assuming a gaussian core
f.write("FLUX_RADIUS\n")    # Half-light radii
f.write("CLASS_STAR\n")    # Star/Galaxy classifier output
f.close()

4) Determining input parameters#

h606 = fits.getheader(imglist[0])
h814 = fits.getheader(imglist[1])
# band = ["F606W", "F814W"]
cat_name = ["606.cat", "814.cat"]
detect_minarea = 5  # DETECT_MINAREA = 5 (default)
detect_thresh = 1.5  # DETECT_THRESH = 1.5 (default)
saturated = 25.0  # SATUR_LEVEL = 100.0 (depending on the image!)
mag0 = [-2.5*np.log10(h606['PHOTFLAM'])-5.0*np.log10(h606['PHOTPLAM'])-2.408,
        -2.5*np.log10(h814['PHOTFLAM'])-5.0*np.log10(h814['PHOTPLAM'])-2.408]
egain = [h606['CCDGAIN']*h606['EXPTIME'], h814['CCDGAIN']*h814['EXPTIME']]
# GAIN (effective gain) = gain*exptime (for c/s image) --> this parameter only affects the magnitude error value!
pixel_scale = 0.03  # arcsec/pixel
fwhm = [0.09, 0.09]  # For HST images, seeing FWHMs are typically 3 pixels (~ 0.09 arcsec).
# However, you can directly measure the FWHM value in your image using imexamine or etc.,
# because the FWHM value can also vary with image quality.
back_size = 32  # BACK_SIZE = 64 (default) --> 32 (revised)
# Smaller BACK_SIZE --> Can subtract more local background --> Can detect more sources
checkimg = ["606_aper.fits", "814_aper.fits"]  # CHECKIMAGE_NAME (apertures)
refimg = imglist[1]

For magnitude zeropoints of the HST images, you can refer to the below web page.

ACS zeropoint - Photometric Keywords in SCI Extensions of ACS Images (AB magnitude zeropoint)

\[ZP_{\rm AB}=−2.5\times log10(\texttt{PHOTFLAM})−5\times log10(\texttt{PHOTPLAM})−2.408\]

PHOTFLAM or PHOTPLAM are written in the image header.

5) Shell script for SExtractor photometry#

- Importance of Dual-mode photometry#

  • Number of detected sources are different between the two filters.

  • Shape and size of aperture is different for identical sources in different filter images (if MAG_AUTO is used).

  • To compute colors, it is important to run SExtractor in \(\color{blue}{\rm dual\:mode}\).

- Running SExtractor in Dual mode#

  • running command: sex [detection image], [photometry image] -c [configuration file]

    • Detection image: reference image with all the detected sources (image with longer exposure time and better quality)

    • Photometry image: image to perform photometry on

  • Filter with longest exposure time for project = F814W = detection image

  • Or you can create a new detection image with F606W+F814W

  • running command Ex)

    • sextractor [F814W image] -c [F814W configuration file]

    • sextractor [F606W image] -c [F606W configuration file] \(\color{blue}{\rm \#\:single\:mode}\)

    • sextractor [F814W image],[F606W image] -c [F606W configuration file] \(\color{blue}{\rm \#\:dual\:mode}\)

scr_name = "sephot.sh"
f = open(scr_name, "w")
for i in np.arange(len(band)):
    
    # Reference image
    if (imglist[i] == refimg):
        txt = command+" "+imglist[i]+" -c config.txt -CATALOG_NAME "+cat_name[i]+" -PARAMETERS_NAME output.param "

    # Non-reference image
    else:
        txt = command+" "+refimg+","+imglist[i]+" -c config.txt -CATALOG_NAME "+cat_name[i]+" -PARAMETERS_NAME output.param "

    txt += f"-DETECT_MINAREA {detect_minarea:d} -DETECT_THRESH {detect_thresh:.1f} "
    txt += f"-FILTER_NAME {SEXDIR}default.conv -SATUR_LEVEL {saturated:.1f} "
    txt += f"-MAG_ZEROPOINT {mag0[i]:.4f} -GAIN {egain[i]:.2f} -PIXEL_SCALE {pixel_scale:.2f} "
    txt += f"-SEEING_FWHM {fwhm[i]:.2f} -STARNNW_NAME {SEXDIR}default.nnw -BACK_SIZE {back_size:d} "
    txt += "-CHECKIMAGE_TYPE APERTURES -CHECKIMAGE_NAME "+checkimg[i]
    txt += "\n"
    
    f.write(txt)
    
f.close()

2. Running SExtractor#

os.system("sh sephot.sh")
Hide code cell output
> 
----- SExtractor 2.28.0 started on 2024-04-24 at 11:19:58 with 1 thread

> Setting catalog parameters
> Reading detection filter
> Initializing Neural Network
> Reading Neural Network Weights
> Initializing check-image(s)
> Initializing catalog
> Looking for M0717_F814W.fits
----- Detecting from: M0717_F814W.fits
      "Unnamed" / no ext. header / 5961x4381 / 32 bits (floats)
> Looking for M0717_F606W.fits
----- Measuring from: M0717_F606W.fits
      "Unnamed" / no ext. header / 5961x4381 / 32 bits (floats)
Measurement image:> Setting up background maps
> Setting up background map at line:   32
> Setting up background map at line:   64
> Setting up background map at line:   96
> Setting up background map at line:  128
> Setting up background map at line:  160
> Setting up background map at line:  192
> Setting up background map at line:  224
> Setting up background map at line:  256
> Setting up background map at line:  288
> Setting up background map at line:  320
> Setting up background map at line:  352
> Setting up background map at line:  384
> Setting up background map at line:  416
> Setting up background map at line:  448
> Setting up background map at line:  480
> Setting up background map at line:  512
> Setting up background map at line:  544
> Setting up background map at line:  576
> Setting up background map at line:  608
> Setting up background map at line:  640
> Setting up background map at line:  672
> Setting up background map at line:  704
> Setting up background map at line:  736
> Setting up background map at line:  768
> Setting up background map at line:  800
> Setting up background map at line:  832
> Setting up background map at line:  864
> Setting up background map at line:  896
> Setting up background map at line:  928
> Setting up background map at line:  960
> Setting up background map at line:  992
> Setting up background map at line: 1024
> Setting up background map at line: 1056
> Setting up background map at line: 1088
> Setting up background map at line: 1120
> Setting up background map at line: 1152
> Setting up background map at line: 1184
> Setting up background map at line: 1216
> Setting up background map at line: 1248
> Setting up background map at line: 1280
> Setting up background map at line: 1312
> Setting up background map at line: 1344
> Setting up background map at line: 1376
> Setting up background map at line: 1408
> Setting up background map at line: 1440
> Setting up background map at line: 1472
> Setting up background map at line: 1504
> Setting up background map at line: 1536
> Setting up background map at line: 1568
> Setting up background map at line: 1600
> Setting up background map at line: 1632
> Setting up background map at line: 1664
> Setting up background map at line: 1696
> Setting up background map at line: 1728
> Setting up background map at line: 1760
> Setting up background map at line: 1792
> Setting up background map at line: 1824
> Setting up background map at line: 1856
> Setting up background map at line: 1888
> Setting up background map at line: 1920
> Setting up background map at line: 1952
> Setting up background map at line: 1984
> Setting up background map at line: 2016
> Setting up background map at line: 2048
> Setting up background map at line: 2080
> Setting up background map at line: 2112
> Setting up background map at line: 2144
> Setting up background map at line: 2176
> Setting up background map at line: 2208
> Setting up background map at line: 2240
> Setting up background map at line: 2272
> Setting up background map at line: 2304
> Setting up background map at line: 2336
> Setting up background map at line: 2368
> Setting up background map at line: 2400
> Setting up background map at line: 2432
> Setting up background map at line: 2464
> Setting up background map at line: 2496
> Setting up background map at line: 2528
> Setting up background map at line: 2560
> Setting up background map at line: 2592
> Setting up background map at line: 2624
> Setting up background map at line: 2656
> Setting up background map at line: 2688
> Setting up background map at line: 2720
> Setting up background map at line: 2752
> Setting up background map at line: 2784
> Setting up background map at line: 2816
> Setting up background map at line: 2848
> Setting up background map at line: 2880
> Setting up background map at line: 2912
> Setting up background map at line: 2944
> Setting up background map at line: 2976
> Setting up background map at line: 3008
> Setting up background map at line: 3040
> Setting up background map at line: 3072
> Setting up background map at line: 3104
> Setting up background map at line: 3136
> Setting up background map at line: 3168
> Setting up background map at line: 3200
> Setting up background map at line: 3232
> Setting up background map at line: 3264
> Setting up background map at line: 3296
> Setting up background map at line: 3328
> Setting up background map at line: 3360
> Setting up background map at line: 3392
> Setting up background map at line: 3424
> Setting up background map at line: 3456
> Setting up background map at line: 3488
> Setting up background map at line: 3520
> Setting up background map at line: 3552
> Setting up background map at line: 3584
> Setting up background map at line: 3616
> Setting up background map at line: 3648
> Setting up background map at line: 3680
> Setting up background map at line: 3712
> Setting up background map at line: 3744
> Setting up background map at line: 3776
> Setting up background map at line: 3808
> Setting up background map at line: 3840
> Setting up background map at line: 3872
> Setting up background map at line: 3904
> Setting up background map at line: 3936
> Setting up background map at line: 3968
> Setting up background map at line: 4000
> Setting up background map at line: 4032
> Setting up background map at line: 4064
> Setting up background map at line: 4096
> Setting up background map at line: 4128
> Setting up background map at line: 4160
> Setting up background map at line: 4192
> Setting up background map at line: 4224
> Setting up background map at line: 4256
> Setting up background map at line: 4288
> Setting up background map at line: 4320
> Setting up background map at line: 4352
> Filtering background map(s)
> Computing background d-map
> Computing background-noise d-map
(M)   Background: 0.000301342 RMS: 0.001017   / Threshold: 0.0015255  
Detection image: > Setting up background maps
> Setting up background map at line:   32
> Setting up background map at line:   64
> Setting up background map at line:   96
> Setting up background map at line:  128
> Setting up background map at line:  160
> Setting up background map at line:  192
> Setting up background map at line:  224
> Setting up background map at line:  256
> Setting up background map at line:  288
> Setting up background map at line:  320
> Setting up background map at line:  352
> Setting up background map at line:  384
> Setting up background map at line:  416
> Setting up background map at line:  448
> Setting up background map at line:  480
> Setting up background map at line:  512
> Setting up background map at line:  544
> Setting up background map at line:  576
> Setting up background map at line:  608
> Setting up background map at line:  640
> Setting up background map at line:  672
> Setting up background map at line:  704
> Setting up background map at line:  736
> Setting up background map at line:  768
> Setting up background map at line:  800
> Setting up background map at line:  832
> Setting up background map at line:  864
> Setting up background map at line:  896
> Setting up background map at line:  928
> Setting up background map at line:  960
> Setting up background map at line:  992
> Setting up background map at line: 1024
> Setting up background map at line: 1056
> Setting up background map at line: 1088
> Setting up background map at line: 1120
> Setting up background map at line: 1152
> Setting up background map at line: 1184
> Setting up background map at line: 1216
> Setting up background map at line: 1248
> Setting up background map at line: 1280
> Setting up background map at line: 1312
> Setting up background map at line: 1344
> Setting up background map at line: 1376
> Setting up background map at line: 1408
> Setting up background map at line: 1440
> Setting up background map at line: 1472
> Setting up background map at line: 1504
> Setting up background map at line: 1536
> Setting up background map at line: 1568
> Setting up background map at line: 1600
> Setting up background map at line: 1632
> Setting up background map at line: 1664
> Setting up background map at line: 1696
> Setting up background map at line: 1728
> Setting up background map at line: 1760
> Setting up background map at line: 1792
> Setting up background map at line: 1824
> Setting up background map at line: 1856
> Setting up background map at line: 1888
> Setting up background map at line: 1920
> Setting up background map at line: 1952
> Setting up background map at line: 1984
> Setting up background map at line: 2016
> Setting up background map at line: 2048
> Setting up background map at line: 2080
> Setting up background map at line: 2112
> Setting up background map at line: 2144
> Setting up background map at line: 2176
> Setting up background map at line: 2208
> Setting up background map at line: 2240
> Setting up background map at line: 2272
> Setting up background map at line: 2304
> Setting up background map at line: 2336
> Setting up background map at line: 2368
> Setting up background map at line: 2400
> Setting up background map at line: 2432
> Setting up background map at line: 2464
> Setting up background map at line: 2496
> Setting up background map at line: 2528
> Setting up background map at line: 2560
> Setting up background map at line: 2592
> Setting up background map at line: 2624
> Setting up background map at line: 2656
> Setting up background map at line: 2688
> Setting up background map at line: 2720
> Setting up background map at line: 2752
> Setting up background map at line: 2784
> Setting up background map at line: 2816
> Setting up background map at line: 2848
> Setting up background map at line: 2880
> Setting up background map at line: 2912
> Setting up background map at line: 2944
> Setting up background map at line: 2976
> Setting up background map at line: 3008
> Setting up background map at line: 3040
> Setting up background map at line: 3072
> Setting up background map at line: 3104
> Setting up background map at line: 3136
> Setting up background map at line: 3168
> Setting up background map at line: 3200
> Setting up background map at line: 3232
> Setting up background map at line: 3264
> Setting up background map at line: 3296
> Setting up background map at line: 3328
> Setting up background map at line: 3360
> Setting up background map at line: 3392
> Setting up background map at line: 3424
> Setting up background map at line: 3456
> Setting up background map at line: 3488
> Setting up background map at line: 3520
> Setting up background map at line: 3552
> Setting up background map at line: 3584
> Setting up background map at line: 3616
> Setting up background map at line: 3648
> Setting up background map at line: 3680
> Setting up background map at line: 3712
> Setting up background map at line: 3744
> Setting up background map at line: 3776
> Setting up background map at line: 3808
> Setting up background map at line: 3840
> Setting up background map at line: 3872
> Setting up background map at line: 3904
> Setting up background map at line: 3936
> Setting up background map at line: 3968
> Setting up background map at line: 4000
> Setting up background map at line: 4032
> Setting up background map at line: 4064
> Setting up background map at line: 4096
> Setting up background map at line: 4128
> Setting up background map at line: 4160
> Setting up background map at line: 4192
> Setting up background map at line: 4224
> Setting up background map at line: 4256
> Setting up background map at line: 4288
> Setting up background map at line: 4320
> Setting up background map at line: 4352
> Filtering background map(s)
> Computing background d-map
> Computing background-noise d-map
(D)   Background: 0.000520703 RMS: 0.000520161 / Threshold: 0.000780242 
> Scanning image
> Line:   25  Objects:       61 detected /        0 sextracted
> Line:   50  Objects:      151 detected /        0 sextracted
> Line:   75  Objects:      228 detected /        0 sextracted
> Line:  100  Objects:      277 detected /        0 sextracted
> Line:  125  Objects:      365 detected /        0 sextracted
> Line:  150  Objects:      439 detected /        0 sextracted
> Line:  175  Objects:      507 detected /        0 sextracted
> Line:  200  Objects:      592 detected /        0 sextracted
> Line:  225  Objects:      674 detected /        0 sextracted
> Line:  250  Objects:      761 detected /        0 sextracted
> Line:  275  Objects:      844 detected /        0 sextracted
> Line:  300  Objects:      912 detected /        0 sextracted
> Line:  325  Objects:      967 detected /        0 sextracted
> Line:  350  Objects:     1053 detected /        0 sextracted
> Line:  375  Objects:     1127 detected /        0 sextracted
> Line:  400  Objects:     1206 detected /        0 sextracted
> Line:  425  Objects:     1296 detected /        0 sextracted
> Line:  450  Objects:     1377 detected /        0 sextracted
> Line:  475  Objects:     1451 detected /        0 sextracted
> Line:  500  Objects:     1539 detected /        0 sextracted
> Line:  525  Objects:     1611 detected /        0 sextracted
> Line:  550  Objects:     1681 detected /        0 sextracted
> Line:  575  Objects:     1776 detected /        0 sextracted
> Line:  600  Objects:     1851 detected /        0 sextracted
> Line:  625  Objects:     1933 detected /        0 sextracted
> Line:  650  Objects:     2029 detected /        0 sextracted
> Line:  675  Objects:     2146 detected /        0 sextracted
> Line:  700  Objects:     2236 detected /        0 sextracted
> Line:  725  Objects:     2331 detected /        0 sextracted
> Line:  750  Objects:     2394 detected /        0 sextracted
> Line:  775  Objects:     2464 detected /        0 sextracted
> Line:  800  Objects:     2544 detected /        0 sextracted
> Line:  825  Objects:     2628 detected /        0 sextracted
> Line:  850  Objects:     2710 detected /        0 sextracted
> Line:  875  Objects:     2781 detected /        0 sextracted
> Line:  900  Objects:     2863 detected /        0 sextracted
> Line:  925  Objects:     2938 detected /        0 sextracted
> Line:  950  Objects:     3039 detected /        0 sextracted
> Line:  975  Objects:     3115 detected /        0 sextracted
> Line: 1000  Objects:     3194 detected /        0 sextracted
> Line: 1022  Objects:     3244 detected /        0 sextracted
> Line: 1025  Objects:     3253 detected /       94 sextracted
> Line: 1050  Objects:     3314 detected /      144 sextracted
> Line: 1075  Objects:     3396 detected /      180 sextracted
> Line: 1100  Objects:     3484 detected /      215 sextracted
> Line: 1125  Objects:     3584 detected /      269 sextracted
> Line: 1150  Objects:     3664 detected /      316 sextracted
> Line: 1175  Objects:     3750 detected /      339 sextracted
> Line: 1200  Objects:     3839 detected /      383 sextracted
> Line: 1211  Objects:     3884 detected /      400 sextracted
> Line: 1225  Objects:     3950 detected /      433 sextracted
> Line: 1250  Objects:     4052 detected /      477 sextracted
> Line: 1275  Objects:     4177 detected /      514 sextracted
> Line: 1300  Objects:     4282 detected /      545 sextracted
> Line: 1325  Objects:     4361 detected /      580 sextracted
> Line: 1350  Objects:     4471 detected /      620 sextracted
> Line: 1375  Objects:     4570 detected /      661 sextracted
> Line: 1400  Objects:     4638 detected /      706 sextracted
> Line: 1425  Objects:     4741 detected /      753 sextracted
> Line: 1450  Objects:     4835 detected /      793 sextracted
> Line: 1455  Objects:     4851 detected /      800 sextracted
> Line: 1475  Objects:     4933 detected /      831 sextracted
> Line: 1500  Objects:     5025 detected /      873 sextracted
> Line: 1525  Objects:     5102 detected /      908 sextracted
> Line: 1550  Objects:     5205 detected /      948 sextracted
> Line: 1575  Objects:     5301 detected /      997 sextracted
> Line: 1600  Objects:     5397 detected /     1034 sextracted
> Line: 1625  Objects:     5528 detected /     1087 sextracted
> Line: 1650  Objects:     5630 detected /     1130 sextracted
> Line: 1675  Objects:     5715 detected /     1174 sextracted
> Line: 1689  Objects:     5742 detected /     1200 sextracted
> Line: 1700  Objects:     5782 detected /     1216 sextracted
> Line: 1725  Objects:     5855 detected /     1261 sextracted
> Line: 1750  Objects:     5936 detected /     1299 sextracted
> Line: 1775  Objects:     5999 detected /     1340 sextracted
> Line: 1800  Objects:     6095 detected /     1373 sextracted
> Line: 1825  Objects:     6181 detected /     1405 sextracted
> Line: 1850  Objects:     6305 detected /     1443 sextracted
> Line: 1875  Objects:     6397 detected /     1478 sextracted
> Line: 1900  Objects:     6485 detected /     1521 sextracted
> Line: 1925  Objects:     6591 detected /     1562 sextracted
> Line: 1947  Objects:     6666 detected /     1600 sextracted
> Line: 1950  Objects:     6675 detected /     1604 sextracted
> Line: 1975  Objects:     6773 detected /     1645 sextracted
> Line: 2000  Objects:     6850 detected /     1674 sextracted
> Line: 2025  Objects:     6947 detected /     1712 sextracted
> Line: 2050  Objects:     7035 detected /     1746 sextracted
> Line: 2075  Objects:     7126 detected /     1792 sextracted
> Line: 2100  Objects:     7200 detected /     1835 sextracted
> Line: 2125  Objects:     7284 detected /     1879 sextracted
> Line: 2150  Objects:     7404 detected /     1919 sextracted
> Line: 2175  Objects:     7486 detected /     1966 sextracted
> Line: 2191  Objects:     7547 detected /     2000 sextracted
> Line: 2200  Objects:     7577 detected /     2015 sextracted
> Line: 2225  Objects:     7693 detected /     2064 sextracted
> Line: 2250  Objects:     7780 detected /     2118 sextracted
> Line: 2275  Objects:     7852 detected /     2166 sextracted
> Line: 2300  Objects:     7917 detected /     2216 sextracted
> Line: 2325  Objects:     7986 detected /     2260 sextracted
> Line: 2350  Objects:     8055 detected /     2316 sextracted
> Line: 2375  Objects:     8137 detected /     2369 sextracted
> Line: 2398  Objects:     8188 detected /     2400 sextracted
> Line: 2400  Objects:     8196 detected /     2404 sextracted
> Line: 2425  Objects:     8267 detected /     2457 sextracted
> Line: 2450  Objects:     8349 detected /     2500 sextracted
> Line: 2475  Objects:     8437 detected /     2551 sextracted
> Line: 2500  Objects:     8516 detected /     2598 sextracted
> Line: 2525  Objects:     8594 detected /     2637 sextracted
> Line: 2550  Objects:     8680 detected /     2683 sextracted
> Line: 2575  Objects:     8761 detected /     2744 sextracted
> Line: 2600  Objects:     8849 detected /     2794 sextracted
> Line: 2605  Objects:     8870 detected /     2800 sextracted
> Line: 2625  Objects:     8951 detected /     2849 sextracted
> Line: 2650  Objects:     9003 detected /     2898 sextracted
> Line: 2675  Objects:     9070 detected /     2941 sextracted
> Line: 2700  Objects:     9145 detected /     2995 sextracted
> Line: 2725  Objects:     9231 detected /     3039 sextracted
> Line: 2750  Objects:     9337 detected /     3085 sextracted
> Line: 2775  Objects:     9430 detected /     3130 sextracted
> Line: 2800  Objects:     9524 detected /     3177 sextracted
> Line: 2812  Objects:     9572 detected /     3200 sextracted
> Line: 2825  Objects:     9631 detected /     3224 sextracted
> Line: 2850  Objects:     9728 detected /     3269 sextracted
> Line: 2875  Objects:     9816 detected /     3324 sextracted
> Line: 2900  Objects:     9887 detected /     3368 sextracted
> Line: 2925  Objects:     9983 detected /     3422 sextracted
> Line: 2950  Objects:    10072 detected /     3476 sextracted
> Line: 2975  Objects:    10150 detected /     3521 sextracted
> Line: 3000  Objects:    10240 detected /     3568 sextracted
> Line: 3025  Objects:    10318 detected /     3596 sextracted
> Line: 3028  Objects:    10330 detected /     3600 sextracted
> Line: 3050  Objects:    10405 detected /     3630 sextracted
> Line: 3075  Objects:    10523 detected /     3667 sextracted
> Line: 3100  Objects:    10610 detected /     3697 sextracted
> Line: 3125  Objects:    10687 detected /     3742 sextracted
> Line: 3150  Objects:    10803 detected /     3782 sextracted
> Line: 3175  Objects:    10909 detected /     3831 sextracted
> Line: 3200  Objects:    11015 detected /     3864 sextracted
> Line: 3225  Objects:    11133 detected /     3902 sextracted
> Line: 3250  Objects:    11251 detected /     3946 sextracted
> Line: 3275  Objects:    11342 detected /     3980 sextracted
> Line: 3284  Objects:    11370 detected /     4000 sextracted
> Line: 3300  Objects:    11411 detected /     4030 sextracted
> Line: 3325  Objects:    11505 detected /     4068 sextracted
> Line: 3350  Objects:    11584 detected /     4114 sextracted
> Line: 3375  Objects:    11666 detected /     4151 sextracted
> Line: 3400  Objects:    11757 detected /     4194 sextracted
> Line: 3425  Objects:    11851 detected /     4233 sextracted
> Line: 3450  Objects:    11962 detected /     4282 sextracted
> Line: 3475  Objects:    12035 detected /     4325 sextracted
> Line: 3500  Objects:    12095 detected /     4373 sextracted
> Line: 3521  Objects:    12152 detected /     4400 sextracted
> Line: 3525  Objects:    12168 detected /     4413 sextracted
> Line: 3550  Objects:    12251 detected /     4457 sextracted
> Line: 3575  Objects:    12326 detected /     4498 sextracted
> Line: 3600  Objects:    12402 detected /     4544 sextracted
> Line: 3625  Objects:    12483 detected /     4584 sextracted
> Line: 3650  Objects:    12561 detected /     4614 sextracted
> Line: 3675  Objects:    12652 detected /     4651 sextracted
> Line: 3700  Objects:    12729 detected /     4687 sextracted
> Line: 3725  Objects:    12820 detected /     4726 sextracted
> Line: 3750  Objects:    12895 detected /     4761 sextracted
> Line: 3775  Objects:    12982 detected /     4790 sextracted
> Line: 3786  Objects:    13011 detected /     4800 sextracted
> Line: 3800  Objects:    13053 detected /     4816 sextracted
> Line: 3825  Objects:    13159 detected /     4847 sextracted
> Line: 3850  Objects:    13259 detected /     4883 sextracted
> Line: 3875  Objects:    13344 detected /     4928 sextracted
> Line: 3900  Objects:    13416 detected /     4960 sextracted
> Line: 3925  Objects:    13502 detected /     4995 sextracted
> Line: 3950  Objects:    13565 detected /     5028 sextracted
> Line: 3975  Objects:    13653 detected /     5050 sextracted
> Line: 4000  Objects:    13742 detected /     5090 sextracted
> Line: 4025  Objects:    13819 detected /     5120 sextracted
> Line: 4050  Objects:    13893 detected /     5165 sextracted
> Line: 4071  Objects:    13975 detected /     5200 sextracted
> Line: 4075  Objects:    13985 detected /     5206 sextracted
> Line: 4100  Objects:    14047 detected /     5242 sextracted
> Line: 4125  Objects:    14115 detected /     5279 sextracted
> Line: 4150  Objects:    14181 detected /     5314 sextracted
> Line: 4175  Objects:    14258 detected /     5346 sextracted
> Line: 4200  Objects:    14329 detected /     5383 sextracted
> Line: 4225  Objects:    14391 detected /     5437 sextracted
> Line: 4250  Objects:    14473 detected /     5480 sextracted
> Line: 4275  Objects:    14525 detected /     5508 sextracted
> Line: 4300  Objects:    14599 detected /     5538 sextracted
> Line: 4325  Objects:    14668 detected /     5577 sextracted
> Line: 4342  Objects:    14720 detected /     5600 sextracted
> Line: 4350  Objects:    14735 detected /     5615 sextracted
> Line: 4375  Objects:    14804 detected /     5662 sextracted
> Line: 4381  Objects:    14858 detected /     6000 sextracted
> Line: 4381  Objects:    14858 detected /     6400 sextracted
> Line: 4381  Objects:    14858 detected /     6800 sextracted
> Line: 4381  Objects:    14858 detected /     7200 sextracted
      Objects: detected 14858    / sextracted 7243            

> Closing files
> 
> All done (in 4.1 s: 1068.0 lines/s , 1765.8 detections/s)
> 
----- SExtractor 2.28.0 started on 2024-04-24 at 11:20:02 with 1 thread

> Setting catalog parameters
> Reading detection filter
> Initializing Neural Network
> Reading Neural Network Weights
> Initializing check-image(s)
> Initializing catalog
> Looking for M0717_F814W.fits
----- Measuring from: M0717_F814W.fits
      "Unnamed" / no ext. header / 5961x4381 / 32 bits (floats)
Detection+Measurement image: > Setting up background maps
> Setting up background map at line:   32
> Setting up background map at line:   64
> Setting up background map at line:   96
> Setting up background map at line:  128
> Setting up background map at line:  160
> Setting up background map at line:  192
> Setting up background map at line:  224
> Setting up background map at line:  256
> Setting up background map at line:  288
> Setting up background map at line:  320
> Setting up background map at line:  352
> Setting up background map at line:  384
> Setting up background map at line:  416
> Setting up background map at line:  448
> Setting up background map at line:  480
> Setting up background map at line:  512
> Setting up background map at line:  544
> Setting up background map at line:  576
> Setting up background map at line:  608
> Setting up background map at line:  640
> Setting up background map at line:  672
> Setting up background map at line:  704
> Setting up background map at line:  736
> Setting up background map at line:  768
> Setting up background map at line:  800
> Setting up background map at line:  832
> Setting up background map at line:  864
> Setting up background map at line:  896
> Setting up background map at line:  928
> Setting up background map at line:  960
> Setting up background map at line:  992
> Setting up background map at line: 1024
> Setting up background map at line: 1056
> Setting up background map at line: 1088
> Setting up background map at line: 1120
> Setting up background map at line: 1152
> Setting up background map at line: 1184
> Setting up background map at line: 1216
> Setting up background map at line: 1248
> Setting up background map at line: 1280
> Setting up background map at line: 1312
> Setting up background map at line: 1344
> Setting up background map at line: 1376
> Setting up background map at line: 1408
> Setting up background map at line: 1440
> Setting up background map at line: 1472
> Setting up background map at line: 1504
> Setting up background map at line: 1536
> Setting up background map at line: 1568
> Setting up background map at line: 1600
> Setting up background map at line: 1632
> Setting up background map at line: 1664
> Setting up background map at line: 1696
> Setting up background map at line: 1728
> Setting up background map at line: 1760
> Setting up background map at line: 1792
> Setting up background map at line: 1824
> Setting up background map at line: 1856
> Setting up background map at line: 1888
> Setting up background map at line: 1920
> Setting up background map at line: 1952
> Setting up background map at line: 1984
> Setting up background map at line: 2016
> Setting up background map at line: 2048
> Setting up background map at line: 2080
> Setting up background map at line: 2112
> Setting up background map at line: 2144
> Setting up background map at line: 2176
> Setting up background map at line: 2208
> Setting up background map at line: 2240
> Setting up background map at line: 2272
> Setting up background map at line: 2304
> Setting up background map at line: 2336
> Setting up background map at line: 2368
> Setting up background map at line: 2400
> Setting up background map at line: 2432
> Setting up background map at line: 2464
> Setting up background map at line: 2496
> Setting up background map at line: 2528
> Setting up background map at line: 2560
> Setting up background map at line: 2592
> Setting up background map at line: 2624
> Setting up background map at line: 2656
> Setting up background map at line: 2688
> Setting up background map at line: 2720
> Setting up background map at line: 2752
> Setting up background map at line: 2784
> Setting up background map at line: 2816
> Setting up background map at line: 2848
> Setting up background map at line: 2880
> Setting up background map at line: 2912
> Setting up background map at line: 2944
> Setting up background map at line: 2976
> Setting up background map at line: 3008
> Setting up background map at line: 3040
> Setting up background map at line: 3072
> Setting up background map at line: 3104
> Setting up background map at line: 3136
> Setting up background map at line: 3168
> Setting up background map at line: 3200
> Setting up background map at line: 3232
> Setting up background map at line: 3264
> Setting up background map at line: 3296
> Setting up background map at line: 3328
> Setting up background map at line: 3360
> Setting up background map at line: 3392
> Setting up background map at line: 3424
> Setting up background map at line: 3456
> Setting up background map at line: 3488
> Setting up background map at line: 3520
> Setting up background map at line: 3552
> Setting up background map at line: 3584
> Setting up background map at line: 3616
> Setting up background map at line: 3648
> Setting up background map at line: 3680
> Setting up background map at line: 3712
> Setting up background map at line: 3744
> Setting up background map at line: 3776
> Setting up background map at line: 3808
> Setting up background map at line: 3840
> Setting up background map at line: 3872
> Setting up background map at line: 3904
> Setting up background map at line: 3936
> Setting up background map at line: 3968
> Setting up background map at line: 4000
> Setting up background map at line: 4032
> Setting up background map at line: 4064
> Setting up background map at line: 4096
> Setting up background map at line: 4128
> Setting up background map at line: 4160
> Setting up background map at line: 4192
> Setting up background map at line: 4224
> Setting up background map at line: 4256
> Setting up background map at line: 4288
> Setting up background map at line: 4320
> Setting up background map at line: 4352
> Filtering background map(s)
> Computing background d-map
> Computing background-noise d-map
(M+D) Background: 0.000520703 RMS: 0.000520161 / Threshold: 0.000780242 
> Scanning image
> Line:   25  Objects:       61 detected /        0 sextracted
> Line:   50  Objects:      151 detected /        0 sextracted
> Line:   75  Objects:      228 detected /        0 sextracted
> Line:  100  Objects:      277 detected /        0 sextracted
> Line:  125  Objects:      365 detected /        0 sextracted
> Line:  150  Objects:      439 detected /        0 sextracted
> Line:  175  Objects:      507 detected /        0 sextracted
> Line:  200  Objects:      592 detected /        0 sextracted
> Line:  225  Objects:      674 detected /        0 sextracted
> Line:  250  Objects:      761 detected /        0 sextracted
> Line:  275  Objects:      844 detected /        0 sextracted
> Line:  300  Objects:      912 detected /        0 sextracted
> Line:  325  Objects:      967 detected /        0 sextracted
> Line:  350  Objects:     1053 detected /        0 sextracted
> Line:  375  Objects:     1127 detected /        0 sextracted
> Line:  400  Objects:     1206 detected /        0 sextracted
> Line:  425  Objects:     1296 detected /        0 sextracted
> Line:  450  Objects:     1377 detected /        0 sextracted
> Line:  475  Objects:     1451 detected /        0 sextracted
> Line:  500  Objects:     1539 detected /        0 sextracted
> Line:  525  Objects:     1611 detected /        0 sextracted
> Line:  550  Objects:     1681 detected /        0 sextracted
> Line:  575  Objects:     1776 detected /        0 sextracted
> Line:  600  Objects:     1851 detected /        0 sextracted
> Line:  625  Objects:     1933 detected /        0 sextracted
> Line:  650  Objects:     2029 detected /        0 sextracted
> Line:  675  Objects:     2146 detected /        0 sextracted
> Line:  700  Objects:     2236 detected /        0 sextracted
> Line:  725  Objects:     2331 detected /        0 sextracted
> Line:  750  Objects:     2394 detected /        0 sextracted
> Line:  775  Objects:     2464 detected /        0 sextracted
> Line:  800  Objects:     2544 detected /        0 sextracted
> Line:  825  Objects:     2628 detected /        0 sextracted
> Line:  850  Objects:     2710 detected /        0 sextracted
> Line:  875  Objects:     2781 detected /        0 sextracted
> Line:  900  Objects:     2863 detected /        0 sextracted
> Line:  925  Objects:     2938 detected /        0 sextracted
> Line:  950  Objects:     3039 detected /        0 sextracted
> Line:  975  Objects:     3115 detected /        0 sextracted
> Line: 1000  Objects:     3194 detected /        0 sextracted
> Line: 1022  Objects:     3244 detected /        0 sextracted
> Line: 1025  Objects:     3253 detected /       94 sextracted
> Line: 1050  Objects:     3314 detected /      144 sextracted
> Line: 1075  Objects:     3396 detected /      180 sextracted
> Line: 1100  Objects:     3484 detected /      215 sextracted
> Line: 1125  Objects:     3584 detected /      269 sextracted
> Line: 1150  Objects:     3664 detected /      316 sextracted
> Line: 1175  Objects:     3750 detected /      339 sextracted
> Line: 1200  Objects:     3839 detected /      383 sextracted
> Line: 1211  Objects:     3884 detected /      400 sextracted
> Line: 1225  Objects:     3950 detected /      433 sextracted
> Line: 1250  Objects:     4052 detected /      477 sextracted
> Line: 1275  Objects:     4177 detected /      514 sextracted
> Line: 1300  Objects:     4282 detected /      545 sextracted
> Line: 1325  Objects:     4361 detected /      580 sextracted
> Line: 1350  Objects:     4471 detected /      620 sextracted
> Line: 1375  Objects:     4570 detected /      661 sextracted
> Line: 1400  Objects:     4638 detected /      706 sextracted
> Line: 1425  Objects:     4741 detected /      753 sextracted
> Line: 1450  Objects:     4835 detected /      793 sextracted
> Line: 1455  Objects:     4851 detected /      800 sextracted
> Line: 1475  Objects:     4933 detected /      831 sextracted
> Line: 1500  Objects:     5025 detected /      873 sextracted
> Line: 1525  Objects:     5102 detected /      908 sextracted
> Line: 1550  Objects:     5205 detected /      948 sextracted
> Line: 1575  Objects:     5301 detected /      997 sextracted
> Line: 1600  Objects:     5397 detected /     1034 sextracted
> Line: 1625  Objects:     5528 detected /     1087 sextracted
> Line: 1650  Objects:     5630 detected /     1130 sextracted
> Line: 1675  Objects:     5715 detected /     1174 sextracted
> Line: 1689  Objects:     5742 detected /     1200 sextracted
> Line: 1700  Objects:     5782 detected /     1216 sextracted
> Line: 1725  Objects:     5855 detected /     1261 sextracted
> Line: 1750  Objects:     5936 detected /     1299 sextracted
> Line: 1775  Objects:     5999 detected /     1340 sextracted
> Line: 1800  Objects:     6095 detected /     1373 sextracted
> Line: 1825  Objects:     6181 detected /     1405 sextracted
> Line: 1850  Objects:     6305 detected /     1443 sextracted
> Line: 1875  Objects:     6397 detected /     1478 sextracted
> Line: 1900  Objects:     6485 detected /     1521 sextracted
> Line: 1925  Objects:     6591 detected /     1562 sextracted
> Line: 1947  Objects:     6666 detected /     1600 sextracted
> Line: 1950  Objects:     6675 detected /     1604 sextracted
> Line: 1975  Objects:     6773 detected /     1645 sextracted
> Line: 2000  Objects:     6850 detected /     1674 sextracted
> Line: 2025  Objects:     6947 detected /     1712 sextracted
> Line: 2050  Objects:     7035 detected /     1746 sextracted
> Line: 2075  Objects:     7126 detected /     1792 sextracted
> Line: 2100  Objects:     7200 detected /     1835 sextracted
> Line: 2125  Objects:     7284 detected /     1879 sextracted
> Line: 2150  Objects:     7404 detected /     1919 sextracted
> Line: 2175  Objects:     7486 detected /     1966 sextracted
> Line: 2191  Objects:     7547 detected /     2000 sextracted
> Line: 2200  Objects:     7577 detected /     2015 sextracted
> Line: 2225  Objects:     7693 detected /     2064 sextracted
> Line: 2250  Objects:     7780 detected /     2118 sextracted
> Line: 2275  Objects:     7852 detected /     2166 sextracted
> Line: 2300  Objects:     7917 detected /     2216 sextracted
> Line: 2325  Objects:     7986 detected /     2260 sextracted
> Line: 2350  Objects:     8055 detected /     2316 sextracted
> Line: 2375  Objects:     8137 detected /     2369 sextracted
> Line: 2398  Objects:     8188 detected /     2400 sextracted
> Line: 2400  Objects:     8196 detected /     2404 sextracted
> Line: 2425  Objects:     8267 detected /     2457 sextracted
> Line: 2450  Objects:     8349 detected /     2500 sextracted
> Line: 2475  Objects:     8437 detected /     2551 sextracted
> Line: 2500  Objects:     8516 detected /     2598 sextracted
> Line: 2525  Objects:     8594 detected /     2637 sextracted
> Line: 2550  Objects:     8680 detected /     2683 sextracted
> Line: 2575  Objects:     8761 detected /     2744 sextracted
> Line: 2600  Objects:     8849 detected /     2794 sextracted
> Line: 2605  Objects:     8870 detected /     2800 sextracted
> Line: 2625  Objects:     8951 detected /     2849 sextracted
> Line: 2650  Objects:     9003 detected /     2898 sextracted
> Line: 2675  Objects:     9070 detected /     2941 sextracted
> Line: 2700  Objects:     9145 detected /     2995 sextracted
> Line: 2725  Objects:     9231 detected /     3039 sextracted
> Line: 2750  Objects:     9337 detected /     3085 sextracted
> Line: 2775  Objects:     9430 detected /     3130 sextracted
> Line: 2800  Objects:     9524 detected /     3177 sextracted
> Line: 2812  Objects:     9572 detected /     3200 sextracted
> Line: 2825  Objects:     9631 detected /     3224 sextracted
> Line: 2850  Objects:     9728 detected /     3269 sextracted
> Line: 2875  Objects:     9816 detected /     3324 sextracted
> Line: 2900  Objects:     9887 detected /     3368 sextracted
> Line: 2925  Objects:     9983 detected /     3422 sextracted
> Line: 2950  Objects:    10072 detected /     3476 sextracted
> Line: 2975  Objects:    10150 detected /     3521 sextracted
> Line: 3000  Objects:    10240 detected /     3568 sextracted
> Line: 3025  Objects:    10318 detected /     3596 sextracted
> Line: 3028  Objects:    10330 detected /     3600 sextracted
> Line: 3050  Objects:    10405 detected /     3630 sextracted
> Line: 3075  Objects:    10523 detected /     3667 sextracted
> Line: 3100  Objects:    10610 detected /     3697 sextracted
> Line: 3125  Objects:    10687 detected /     3742 sextracted
> Line: 3150  Objects:    10803 detected /     3782 sextracted
> Line: 3175  Objects:    10909 detected /     3831 sextracted
> Line: 3200  Objects:    11015 detected /     3864 sextracted
> Line: 3225  Objects:    11133 detected /     3902 sextracted
> Line: 3250  Objects:    11251 detected /     3946 sextracted
> Line: 3275  Objects:    11342 detected /     3980 sextracted
> Line: 3284  Objects:    11370 detected /     4000 sextracted
> Line: 3300  Objects:    11411 detected /     4030 sextracted
> Line: 3325  Objects:    11505 detected /     4068 sextracted
> Line: 3350  Objects:    11584 detected /     4114 sextracted
> Line: 3375  Objects:    11666 detected /     4151 sextracted
> Line: 3400  Objects:    11757 detected /     4194 sextracted
> Line: 3425  Objects:    11851 detected /     4233 sextracted
> Line: 3450  Objects:    11962 detected /     4282 sextracted
> Line: 3475  Objects:    12035 detected /     4325 sextracted
> Line: 3500  Objects:    12095 detected /     4373 sextracted
> Line: 3521  Objects:    12152 detected /     4400 sextracted
> Line: 3525  Objects:    12168 detected /     4413 sextracted
> Line: 3550  Objects:    12251 detected /     4457 sextracted
> Line: 3575  Objects:    12326 detected /     4498 sextracted
> Line: 3600  Objects:    12402 detected /     4544 sextracted
> Line: 3625  Objects:    12483 detected /     4584 sextracted
> Line: 3650  Objects:    12561 detected /     4614 sextracted
> Line: 3675  Objects:    12652 detected /     4651 sextracted
> Line: 3700  Objects:    12729 detected /     4687 sextracted
> Line: 3725  Objects:    12820 detected /     4726 sextracted
> Line: 3750  Objects:    12895 detected /     4761 sextracted
> Line: 3775  Objects:    12982 detected /     4790 sextracted
> Line: 3786  Objects:    13011 detected /     4800 sextracted
> Line: 3800  Objects:    13053 detected /     4816 sextracted
> Line: 3825  Objects:    13159 detected /     4847 sextracted
> Line: 3850  Objects:    13259 detected /     4883 sextracted
> Line: 3875  Objects:    13344 detected /     4928 sextracted
> Line: 3900  Objects:    13416 detected /     4960 sextracted
> Line: 3925  Objects:    13502 detected /     4995 sextracted
> Line: 3950  Objects:    13565 detected /     5028 sextracted
> Line: 3975  Objects:    13653 detected /     5050 sextracted
> Line: 4000  Objects:    13742 detected /     5090 sextracted
> Line: 4025  Objects:    13819 detected /     5120 sextracted
> Line: 4050  Objects:    13893 detected /     5165 sextracted
> Line: 4071  Objects:    13975 detected /     5200 sextracted
> Line: 4075  Objects:    13985 detected /     5206 sextracted
> Line: 4100  Objects:    14047 detected /     5242 sextracted
> Line: 4125  Objects:    14115 detected /     5279 sextracted
> Line: 4150  Objects:    14181 detected /     5314 sextracted
> Line: 4175  Objects:    14258 detected /     5346 sextracted
> Line: 4200  Objects:    14329 detected /     5383 sextracted
> Line: 4225  Objects:    14391 detected /     5437 sextracted
> Line: 4250  Objects:    14473 detected /     5480 sextracted
> Line: 4275  Objects:    14525 detected /     5508 sextracted
> Line: 4300  Objects:    14599 detected /     5538 sextracted
> Line: 4325  Objects:    14668 detected /     5577 sextracted
> Line: 4342  Objects:    14720 detected /     5600 sextracted
> Line: 4350  Objects:    14735 detected /     5615 sextracted
> Line: 4375  Objects:    14804 detected /     5662 sextracted
> Line: 4381  Objects:    14858 detected /     6000 sextracted
> Line: 4381  Objects:    14858 detected /     6400 sextracted
> Line: 4381  Objects:    14858 detected /     6800 sextracted
> Line: 4381  Objects:    14858 detected /     7200 sextracted
      Objects: detected 14858    / sextracted 7243            

> Closing files
> 
> All done (in 3.6 s: 1228.1 lines/s , 2030.4 detections/s)
0

3. Reading the Data#

colnames = ['x','y','num','mag','merr','kron','backgr','ra','dec',
            'a','b','theta','mu0','flag','fwhm','flxrad','cl']
dat_V = np.genfromtxt(cat_name[0], dtype=None, encoding='ascii', names=colnames)
dat_I = np.genfromtxt(cat_name[1], dtype=None, encoding='ascii', names=colnames)
pd.DataFrame(dat_V).head(5)
x y num mag merr kron backgr ra dec a b theta mu0 flag fwhm flxrad cl
0 1911.3966 731.6298 1 21.6796 0.0016 3.50 0.008239 109.418494 37.714342 19.341 17.625 0.44 20.1833 2 9.84 15.628 0.029
1 5889.4160 712.3062 2 25.0555 0.0258 5.06 0.000524 109.376589 37.714185 38.850 2.450 -79.75 24.3301 19 58.57 90.367 0.000
2 4584.9277 434.9285 3 21.8951 0.0017 3.50 0.004010 109.390331 37.711874 21.432 12.511 72.92 19.8551 0 13.37 10.840 0.029
3 2690.8933 337.5047 4 23.0958 0.0032 3.50 0.001310 109.410282 37.711060 15.863 6.663 -87.72 20.8277 0 8.63 9.864 0.029
4 1297.1003 281.1276 5 21.8859 0.0022 3.50 0.008271 109.424964 37.710586 33.888 13.639 -61.65 21.7182 0 111.26 27.440 0.001
pd.DataFrame(dat_I).head(5)
x y num mag merr kron backgr ra dec a b theta mu0 flag fwhm flxrad cl
0 1911.3966 731.6298 1 20.1743 0.0004 3.50 0.016663 109.418494 37.714342 19.341 17.625 0.44 18.7318 2 10.11 16.040 0.029
1 5889.4160 712.3062 2 24.5670 0.0139 5.06 0.000402 109.376589 37.714185 38.850 2.450 -79.75 23.9554 19 58.57 40.278 0.000
2 4584.9277 434.9285 3 20.5084 0.0004 3.50 0.007200 109.390331 37.711874 21.432 12.511 72.92 18.6067 0 13.36 12.136 0.029
3 2690.8933 337.5047 4 21.7658 0.0008 3.50 0.001527 109.410282 37.711060 15.863 6.663 -87.72 19.4696 0 8.54 9.882 0.029
4 1297.1003 281.1276 5 21.3095 0.0011 3.50 0.008162 109.424964 37.710586 33.888 13.639 -61.65 20.9812 0 73.93 26.175 0.029

4. Plotting the Figures#

0) Check image - APERTURES#

hdu_606_check = fits.open('./606_aper.fits')
hdu_814_check = fits.open('./814_aper.fits')

interval = ZScaleInterval()
vmin_606_check, vmax_606_check = interval.get_limits(hdu_606_check[0].data)
vmin_814_check, vmax_814_check = interval.get_limits(hdu_814_check[0].data)

fig, axes = plt.subplots(2,1, figsize=(10, 15))
axes[0].imshow(hdu_606_check[0].data, vmin=vmin_606_check, vmax=vmax_606_check)
axes[0].set_title('CHECKIMAGE_TYPE: APERTURES [F606W]')
axes[1].imshow(hdu_814_check[0].data, vmin=vmin_814_check, vmax=vmax_814_check)
axes[1].set_title('CHECKIMAGE_TYPE: APERTURES [F814W]')
plt.show()
dat = [dat_V, dat_I]

1) Magnitude - magnitude error diagram#

xlab = ["F606W magnitude", "F814W magnitude"]
ylab = ["Magnitude error"]

fig, axs = plt.subplots(1, 2, figsize=(9,4))
for i, ax in enumerate(axs):
    mag_range = (dat[i]['mag'] < 99.0)
    # magnitude of 99.0 means the source not detected in the 606-band image but detected in the 814-band image.
    ax.plot(dat[i]['mag'][mag_range], dat[i]['merr'][mag_range], 'o', ms=1)
    ax.set_xlim([12.5, 32.5])
    ax.set_ylim([0.0, 0.6])
    ax.set_xlabel(xlab[i])
    ax.set_ylabel(ylab[0])

2) Magnitude - stellarity (CLASS_STAR) digram#

xlab = ["F606W magnitude", "F814W magnitude"]
ylab = ["Stellarity (CLASS_STAR)"]

fig, axs = plt.subplots(1, 2, figsize=(9,4))
for i, ax in enumerate(axs):
    mag_range = (dat[i]['mag'] < 99.0)
    # magnitude of 99.0 means the source not detected in the 606-band image but detected in the 814-band image.
    ax.plot(dat[i]['mag'][mag_range], dat[i]['cl'][mag_range], 'o', ms=1)
    ax.axhline(0.4, 0, 1, color='red', ls='--', lw=1)
    ax.axhline(0.8, 0, 1, color='red', ls='--', lw=1)
    # CLASS_STAR = 0.4 cut can also depend on the image quality, distribution of CLASS_STAR, or your scientific goals!
    ax.set_xlim([12.5, 32.5])
    ax.set_ylim([0.0, 1.0])
    ax.set_xlabel(xlab[i])
    ax.set_ylabel(ylab[0])

From the above basic results, how can you select point/extended sources for analysis?

3) CMDs of galaxies (just for example!)#

gal_cnd = ((dat_V['mag'] < 30.0) & (dat_V['merr'] < 0.5) & (dat_I['mag'] < 30.0) & (dat_I['merr'] < 0.5) & \
           (dat_V['flxrad'] > 4.) & (dat_V['fwhm'] > 4.) & (dat_I['flxrad'] > 4.) & (dat_I['fwhm'] > 4.) & \
           (dat_V['mag']-dat_I['mag'] > -1.0) & (dat_V['mag']-dat_I['mag'] < 2.0) & \
           (dat_I['cl'] < 0.4))

xlab = ["F606W-F814W"]
ylab = ["F814W magnitude"]

fig, ax = plt.subplots(1, 1, figsize=(5,5))
ax.plot(dat_V['mag'][gal_cnd]-dat_I['mag'][gal_cnd], dat_I['mag'][gal_cnd], 'o', ms=1)
# ax.axhline(0.4, 0, 1, color='red', ls='--', lw=1)
# # CLASS_STAR = 0.4 cut can also depend on the image quality, distribution of CLASS_STAR, or your scientific goals!
ax.set_xlim([-1.0, 2.0])
ax.set_ylim([30.0, 17.0])
ax.set_xlabel(xlab[0])
ax.set_ylabel(ylab[0])
Text(0, 0.5, 'F814W magnitude')
../../../_images/d75b7de7d5d856f85eeb351d2da5183a1e3ad52c85e0bfafe49b8166215d7d40.png