Skip to content

Commit

Permalink
cfht files
Browse files Browse the repository at this point in the history
  • Loading branch information
virajkaram committed Jan 26, 2025
1 parent 1212490 commit 2776e8e
Show file tree
Hide file tree
Showing 20 changed files with 968 additions and 11 deletions.
1 change: 1 addition & 0 deletions mirar/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from mirar.errors import ProcessorError
from mirar.pipelines.base_pipeline import Pipeline
from mirar.pipelines.cfht.cfht_pipeline import CFHTPipeline
from mirar.pipelines.git.git_pipeline import GITPipeline
from mirar.pipelines.gmos.gmos_pipeline import GMOSPipeline
from mirar.pipelines.sedmv2.sedmv2_pipeline import SEDMv2Pipeline
Expand Down
44 changes: 44 additions & 0 deletions mirar/pipelines/cfht/blocks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from mirar.paths import BASE_NAME_KEY
from mirar.pipelines.cfht.config import sextractor_photometry_config
from mirar.pipelines.cfht.generator import cfht_anet_sextractor_config_path_generator
from mirar.pipelines.cfht.load_cfht_file import load_raw_cfht_image
from mirar.processors.astromatic.sextractor.sextractor import Sextractor
from mirar.processors.astrometry.anet import AstrometryNet
from mirar.processors.utils import (
CustomImageBatchModifier,
HeaderAnnotator,
HeaderEditor,
ImageBatcher,
ImageDebatcher,
ImageLoader,
ImagePlotter,
ImageRebatcher,
ImageRejector,
ImageSaver,
ImageSelector,
MEFLoader,
)

astrometry = [
ImageLoader(input_sub_dir="single_ext", load_image=load_raw_cfht_image),
ImageBatcher(BASE_NAME_KEY),
AstrometryNet(
output_sub_dir="anet",
scale_bounds=[0.1, 0.3],
scale_units="app",
use_sextractor=False,
timeout=120,
search_radius_deg=1.0,
cache=False,
x_image_key=None,
y_image_key=None,
downsample=2,
write_regions=False,
),
ImageSaver(output_dir_name="post_anet"),
Sextractor(
**sextractor_photometry_config,
output_sub_dir="photometery",
write_regions_bool=True,
),
]
30 changes: 30 additions & 0 deletions mirar/pipelines/cfht/cfht_pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
Module to run the SEDMv2 data reduction pipeline
"""

import logging

from mirar.pipelines.base_pipeline import Pipeline
from mirar.pipelines.cfht.blocks import astrometry
from mirar.pipelines.cfht.config import PIPELINE_NAME

logger = logging.getLogger(__name__)


class CFHTPipeline(Pipeline):
"""
Class to run GIT/LT data reduction pipeline
"""

name = PIPELINE_NAME

non_linear_level = 30000 # no idea, for pylint
all_pipeline_configurations = {
"default": astrometry,
}

def download_raw_images_for_night(night: str | int):
"""
Download raw images for a night
"""
raise NotImplementedError
60 changes: 60 additions & 0 deletions mirar/pipelines/cfht/config/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"""
Module containing CFHT-specific paths
"""

import os

from mirar.pipelines.cfht.config.constants import (
DB_NAME,
GAIN,
PIPELINE_NAME,
PIXEL_SCALE,
)

cfht_dir = os.path.dirname(__file__)

astromatic_config_dir = os.path.join(cfht_dir, "files")

sextractor_photometry_config = {
"config_path": os.path.join(astromatic_config_dir, "photomCat.sex"),
"filter_path": os.path.join(astromatic_config_dir, "default.conv"),
"parameter_path": os.path.join(astromatic_config_dir, "photom.param"),
"starnnw_path": os.path.join(astromatic_config_dir, "default.nnw"),
}

sextractor_PSF_photometry_config = {
"config_path": os.path.join(astromatic_config_dir, "photomCat.sex"),
"filter_path": os.path.join(astromatic_config_dir, "default.conv"),
"parameter_path": os.path.join(astromatic_config_dir, "photomPSF.param"),
"starnnw_path": os.path.join(astromatic_config_dir, "default.nnw"),
}

sextractor_astrometry_config = {
"config_path": os.path.join(astromatic_config_dir, "astrom.sex"),
"filter_path": os.path.join(astromatic_config_dir, "default.conv"),
"parameter_path": os.path.join(astromatic_config_dir, "astrom.param"),
"starnnw_path": os.path.join(astromatic_config_dir, "default.nnw"),
}


sextractor_candidates_config = {
"cand_det_sextractor_config": os.path.join(astromatic_config_dir, "photomCat.sex"),
"cand_det_sextractor_nnw": os.path.join(astromatic_config_dir, "default.nnw"),
"cand_det_sextractor_filter": os.path.join(astromatic_config_dir, "default.conv"),
"cand_det_sextractor_params": os.path.join(astromatic_config_dir, "Scorr.param"),
}

sextractor_reference_config = {
"config_path": os.path.join(astromatic_config_dir, "photomCat.sex"),
"parameter_path": os.path.join(astromatic_config_dir, "photom.param"),
"filter_path": os.path.join(astromatic_config_dir, "default.conv"),
"starnnw_path": os.path.join(astromatic_config_dir, "default.nnw"),
}

scamp_path = os.path.join(astromatic_config_dir, "scamp.conf")

swarp_config_path = os.path.join(astromatic_config_dir, "config.swarp")

psfex_config_path = os.path.join(astromatic_config_dir, "photom.psfex")

psfex_sci_config_path = os.path.join(astromatic_config_dir, "photom_sci.psfex")
8 changes: 8 additions & 0 deletions mirar/pipelines/cfht/config/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""
Module for GIT-specific constants
"""

PIPELINE_NAME = "cfht"
GAIN = 1
PIXEL_SCALE = 0.18 # arcsec/pixel
DB_NAME = PIPELINE_NAME
21 changes: 21 additions & 0 deletions mirar/pipelines/cfht/config/files/Scorr.param
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
NUMBER
FLUX_APER(1)
FLUXERR_APER(1)
FLUX_AUTO
FLUXERR_AUTO
FLUX_RADIUS
FLUX_MAX
X_IMAGE
Y_IMAGE
XPEAK_IMAGE
YPEAK_IMAGE
ERRX2_IMAGE
ERRY2_IMAGE
ALPHA_J2000
DELTA_J2000
A_IMAGE
B_IMAGE
ELONGATION
FWHM_IMAGE
FWHM_WORLD
FLAGS
28 changes: 28 additions & 0 deletions mirar/pipelines/cfht/config/files/astrom.param
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#VECTOR_ASSOC(10)
ALPHAWIN_J2000
DELTAWIN_J2000
X_IMAGE
Y_IMAGE
ELONGATION
ELLIPTICITY
XWIN_IMAGE
YWIN_IMAGE
ERRAWIN_IMAGE
ERRBWIN_IMAGE
FLUX_RADIUS
FWHM_WORLD
FWHM_IMAGE
FLUX_AUTO
FLUXERR_AUTO
FLUX_MAX
MAG_AUTO
MAGERR_AUTO
FLAGS
BACKGROUND
CLASS_STAR
FLUX_APER(5)
FLUXERR_APER(5)
MAG_APER(5)
MAGERR_APER(5)
VIGNET(41,41)
SNR_WIN
111 changes: 111 additions & 0 deletions mirar/pipelines/cfht/config/files/astrom.sex
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Default configuration file for SExtractor 2.5.0
# EB 2006-07-14
#

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

CATALOG_NAME test.cat # name of the output catalog
CATALOG_TYPE FITS_LDAC # NONE,ASCII,ASCII_HEAD, ASCII_SKYCAT,
# ASCII_VOTABLE, FITS_1.0 or FITS_LDAC
PARAMETERS_NAME /home/viraj/rts2/python/img_subtraction/astrom.param # name of the file containing catalog contents

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

DETECT_TYPE CCD # CCD (linear) or PHOTO (with gamma correction)
DETECT_MINAREA 10 # minimum number of pixels above threshold
THRESH_TYPE RELATIVE # threshold type: RELATIVE (in sigmas) or ABSOLUTE (in ADUs)

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

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

DEBLEND_NTHRESH 16 # Number of deblending sub-thresholds
DEBLEND_MINCONT 1e-4 # Minimum contrast parameter for deblending

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

MASK_TYPE CORRECT # type of detection MASKing: can be one of
# NONE, BLANK or CORRECT

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

WEIGHT_TYPE MAP_WEIGHT # type of WEIGHTing: NONE, BACKGROUND,
# MAP_RMS, MAP_VAR or MAP_WEIGHT
WEIGHT_IMAGE weight.fits # weight-map filename
WEIGHT_GAIN Y # modulate gain (E/ADU) with weights? (Y/N)
WEIGHT_THRESH # weight threshold[s] for bad pixels


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

#PHOT_APERTURES 6.0,10.0,14.0,18.0,22.0 # MAG_APER aperture diameter(s) in pixels
PHOT_APERTURES 4.0, 6.0, 8.0, 10.0 # MAG_APER aperture diameter(s) in pixels
PHOT_FLUXFRAC 0.5 # flux fraction[s] used for FLUX_RADIUS
#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_AUTOPARAMS 1.0,2.0 # MAG_AUTO parameters: <Kron_fact>,<min_radius>
PHOT_PETROPARAMS 1.0,2.0 # MAG_PETRO parameters: <Petrosian_fact>,


#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>

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

MAG_ZEROPOINT 0 # magnitude zero-point
MAG_GAMMA 4.0 # gamma of emulsion (for photographic scans)
GAIN 1.6 # detector gain in e-/ADU

PIXEL_SCALE 0.32 # size of pixel in arcsec (0=use FITS WCS info)

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

SEEING_FWHM 2 # stellar FWHM in arcsec
STARNNW_NAME / # Neural-Network_Weight table filename

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

BACK_SIZE 256 # Background mesh: <size> or <width>,<height>
BACK_FILTERSIZE 6 # Background filter: <size> or <width>,<height>

BACK_TYPE AUTO # AUTO or MANUAL
BACKPHOTO_TYPE LOCAL # can be GLOBAL or LOCAL

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

#ASSOC_NAME sky.list # name of the ASCII file to ASSOCiate
#ASSOC_DATA 5,6,7,8,9,10,11,12,13,14 # columns of the data to replicate (0=all)
#ASSOC_PARAMS 3,4 # columns of xpos,ypos[,mag]
#ASSOC_RADIUS 3.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


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

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

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

MEMORY_OBJSTACK 10000 # number of objects in stack
MEMORY_PIXSTACK 5000000 # number of pixels in stack
MEMORY_BUFSIZE 1024 # number of lines in buffer

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

VERBOSE_TYPE NORMAL # can be QUIET, NORMAL or FULL
WRITE_XML N # Write XML file (Y/N)?
XML_NAME sex.xml # Filename for XML output
Loading

0 comments on commit 2776e8e

Please sign in to comment.