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:
  • poslist [~astropy.units], coordinates of ground station (i.e. latitude, longitude, altitude)

  • id_descriptionstr, Set ground station description

  • label_fill_colorlist (int), Fill Color in rgba format

  • label_outline_colorlist (int), Outline Color in rgba format

  • label_fontstr, Set label font style and size (CSS syntax)

  • label_textstr, Set label text

  • label_showbool, 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:
  • satobject, SatSim Skyfield object

  • Nint, Number of sample points

  • id_namestr, Set orbit name

  • id_descriptionstr, Set orbit description

  • path_widthint, Path width

  • path_showbool, Indicates whether the path is visible

  • path_colorlist (int), Rgba path color

  • label_fill_colorlist (int), Fill Color in rgba format

  • label_outline_colorlist (int), Outline Color in rgba format

  • label_fontstr, Set label font style and size (CSS syntax)

  • label_textstr, Set label text

  • label_showbool, 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:
  • sspdict, SatSim input configuration.

  • obs_cachelist, list of SatSim Skyfield objects.

  • filenamestr, 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:
  • filenamestring, the FITS filename.

  • fpanp.array, input image as a 2D numpy array.

  • exposure_timefloat, exposure time for header.

  • dt_startdatetime, datetime of start of exposure.

  • headerdict, placeholder, not implemented

  • overwriteboolean, if True overwrite file if it exists

  • dtypestring, ‘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:
  • filenamestring, the image filename.

  • fpanp.array, input image as a 2D numpy array.

  • vauto – vmin is set to min value, and vmax is set to 2*median value

  • vminint, 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.

  • vmaxint, 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.

  • cmapstr, A Colormap instance or registered colormap name.

  • annotationdict, annotation object created from satsim.io.satnet.set_frame_annotation used to place a box around objects in the image

  • padint, 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:
  • dirnamestring, directory containing image files to combine.

  • filenamestring, 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:
  • dirnamestring, the name of the directory (not full path) the SatNet data files will be saved to.

  • sequenceint, sequence

  • heightint, image height in pixels

  • widthint, image width in pixels

  • y_ifovfloat, pixel fov in degrees

  • x_ifovfloat, 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:
  • datadict, object returned by init_annotation.

  • frame_numint, the current frame number

  • heightint, image height in pixels

  • widthint, image width in pixels

  • obslist, list of SatSim obs

  • box_size[int, int], box size in row,col pixels

  • box_padint, amount of pad to add to each side of box

  • filter_obboolean, bounds min and max and remove out of bounds

  • snrarray, image array with target snr values per pixel

  • star_os_pixdict, 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_namestring, directory to save files to

  • sat_namestring, satellite name

  • fpa_digitalarray, image as a numpy array

  • meta_datadict, annotation data generated by init_annotation

  • frame_numint, current frame number in set

  • exposure_timefloat, current frame exposure time in seconds

  • time_stampdatetime, reference time

  • sspdict: SatSim parameters to be saved to JSON file

  • dtypestring: Data type to save FITS pixel data as

  • save_jpegboolean: specify to save a JPEG annotated image

  • ground_truthOrderedDict: an ordered dictionary of arrays or numbers

  • ground_truth_minfloat, set any value less than this number in ground_truth to 0

  • show_star_boxesboolean, draw boudning boxes around stars

  • segmentationdict, if not None, segmentation maps