satsim.io package
Submodules
satsim.io.czml module
- class satsim.io.czml.CZMLExtractor(start_epoch, end_epoch, multiplier=60)
Bases:
object
A class for extracting SatSim data to Cesium
- add_ground_station(pos, sensor, id_name=None, id_description=None, label_fill_color=[255, 255, 0, 255], label_outline_color=[255, 255, 0, 255], label_font='16pt Lucida Console', label_text=None, label_show=False, billboard_show=True, billboard_image='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACvSURBVDhPrZDRDcMgDAU9GqN0lIzijw6SUbJJygUeNQgSqepJTyHG91LVVpwDdfxM3T9TSl1EXZvDwii471fivK73cBFFQNTT/d2KoGpfGOpSIkhUpgUMxq9DFEsWv4IXhlyCnhBFnZcFEEuYqbiUlNwWgMTdrZ3JbQFoEVG53rd8ztG9aPJMnBUQf/VFraBJeWnLS0RfjbKyLJA8FkT5seDYS1Qwyv8t0B/5C2ZmH2/eTGNNBgMmAAAAAElFTkSuQmCC', cone_color=[255, 255, 0, 64], cone_show=True)
Adds a ground station
- Parameters:
pos – list [~astropy.units], coordinates of ground station (i.e. latitude, longitude, altitude)
id_description – str, Set ground station description
label_fill_color – list (int), Fill Color in rgba format
label_outline_color – list (int), Outline Color in rgba format
label_font – str, Set label font style and size (CSS syntax)
label_text – str, Set label text
label_show – bool, Indicates whether the label is visible
- add_object(sat, N=10, id_name=None, id_description=None, path_width=None, path_show=None, path_color=[255, 255, 0], label_fill_color=[255, 255, 0, 255], label_outline_color=[255, 255, 0, 255], label_font='16pt Lucida Console', label_text=None, label_show=False, start_interval=None, end_interval=None, start_available=None, end_available=None, billboard_show=True, billboard_image='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADJSURBVDhPnZHRDcMgEEMZjVEYpaNklIzSEfLfD4qNnXAJSFWfhO7w2Zc0Tf9QG2rXrEzSUeZLOGm47WoH95x3Hl3jEgilvDgsOQUTqsNl68ezEwn1vae6lceSEEYvvWNT/Rxc4CXQNGadho1NXoJ+9iaqc2xi2xbt23PJCDIB6TQjOC6Bho/sDy3fBQT8PrVhibU7yBFcEPaRxOoeTwbwByCOYf9VGp1BYI1BA+EeHhmfzKbBoJEQwn1yzUZtyspIQUha85MpkNIXB7GizqDEECsAAAAASUVORK5CYII=')
Adds a SatSim Skyfield object
- Parameters:
sat – object, SatSim Skyfield object
N – int, Number of sample points
id_name – str, Set orbit name
id_description – str, Set orbit description
path_width – int, Path width
path_show – bool, Indicates whether the path is visible
path_color – list (int), Rgba path color
label_fill_color – list (int), Fill Color in rgba format
label_outline_color – list (int), Outline Color in rgba format
label_font – str, Set label font style and size (CSS syntax)
label_text – str, Set label text
label_show – bool, Indicates whether the label is visible
- get_document()
Retrieves CZML document.
- Returns:
A Document, the CZML document.
- satsim.io.czml.save_czml(ssp, obs_cache, astrometrics, filename)
Saves scenario as a Cesium czml file.
- Parameters:
ssp – dict, SatSim input configuration.
obs_cache – list, list of SatSim Skyfield objects.
filename – str, if not None, save czml output. default=None
- Returns:
A dict, the CZML output
satsim.io.fits module
- satsim.io.fits.save(filename, fpa, exposure_time=0, dt_start=datetime.datetime(2024, 3, 23, 7, 33, 44, 552367), header={}, overwrite=False, dtype='uint16', astrometrics=None)
Save a SatNet compatible FITS file.
- Parameters:
filename – string, the FITS filename.
fpa – np.array, input image as a 2D numpy array.
exposure_time – float, exposure time for header.
dt_start – datetime, datetime of start of exposure.
header – dict, placeholder, not implemented
overwrite – boolean, if True overwrite file if it exists
dtype – string, ‘int16’, ‘uint16’, ‘int32’, ‘uint32’, or ‘float32’. default: ‘int16’
satsim.io.image module
- satsim.io.image.save(filename, fpa, vauto=False, vmin=None, vmax=None, cmap='gray', annotation=None, pad=5, show_obs_boxes=True, show_star_boxes=False)
Save an array as an image file.
- Parameters:
filename – string, the image filename.
fpa – np.array, input image as a 2D numpy array.
vauto – vmin is set to min value, and vmax is set to 2*median value
vmin – int, vmin and vmax set the color scaling for the image by fixing the values that map to the colormap color limits. If either vmin or vmax is None, that limit is determined from the arr min/max value.
vmax – int, vmin and vmax set the color scaling for the image by fixing the values that map to the colormap color limits. If either vmin or vmax is None, that limit is determined from the arr min/max value.
cmap – str, A Colormap instance or registered colormap name.
annotation – dict, annotation object created from satsim.io.satnet.set_frame_annotation used to place a box around objects in the image
pad – int, pad length in pixels to add to each side of the annotation box
- satsim.io.image.save_apng(dirname, filename)
Combine all jpg and png image files in the specified directory into an animated PNG file. Useful to view images in a web browser.
- Parameters:
dirname – string, directory containing image files to combine.
filename – string, file name of the animated PNG.
satsim.io.satnet module
- satsim.io.satnet.init_annotation(dirname, sequence, height, width, y_ifov, x_ifov)
Init annotation object for SatNet.
- Parameters:
dirname – string, the name of the directory (not full path) the SatNet data files will be saved to.
sequence – int, sequence
height – int, image height in pixels
width – int, image width in pixels
y_ifov – float, pixel fov in degrees
x_ifov – float, pixel fov in degrees
- Returns:
A dict, the data object for set_frame_annotation
- satsim.io.satnet.set_frame_annotation(data, frame_num, height, width, obs, box_size=None, box_pad=0, filter_ob=False, snr=None, star_os_pix=None)
Set frame data on annotation object for SatNet.
- Parameters:
data – dict, object returned by init_annotation.
frame_num – int, the current frame number
height – int, image height in pixels
width – int, image width in pixels
obs – list, list of SatSim obs
box_size – [int, int], box size in row,col pixels
box_pad – int, amount of pad to add to each side of box
filter_ob – boolean, bounds min and max and remove out of bounds
snr – array, image array with target snr values per pixel
star_os_pix – dict, dict with SatSim star data
- Returns:
A dict, the data object for set_frame_annotation
- satsim.io.satnet.write_frame(dir_name, sat_name, fpa_digital, meta_data, frame_num, exposure_time, time_stamp, ssp, show_obs_boxes=True, astrometrics=None, save_pickle=False, dtype='uint16', save_jpeg=True, ground_truth=None, ground_truth_min=None, show_star_boxes=False, segmentation=None)
Write image and annotation files compatible with SatNet. In addition, writes annotated images and SatSim configuration file for reference.
- Parameters:
dir_name – string, directory to save files to
sat_name – string, satellite name
fpa_digital – array, image as a numpy array
meta_data – dict, annotation data generated by init_annotation
frame_num – int, current frame number in set
exposure_time – float, current frame exposure time in seconds
time_stamp – datetime, reference time
ssp – dict: SatSim parameters to be saved to JSON file
dtype – string: Data type to save FITS pixel data as
save_jpeg – boolean: specify to save a JPEG annotated image
ground_truth – OrderedDict: an ordered dictionary of arrays or numbers
ground_truth_min – float, set any value less than this number in ground_truth to 0
show_star_boxes – boolean, draw boudning boxes around stars
segmentation – dict, if not None, segmentation maps