ClosedLoopTask¶
- class lsst.ts.imsim.ClosedLoopTask¶
Bases:
object
Initialization of the closed loop task class to run the simulation with imSim.
Methods Summary
check_and_create_base_output_dir
(base_output_dir)Check and create the base output directory.
check_boresight
(boresight)Check the boresight.
config_ofc_calc
(cam_type, controller_config_file)Configure the OFC calculator.
config_sky_sim
(cam_type, obs_metadata[, ...])Configure the sky simulator.
erase_directory_content
(target_dir)Erase the directory content.
generate_butler
(butler_root_path, cam_type)Generate butler gen3.
generate_ref_catalog
(butler_root_path, ...)Generate reference star catalog.
get_sensor_id_list_of_fields
(cam_type)Get the list of sensor ids of fields.
get_sensor_name_list_of_fields
(cam_type)Get the list of sensor name of fields.
ingest_data
(butler_root_path, cam_type)Ingest data into a gen3 data Butler.
map_filter_ref_to_g
(filter_type_name)Map the reference filter to the G filter.
run_img
(inst, filter_type_name, ...)Run the simulation of images.
run_wep
(seq_num, butler_root_path, cam_type, ...)Run wavefront estimation pipeline task for wavefront sensors.
set_default_parser
(parser)Set the default parser.
set_img_parser
(parser)Set the image-specific parser.
write_wep_configuration
(cam_type, ...)Write wavefront estimation pipeline task configuration.
Methods Documentation
- check_and_create_base_output_dir(base_output_dir: str) str ¶
Check and create the base output directory.
This function will create the directory if it does not exist.
Parameters¶
- base_output_dirstr
Base output directory.
Returns¶
- str
Base output directory.
- check_boresight(boresight: list[float]) None ¶
Check the boresight.
Parameters¶
- boresightlist[float]
Boresight [ra, dec] in degree.
Raises¶
- ValueError
The right ascension (RA) should be in [0, 360].
- ValueError
The declination (Dec) should be in [-90, 90].
- config_ofc_calc(cam_type: CamType, controller_config_file: str) None ¶
Configure the OFC calculator.
OFC: Optical feedback calculator.
Parameters¶
- cam_typelsst.ts.imsim.utils.CamType
Camera type.
- controller_config_filestr
Controller configuration file.
- config_sky_sim(cam_type: CamType, obs_metadata: ObsMetadata, path_sky_file: str = '', star_mag: float = 15.0) None ¶
Configure the sky simulator.
If the path of sky file is not provided, The defult OPD field positions will be used.
OPD: Optical path difference.
Parameters¶
- cam_typelsst.ts.imsim.utils.CamType
Camera type.
- obs_metadatalsst.ts.imsim.ObsMetadata
Observation metadata.
- path_sky_filestr, optional
Path to the sky file. (the default is “”.)
- star_magfloat, optional
Default star magnitude if there is no sky file used. This is to pretend there are the stars at OPD field positions. (the default is 15.)
Raises¶
- ValueError
This instrument name is not supported.
- erase_directory_content(target_dir: str) None ¶
Erase the directory content.
Parameters¶
- target_dirstr
Target directory.
- generate_butler(butler_root_path: str, cam_type: CamType) None ¶
Generate butler gen3.
Parameters¶
- butler_root_path:
str
Path to where the butler repository should be created.
- cam_typelsst.ts.imsim.utils.CamType
Camera type.
- butler_root_path:
- generate_ref_catalog(butler_root_path: str, path_sky_file: str, filter_type_name: str) None ¶
Generate reference star catalog.
Parameters¶
- butler_root_path:
str
Path to the butler gen3 repository.
- path_sky_file:
str
Path to the catalog star file.
- filter_type_namestr
Filter type name: ref (or ‘’), u, g, r, i, z, or y.
- butler_root_path:
- get_sensor_id_list_of_fields(cam_type: CamType) list[int] ¶
Get the list of sensor ids of fields.
The list will be sorted based on the field index.
Parameters¶
- cam_typelsst.ts.imsim.utils.CamType
Camera type.
Returns¶
- list[int]
List of sensor ids.
Raises¶
- ValueError
This instrument name is not supported.
- get_sensor_name_list_of_fields(cam_type: CamType) list[str] ¶
Get the list of sensor name of fields.
The list will be sorted based on the field index.
Parameters¶
- cam_typelsst.ts.imsim.utils.CamType
Camera type.
Returns¶
- list[str]
List of sensor name.
Raises¶
- ValueError
This instrument name is not supported.
- ingest_data(butler_root_path: str, cam_type: CamType) None ¶
Ingest data into a gen3 data Butler.
Parameters¶
- butler_root_pathstr
Path to the butler repository.
- cam_typelsst.ts.imsim.utils.CamType
Camera type.
- map_filter_ref_to_g(filter_type_name: str) str ¶
Map the reference filter to the G filter.
Parameters¶
- filter_type_namestr
Filter type name: ref (or ‘’), u, g, r, i, z, or y.
Returns¶
- filter_type_namestr
Mapped filter type.
- run_img(inst: str, filter_type_name: str, rot_cam_in_deg: float, boresight: list[float], mjd: float, star_mag: float, base_output_dir: str, path_sky_file: str, do_erase_dir_content: bool, sky_seed: int, pert_seed: int, iter_num: int, pipeline_file: str, imsim_config_pointer_file: str, controller_config_file: str, turn_off_sky_background: bool, turn_off_atmosphere: bool, turn_off_wavefront_estimates: bool, num_pro: int, raw_seeing: float, imsim_log_file: str, wep_estimator_method: str, max_noll_index: int) None ¶
Run the simulation of images.
Parameters¶
- inststr
Instrument to use: currently only lsst.
- filter_type_namestr
Filter type name: ref, u, g, r, i, z, or y.
- rot_cam_in_degfloat
The camera rotation angle in degree (-90 to 90).
- boresightlist[float]
Boresight [ra, dec] in degree.
- mjdfloat
MJD of the observation.
- star_magfloat
Magnitude of stars if using default sky file.
- base_output_dirstr
Base output directory.
- path_sky_filestr
Path to the sky file.
- do_erase_dir_contentbool
Do the erase of the content of base output directory or not.
- sky_seedint
Random seed for the sky background.
- pert_seedint
Random seed for the perturbations.
- iter_numint
Number of closed-loop iteration.
- pipeline_filestr
Path to existing pipeline yaml file to use. If empty string then the code will write its own default pipeline yaml.
- imsim_config_pointer_filestr
Path to pointer file with locations of yaml configuration files for imsim submodules. If empty string then the code will use the default in policy/config for the given inst.
- controller_config_filestr
Path to the controller configuration file.
- turn_off_sky_backgroundbool
If set to True then the closed loop will simulate images without sky background.
- turn_off_atmospherebool
If set to True then will turn off the imsim atmosphere.
- turn_off_wavefront_estimatesbool
If set to True then will run the closed loop only with the OPD.fits files and not simulated images.
- num_proint
Number of processors to use.
- raw_seeingfloat
Raw seeing in arcsec.
- imsim_log_filestr
Location to save imsim log output.
- wep_estimator_methodstr
Specify the method used to calculate Zernikes in ts_wep. Options are “tie” or “danish”.
- max_noll_indexint
Maximum Noll index to calculate Zernikes.
- run_wep(seq_num: int, butler_root_path: str, cam_type: CamType, wep_estimator: WepEstimator, num_pro: int = 1, pipeline_file: str | None = None, filter_type_name: str = '') list[lsst.ts.imsim.utils.sensor_wavefront_error.SensorWavefrontError] ¶
Run wavefront estimation pipeline task for wavefront sensors.
Parameters¶
- seq_numint
Observation id.
- butler_root_pathstr
Path to the butler gen3 repos.
- cam_typelsst.ts.imsim.utils.CamType
Camera type.
- wep_estimatorenum ‘WepEstimator’ in lsst.ts.wep.utility
Specify the method used to calculate Zernikes in ts_wep.
- num_proint, optional
Number of processor to run DM pipeline. (the default is 1.)
- pipeline_filestr or None, optional
Path to existing pipeline yaml file to use. If None then the code will write its own default pipeline yaml. (The default is None.)
- filter_type_namestr, optional
Filter type name: ref (or ‘’), u, g, r, i, z, or y.
Returns¶
- list[lsst.ts.imsim.utils.SensorWavefrontError]
List of SensorWavefrontError with the results of the wavefront estimation pipeline for each sensor.
- static set_default_parser(parser: ArgumentParser) ArgumentParser ¶
Set the default parser.
Parameters¶
- parserargparse.ArgumentParser
Input parser.
Returns¶
- argparse.ArgumentParser
Updated parser.
- static set_img_parser(parser: ArgumentParser) ArgumentParser ¶
Set the image-specific parser.
Parameters¶
- parserargparse.ArgumentParser
Input parser.
Returns¶
- argparse.ArgumentParser
Updated parser.
- write_wep_configuration(cam_type: CamType, pipeline_yaml_path: str, filter_type_name: str, wep_estimator: WepEstimator) None ¶
Write wavefront estimation pipeline task configuration.
Parameters¶
- cam_typelsst.ts.imsim.utils.CamType
Camera type.
- pipeline_yaml_pathstr
Path where the pipeline task configuration yaml file should be saved.
- filter_type_namestr
Filter type name: ref (or ‘’), u, g, r, i, z, or y.
- wep_estimatorenum ‘WepEstimator’ in lsst.ts.wep.utility
Specify the method used to calculate Zernikes in ts_wep.