LBCgo.lbcregister¶
Functions¶
|
Run SExtractor on a single chip image to produce a source catalog. |
|
Run SCAMP to compute an astrometric solution for a chip catalog. |
|
Resample and co-add chip images using SWarp. |
|
Perform astrometric registration and image combination for LBC chip-extracted data. |
Module Contents¶
- LBCgo.lbcregister.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 (
<base>.cat) alongside the input file. Default configuration files are read from the LBCgo packageconf/directory.- Parameters:
inputfile (str) – Path to the chip FITS image to process.
configfile (str or None, optional) – Path to a SExtractor configuration file. If None, uses the LBCgo default
sextractor.lbc.conf. Default: Noneparamfile (str or None, optional) – Path to a SExtractor output parameter file. If None, uses the LBCgo default
sextractor.lbcoutput.param. Default: Noneconvfile (str or None, optional) – Path to a SExtractor convolution kernel file. If None, uses the LBCgo default
default.conv. Default: Nonennwfile (str or None, optional) – Path to a SExtractor neural network weights file. If None, uses the LBCgo default
default.nnw. Default: Noneverbose (bool, optional) – Print the SExtractor command and progress. Default: True
- Raises:
RuntimeError – If SExtractor (
sex) is not found on the system PATH.- Returns:
Writes a FITS_LDAC catalog to
<inputfile_base>.cat. Returns None if a required configuration file is missing.- Return type:
None
- LBCgo.lbcregister.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
.headWCS solution file. SCAMP is run iteratively with progressively tighter tolerance parameters to refine the solution. A minimum of 2 iterations is enforced.- Parameters:
inputfile (str) – Path to the chip FITS image or SExtractor catalog (
*.fitsor*.cat). The function converts.fitsto.catautomatically.astrometric_catalog (str, optional) – Reference catalog for cross-matching. Common options:
'GAIA-DR3','GAIA-DR2','2MASS','USNO-B1'. Default:'GAIA-DR3'astrometric_method (str, optional) – Mosaic type strategy passed to SCAMP. Default:
'exposure'num_iterations (int, optional) – Number of SCAMP iterations. Fewer than 2 will be raised to 2. Default: 3
configfile (str or None, optional) – Path to a SCAMP configuration file. If None, uses the LBCgo default
scamp.lbc.conf. Default: Noneverbose (bool, optional) – Print SCAMP commands and progress. Default: True
- Raises:
RuntimeError – If SCAMP is not found on the system PATH.
- Returns:
Writes a
.headWCS solution file alongside the input catalog.- Return type:
None
- LBCgo.lbcregister.go_swarp(inputfiles, output_filename=None, configfile=None, verbose=True)¶
Resample and co-add chip images using SWarp.
Reads SCAMP-produced
.headWCS 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 theOBJECTandFILTERheaders of the first input file if not specified.All input files must share the same filter; a
ValueErroris raised otherwise.- Parameters:
inputfiles (list of str) – Paths to chip FITS images to co-add. All must have the same filter.
output_filename (str or None, optional) – Output mosaic filename. If None, derived from the object name and filter as
<object>.<filter>.mos.fits. Default: Noneconfigfile (str or None, optional) – Path to a SWarp configuration file. If None, uses the LBCgo default
swarp.lbc.conf. Default: Noneverbose (bool, optional) – Print the SWarp command and progress. Default: True
- Raises:
RuntimeError – If SWarp is not found on the system PATH.
ValueError – If the input files span more than one filter.
- Returns:
Writes
<output_filename>and<output_filename>.weight.fitsto the current directory. Mean exposure-time-weighted airmass is written to the output header.- Return type:
None
- LBCgo.lbcregister.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
- Parameters:
filter_directories (str or list of str) – 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.
lbc_chips (bool or list of int, optional) – 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
do_sextractor (bool, optional) – Run SExtractor for source detection on each chip image. Creates catalogs needed for astrometric calibration. Default: True
do_scamp (bool, optional) – Run SCAMP for astrometric calibration. Calculates WCS solutions using reference catalog cross-matching. Default: True
do_swarp (bool, optional) – Run SWARP for image resampling and combination. Creates final co-added mosaics with corrected astrometry. Default: True
astrometric_catalog (str, optional) – Reference catalog for astrometric calibration. Common options include ‘GAIA-DR3’, ‘GAIA-DR2’, ‘2MASS’, ‘USNO-B1’, etc. Default: ‘GAIA-DR3’
scamp_iterations (int, optional) – Number of SCAMP iterations for astrometric solution refinement. More iterations improve precision but increase processing time. Minimum of 2 recommended. Default: 3
verbose (bool, optional) – Print detailed processing information and command outputs. Default: True
- 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.
- Return type:
None
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
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)