satsim.io package — SatSim 0.13.0 documentation

# 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, 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)

    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)

    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, 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(2023, 2, 27, 0, 10, 41, 141390), 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 – datatime, 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)

  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)

  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

  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)

  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