LBCgo.lbcregister ================= .. py:module:: LBCgo.lbcregister Functions --------- .. autoapisummary:: LBCgo.lbcregister.go_sextractor LBCgo.lbcregister.go_scamp LBCgo.lbcregister.go_swarp LBCgo.lbcregister.go_register Module Contents --------------- .. py:function:: go_sextractor(inputfile, configfile=None, paramfile=None, convfile=None, nnwfile=None, verbose=True) Run SExtractor on a single chip image to produce a source catalog. Detects sources and writes a FITS_LDAC catalog (``.cat``) alongside the input file. Default configuration files are read from the LBCgo package ``conf/`` directory. :param inputfile: Path to the chip FITS image to process. :type inputfile: str :param configfile: Path to a SExtractor configuration file. If None, uses the LBCgo default ``sextractor.lbc.conf``. Default: None :type configfile: str or None, optional :param paramfile: Path to a SExtractor output parameter file. If None, uses the LBCgo default ``sextractor.lbcoutput.param``. Default: None :type paramfile: str or None, optional :param convfile: Path to a SExtractor convolution kernel file. If None, uses the LBCgo default ``default.conv``. Default: None :type convfile: str or None, optional :param nnwfile: Path to a SExtractor neural network weights file. If None, uses the LBCgo default ``default.nnw``. Default: None :type nnwfile: str or None, optional :param verbose: Print the SExtractor command and progress. Default: True :type verbose: bool, optional :raises RuntimeError: If SExtractor (``sex``) is not found on the system PATH. :returns: Writes a FITS_LDAC catalog to ``.cat``. Returns None if a required configuration file is missing. :rtype: None .. py:function:: go_scamp(inputfile, astrometric_catalog='GAIA-DR3', astrometric_method='exposure', num_iterations=3, configfile=None, verbose=True) Run SCAMP to compute an astrometric solution for a chip catalog. Matches the SExtractor FITS_LDAC catalog against an astrometric reference catalog and writes a ``.head`` WCS solution file. SCAMP is run iteratively with progressively tighter tolerance parameters to refine the solution. A minimum of 2 iterations is enforced. :param inputfile: Path to the chip FITS image or SExtractor catalog (``*.fits`` or ``*.cat``). The function converts ``.fits`` to ``.cat`` automatically. :type inputfile: str :param astrometric_catalog: Reference catalog for cross-matching. Common options: ``'GAIA-DR3'``, ``'GAIA-DR2'``, ``'2MASS'``, ``'USNO-B1'``. Default: ``'GAIA-DR3'`` :type astrometric_catalog: str, optional :param astrometric_method: Mosaic type strategy passed to SCAMP. Default: ``'exposure'`` :type astrometric_method: str, optional :param num_iterations: Number of SCAMP iterations. Fewer than 2 will be raised to 2. Default: 3 :type num_iterations: int, optional :param configfile: Path to a SCAMP configuration file. If None, uses the LBCgo default ``scamp.lbc.conf``. Default: None :type configfile: str or None, optional :param verbose: Print SCAMP commands and progress. Default: True :type verbose: bool, optional :raises RuntimeError: If SCAMP is not found on the system PATH. :returns: Writes a ``.head`` WCS solution file alongside the input catalog. :rtype: None .. py:function:: go_swarp(inputfiles, output_filename=None, configfile=None, verbose=True) Resample and co-add chip images using SWarp. Reads SCAMP-produced ``.head`` WCS solutions, reprojects all input chip images onto a common astrometric grid, and co-adds them into a single mosaic. The output filename is derived from the ``OBJECT`` and ``FILTER`` headers of the first input file if not specified. All input files must share the same filter; a ``ValueError`` is raised otherwise. :param inputfiles: Paths to chip FITS images to co-add. All must have the same filter. :type inputfiles: list of str :param output_filename: Output mosaic filename. If None, derived from the object name and filter as ``..mos.fits``. Default: None :type output_filename: str or None, optional :param configfile: Path to a SWarp configuration file. If None, uses the LBCgo default ``swarp.lbc.conf``. Default: None :type configfile: str or None, optional :param verbose: Print the SWarp command and progress. Default: True :type verbose: bool, optional :raises RuntimeError: If SWarp is not found on the system PATH. :raises ValueError: If the input files span more than one filter. :returns: Writes ```` and ``.weight.fits`` to the current directory. Mean exposure-time-weighted airmass is written to the output header. :rtype: None .. py:function:: go_register(filter_directories, lbc_chips=True, do_sextractor=True, do_scamp=True, do_swarp=True, astrometric_catalog='GAIA-DR3', scamp_iterations=3, verbose=True) Perform astrometric registration and image combination for LBC chip-extracted data. This function coordinates the complete astrometric processing pipeline for LBC data that has been processed through flat fielding and chip extraction. It sequentially runs source extraction (SExtractor), astrometric calibration (SCAMP), and image combination (SWARP) on individual CCD chip images to produce final registered and co-added mosaics. Processing Steps: 1. Source extraction on individual chip images using SExtractor 2. Astrometric solution calculation using SCAMP with iterative refinement 3. Image resampling and combination using SWARP to create final mosaics :param filter_directories: Directory path(s) containing chip-extracted FITS files. Each directory should contain individual chip images (e.g., 'object_1.fits', 'object_2.fits', etc.) from the chip extraction step. :type filter_directories: str or list of str :param lbc_chips: CCD chips to process. If True, processes all 4 chips [1,2,3,4]. Can specify subset as list (e.g., [1,3]). Default: True :type lbc_chips: bool or list of int, optional :param do_sextractor: Run SExtractor for source detection on each chip image. Creates catalogs needed for astrometric calibration. Default: True :type do_sextractor: bool, optional :param do_scamp: Run SCAMP for astrometric calibration. Calculates WCS solutions using reference catalog cross-matching. Default: True :type do_scamp: bool, optional :param do_swarp: Run SWARP for image resampling and combination. Creates final co-added mosaics with corrected astrometry. Default: True :type do_swarp: bool, optional :param astrometric_catalog: Reference catalog for astrometric calibration. Common options include 'GAIA-DR3', 'GAIA-DR2', '2MASS', 'USNO-B1', etc. Default: 'GAIA-DR3' :type astrometric_catalog: str, optional :param scamp_iterations: Number of SCAMP iterations for astrometric solution refinement. More iterations improve precision but increase processing time. Minimum of 2 recommended. Default: 3 :type scamp_iterations: int, optional :param verbose: Print detailed processing information and command outputs. Default: True :type verbose: bool, optional :returns: Function performs file operations and creates output files in the input directories. Final products are astrometrically-calibrated combined images with '.mos.fits' extension and corresponding weight maps. :rtype: None .. rubric:: Notes - Input directories should contain chip-extracted FITS files from go_extractchips() - Requires external tools: SExtractor, SCAMP, and SWARP from astromatic.net - Creates intermediate files (.cat, .xml, .head) during processing - Final mosaics are named using object name and filter (e.g., 'M31.g.mos.fits') - Processing is done per filter directory to maintain filter separation - SCAMP uses iterative refinement with progressively tighter tolerances .. rubric:: Examples Basic astrometric processing for all chips: >>> go_register(['M31/g-SLOAN/', 'M31/r-SLOAN/']) Process only specific chips with custom catalog: >>> go_register(['NGC4321/V/'], lbc_chips=[1,2], ... astrometric_catalog='2MASS') Source extraction and astrometry only (no final combination): >>> go_register(['target/filter/'], do_swarp=False) High-precision astrometry with more iterations: >>> go_register(['science/'], scamp_iterations=5)