Preprocessing#
- run_full_preprocessing(output, master_cat, line, mock_params=None, priors=None, save_runs_path='fitting_results/', source_id=None, field=None, grism_filter='F444W', delta_wave_cutoff=0.005, factor=5, wave_factor=10, model_name='Disk', manual_psf_name=None, manual_grism_file=None)#
Main function that automatically preprocesses data for geko fitting.
Loads grism spectroscopy data, performs background subtraction and cropping, loads PSF, initializes the Grism dispersion object and kinematic model.
- Parameters:
output (str) – Name of output subfolder
master_cat (str) – Path to master catalog file
line (int) – Emission line wavelength in Angstroms
mock_params (dict, optional) – Parameters for mock data (for testing)
priors (dict, optional) – Custom priors (not used in current implementation)
save_runs_path (str) – Base directory containing data files
source_id (int) – Source ID number
field (str) – Field name: ‘GOODS-N’, ‘GOODS-N-CONGRESS’, ‘GOODS-S-FRESCO’, or ‘manual’
grism_filter (str) – Grism filter name (default: ‘F444W’)
delta_wave_cutoff (float) – Wavelength bin size cutoff in microns
factor (int) – Spatial oversampling factor
wave_factor (int) – Wavelength oversampling factor
model_name (str) – Kinematic model type (default: ‘Disk’)
manual_psf_name (str, optional) – PSF filename in save_runs_path/psfs/ (required if field=’manual’)
manual_grism_file (str, optional) – Grism spectrum filename in save_runs_path/output/ (required if field=’manual’)
- Returns:
z_spec (float) – Spectroscopic redshift
wavelength (float) – Observed wavelength in microns
wave_space (numpy.ndarray) – Wavelength array for the cropped spectrum
obs_map (numpy.ndarray) – Observed 2D grism spectrum (spatial x wavelength)
obs_error (numpy.ndarray) – Error map for observations
kin_model (KinModels) – Initialized kinematic model object
grism_object (Grism) – Initialized grism dispersion object
delta_wave (float) – Wavelength bin size in microns
- prep_grism(grism_spectrum, grism_spectrum_error, wavelength, delta_wave_cutoff=0.02, wave_first=3.5, d_wave=0.001)#
Crop the grism spectrum to a smaller size, centered on the wavelength of interest Remove the continuum