Classes
A reference for the documentation of all user class objects.
Module
- class scanning.camera.Module(data=None, units=None, **kwargs)[source]
Class for a single camera module (e.g. EoRSpec, CMBPol, SFH). Each module consists of three wafers/detector arrays. Each wafter contains three rhombuses.
- __init__(data=None, units=None, **kwargs) None[source]
- Create a camera module either through:
- option1 : Module(data, units)option2 : Module(freq=, F_lambda=)option3 : Module(wavelength=, F_lambda=)
- Parameters
data (str, DataFrame or [dict of str -> sequence]) – If str, a file path to a csv file. If dict or DataFrame, column names map to their values. Must have columns: x, y. Recommended to have columns: pol, rhombus, and wafer.
units ([dict of str -> str or Unit] or None; default None) – Mapping columns in data with their units. All columns do not need to be mapped. If not provided, all applicable units are assumed to be in degrees.
- Keyword Arguments
freq (float, Quantity or str; default unit GHz) – Center of frequency band. Must be positive. If each wafer is different (such as EoRSpec), pass a three-length list like [freq1, freq2, freq3].
wavelength (float, Quantity or str; default unit micron) – Intended wavelength of light. Must be positive. If each wafer is different (such as EoRSpec), pass a three-length list like [wavelength1, wavelength2, wavelength3].
F_lambda (float; default 1.2) – Factor for spacing between individual detectors.
- Raises
ValueError – data could not be properly interpreted.
TypeError – Missing parameters or unneccesary keywords.
Examples
>>> Module('file.csv', units={'x': 'arcsec'}) # specify x is in arcsec >>> Module(freq=280, F_lambda=1.2) >>> Module(wavelength='350 micron')
- save_data(path_or_buf=None, columns='all')[source]
Write Module object to csv file.
- Parameters
path_or_buf (str, file handle or None; default None) – File path or object, if None is provided the result is returned as a dictionary.
columns (sequence, str or [dict of str -> str/Unit/None]; default 'all') – Columns to write. If dict, map column names to their desired unit and use None if column is unit-less. ‘all’ is [‘x’, ‘y’, ‘pol’, ‘pixel_num’, ‘rhombus’, ‘wafer’]
- Returns
If path_or_buf is None, returns the data as a dictionary mapping column name to values. Otherwise returns None.
- Return type
None or [dict of str -> array]
Examples
>>> # saves x, y, and rhombus >>> module.save_data(path_or_buf='file.csv', columns={'x': 'arcsec', 'y': 'rad', 'rhombus': None})
- property F_lambda
F lambda.
- Type
Quantity
- property ang_res
Angular resolution. If multiple frequencies or wavelengths were provided, this will be a three-length sequence.
- Type
Quantity or Quantity array
- property freq
Center of frequency band. If multiple frequencies or wavelengths were provided, this will be a three-length sequence.
- Type
Quantity or Quantity array
- property pixel_num
Pixel mumber.
- Type
int array
- property pol
Polarization geometry.
- Type
Quantity array
- property rhombus
Rhombus number.
- Type
int array
- property wafer
Wafer number.
- Type
int array
- property x
x offset of detector pixels.
- Type
Quantity array
- property y
y offset of detector pixels
- Type
Quantity array
Instrument
- class scanning.camera.Instrument(data=None, instr_offset=(0, 0), instr_rot=0)[source]
A configurable instrument that holds modules.
- __init__(data=None, instr_offset=(0, 0), instr_rot=0) None[source]
- Initialize a filled Instrument:
option 1: Instrument(data)
- or an empty Intrument:
option 2: Instrument(instr_offset, instr_rot)
- Parameters
data (str or dict) – File path to json file or dict object. Overwrites instr_offset and instr_rot. Applicable values are in degrees unit.
instr_offset ((float/Quantity/str, float/Quantity/str); default (0, 0), default unit deg) – Offset of the instrument from the boresight.
instr_rot (float, Quantity or str; default 0, default unit deg) – CCW rotation of the instrument.
- Raises
ValueError – could not parse “data”
Examples
>>> import astropy.units as u >>> Instrument(inst_offset=(0, '100 arcsec'), instr_rot=3.14*u.rad) >>> Instrument('file.json')
- add_module(module, location, mod_rot=0, identifier=None) None[source]
Add a module to the instrument.
- Parameters
module (Module or str) – A Module object or one of the default options [‘CMBPol’, ‘SFH’, ‘EoRSpec’, ‘Mod280’]
location ((float/Quantity/str, float/Quantity/str) or str; default unit deg) – A tuple containing the (distance, theta) from the center of the instrument in polar coordinates. Or a str of one of the default slot options.
identifier (str or None) – Name of the module. If user chose a default module option and this is None, then identifier will be its corresponding name.
mod_rot (float/Quantity/str; default 0, default unit deg) – CCW rotation of the module.
- change_module(identifier, new_location=None, new_mod_rot=None, new_identifier=None) None[source]
Change a module in the instrument.
- Parameters
identifier (str) – Name of the module to change.
new_location ((float/Quantity/str, float/Quantity/str) or str; default unit deg, optional) – A tuple containing the (distance, theta) from the center of the instrument in polar coordinates. Or a str of one of the default slot options.
new_mod_rot (float/Quantity/str; default 0, default unit deg, optional) – CCW rotation of the module.
new_identifier (str, optional, optional) – New name of the module.
- Raises
ValueError – “identifier” is not valid
- delete_module(identifier) None[source]
Delete a module in the instrument.
- Parameters
identifier (str) – Name of the module.
- Raises
ValueError – “identifier” is not valid
- get_module(identifier, with_mod_rot=False, with_instr_rot=False, with_instr_offset=False, with_mod_offset=False) scanning.camera.Module[source]
- Parameters
identifier (str) – Name of the module.
with_mod_rot (bool; default False) – Whether to apply instrument and module rotation and offset to the returned Module.
with_instr_rot (bool; default False) – Whether to apply instrument and module rotation and offset to the returned Module.
with_instr_offset (bool; default False) – Whether to apply instrument and module rotation and offset to the returned Module.
with_mod_offset (bool; default False) – Whether to apply instrument and module rotation and offset to the returned Module.
- Returns
Module object.
- Return type
- Raises
ValueError – “identifier” is not valid
- get_module_dist(identifier, from_boresight=False)[source]
- Parameters
identifier (str) – Name of the module.
from_boresight (bool; default False) – From the boresight (True) or from the center of the instrument (False).
- Returns
Distance away of the module in polar coordinates.
- Return type
Quantity
- Raises
ValueError – “identifier” is not valid
- get_module_location(identifier, from_boresight=False, polar=True)[source]
- Parameters
identifier (str) – Name of the module.
from_boresight (bool; default False) – From the boresight (True) or from the center of the instrument (False).
polar (bool; default True) – In polar coordinates (True) or in cartesian coordinates (False)
- Returns
(distance, theta) location of module.
- Return type
Quantity two-tuple
- Raises
ValueError – “identifier” is not valid
- get_module_rot(identifier, with_instr_rot=False)[source]
Get rotation of module from the center of the instrument.
- Parameters
identifier (str) – Name of the module.
with_instr_rot (bool; default False) – Whether to include instrument rotation.
- Returns
Rotation of the module
- Return type
Quantity
- Raises
ValueError – “identifier” is not valid
- get_module_theta(identifier, from_boresight=False)[source]
- Parameters
identifier (str) – Name of the module.
from_boresight (bool; default False) – From the boresight (True) or from the center of the instrument (False).
- Returns
Angle of the module in polar coordinates.
- Return type
Quantity
- Raises
ValueError – “identifier” is not valid
- get_slot_location(slot_name, from_boresight=False, polar=True)[source]
- Parameters
slot_name (str) – Name of slot.
from_boresight (bool; default False) – From the boresight (True) or from the center of the instrument (False).
polar (bool; default True) – In polar coordinates (True) or in cartesian coordinates (False)
- Returns
(distance, theta) location of slot.
- Return type
Quantity two-tuple
- Raises
ValueError – “slot_name” is not valid
- location_from_boresight(dist, theta, polar=True)[source]
Given a location relative to the center of the instrument, find the location relative to the boresight.
- Parameters
dist (float, Quantity, or str; default unit deg) – Distance away from the center of the instrument.
theta (float, Quantity, or str; default unit deg) – Angle away from the center of the instrument in polar coordinates.
polar (bool; default True) – In polar coordinates (True) or in cartesian coordinates (False)
- Returns
(distance, theta) location of slot.
- Return type
Quantity two-tuple
- save_data(path_or_buf=None)[source]
Saves as a dictionary like in a json format.
- Parameters
path_or_buf (str or file handle, default None) – File path or object, if None is provided the result is returned as a dict.
- Returns
If path_or_buf is None, returns the resulting json format as a dictionary. Otherwise returns None.
- Return type
None or dict
- property instr_offset
The x and y offsets of the center of the instrument from the boresight.
- Type
Quantity two-tuple
- property instr_rot
The CCW rotation of the instrument.
- Type
Quantity
- property modules
list of module identifiers inside the instrument.
- Type
list of str
- property slots
Map of slot name to their (distance, theta) from the center of the instrument.
- Type
dict of str -> Quantity two-tuple
PrimeCam
A subclass of the Instrument class. The only major difference are the slot locations, so inherited members are not listed.
ModCam
A subclass of the Instrument class. The only major difference are the slot locations, so inherited members are not listed.
SkyPattern
- class scanning.coordinates.SkyPattern(data, units=None, repeatable=False, **kwargs)[source]
Representing the path of the center of a detector array in terms of offsets.
- __init__(data, units=None, repeatable=False, **kwargs) None[source]
- Parameters
data (str, DataFrame, or [dict of str -> sequence]) – If str, a file path to a csv file. If dict or DataFrame, column names map to their values. Must have columns ‘time_offset’, ‘x_coord’, ‘y_coord’.
repeatable (bool; default False) – Whether this pattern can repeat itself (ends where it starts).
units ([dict of str -> str or Unit] or None; default None) – Mapping columns in data with their units. All columns do not need to be mapped. If not provided, all angle-like units are assumed to be in degrees and all time-like units are assumed to be in seconds.
- Keyword Arguments
num_repeat (int; default 1) – Number of repeats of the pattern. Must be a positive integer. Cannot be used with max_scan_duration and repeatable must be True.
max_scan_duration (float/Quantity/str; default unit sec) – Maximum total scan time to determine number of repeats. Must be positive. Cannot be used with num_repeat and repeatable must be True.
- Raises
ValueError – “data” could not be parsed
ValueError – sample interval must be constant
Examples
>>> # if x_coord is specifically in arcseconds >>> SkyPattern('file.csv', units={'x_coord': 'arcsec'})
- save_data(path_or_buf=None, columns='default', include_repeats=True)[source]
- Parameters
path_or_buf (str, file handle or None; default None) – File path or object, if None is provided the result is returned as a dictionary.
columns (sequence, str or [dict of str -> str/Unit/None]; default 'default') – Columns to write. If dict, map column names to their desired unit and use None if you would like to use the standard (deg for angle-like units, sec for time-like units). ‘default’ for [‘time_offset’, ‘x_coord’, ‘y_coord’] ‘all’ for [‘time_offset’, ‘x_coord’, ‘y_coord’, ‘distance’, ‘x_vel’, ‘y_vel’, ‘vel’, ‘x_acc’, ‘y_acc’, ‘acc’, ‘x_jerk’, ‘y_jerk’, ‘jerk’]
include_repeats (bool, default 'True') – Whether to include repeats of the SkyPattern.
- Returns
If path_or_buf is None, returns the data as a dictionary mapping column name to values. Otherwise returns None.
- Return type
None or [dict of str -> array]
Examples
>>> skypattern.save_data('file.csv', columns={'time_offset': 's', 'x_coord': 'arcsec', 'y_coord': None})
- save_param(path_or_buf=None)[source]
- Parameters
path_or_buf (str, file handle, or None; default None) – File path or object, if None is provided the result is returned as a dictionary.
- Returns
If path_or_buf is None, returns the resulting json format as a dictionary. Otherwise returns None.
- Return type
None or [dict of str -> numeric]
- property acc
Total acceleration.
- Type
Quantity array
- property distance
Distance of points from the center.
- Type
Quantity array
- property jerk
Total jerk.
- Type
Quantity array
- property param
Parameters inputted by user.
- Type
dict of str -> (float or Quantity)
- property repeatable
Whether this pattern is repeatable or not.
- Type
bool
- property sample_interval
Time interval between samples.
- Type
Quantity
- property scan_duration
Total scan duration.
- Type
Quantity
- property time_offset
Time offsets.
- Type
Quantity array
- property vel
Total velocity.
- Type
Quantity array
- property x_acc
x acceleration.
- Type
Quantity array
- property x_coord
x positions.
- Type
Quantity array
- property x_jerk
x jerk.
- Type
Quantity array
- property x_vel
x velocity.
- Type
Quantity array
- property y_acc
y acceleration.
- Type
Quantity array
- property y_coord
y positions.
- Type
Quantity array
- property y_jerk
y jerk.
- Type
Quantity array
- property y_vel
y velocity.
- Type
Quantity array
Pong
A subclass of the SkyPattern object. Inherited members are listed.
- class scanning.coordinates.Pong(param_json=None, **kwargs)[source]
The Curvy Pong pattern allows for an approximation of a Pong pattern while avoiding sharp turnarounds at the vertices. The Pong pattern is an analytic and close-pathed pattern that is optimized for regions a few square degrees. It makes a path that intends to cover each area uniformly and ends where it starts.
See “The Impact of Scanning Pattern Strategies on Uniform Sky Coverage of Large Maps” (SCUBA Project SC2/ANA/S210/008) for details of implementation.
- __init__(param_json=None, **kwargs) None[source]
- Initialize a Pong pattern by passing a parameter file and overwriting any parameters with **kwargs:
option1 : Pong(param_json, **kwargs)
- or building from scratch:
option2 : Pong(**kwargs)
- Parameters
param_json (str or None) – If str path to JSON file containing parameters.
- Keyword Arguments
num_term (int) – Number of terms in the triangle wave expansion. Must be positive.
width (float or Quantity or str; default unit deg) – Width of the field. Must be positive.
height (float or Quantity or str; default unit deg) – Height of the field. Must be positive.
spacing (float or Quantity or str; default unit deg) – Space between adjacent (parallel) scan lines in the Pong pattern. Must be positive.
velocity (float or Quantity or str; default unit deg/s) – Target magnitude of the total scan velocity excluding turn-arounds. NOTE this is now the total velocity, not just the velocity of one direction.
angle (float or Quantity or str; default 0; default unit deg) – Position angle of the box in the native coordinate system.
sample_interval (float or Quantity or str; default 1/400, default unit s) – Time between read-outs. Must be positive.
num_repeat (int; default 1) – Number of repeats of the pattern. Must be a positive integer. Cannot be used with max_scan_duration.
max_scan_duration (float or Quantity or str; default unit sec) – Maximum total scan time to determine number of repeats. Must be positive. Cannot be used with num_repeat.
Examples
>>> import astropy.units as u >>> Pong(num_term=4, width=2, height=7200*u.arcsec, spacing='500 arcsec', velocity=1/2)
- save_data(path_or_buf=None, columns='default', include_repeats=True)
- Parameters
path_or_buf (str, file handle or None; default None) – File path or object, if None is provided the result is returned as a dictionary.
columns (sequence, str or [dict of str -> str/Unit/None]; default 'default') – Columns to write. If dict, map column names to their desired unit and use None if you would like to use the standard (deg for angle-like units, sec for time-like units). ‘default’ for [‘time_offset’, ‘x_coord’, ‘y_coord’] ‘all’ for [‘time_offset’, ‘x_coord’, ‘y_coord’, ‘distance’, ‘x_vel’, ‘y_vel’, ‘vel’, ‘x_acc’, ‘y_acc’, ‘acc’, ‘x_jerk’, ‘y_jerk’, ‘jerk’]
include_repeats (bool, default 'True') – Whether to include repeats of the SkyPattern.
- Returns
If path_or_buf is None, returns the data as a dictionary mapping column name to values. Otherwise returns None.
- Return type
None or [dict of str -> array]
Examples
>>> skypattern.save_data('file.csv', columns={'time_offset': 's', 'x_coord': 'arcsec', 'y_coord': None})
- save_param(path_or_buf=None)
- Parameters
path_or_buf (str, file handle, or None; default None) – File path or object, if None is provided the result is returned as a dictionary.
- Returns
If path_or_buf is None, returns the resulting json format as a dictionary. Otherwise returns None.
- Return type
None or [dict of str -> numeric]
- property acc
Total acceleration.
- Type
Quantity array
- property distance
Distance of points from the center.
- Type
Quantity array
- property jerk
Total jerk.
- Type
Quantity array
- property param
Parameters inputted by user.
- Type
dict of str -> (float or Quantity)
- property repeatable
Whether this pattern is repeatable or not.
- Type
bool
- property sample_interval
Time interval between samples.
- Type
Quantity
- property scan_duration
Total scan duration.
- Type
Quantity
- property time_offset
Time offsets.
- Type
Quantity array
- property vel
Total velocity.
- Type
Quantity array
- property x_acc
x acceleration.
- Type
Quantity array
- property x_coord
x positions.
- Type
Quantity array
- property x_jerk
x jerk.
- Type
Quantity array
- property x_vel
x velocity.
- Type
Quantity array
- property y_acc
y acceleration.
- Type
Quantity array
- property y_coord
y positions.
- Type
Quantity array
- property y_jerk
y jerk.
- Type
Quantity array
- property y_vel
y velocity.
- Type
Quantity array
Daisy
A subclass of the SkyPattern object. Inherited members are listed.
- class scanning.coordinates.Daisy(param_json=None, **kwargs)[source]
The Daisy pattern is optimized for point sources and works by having the path of the camera module move at constant velocity and cross the center of the map at various angles.
See “CV Daisy - JCMT small area scanning pattern” (JCMT TCS/UN/005) for details of implementation.
- __init__(param_json=None, **kwargs) None[source]
- Initialize a Daisy pattern by passing a parameter file and overwriting any parameters with **kwargs:
option1 : Daisy(param_json, **kwargs)
- or building from scratch:
option2 : Daisy(**kwargs)
- Parameters
param_json (str or None) – If str path to JSON file containing parameters.
- Keyword Arguments
velocity (float or Quanity or str; default unit deg/s) – Constant velocity (CV) for scan to go at.
start_acc (float or Quanity or str; default unit deg/s^2) – Acceleration at start of pattern. Cannot be 0.
R0 (float or Quanity or str; default unit deg) – Radius R0. Must be positive.
Rt (float or Quanity or str; default unit deg) – Turn radius. Must be positive.
Ra (float or Quanity or str; default unit deg) – Avoidance radius. Must be non-negative.
T (float or Quanity or str; default unit sec) – Total time of the simulation. Must be postivie.
sample_interval (float or Quanity or str; default 1/400, default unit sec) – Time step.
y_offset (float or Quanity or str; default 0, default unit deg) – Start offset in y.
Examples
>>> import astropy.units as u >>> Daisy(velocity=1/3*u.deg/u.s, start_acc='0.2 deg/s/s', R0=0.47, Rt=800*u.arcsec, Ra='600 arcsec', T=300)
- save_data(path_or_buf=None, columns='default', include_repeats=True)
- Parameters
path_or_buf (str, file handle or None; default None) – File path or object, if None is provided the result is returned as a dictionary.
columns (sequence, str or [dict of str -> str/Unit/None]; default 'default') – Columns to write. If dict, map column names to their desired unit and use None if you would like to use the standard (deg for angle-like units, sec for time-like units). ‘default’ for [‘time_offset’, ‘x_coord’, ‘y_coord’] ‘all’ for [‘time_offset’, ‘x_coord’, ‘y_coord’, ‘distance’, ‘x_vel’, ‘y_vel’, ‘vel’, ‘x_acc’, ‘y_acc’, ‘acc’, ‘x_jerk’, ‘y_jerk’, ‘jerk’]
include_repeats (bool, default 'True') – Whether to include repeats of the SkyPattern.
- Returns
If path_or_buf is None, returns the data as a dictionary mapping column name to values. Otherwise returns None.
- Return type
None or [dict of str -> array]
Examples
>>> skypattern.save_data('file.csv', columns={'time_offset': 's', 'x_coord': 'arcsec', 'y_coord': None})
- save_param(path_or_buf=None)
- Parameters
path_or_buf (str, file handle, or None; default None) – File path or object, if None is provided the result is returned as a dictionary.
- Returns
If path_or_buf is None, returns the resulting json format as a dictionary. Otherwise returns None.
- Return type
None or [dict of str -> numeric]
- property acc
Total acceleration.
- Type
Quantity array
- property distance
Distance of points from the center.
- Type
Quantity array
- property jerk
Total jerk.
- Type
Quantity array
- property param
Parameters inputted by user.
- Type
dict of str -> (float or Quantity)
- property repeatable
Whether this pattern is repeatable or not.
- Type
bool
- property sample_interval
Time interval between samples.
- Type
Quantity
- property scan_duration
Total scan duration.
- Type
Quantity
- property time_offset
Time offsets.
- Type
Quantity array
- property vel
Total velocity.
- Type
Quantity array
- property x_acc
x acceleration.
- Type
Quantity array
- property x_coord
x positions.
- Type
Quantity array
- property x_jerk
x jerk.
- Type
Quantity array
- property x_vel
x velocity.
- Type
Quantity array
- property y_acc
y acceleration.
- Type
Quantity array
- property y_coord
y positions.
- Type
Quantity array
- property y_jerk
y jerk.
- Type
Quantity array
- property y_vel
y velocity.
- Type
Quantity array
TelescopePattern
- class scanning.coordinates.TelescopePattern(data, instrument=None, data_loc='boresight', obs_param=None, units=None, **kwargs)[source]
Representing the path in AZ/EL coordinates of the telescope’s boresight.
- __init__(data, instrument=None, data_loc='boresight', obs_param=None, units=None, **kwargs) None[source]
- Determine the motion of the telescope. Note that **kwargs can be passed as a file through obs_param.
- option1: data (sky), instrument (optional), data_loc (optional); lat, start_ra, start_dec, (start_datetime or start_hrang or start_lst or [start_elev and moving_up])option2: data (telescope, excludes lst), instrument (optional), data_loc (optional); lat, (start_ra or start_datetime or start_lst)option3: data (telescope, includes lst), instrument (optional), data_loc (optional); lat
- Parameters
data (str, DataFrame, [dict of str -> sequence], or SkyPattern) – If str, a file path to a csv file. If dict or DataFrame, column names map to their values. Columns must contain ‘time_offset, ‘az_coord’, and ‘alt_coord’. If ‘lst’ is included as a column, certain observation parameters are not required (see options). Otherwise, data is a SkyPattern object.
units ([dict of str -> str or Unit] or None; default None) – If data is not SkyPattern, this mapping column in data with their units. All columns do not need to be mapped. If not provided, all angle-like units are assumed to be in degrees (except for hour angle and lst which are in hourangle) and all time-like units are assumed to be in seconds.
instrument (Instrument or None, default None) – An Instrument object.
data_loc (str or two-tuple; default 'boresight') –
- Location relative to the center of the instrument where observation parameters are applied:
- 1. ‘boresight’ for boresight of the telescope2. string indicating a module name in the instrument e.g. ‘SFH’ or one of the default slots in the instrument e.g. ‘c’, ‘i1’3. tuple of (distance, theta) indicating module’s offset from the center of the instrument; default unit deg
obs_param (str) – File path to json containing all required obervation parameters (see **kwargs).
- Keyword Arguments
start_ra (float/Quantity/str; default unit deg) – Starting right acension of telescope / right acension offset for sky.
start_dec (float/Quantity/str; default unit deg) – Declination offset for sky_pattern.
lat (float/Quantity/str; default unit deg, default FYST_LOC.lat) – Latitude of observation.
start_datetime (str or datetime; default timezone UTC) – Starting date and time of observation.
start_hrang (float/Quantity/str; default unit hourangle) – Starting hour angle of source.
start_lst (float/Quantity/str; default unit hourangle) – Starting local sidereal time.
start_elev (float/Quantity/str; default unit deg) – Starting elevation of source, must be used with moving_up.
moving_up (bool, default True) – Whether observation is moving towards the meridian or away, must be used with start_elev.
Example
>>> sky_pattern = SkyPattern(sky_pattern.csv) >>> telescope_pattern1 = TelescopePattern(sky_pattern, data_loc='i1', start_ra='5 hourangle', start_dec='-60 deg', start_elev=30)
- get_sky_pattern() scanning.coordinates.SkyPattern[source]
- Returns
A SkyPattern object for the boresight.
- Return type
- save_data(path_or_buf=None, columns='default')[source]
Save kinematics data of the boresight.
- Parameters
path_or_buf (str, file handle or None; default None) – File path or object, if None is provided the result is returned as a dictionary.
columns (sequence, str or [dict of str -> str/Unit/None]; default 'default') – Columns to write. If dict, map column names to their desired unit and use None if you would like to use the standard. ‘default’ for [‘time_offset’, ‘lst’, ‘az_coord’, ‘alt_coord’, ‘az_vel’, ‘alt_vel’]. ‘all’ for [‘time_offset’, ‘az_coord’, ‘alt_coord’, ‘az_vel’, ‘alt_vel’, ‘vel’, ‘az_acc’, ‘alt_acc’, ‘acc’, ‘az_jerk’, ‘alt_jerk’, ‘jerk’, ‘lst’, ‘hour_angle’, ‘para_angle’, ‘rot_angle’, ‘ra_coord’, ‘dec_coord’].
- Returns
If path_or_buf is None, returns the data as a dictionary mapping column name to values. Otherwise returns None.
- Return type
None or [dict of str -> array]
Examples
>>> telescope_pattern.save_data('file.csv', columns={'time_offset': 'sec', 'alt_coord': 'arcsec', 'az_coord': None})
- save_param(param_json=None)[source]
Save observation parameters.
- Parameters
path_or_buf (str, file handle, or None; default None) – File path or object, if None is provided the result is returned as a dictionary.
- Returns
If path_or_buf is None, returns the resulting json format as a dictionary. Otherwise returns None.
- Return type
None or dict
- view_module(module, includes_instr_offset=False)[source]
Get a TelescopePattern object representing the AZ/EL coordinates of the provided module.
- Parameters
module (str or two-tuple) –
1. string indicating a module name in the instrument e.g. ‘SFH’2. string indicating one of the default slots in the instrument e.g. ‘c’, ‘i1’3. tuple of (distance, theta) indicating module’s offset from the center of the instrument, default unit degincludes_instr_offset (bool, default False) – if “module” parameter is a tuple of (distance, theta), this includes the instrument offset
- Returns
A TelescopePattern object where the “boresight” is the path of the provided module.
- Return type
- property acc
Total acceleration.
- Type
Quantity array
- property alt_acc
Elevation acceleration.
- Type
Quantity array
- property alt_coord
Elevation coordinates.
- Type
Quantity array
- property alt_jerk
Elevation jerk.
- Type
Quantity array
- property alt_vel
Elevation velocity.
- Type
Quantity array
- property az_acc
Azimuth acceleration.
- Type
Quantity array
- property az_coord
Azimuth coordinates (in terms of East of North).
- Type
Quantity array
- property az_jerk
Azimuth jerk.
- Type
Quantity array
- property az_vel
Azimuth velocity.
- Type
Quantity array
- property dec_coord
Declination.
- Type
Quantity array
- property hour_angle
Hour angle.
- Type
Quantity array
- property instrument
Insturment object.
- Type
Insturment
- property jerk
Total jerk.
- Type
Quantity array
- property lst
Local sidereal time.
- Type
Quantity array
- property para_angle
Parallactic angle.
- Type
Quantity array
- property param
Parameters inputted by user.
- Type
dict
- property ra_coord
Right ascension.
- Type
Quantity array
- property rot_angle
Field rotation (elevation + parallactic angle).
- Type
Quantity array
- property sample_interval
Time between samples.
- Type
Quantity
- property scan_duration
Total scan duration.
- Type
Quantity
- property time_offset
Time offsets.
- Type
Quantity array
- property vel
Total velocity.
- Type
Quantity array
Simulation
- class scanning.optimization.Simulation(telescope_pattern, instrument, module_identifier, sim_param=None, **kwargs)[source]
- __init__(telescope_pattern, instrument, module_identifier, sim_param=None, **kwargs) None[source]
Creating a Simulation object works by passing a TelescopePattern object, which stores the AZ/EL coordinates of the telescope boresight. By passing an Instrument object and the name of one of its modules, we use the detector element positions of that camera module and use the coordinates of the scan pattern that that camera module would make.
Use **kwargs to specify conditions. Note that if multiple detector filters are used (pols_on, det_lim, etc.), only detector elements that satisfy all will be used.
- Parameters
telescope_pattern (TelescopePattern) – A TelescopePattern object representing the boresight.
instrument (Instrument) – Instrument object to get module from.
module_identifier (str) – Gets the Module and AZ/ALT coordinates from a string indicating a module name in the instrument e.g. ‘SFH’.
sim_param (str) – File path to a json file containing parameters for simulation (see **kwargs).
- Keyword Arguments
mem_limit (int; default 640 MB) – Approximate memory limit in megabytes when simulating the scan.
pixel_size (float/Quantity/str; default 10 arcsec, default unit arcsec) – Length of a square pixel in x-y offsets.
max_acc (float/Quantity/str; default None, default unit deg/s^2) – Maximum absolute accleration in x-y offsets. If None, all points are considered valid.
min_acc (float/Quantity/str; default None, default unit deg/s) – Minimum speed in x-y offsets. If None, all points are considered valid.
pols_on (int, int sequence or None; default None FIXME allow other units) – Which polarization geometries (in degrees) of the detector elements to keep on. If None, include all.
rhombi_on (int, int sequence or None; default None) – Which rhombi to keep on. If None, include all rhombi.
wafers_on (int, int sequence or None; default None) – Which wafers to keep on. If None, include all wafers.
det_radius (two-length tuple or None; default None; default unit arcsec) – Take the (min_radius, max_radius) of detector elements to keep. Use None in the tuple for an unspecified limit. If None, include all.
det_lim (two-length sequence of two-length tuples or None; default None; default unit arcsec) – Take the [(x_min, x_max), (y_min, y_max)] range of detector elements to keep. Use None in the tuple for an unspecified limit. If None, include all. FIXME is this with mod_rot? instr_rot? field rotation?
det_list (sequence of int, sequence of two-length tuples, or None; default None) – If a sequence of int, a list of detector numbers to keep on exact detector elements. If a sequence of two-length tuples, a list of (x, y) positions to keep on the detector element closest to each position; default unit arcsec If `None, include all. FIXME is this with mod_rot? instr_rot? field rotation?
pxan_lim (two-length sequence of two-length tuples or None; default None; default unit arcsec) – A recutangular range of x-y pixels within [(xmin, xmax), (ymin, ymax)] to perform analysis. Cannot be used with pxan_list. If both are None, no pixel analysis is performed.
pxan_list (sequence of two-length tuples, or None; default None; default unit arcsec) – A list of pixels such as [(x1, y1), (x2, y2)] to analyze. Each point (x, y) corresponds to a singular pixel that contains this point. Cannot be used with pxan_lim. If both are None, no pixel analysis is performed.
- det_histogram(hits='kept', norm_pxan=True, norm_time=False, path=None)[source]
Get a histogram of the number of hits per detector element on a pixel on the sky (specified in pxan_list or pxan_lim).
- Parameters
hits (str; default 'kept') – One of ‘kept’, ‘removed’, or ‘total’ hits.
norm_pxan (bool; default True) – Whether to average the hits by dividing the total hits by the number of pixels.
norm_time (bool; default False) – True for hits/px per total scan duration. False for hits/px.
path_or_buf (str, file handle or None; default None) – File path or object, if None is provided the result is returned. The file is saved as a csv.
- Returns
If path_or_buf is None, returns the counts for each detector element as well as the corresponding detector number. NaN values mean that detector element has been filtered off. Otherwise returns None.
- Return type
None or (float array, int array)
- sky_histogram(hits='kept', convolve=True, norm_time=False, path_or_buf=None)[source]
Get a 2D histogram of the resultant hitmap.
- Parameters
hits (str; default 'kept') – One of ‘kept’, ‘removed’, or ‘total’ hits.
convolve (bool; default True) – Whether to convolve the hitmap.
norm_time (bool; default False) – True for hits/px per total scan duration. False for hits/px.
path_or_buf (str, file handle or None; default None) – File path or object, if None is provided the result is returned. The file is saved as a csv with the header and columns representing the bin edges (in deg).
- Returns
If path_or_buf is None, returns a 2D histogram of the hits as well as the bin edges. Otherwise returns None.
- Return type
None or (2d float array, Quantity array)
- time_histogram(hits='kept', norm_pxan=True, norm_time=False, path=None)[source]
Get a histogram of the number of hits at each time step on a pixel on the sky (specified in pxan_list or pxan_lim).
- Parameters
hits (str; default 'kept') – One of ‘kept’, ‘removed’, or ‘total’ hits.
norm_pxan (bool; default True) – Whether to average the hits by dividing the total hits by the number of pixels.
norm_time (bool; default False) – True for hits/px per total scan duration. False for hits/px.
path_or_buf (str, file handle or None; default None) – File path or object, if None is provided the result is returned. The file is saved as a csv.
- Returns
If path_or_buf is None, returns the counts for each time step as well as the corresponding time offset. NaN values mean that time step is out/in the speed/accleration limits. Otherwise returns None.
- Return type
None or (float array, int array)
- property det_mask
Mask for detector elements that are turned on.
- Type
bool array
- property field_rotation
Field rotation.
- Type
Quantity array
- property sky_pattern
Associated SkyPattern object.
- Type
- property validity_mask
Mask for samples that are within the acceleration/speed limits.
- Type
bool array
Observation
- class scanning.observation.Observation(dec, hrang_range=None, datetime_range=None, ra=None, freq=None, lat=<Latitude -22.98563889 deg>)[source]
- __init__(dec, hrang_range=None, datetime_range=None, ra=None, freq=None, lat=<Latitude -22.98563889 deg>) None[source]
Initialize an observation of a particular source(s) for a particular time range.
- Parameters
dec (angle-like or iterable, default unit deg) – Declination(s) of your source.
hrang_range ((angle-like, angle-like) or None, default unit hourangle) – (start, end) range of hour angles to consider. If both hrang_range and datetime_range is None, this is by default the full -12 to 12 range. Note that start must be less than end. Cannot be larger than -12 to 12 range. Cannot be used with datetime_range.
datetime_range ((str or datetime-like, str or datetime-like) or None, default None.) – (start, end) range of datetimes to consider. Cannot be used with hrang_range. Must include ra.
ra (angle-like or iterable, default unit deg) – Right ascensions(s) of your source. Required if datetime_range is passed.
freq (time-like, default unit seconds) – The timestep between points. By default, the will be enough so that there are 1500 points.
lat (angle-like, default unit deg, default FYST_LOC.lat) – Latitude of observation.
- filter(min_elev=30, max_elev=75, min_rot_rate=0)[source]
Filter the time ranges when
- Parameters
min_elev (angle-like, default unit deg, default 30 deg) – Minimum elevation to consider.
max_elev (angle-like, default unit deg, default 75 deg) – Maximum elevation to consider.
min_rot_rate (angular velocity-like, default unit deg, default 0 deg/s) – Minimum absolute field rotation rate to consider.
- Returns
In the format of {index of source : list of tuples}. Each tuple is a range of valid times, in datetime.datetime if datetime_range was provided, otherwise in hour angles.
- Return type
dict