ImsimCmpt

class lsst.ts.imsim.ImsimCmpt(num_of_zk: int)

Bases: object

Class to take configurations for each imsim component and generate full imsim configuration files.

Attributes

_output_dirstr

Output directory.

_output_img_dirstr

Output image directory.

opd_file_pathstr

OPD file path.

opd_metrlsst.ts.imsim.OpdMetrology

OPD metrology.

num_of_zkint

Number of Zernikes.

num_of_dofint

Number of degrees of freedom.

dof_in_umnumpy.ndarray

Degrees of freedom in microns.

Attributes Summary

output_dir

output_img_dir

Methods Summary

add_config_header(obs_metadata)

Write out the header section of the config file.

add_sources_to_config(config_yaml, inst_cat_path)

Add source information to config.

analyze_opd_data(cam_type[, zk_file_name, ...])

Analyze the OPD data.

assemble_config_yaml(obs_metadata, ...[, ...])

Parameters obs_metadata lsst.ts.imsim.ObsMetadata ObsMetadata dataclass object with observation information. config_pointer_file str The location of the config pointer file that specifies the location of configurations files for each imsim component. cam_type lsst.ts.imsim.utils.CamType Camera type. required_modules_file str or None Path to yaml file with required imsim modules. If None, then will use policy/requiredModulesDefault.yaml. (The default is None.)

convert_obs_metadata_to_text(obs_metadata)

Write out the evalVariables section of the config file.

format_opd_text(obs_metadata, cam_type)

Write out the OPD section of the config file.

gen_inst_cat_stars(sky_sim)

Add stars to the instance catalog.

gen_instance_catalog(sky_sim)

Generate the instance catalog.

generate_star(star_id, ra, dec, mag_norm[, ...])

Generate the star source.

get_list_of_fwhm_sensor_data(pssn_file_name)

Get the list of FWHM sensor data based on the OPD PSSN file.

get_opd_gq_eff_fwhm_from_file(pssn_file_name)

Get the OPD GQ effective FWHM from file.

get_opd_pssn_from_file(pssn_file_name)

Get the OPD PSSN from file.

map_opd_data_to_list_of_wf_err(...)

Map the OPD data to the list of wavefront error.

reorder_and_save_wf_err_file(list_of_wf_err, ...)

Reorder the wavefront error in the wavefront error list according to the reference sensor name list and save to a file.

run_imsim(config_file_path[, imsim_log_file])

Run imSim with the given configuration file.

save_dof_in_um_file_for_next_iter([...])

Save the DOF in um data to file for the next iteration.

write_yaml_and_run_imsim(config_path, ...[, ...])

Write yaml config file and run Imsim.

Attributes Documentation

output_dir
output_img_dir

Methods Documentation

add_config_header(obs_metadata: ObsMetadata) str

Write out the header section of the config file.

Parameters

obs_metadatalsst.ts.imsim.ObsMetadata

ObsMetadata dataclass object with observation information.

Returns

str

Header information for ImSim config

add_sources_to_config(config_yaml: dict[str, Any], inst_cat_path: str, use_ccd_img: bool = True) dict[str, Any]

Add source information to config. If using CCD it will add the instance catalog details. If only using OPD it will remove the instance catalog info so that we are not generating unnecessary images.

Parameters

config_yamldict

Dictionary that contains imsim config details to write to yaml.

inst_cat_pathstr

Path to instance catalog file.

use_ccd_imgbool, optional

When outputting CCD images this is set to True so that the instance catalog information is included in the configuration. For OPD only this should be set to False. (The default is True.)

Returns

dict

Updated yaml configuration.

analyze_opd_data(cam_type: CamType, zk_file_name: str = 'opd.zer', rot_opd_in_deg: float = 0.0, pssn_file_name: str = 'PSSN.txt') None

Analyze the OPD data.

Rotate OPD to simulate the output by rotated camera. When anaylzing the PSSN, the unrotated OPD is used.

OPD: Optical path difference. PSSN: Normalized point source sensitivity.

Parameters

cam_typelsst.ts.imsim.utils.CamType

Camera type.

zk_file_namestr, optional

OPD in zk file name. (the default is “opd.zer”.)

rot_opd_in_degfloat, optional

Rotate OPD in degree in the counter-clockwise direction. (the default is 0.0.)

pssn_file_namestr, optional

PSSN file name. (the default is “PSSN.txt”.)

assemble_config_yaml(obs_metadata: ObsMetadata, config_pointer_file: str, cam_type: CamType, required_modules_file: str | None = None) dict[str, Any]

Parameters

obs_metadatalsst.ts.imsim.ObsMetadata

ObsMetadata dataclass object with observation information.

config_pointer_filestr

The location of the config pointer file that specifies the location of configurations files for each imsim component.

cam_typelsst.ts.imsim.utils.CamType

Camera type.

required_modules_filestr or None

Path to yaml file with required imsim modules. If None, then will use policy/requiredModulesDefault.yaml. (The default is None.)

convert_obs_metadata_to_text(obs_metadata: ObsMetadata) str

Write out the evalVariables section of the config file.

Parameters

obs_metadatalsst.ts.imsim.ObsMetadata

ObsMetadata dataclass object with observation information.

Returns

str

eval_variables for ImSim config

format_opd_text(obs_metadata: ObsMetadata, cam_type: CamType) str

Write out the OPD section of the config file.

Parameters

obs_metadatalsst.ts.imsim.ObsMetadata

ObsMetadata dataclass object with observation information.

cam_typelsst.ts.imsim.utils.CamType

Camera type.

Returns

str

OPD information for ImSim config

gen_inst_cat_stars(sky_sim: SkySim) str

Add stars to the instance catalog.

Parameters

sky_simlsst.ts.imsim.skySim.SkySim

The SkySim object with the stars to simulate.

Returns

str

Instance catalog text for the stars in the SkySim catalog.

gen_instance_catalog(sky_sim: SkySim) str

Generate the instance catalog.

Parameters

sky_simlsst.ts.imsim.skySim.SkySim

The SkySim object with the stars to simulate.

Returns

str

Text to write to instance catalog file.

generate_star(star_id: int, ra: float, dec: float, mag_norm: float, sed_name: str = 'flatSED/sed_flat.txt.gz', redshift: float = 0, gamma_1: float = 0, gamma_2: float = 0, kappa: float = 0, delta_ra: float = 0, delta_dec: float = 0, source_type: str = 'point') str

Generate the star source.

Parameters

star_idint

Star Id.

rafloat

The right ascension of the center of the object or image in decimal degrees.

decfloat

The declination of the center of the object in decimal degrees.

mag_normfloat

The normalization of the flux of the object in AB magnitudes at (500 nm)/(1+z) (which is roughly equivalent to V (AB) or g (AB)).

sed_namestr, optional

The name of the SED file with a file path that is relative to the $SIMS_SED_LIBRARY_DIR directory environment variable required for imSim.. (The default is “flatSED/sed_flat.txt.gz”)

redshiftfloat, optional

The redshift (or blueshift) of the object. Note that the SED does not need to be redshifted if using this. (the default is 0.)

gamma_1float, optional

The value of the shear parameter gamma1 used in weak lensing. (the default is 0.)

gamma_2float, optional

The value of the shear parameter gamma2 used in weak lensing. (the default is 0.)

kappafloat, optional

The value of the magnification parameter in weak lensing. (the default is 0.)

delta_rafloat, optional

The value of the declination offset in radians. This can be used either for weak lensing or objects that moved from another exposure if you do not want to change the source position in the first two columns. (the default is 0.)

delta_decfloat, optional

The value of the declination offset in radians. This can be used either for weak lensing or objects that moved from another exposure if you do not want to change the source position in the first two columns. (the default is 0.)

source_typestr, optional

The name of the spatial model to be used as defined below. (the default is “point”.)

Returns

str

Instance catalog entry for star.

get_list_of_fwhm_sensor_data(pssn_file_name: str) tuple[numpy.ndarray, numpy.ndarray]

Get the list of FWHM sensor data based on the OPD PSSN file.

FWHM: Full width at half maximum. OPD: Optical path difference. PSSN: Normalized point source sensitivity.

Parameters

pssn_file_namestr

PSSN file name.

sensor_id_listlist

Reference sensor id list.

Returns

np.ndarray [object]

Numpy array with fwhm data. This is a numpy array of arrays. The data type is object because each element may have different number of elements.

get_opd_gq_eff_fwhm_from_file(pssn_file_name: str) float

Get the OPD GQ effective FWHM from file.

OPD: Optical path difference. GQ: Gaussian quadrature. FWHM: Full width at half maximum. PSSN: Normalized point source sensitivity.

Parameters

pssn_file_namestr

PSSN file name.

Returns

float

OPD GQ effective FWHM.

get_opd_pssn_from_file(pssn_file_name: str) ndarray

Get the OPD PSSN from file.

OPD: Optical path difference. PSSN: Normalized point source sensitivity.

Parameters

pssn_file_namestr

PSSN file name.

Returns

numpy.ndarray

PSSN.

map_opd_data_to_list_of_wf_err(opd_zk_file_name: str, sensor_id_list: list[int], sensor_name_list: list[str]) list[lsst.ts.imsim.utils.sensor_wavefront_error.SensorWavefrontError]

Map the OPD data to the list of wavefront error.

OPD: Optical path difference.

Parameters

opd_zk_file_namestr

OPD zk file name.

sensor_id_listlist

Reference sensor ID list.

sensor_name_listlist

Reference sensor name list.

Returns

list [lsst.ts.wep.ctrlIntf.SensorWavefrontError]

List of SensorWavefrontError object.

reorder_and_save_wf_err_file(list_of_wf_err: list[lsst.ts.imsim.utils.sensor_wavefront_error.SensorWavefrontError], ref_sensor_name_list: list[str], camera: Camera, zk_file_name: str = 'wfs.zer') None

Reorder the wavefront error in the wavefront error list according to the reference sensor name list and save to a file.

The unexisted wavefront error will be a numpy zero array. The unit is um.

Parameters

list_of_wf_errlist [lsst.ts.wep.ctrlIntf.SensorWavefrontData]

List of SensorWavefrontData object.

ref_sensor_name_listlist

Reference sensor name list.

cameralsst.afw.cameraGeom.Camera

Instrument.

zk_file_namestr, optional

Wavefront error file name. (the default is “wfs.zer”.)

run_imsim(config_file_path: str, imsim_log_file: str = '') None

Run imSim with the given configuration file.

Parameters

config_file_pathstr

Path to the imSim configuration yaml file.

imsim_log_filestr, optional

Path to save imSim log output. If empty string then the code will just default to sending it to stdout. (The default is “”.)

save_dof_in_um_file_for_next_iter(dof_in_um_file_name: str = 'dofPertInNextIter.mat') None

Save the DOF in um data to file for the next iteration.

DOF: degree of freedom.

Parameters

dof_in_um_file_namestr, optional

File name to save the DOF in um. (the default is “dofPertInNextIter.mat”.)

write_yaml_and_run_imsim(config_path: str, config_yaml: dict[str, Any], imsim_log_file: str = '') None

Write yaml config file and run Imsim.

Parameters

config_pathstr

Path to write config yaml file.

config_yamldict

Dictionary that contains imsim config details to write to yaml.

imsim_log_filestr, optional

Path to save imSim log output. If empty string then the code will just default to sending it to stdout. (The default is “”.)