API Documentation for ghosts¶
Stuff
camera interface¶
ghosts.camera¶
camera module
This module provides functions to display a dummy camera, with rafts, CCDs and amplifiers.
- ghosts.camera.make_amp(x, y)[source]¶
Build an amplifier rectangle
- Parameters:
x (float) – x position of the lower left angle of the amplifier rectangle
y (float) – y position of the lower left angle of the amplifier rectangle
- Returns:
- – a Rectangle object
- Return type:
matplotlib.patches.Rectangle
- ghosts.camera.make_ccd(x, y)[source]¶
Build a CCD rectangle
- Parameters:
x (float) – x position of the lower left angle of the CCD rectangle
y (float) – y position of the lower left angle of the CCD rectangle
- Returns:
- – a Rectangle object
- Return type:
matplotlib.patches.Rectangle
- ghosts.camera.make_raft(x, y)[source]¶
Build a raft rectangle
- Parameters:
x (float) – x position of the lower left angle of the raft rectangle
y (float) – y position of the lower left angle of the raft rectangle
- Returns:
- – a Rectangle object
- Return type:
matplotlib.patches.Rectangle
- ghosts.camera.make_ccd_with_amp(x, y)[source]¶
Build a CCD rectangle filled with Amplifiers :param x: x position of the lower left angle of the raft rectangle :type x: float :param y: y position of the lower left angle of the raft rectangle :type y: float
- Returns:
ccd – a list of CCDs with amplifiers
- Return type:
list of matplotlib.patches.Rectangle
- ghosts.camera.make_raft_with_ccd(x, y)[source]¶
Build a raft filled with CCDs
- Parameters:
x (float) – x position of the lower left angle of the raft rectangle
y (float) – y position of the lower left angle of the raft rectangle
- Returns:
raft – a list of rafts with CCDs
- Return type:
list of matplotlib.patches.Rectangle
- ghosts.camera.make_raft_with_ccd_with_amp(x, y)[source]¶
Build a raft filled with CCDs filled with amps
- Parameters:
x (float) – x position of the lower left angle of the raft rectangle
y (float) – y position of the lower left angle of the raft rectangle
- Returns:
raft – a list of CCDs with amplifiers
- Return type:
list of matplotlib.patches.Rectangle
- ghosts.camera.make_raft_with_one_ccd_with_amp(x, y, i_ccd)[source]¶
Build a raft with one CCD filled with amps
- Parameters:
x (float) – x position of the lower left angle of the raft rectangle
y (float) – y position of the lower left angle of the raft rectangle
i_ccd (int) – number of the CCD that you wish to fill with amplifiers
- Returns:
raft – a list of CCDs and some amplifiers
- Return type:
list of matplotlib.patches.Rectangle
- ghosts.camera.build_camera()[source]¶
Build a camera as a collection of Rectangles
- Returns:
rafts (matplotlib.collections.PatchCollection) – a collection of rectangles that looks like the rafts of the Rubin LSST Camera
ccds (matplotlib.collections.PatchCollection) – a collection of rectangles that looks like the CCDs of the Rubin LSST Camera
amps (matplotlib.collections.PatchCollection) – a collection of rectangles that looks like the Amplifiers of the Rubin LSST Camera
beam configuration interface¶
ghosts.beam_configs¶
Beam configurations are defined as simple dictionaries with minimal information.
BEAM_CONFIG_0 = {'beam_id': 0, 'wl': 500e-9, 'n_photons': 1000, 'radius': 0.00125,
'x_offset': 0., 'y_offset': 0, 'z_offset': 2.2,
'z_euler': 0., 'y_euler': 0., 'x_euler': 0.}
beam interface¶
ghosts.beam¶
beam module
This module provides tools to manipulate beam geometries, and generate light rays as batoid.RayVector
- ghosts.beam.to_panda(beam_config)[source]¶
Convert a beam configuration dictionary to a panda data frame
Indexing is done using the beam configuration beam_id.
- Parameters:
beam_config (dict) – a dictionary with beam characteristics
- Returns:
data_frame – a pandas data frame with beam information
- Return type:
pandas.DataFrame
- ghosts.beam.to_dict(beam_frame)[source]¶
Convert a beam panda data frame to a dictionary of use with simulator
The beam data frame is expected to have only one beam configuration.
- Parameters:
beam_frame (pandas.DataFrame) – a pandas data frame with one beam configuration
- Returns:
beam_config – a dictionary with a beam configuration
- Return type:
dict
- ghosts.beam.concat_frames(beam_frame_list)[source]¶
Concatenates beam configuration data frames within one table
- Parameters:
beam_frame_list (list of pandas.DataFrame) – a list of beam configuration data frames
- Returns:
beam_concat – a pandas data frame with several configurations of beams
- Return type:
pandas.DataFrame
- ghosts.beam.concat_dicts(beam_dict_list)[source]¶
Concatenates geometry configuration dictionaries into a data frame
- Parameters:
beam_dict_list (list of dict) – a list of beam configuration dictionaries
- Returns:
beam_concat – a pandas data frame with several configurations of beams
- Return type:
pandas.DataFrame
- ghosts.beam.to_beam_set(beam_frame)[source]¶
Convert a data frame of many beam configurations to a beam set (list of dicts)
- Parameters:
beam_frame (pandas.DataFrame) – a pandas data frame with several configurations of beams
- Returns:
beam_set – a beam set as a list of beam configuration dictionaries
- Return type:
list of dict
- ghosts.beam.get_photon_energy(beam_nu)[source]¶
Compute the energy of a photon at a given frequency
- Parameters:
beam_nu (float) – light frequency in Hz
- Returns:
photon_energy – the photon energy in Joules
- Return type:
float
- ghosts.beam.get_n_phot_for_power(beam_power, beam_nu)[source]¶
Compute the number of photons in a beam of light of a given power for a given frequency
- Parameters:
beam_power (float) – light beam power in nanowatt
beam_nu (float) – light frequency in Hz
- Returns:
n_photon – a number of photons
- Return type:
int
- ghosts.beam.get_n_phot_for_power_nw_wl_nm(beam_power, wl)[source]¶
Compute the number of photons in a beam of light of a given power for a given wavelength
- Parameters:
beam_power (float) – light beam power in nanowatt
wl (int) – light wavelength
- Returns:
n_photon – a number of photons
- Return type:
int
- ghosts.beam.point_beam_to_target(beam_config, target_x=0.0, target_y=0.0)[source]¶
Compute the Euler angles to point the beam at the camera center given a beam position
- Parameters:
beam_config (dict) – a dictionary with the light beam configuration, see ghosts.beam_configs.
target_x (float) – target position on the X-axis of the camera plane
target_y (float) – target position on the Y-axis of the camera plane
- Returns:
new_beam – a dictionary with the light beam configuration (see ghosts.beam_configs) that points toward the requested position on the camera plane
- Return type:
dict
- ghosts.beam.beam_on(beam_config)[source]¶
Generates a beam of light rays to be used for a simulation
- Parameters:
beam_config (dict) – a dictionary with the light beam configuration, see ghosts.beam_configs.
- Returns:
rays – a light beam as many photons of the requested wave length
- Return type:
batoid.RayVectors
- ghosts.beam.simple_beam(x_offset=0.1, y_offset=0, wl=5e-07, n_photons=1000)[source]¶
Proxy to generate a simple beam of light rays to be used for a simulation
Offsets are with respect to the default beam configuration, see BEAM_CONFIG_0 at ghosts.beam_configs.
- Parameters:
x_offset (float) – the beam offset along x in meters
y_offset (float) – the beam offset along y in meters
wl (int) – the light wavelength in nanometers
n_photons (int) – the number of light rays to generate
- Returns:
rays – a light beam as many photons of the requested wave length
- Return type:
batoid.RayVectors
- ghosts.beam.rotate_config_to_ub(beam_config, u, b)[source]¶
Rotate a beam configuration to given b and u CCOB motor angles
Email from Andy: - Check that U=0, B rotates around the Y axis, B>0 -> +X, B<0 -> -X - Check that U>0 rotates around -Z in the right-handed sense.
Euler angles in extrinsic rotations https://en.wikipedia.org/wiki/Euler_angles#Conventions_by_extrinsic_rotations
- Parameters:
beam_config (ghost.beam_config) – a beam configuration as a dictionary
u (float) – the value of the rotation angle in degrees around “-Z” (when b=0)
b (float) – the value of the rotation angle in degrees around “Y” (when u=0)
- Returns:
new_beam – a new beam configuration corresponding to CCOB motor set as (u, b) angles
- Return type:
ghost.beam_config
- ghosts.beam.build_translation_set(base_beam_config, axis, shifts_list, base_id=0)[source]¶
Build a set of beams for the given list of translations
- Parameters:
base_beam_config (dict) – the base beam configuration dictionary to start from
axis (string) – the name of the translation axis, usually x or y
shifts_list (list of float) – the list of distances to scan in meters
base_id (int) – the id of the first beam configuration created, following ids will be id+1
- Returns:
beams – a list of beam configuration dictionaries
- Return type:
list of geom_config
- ghosts.beam.build_rotation_set(base_beam_config, axis, angles_list, base_id=0)[source]¶
Build a set of beam configurations for the given list of rotations starting from the given beam configuration
- Parameters:
base_beam_config (dict) – the base beam configuration dictionary to start from
axis (string) – axis around which to rotate as Euler rotations: “x_euler” or “y_euler”
angles_list (list of float) – the list of angles to scan in degrees
base_id (int) – the id of the first beam configuration created, following ids will be id+1
- Returns:
beams – a list of geometry configuration dictionaries
- Return type:
list of geom_config
- ghosts.beam.build_square_set(distances, base_id=0)[source]¶
Build a square set of beams for a given list of distances
- Parameters:
distances (list of float) – list of distances from -x/-y to +x/+Y
base_id (int) – the id of the first beam configuration created, following ids will be id+1
- Returns:
beams – a list of beam configuration dictionaries
- Return type:
list of geom_config
- ghosts.beam.build_first_quadrant_square_set(delta=0.02, d_max=0.26, base_id=0)[source]¶
Build a set of beams to cover the first quadrant with a square grid
- Parameters:
delta (float) – distance between 2 points in x or y, usually 2 cm = 0.02 m
d_max (float) – maximum distance to go from center, up to ~0.26 m is fine, then beam does not converge on camera
base_id (int) – the id of the first beam configuration created, following ids will be id+1
- Returns:
beams – a list of beam configuration dictionaries
- Return type:
list of geom_config
- ghosts.beam.build_full_frame_square_set(delta=0.02, d_max=0.26, base_id=0)[source]¶
Build a full square set of beams on the full camera frame
- Parameters:
delta (float) – distance between 2 points in x or y, usually 2 cm = 0.02 m
d_max (float) – maximum distance to go from center, up to ~0.26 m is fine, then beam does not converge on camera
base_id (int) – the id of the first beam configuration created, following ids will be id+1
- Returns:
beams – a list of beam configuration dictionaries
- Return type:
list of geom_config
- ghosts.beam.build_square_set_on_target(base_beam_config, distances, target_x=0, target_y=0, base_id=0)[source]¶
Build a set of beams for the given list of distances from target
- Parameters:
base_beam_config (dict) – the base beam configuration dictionary to start from
distances (list of float) – list of distances from -x/-y to +x/+Y
target_x (float) – target position on the X-axis of the camera plane
target_y (float) – target position on the Y-axis of the camera plane
base_id (int) – the id of the first beam configuration created, following ids will be id+1
- Returns:
beams – a list of beam configuration dictionaries
- Return type:
list of geom_config
- ghosts.beam.build_polar_set(distances, angles, base_id=0)[source]¶
Build a set of beams for the given list of distances to center and a list of angles
- Parameters:
distances (list of float) – list of distances to center to sample lenses
angles (list of float) – list of polar angles to sample lenses
base_id (int) – the id of the first beam configuration created, following ids will be id+1
- Returns:
beams – a list of beam configuration dictionaries
- Return type:
list of geom_config
- ghosts.beam.build_first_quadrant_polar_set(delta=0.02, d_max=0.36, base_id=0)[source]¶
Build a set of beams for the given list of distances, and rotate on the first quadrant
- Parameters:
delta (float) – distance between 2 points in x or y, usually 2 cm = 0.02 m
d_max (float) – maximum distance to go from center, up to ~0.26 m is fine, then beam does not converge on camera
base_id (int) – the id of the first beam configuration created, following ids will be id+1
- Returns:
beams – a list of beam configuration dictionaries
- Return type:
list of geom_config
- ghosts.beam.build_full_frame_polar_set(base_id=0, set_size='large')[source]¶
Build a set of beams for the given list of translations
- Parameters:
base_id (int) – the id of the first beam configuration created, following ids will be id+1
set_size ('string') – small, medium, large are the 3 default configurations
- Returns:
beams – a list of beam configuration dictionaries
- Return type:
list of geom_config
- ghosts.beam.set_n_photons_on_beam_set(beam_set, n_photons=1000)[source]¶
Build a beam configuration matching the reference one, but with fewer photons so that the simulations called by the fit are faster
- Parameters:
beam_set (list of dict) – the list of beam configurations to adjust
n_photons (int) – the number of rays to simulate for the new configuration
- Returns:
fix_beam_set – the list of beam configuration with the adjusted number of photons
- Return type:
list of dict
geom configuration interface¶
ghosts.geom_configs¶
Geometry configurations are defined as dictionaries with translations and rotations for each of the optical element
GEOM_CONFIG_0 = {'geom_id': 0,
'L1_dx': 0.0, 'L1_dy': 0.0, 'L1_dz': 0.0, 'L1_rx': 0.0, 'L1_ry': 0.0, 'L1_rz': 0.0,
'L2_dx': 0.0, 'L2_dy': 0.0, 'L2_dz': 0.0, 'L2_rx': 0.0, 'L2_ry': 0.0, 'L2_rz': 0.0,
'L3_dx': 0.0, 'L3_dy': 0.0, 'L3_dz': 0.0, 'L3_rx': 0.0, 'L3_ry': 0.0, 'L3_rz': 0.0,
'Filter_dx': 0.0, 'Filter_dy': 0.0, 'Filter_dz': 0.0,
'Filter_rx': 0.0, 'Filter_ry': 0.0, 'Filter_rz': 0.0,
'Detector_dx': 0.0, 'Detector_dy': 0.0, 'Detector_dz': 0.0,
'Detector_rx': 0.0, 'Detector_ry': 0.0, 'Detector_rz': 0.0}
geom interface¶
ghosts.geom¶
geom module
This module provides tools to manipulate telescope geometries, i.e. shifts and rotations
- ghosts.geom.get_optics_translation(optics, geom_config)[source]¶
Return a vector with the translations of the given optics
- Parameters:
optics (string) – the name of an optical element in L1, L2, L3, Filter, Detector
geom_config (dict) – a dictionary with shifts and rotations for each optical element
- Returns:
translation_vector – a vector of translations for the optical element
- Return type:
list of float
- ghosts.geom.get_optics_rotation(optics, geom_config)[source]¶
Return a vector with the rotations of the given optics
- Parameters:
optics (string) – the name of an optical element in L1, L2, L3, Filter, Detector
geom_config (dict) – a dictionary with shifts and rotations for each optical element
- Returns:
rotation_vector – a vector of rotations for the optical element
- Return type:
list of float
- ghosts.geom.to_panda(geom_config)[source]¶
Convert a geometry configuration dictionary to a panda data frame
Indexing is done using the beam configuration geom_id.
- Parameters:
geom_config (dict) – a dictionary with shifts and rotations for each optical element
- Returns:
data_frame – a pandas data frame with shifts and rotations information
- Return type:
pandas.DataFrame
- ghosts.geom.to_dict(geom_frame)[source]¶
Convert a geometry panda data frame to a dictionary of use with tweak_optics
The geom data frame is expected to have only one geometry configuration.
- Parameters:
geom_frame (pandas.DataFrame) – a pandas data frame with shifts and rotations information
- Returns:
geom_config – a dictionary with shifts and rotations for each optical element
- Return type:
dict
- ghosts.geom.concat_frames(geom_frame_list)[source]¶
Concatenates geometry configuration data frames within one table
- Parameters:
geom_frame_list (list of pandas.DataFrame) – a list of geometry configuration data frames
- Returns:
geom_concat – a pandas data frame with several configurations of shifts and rotations information
- Return type:
pandas.DataFrame
- ghosts.geom.concat_dicts(geom_dict_list)[source]¶
Concatenates geometry configuration dictionaries into a data frame
- Parameters:
geom_dict_list (list of dict) – a list of geometry configuration dictionaries
- Returns:
geom_concat – a pandas data frame with several configurations of shifts and rotations information
- Return type:
pandas.DataFrame
- ghosts.geom.translate_optic(optic_name, axis, distance, geom_id=1000000)[source]¶
Create a dictionary to translate a piece of optic along an axis
- Parameters:
optic_name (string) – the name of an optical element
axis (string) – the name of the translation axis, in [x, y , z]
distance (float) – the value of the shift in meters
geom_id (int) – the id of the new geometry configuration
- Returns:
geom – a geom_config dictionary for the application of the translation
- Return type:
dict
- ghosts.geom.rotate_optic(optic_name, axis, angle, geom_id=1000000)[source]¶
Rotate one optical element of a telescope given a list of Euler angles
- Parameters:
optic_name (string) – the name of an optical element
axis (string) – the name of the rotation axis, usually y
angle (float) – the values of angle in degrees
geom_id (int) – the id of the new geometry configuration
- Returns:
geom – a geom_config dictionary for the application of the rotation
- Return type:
dict
- ghosts.geom.build_translation_set(optic_name, axis, shifts_list, base_id=0)[source]¶
Build a set of geometries for the given list of translations
- Parameters:
optic_name (string) – the name of an optical element
axis (string) – the name of the rotation axis, usually y
shifts_list (list of float) – the list of distances to scan in meters
base_id (int) – the id of the first geometry configuration created, following ids will be id+1
- Returns:
geoms – a list of geometry configuration dictionaries
- Return type:
list of geom_config
- ghosts.geom.build_rotation_set(optic_name, axis, angles_list, base_id=0)[source]¶
Build a set of geometries for the given list of rotations
- Parameters:
optic_name (string) – the name of an optical element
axis (string) – the name of the rotation axis, usually y
angles_list (list of float) – the list of angles to scan in degrees
base_id (int) – the id of the first geometry configuration created, following ids will be id+1
- Returns:
geoms – a list of geometry configuration dictionaries
- Return type:
list of geom_config
- ghosts.geom.build_random_geom(max_angle=0.1, max_shift=0.001)[source]¶
Build a random geometry from a base geometry configuration
- Parameters:
max_angle (float) – the maximum value of the rotation angle in degree
max_shift (floats) – the maximum value of the shift in meters
- Returns:
rnd_geom – a random geometry
- Return type:
geom.geom_configs
tweak optics interface¶
ghosts.tweak_optics¶
tweak_optics module
This module is used to build new telescope with a modified geometry from the default telescope read in the yaml file.
- ghosts.tweak_optics.get_list_of_optics(telescope, debug=False)[source]¶
Get a simple list of optical elements from a batoid telescope
Todo
get_list_of_optics needs to better handle optics which are not of interest, e.g. fake baffle
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
debug (bool) – print debug information or not
- Returns:
optics – a simple list of optical element names
- Return type:
list of string objects
- ghosts.tweak_optics.make_optics_reflective(telescope, coating='simple', r_frac=[0.02, 0.02, 0.15], debug=False)[source]¶
Applies a simple coating as a unique refraction index for each optical element surface
Todo
make_optics_reflective should implement wavelength dependent coating for each optical surface
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
coating (string) – use “simple” for simple coating, just one reflection fraction for all surfaces, or “smart” to set one coefficient per element type
r_frac (list of float) – the fraction of light that you wish surfaces to reflect, usually of the order of 0.02 use a list of 3 elements, for simple coating only the first one is used for smart coating all 3 are used for lens, filter and detector
debug (bool) – print debug information or not
- ghosts.tweak_optics.get_optics_position(telescope, name, axis_i)[source]¶
Internal interface to get the position of an optical element given its name
Todo
get_optics_position should be a hidden internal interface
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
name (string) – the name of an optical element
axis_i (int) – the axis index in [0, 1, 2]
- Returns:
position_i – the position along the axis index i
- Return type:
float
- ghosts.tweak_optics.get_optics_position_x(telescope, name)[source]¶
Proxy to get the position of an optical element along the x-axis
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
name (string) – the name of an optical element
- Returns:
pos_x – the position along the axis x
- Return type:
float
- ghosts.tweak_optics.get_optics_position_y(telescope, name)[source]¶
Proxy to get the position of an optical element along the y-axis
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
name (string) – the name of an optical element
- Returns:
pos_y – the position along the axis y
- Return type:
float
- ghosts.tweak_optics.get_optics_position_z(telescope, name)[source]¶
Proxy to get the position of an optical element along the z axis
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
name (string) – the name of an optical element
- Returns:
pos_z – the position along the axis z
- Return type:
float
- ghosts.tweak_optics.rotate_optic(telescope, name, axis='y', angle=1, debug=False)[source]¶
Rotate one optical element of a telescope around a given axis and for a given rotation angle
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
name (string) – the name of an optical element
axis (string) – the name of the rotation axis, usually y
angle (float) – the value of the rotation angle in degrees
debug (bool) – print debug information if True
- Returns:
rotated_telescope – a new telescope with a rotated optical element
- Return type:
batoid.telescope
- ghosts.tweak_optics.translate_optic(telescope, name, axis='x', distance=0.01)[source]¶
Translate one optical element of a telescope along a given axis and for a given length
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
name (string) – the name of an optical element
axis (string) – the name of the rotation axis, usually y
distance (float) – the value of the shift in meters
- Returns:
rotated_telescope – a new telescope with a rotated optical element
- Return type:
batoid.telescope
- ghosts.tweak_optics.rotate_optic_vector(telescope, name, angles, verbose=False)[source]¶
Rotate one optical element of a telescope given a list of Euler angles
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
name (string) – the name of an optical element
angles (list of floats) – the values of Euler angles in degrees as a list,e.g. [0.1, 0.1, 0.1]
verbose (bool) – the verbose mode, true or false
- Returns:
rotated_telescope – a new telescope with a rotated optical element
- Return type:
batoid.telescope
- ghosts.tweak_optics.translate_optic_vector(telescope, name, shifts)[source]¶
Translate an optical element of a telescope given a list of shifts along x, y and z axis
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
name (string) – the name of an optical element
shifts (list of floats) – the values of shifts in meters as a list for x, y and z axis, e.g. [0.001, 0.001, 0.001]
- Returns:
rotated_telescope – a new telescope with a rotated optical element
- Return type:
batoid.telescope
- ghosts.tweak_optics.randomized_telescope(telescope, max_angle=0.1, max_shift=0.001, verbose=False)[source]¶
Randomly translates and rotates all optical elements of a telescope according to uniform distributions drown from the given a maximum rotation angle and shift.
Rotation angles are drawn from a uniform distribution in [-max_angle; +max_angle]
Translation values are drawn from a uniform distribution in [-max_shift; +max_shift]
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
max_angle (float) – the maximum value of the rotation angle in degree
max_shift (floats) – the maximum value of the shift in meters
verbose (bool) – the verbose mode, true or false
- Returns:
rnd_telescope – a new telescope with randomized optics position and rotation
- Return type:
batoid.telescope
- ghosts.tweak_optics.tweak_telescope(telescope, geom_config)[source]¶
Tweak a telescope using rotations and shifts from a dictionary
Todo
tweak_telescope should preserve coating
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
geom_config (dict) – a dictionary with shifts and rotations for each optical element
- Returns:
tweaked_telescope – a new telescope with tweaked optical elements
- Return type:
batoid.telescope
- ghosts.tweak_optics.build_telescope(yaml_geometry='../data/LSST_CCOB_r.yaml')[source]¶
Build a telescope from a geometry description
- Parameters:
yaml_geometry (string) – a yaml telescope geometry
- Returns:
telescope – a telescope with the given geometry
- Return type:
batoid.telescope
- ghosts.tweak_optics.build_telescope_at_600nm(yaml_geometry)[source]¶
Build the reference telescope from a yaml geometry.
- Parameters:
yaml_geometry (string) – path to the yaml file with the reference geometry to be used.
- Returns:
ref_telescope – the reference optical setup as defined in batoid with reflectivity at 600 nm
- Return type:
batoid.telescope
- ghosts.tweak_optics.build_telescope_from_geom(geom_config)[source]¶
Build the default telescope and tweak its optics given shifts and rotations from a geometry configuration
- Parameters:
geom_config (dict) – a dictionary with shifts and rotations for each optical element
- Returns:
tw_telescope – a telescope with the given geometry tweaks
- Return type:
batoid.telescope
reflectivity interface¶
ghosts.reflectivity¶
reflectivity module
This module is used to read and handcraft wave length dependent reflectivity of the different optical element
- ghosts.reflectivity.read_sensor_reflectivity(file_path='../data/sensor_reflectivity_qe_r+qe.xlsx')[source]¶
Reads sensor reflectivity from a spreadsheet and get back data formatted into a panda data frame
- Parameters:
file_path (string) – the path to the spreadsheet containing sensor reflectivity data
- Returns:
data_frame – a panda data frame with wavelength, reflectivity, Q.E. and Q.E. error
- Return type:
pandas.DataFrame
- ghosts.reflectivity.make_simple_coating(telescope, r_frac=[0.02, 0.02, 0.15], debug=False)[source]¶
Applies a simple coating as a unique refraction index for each optical element surface
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
r_frac (list of float) – a refraction index, usually of the order of 0.02
debug (bool) – print debug information or not
- Returns:
coef – the reflexion coefficient applied
- Return type:
float
- ghosts.reflectivity.make_smart_coating(telescope, r_frac=[0.02, 0.02, 0.15], debug=False)[source]¶
Applies a different reflexion index for each element type lens, filter, detector
- Parameters:
telescope (batoid.telescope) – the optical setup as defined in batoid
r_frac (list of float) – the fraction of light that you wish surfaces to reflect, usually of the order of 0.02 use a list of a unique element for simple coating, or of 3 elements for smart coating (lens, filter, detector)
debug (bool) – print debug information or not
simulator interface¶
ghosts.simulator¶
analysis interface¶
ghosts.analysis¶
plotter interface¶
ghosts.plotter¶
tools interface¶
ghosts.tools¶
Tools moduls
This module provides a number of generic tools.
- ghosts.tools.get_default_yaml_path()[source]¶
Hack to find where the default yaml is, to be fixed properly
- ghosts.tools.get_vector(axis, value)[source]¶
Returns a vector containing the given value at the right spot for the given axis
- Parameters:
axis (string) – the name of the rotation axis, x, y or z
value (float) – the value of the rotation angle in degrees or of the shift in meters
- Returns:
vector – a list containing value at the corresponding spot of the given axis
- Return type:
list of floats
- ghosts.tools.get_ranges(x, y, dr=0.01)[source]¶
Get x and y ranges around their mean values with a delta of dr
This is useful to center plots around a region of interest
- Parameters:
x (numpy.array) – The input array along the x-axis
y (numpy.array) – The input array along the y-axis
dr (float) – The delta around the mean value, or the box size if you wish
- Returns:
x_min, x_max, y_min, y_max – The min and max values for x- and y-axis, i.e. the box boundaries.
- Return type:
a tuple of 4 floats
- ghosts.tools.get_main_impact_point(r_forward)[source]¶
Return main image light rays
Direct path will be r_forward with fewest number of things in “path”
Todo
get_main_impact_point should compute a real barycentre?
- Parameters:
r_forward (list of batoid.RayVector) – a list of batoid RayVector with a bunch of rays propagated through the system.
- Returns:
i_straight (int) – the index of the main image
direct_x, direct_y (float, float) – the x and y coordinate of the center of the main image
direct_f (float) – the main image flux, relative to 1
- ghosts.tools.unpack_geom_params(geom_params, geom_labels)[source]¶
Convert a list of geometry parameters into a dictionary as a telescope geometry configuration
- Parameters:
geom_params (list) – an ordered list of parameters corresponding to a geometry configuration
geom_labels (list) – a list of the geometry parameter labels (names) matching the list above
- Returns:
fitted_geom_config – a dictionary with the geometry of the telescope to fit
- Return type:
dict