satsim package
Top-level package for SatSim.
Subpackages
- satsim.dataset package
- satsim.generator package
- satsim.geometry package
- Submodules
- satsim.geometry.astrometric module
GreatCircle
angle_between()
angle_from_los()
apparent()
create_topocentric()
eci_to_ecr()
eci_to_radec()
gen_track()
gen_track_from_wcs()
get_los()
get_los_azel()
lambertian_sphere_to_mv()
load_earth()
load_moon()
load_sun()
query_by_los()
radec_to_eci()
wcs_from_observer_fixed()
wcs_from_observer_rate()
wcs_from_observer_sidereal()
- satsim.geometry.csvsc module
- satsim.geometry.draw module
- satsim.geometry.ephemeris module
- satsim.geometry.observation module
- satsim.geometry.random module
- satsim.geometry.sgp4 module
- satsim.geometry.sprite module
- satsim.geometry.sstr7 module
- satsim.geometry.transform module
- satsim.geometry.twobody module
- satsim.geometry.wcs module
- satsim.image package
- satsim.io package
- satsim.math package
- satsim.pipeline package
- satsim.tfa package
- satsim.time package
- satsim.util package
- satsim.vecmath package
- Submodules
- satsim.vecmath.Cartesian2 module
Cartesian2
Cartesian2.ONE()
Cartesian2.UNIT_X()
Cartesian2.UNIT_Y()
Cartesian2.ZERO()
Cartesian2.abs()
Cartesian2.add()
Cartesian2.angleBetween()
Cartesian2.clamp()
Cartesian2.clone()
Cartesian2.cross()
Cartesian2.distance()
Cartesian2.distanceSquared()
Cartesian2.divideByScalar()
Cartesian2.divideComponents()
Cartesian2.dot()
Cartesian2.equals()
Cartesian2.equalsEpsilon()
Cartesian2.fromArray()
Cartesian2.fromCartesian3()
Cartesian2.fromCartesian4()
Cartesian2.fromElements()
Cartesian2.lerp()
Cartesian2.magnitude()
Cartesian2.magnitudeSquared()
Cartesian2.maximumByComponent()
Cartesian2.maximumComponent()
Cartesian2.minimumByComponent()
Cartesian2.minimumComponent()
Cartesian2.mostOrthogonalAxis()
Cartesian2.multiplyByScalar()
Cartesian2.multiplyComponents()
Cartesian2.negate()
Cartesian2.normalize()
Cartesian2.subtract()
- satsim.vecmath.Cartesian3 module
Cartesian3
Cartesian3.ONE()
Cartesian3.UNIT_X()
Cartesian3.UNIT_Y()
Cartesian3.UNIT_Z()
Cartesian3.ZERO()
Cartesian3.abs()
Cartesian3.add()
Cartesian3.angleBetween()
Cartesian3.clamp()
Cartesian3.clone()
Cartesian3.cross()
Cartesian3.distance()
Cartesian3.distanceSquared()
Cartesian3.divideByScalar()
Cartesian3.divideComponents()
Cartesian3.dot()
Cartesian3.equals()
Cartesian3.equalsEpsilon()
Cartesian3.fromArray()
Cartesian3.fromCartesian4()
Cartesian3.fromElements()
Cartesian3.fromSpherical()
Cartesian3.lerp()
Cartesian3.magnitude()
Cartesian3.magnitudeSquared()
Cartesian3.maximumByComponent()
Cartesian3.maximumComponent()
Cartesian3.midpoint()
Cartesian3.minimumByComponent()
Cartesian3.minimumComponent()
Cartesian3.mostOrthogonalAxis()
Cartesian3.multiplyByScalar()
Cartesian3.multiplyComponents()
Cartesian3.negate()
Cartesian3.normalize()
Cartesian3.projectVector()
Cartesian3.subtract()
- satsim.vecmath.Cartesian4 module
Cartesian4
Cartesian4.ONE()
Cartesian4.UNIT_W()
Cartesian4.UNIT_X()
Cartesian4.UNIT_Y()
Cartesian4.UNIT_Z()
Cartesian4.ZERO()
Cartesian4.abs()
Cartesian4.add()
Cartesian4.clamp()
Cartesian4.clone()
Cartesian4.distance()
Cartesian4.distanceSquared()
Cartesian4.divideByScalar()
Cartesian4.divideComponents()
Cartesian4.dot()
Cartesian4.equals()
Cartesian4.equalsEpsilon()
Cartesian4.fromArray()
Cartesian4.fromElements()
Cartesian4.lerp()
Cartesian4.magnitude()
Cartesian4.magnitudeSquared()
Cartesian4.maximumByComponent()
Cartesian4.maximumComponent()
Cartesian4.minimumByComponent()
Cartesian4.minimumComponent()
Cartesian4.mostOrthogonalAxis()
Cartesian4.multiplyByScalar()
Cartesian4.multiplyComponents()
Cartesian4.negate()
Cartesian4.normalize()
Cartesian4.subtract()
- satsim.vecmath.Matrix2 module
Matrix2
Matrix2.COLUMN0ROW0
Matrix2.COLUMN0ROW1
Matrix2.COLUMN1ROW0
Matrix2.COLUMN1ROW1
Matrix2.IDENTITY()
Matrix2.ZERO()
Matrix2.abs()
Matrix2.add()
Matrix2.clone()
Matrix2.equalsEpsilon()
Matrix2.fromArray()
Matrix2.fromColumnMajorArray()
Matrix2.fromRotation()
Matrix2.fromRowMajorArray()
Matrix2.fromScale()
Matrix2.fromUniformScale()
Matrix2.getColumn()
Matrix2.getElementIndex()
Matrix2.getMaximumScale()
Matrix2.getRotation()
Matrix2.getRow()
Matrix2.getScale()
Matrix2.multiply()
Matrix2.multiplyByScalar()
Matrix2.multiplyByScale()
Matrix2.multiplyByUniformScale()
Matrix2.multiplyByVector()
Matrix2.negate()
Matrix2.packedLength
Matrix2.setColumn()
Matrix2.setRotation()
Matrix2.setRow()
Matrix2.setScale()
Matrix2.setUniformScale()
Matrix2.subtract()
Matrix2.toArray()
Matrix2.transpose()
- satsim.vecmath.Matrix3 module
Matrix3
Matrix3.COLUMN0ROW0
Matrix3.COLUMN0ROW1
Matrix3.COLUMN0ROW2
Matrix3.COLUMN1ROW0
Matrix3.COLUMN1ROW1
Matrix3.COLUMN1ROW2
Matrix3.COLUMN2ROW0
Matrix3.COLUMN2ROW1
Matrix3.COLUMN2ROW2
Matrix3.IDENTITY()
Matrix3.ZERO()
Matrix3.abs()
Matrix3.add()
Matrix3.clone()
Matrix3.computeEigenDecomposition()
Matrix3.computeFrobeniusNorm()
Matrix3.determinant()
Matrix3.equals()
Matrix3.equalsEpsilon()
Matrix3.fromArray()
Matrix3.fromColumnMajorArray()
Matrix3.fromCrossProduct()
Matrix3.fromHeadingPitchRoll()
Matrix3.fromQuaternion()
Matrix3.fromRotationX()
Matrix3.fromRotationY()
Matrix3.fromRotationZ()
Matrix3.fromRowMajorArray()
Matrix3.fromScale()
Matrix3.fromUniformScale()
Matrix3.getColumn()
Matrix3.getElementIndex()
Matrix3.getMaximumScale()
Matrix3.getRotation()
Matrix3.getRow()
Matrix3.getScale()
Matrix3.inverse()
Matrix3.inverseTranspose()
Matrix3.multiply()
Matrix3.multiplyByScalar()
Matrix3.multiplyByScale()
Matrix3.multiplyByUniformScale()
Matrix3.multiplyByVector()
Matrix3.negate()
Matrix3.offDiagonalFrobeniusNorm()
Matrix3.packedLength
Matrix3.setColumn()
Matrix3.setRotation()
Matrix3.setRow()
Matrix3.setScale()
Matrix3.setUniformScale()
Matrix3.shurDecomposition()
Matrix3.subtract()
Matrix3.toArray()
Matrix3.transpose()
- satsim.vecmath.Matrix4 module
Matrix4
Matrix4.COLUMN0ROW0
Matrix4.COLUMN0ROW1
Matrix4.COLUMN0ROW2
Matrix4.COLUMN0ROW3
Matrix4.COLUMN1ROW0
Matrix4.COLUMN1ROW1
Matrix4.COLUMN1ROW2
Matrix4.COLUMN1ROW3
Matrix4.COLUMN2ROW0
Matrix4.COLUMN2ROW1
Matrix4.COLUMN2ROW2
Matrix4.COLUMN2ROW3
Matrix4.COLUMN3ROW0
Matrix4.COLUMN3ROW1
Matrix4.COLUMN3ROW2
Matrix4.COLUMN3ROW3
Matrix4.IDENTITY()
Matrix4.ZERO()
Matrix4.abs()
Matrix4.add()
Matrix4.clone()
Matrix4.computeInfinitePerspectiveOffCenter()
Matrix4.computeLookAt()
Matrix4.computeOrthographicOffCenter()
Matrix4.computePerspectiveFieldOfView()
Matrix4.computePerspectiveOffCenter()
Matrix4.computeView()
Matrix4.computeViewportTransformation()
Matrix4.equalsEpsilon()
Matrix4.fromArray()
Matrix4.fromCamera()
Matrix4.fromColumnMajorArray()
Matrix4.fromRotation()
Matrix4.fromRotationTranslation()
Matrix4.fromRowMajorArray()
Matrix4.fromScale()
Matrix4.fromTranslation()
Matrix4.fromTranslationQuaternionRotationScale()
Matrix4.fromTranslationRotationScale()
Matrix4.fromUniformScale()
Matrix4.getColumn()
Matrix4.getElementIndex()
Matrix4.getMatrix3()
Matrix4.getMaximumScale()
Matrix4.getRotation()
Matrix4.getRow()
Matrix4.getScale()
Matrix4.getTranslation()
Matrix4.inverse()
Matrix4.inverseTransformation()
Matrix4.inverseTranspose()
Matrix4.m
Matrix4.multiply()
Matrix4.multiplyByMatrix3()
Matrix4.multiplyByPoint()
Matrix4.multiplyByPointAsVector()
Matrix4.multiplyByScalar()
Matrix4.multiplyByScale()
Matrix4.multiplyByTranslation()
Matrix4.multiplyByUniformScale()
Matrix4.multiplyByVector()
Matrix4.multiplyTransformation()
Matrix4.negate()
Matrix4.packedLength
Matrix4.setColumn()
Matrix4.setRotation()
Matrix4.setRow()
Matrix4.setScale()
Matrix4.setTranslation()
Matrix4.setUniformScale()
Matrix4.subtract()
Matrix4.toArray()
Matrix4.transpose()
- satsim.vecmath.Quaternion module
Quaternion
Quaternion.add()
Quaternion.clone()
Quaternion.computeAngle()
Quaternion.computeAxis()
Quaternion.computeInnerQuadrangle()
Quaternion.conjugate()
Quaternion.divideByScalar()
Quaternion.dot()
Quaternion.equals()
Quaternion.equalsEpsilon()
Quaternion.exp()
Quaternion.fastSlerp()
Quaternion.fastSquad()
Quaternion.fromAxisAngle()
Quaternion.fromHeadingPitchRoll()
Quaternion.fromRotationMatrix()
Quaternion.inverse()
Quaternion.lerp()
Quaternion.log()
Quaternion.magnitude()
Quaternion.magnitudeSquared()
Quaternion.multiply()
Quaternion.multiplyByScalar()
Quaternion.negate()
Quaternion.normalize()
Quaternion.slerp()
Quaternion.squad()
Quaternion.subtract()
Quaternion.toHeadingPitchRoll()
Submodules
satsim.cli module
satsim.config module
- satsim.config.dict_merge(dct, merge_dct)
Recursive dict merge. Inspired by
dict.update()
, instead of updating only top-level keys, dict_merge recurses down into dicts nested to an arbitrary depth, updating keys. The merge_dct is merged into dct.- Param:
dct: dict, onto which the merge is executed merge_dct: dict, dct merged into dct
- satsim.config.has_key_deep(d, key)
Nested check to see if a dictionary has a key.
- Parameters:
d – dict or list
key – str, key name to check for
- satsim.config.load_json(filename)
Opens a JSON file and returns the result as a dictionary.
- Parameters:
filename – str, path to file
- Returns:
A dict, the result.
- satsim.config.load_yaml(filename)
Opens a YAML file and returns the result as a dictionary.
- Parameters:
filename – str, path to file
- Returns:
A dict, the result.
- satsim.config.parse_cache(param)
Parse a cache parameter. The input argument, param, may contain the following keys and values which describe the function to run. For example:
param = { '$cache': './path/to/cache' }
Cache is not used if $cache key is not present.
- Parameters:
param – dict, a dictionary that contain keys: $cache
- Returns:
- A tuple,
a dictionary, loaded from cache if available a boolean, True if cache loaded, False otherwise
- satsim.config.parse_function(param)
Parse a function. The input argument, param, should contain the following keys and values which describe the function to run. For example:
param = { 'module': 'my_module', 'function': 'my_function', 'kwargs': { 'param_1': 10.0, 'param_2': 'astring' } }
Which is comparable to:
import my_module return lambda: my_function(param_1 = 10.0, param_2 = 'astring')
- Parameters:
param – dict, a dictionary that contain keys: module, function, kwargs
- Returns:
- A function, a lambda function encapsulating the parsed function and
arguments
- satsim.config.parse_function_pipeline(param)
Parse a pipeline of functions. See parse_function.
- Parameters:
param – dict, a dictionary that contain keys: module, function, kwargs
- Returns:
An func, a function encapsulating the pipeline
- satsim.config.parse_generator(param)
Parse and run a generator function. See parse_function.
- Parameters:
param – dict, a dictionary that contain keys: module, function, kwargs
- Returns:
A dict, a dictionary generated by the generator function
- satsim.config.parse_import(param)
Parse a import key. The input argument, param, should contain the following keys and values which describe the function to run. For example:
param = { '$import': './base.json', 'override': { 'param_1': 10.0, 'param_2': 'override string' } }
- Parameters:
param – dict, a dictionary that contain keys: import, and optionally override
- Returns:
A dict, a dictionary generated by the generator function
- satsim.config.parse_param(param, dirname=None, run_generator=False, eval_python=False, run_compound=False)
Parses a parameter and recursively parses any children parameters.
if the parameter contains the key sample, result from parse_random_sample will be returned.
if the parameter contains the key file, the contents of the loaded pickle file will be returned.
if the parameter contains the key generator, result from parse_generator will be returned.
else if no special keys are found, param is returned.
- Parameters:
param – dict, root parameter
dirname – str, root directory for files referenced in param
run_generator – boolean, evaluate generator functions during this pass
- Returns:
A any, a random sample, contents of pickle file, or original value
- satsim.config.parse_random_sample(param)
Parses a random sample parameter and returns a sample. The value of the key $sample should be the format random.DISTRIBUTION, where DISTRIBUTION is a NumPy random distribution. For example:
p = { "$sample": "random.uniform", "low": 5.0, "high": 22.0 } x = parse_random_sample(p) # x is a value between 5 and 22
If the key $sample is equal to random.choice, one option will be chosen from the key choices. For example:
p = { "$sample": "random.choice", "choices": [1, 2, 4, 8] } x = parse_random_sample(p) # x will be 1, 2, 4, or 8
If the key $sample is equal to random.list, a list of random samples will be generated. For example:
p = { "$sample": "random.list", "length": 5, "value": { "$sample": "random.randint", "low": 0, "high": 10 } } x = parse_random_sample(p) # x will a list of length 5, i.e. x == [7,5,8,5,1]
- Parameters:
param – dict, random sample parameter
- Returns:
A number, random sample
- satsim.config.save_cache(param, value)
Saves a parameter to the disk cache. Parameter will be loaded from cache on any subsequent calls.
- Parameters:
param – dict, root parameter to be used as the cache key
value – any, the value to save to cache
- satsim.config.save_debug(configs, output_dir)
Writes an array of configs to files for debugging.
- Parameters:
configs – array, configuration stages output by transform
output_dir – str, directory to output files
- satsim.config.save_json(filename, config, save_pickle=False)
Saves a configuration to a JSON file. Any items that are not JSON serializable are saved to a binary pickle file and saved in the same directory as the file filename.
- Parameters:
filename – str, path to file
config – dict, configuration as a dictionary
- satsim.config.transform(config, dirname=None, max_stages=5, with_debug=False, max_imports=20, max_ref=5)
Transforms a SatSim configuration, evaluating any random sample parameters, references and/or generator functions. The transformation will happen in two passes. The first pass evaluates sample parameters; the second pass evaluates generator parameters. This is repeated for max_stages or until no more generator or sample keys are found.
- Parameters:
config – dict, configuration as a dictionary.
dirname – str, root directory for files referenced in config.
max_stages – int, maximum number of times to evaluate (one stage is equivalent to running pass 1 and pass 2 once each).
with_debug – boolean, return config after each stage.
max_imports – int, maximum number of times to evaluate imports.
max_refs – int, maximum number of times to evaluate refs.
- Returns:
- A dict or tuple,
- if with_debug is False:
dict, in place transformation of config
- if with_debug is True:
config: dict, in place transformation of config stages: array, array of dictionaries after each transformation stage
satsim.satsim module
- satsim.satsim.gen_images(ssp, eager=True, output_dir='./', sample_num=0, output_debug=False, queue=None, set_name=None)
Generates a single set of images.
Examples:
# load a template json file ssp = load_json('input/config.json') ssp = transform(copy.deepcopy(ssp), 'input/') # generate SatNet files to the output directory gen_images(ssp, eager=True, output_dir='output/')
- Parameters:
ssp – dict, static satsim configuration and parameters. Any dynamic parameters should already be transformed.
eager – boolean, Has no effect. True only.
output_dir – str, output directory to save SatNet files.
sample_num – int, recorded to annotation files.
output_debug – boolean, output intermediate debug files.
queue – MultithreadedTaskQueue, if not None, files will be written.
set_name – str, sets the directory name to save the images to, if None, is set to current time.
- Returns:
A str, directory to where the output files are saved.
- satsim.satsim.gen_multi(ssp, eager=True, output_dir='./', input_dir='./', device=None, memory=None, pid=0, output_debug=False, folder_name=None)
Generates multiple sets of images. Number of sets is based on the parameters ssp[‘sim’][‘samples’].
Examples:
# load a template json file ssp = load_json('input/config.json') # edit some parameters ssp['sim']['samples'] = 50 ssp['geometry']['obs']['list']['mv'] = 17.5 # generate SatNet files to the output directory gen_multi(ssp, eager=True, output_dir='output/')
- Parameters:
ssp – dict, static or dynamic satsim configuration and parameters.
eager – boolean, Has no effect. True only.
output_dir – str, output directory to save SatNet files.
input_dir – str, typically the input directory of the configuration file.
device – array, array of GPU device IDs to enable. If None, enable all.
pid – int, an ID to associate this instance to.
output_debug – boolean, output intermediate debug files.
folder_name – str, Optional name for folder to save files to.
- satsim.satsim.image_generator(ssp, output_dir='.', output_debug=False, dir_debug='./Debug', with_meta=False, eager=True, num_sets=0)
Generator function for a single set of images.
Examples:
# load a template json file ssp = load_json('input/config.json') ssp = transform(copy.deepcopy(ssp), 'input/') # generate SatNet files to the output directory for results in image_generator(ssp, eager=True, output_dir='output/'): imshow(results.numpy())
- Parameters:
ssp – dict, static satsim configuration and parameters. Any dynamic parameters should already be transformed.
output_dir – str, root directory for SatSim configuration file.
sample_num – int, recorded to annotation files.
output_debug – boolean, output intermediate debug files.
dir_debug – str, directory to output debug files.
with_meta – boolean, add metadata to the return function.
eager – boolean, Has no effect. True only.
num_sets – int, number of sets until generator exits. Set to 0 to run forever.
- Returns:
fpa_digital: image, rendered image. frame_num: int, frame number. astrometrics: dict, astrometry meta data. obs_os_pix: dict, observations meta data. fpa_conv_star: image, pristine image with stars. fpa_conv_targ: image, pristine image with targets. bg_tf: image, background image. dc_tf: image, dark current image. rn_tf: image, read noise image. num_shot_noise_samples: int, number of shot noise samples averaged
- Return type:
An image, the rendered image. If with_meta is set to True, additional values are returned