code
stringlengths
114
1.05M
path
stringlengths
3
312
quality_prob
float64
0.5
0.99
learning_prob
float64
0.2
1
filename
stringlengths
3
168
kind
stringclasses
1 value
import numpy as np _LONGITUDES = list(np.arange(-90.0, 90.25, 0.25)) _LATITUDES = list(np.arange(-180.0, 180.25, 0.25)) def from_latlon(lat, lon) -> tuple: """ Firstly, the closest coordinate to the city is found. It is then calculated the relative position in the quadrant, to define the other three coordinates which will later become the average values to a specific city. Take the example the center of a city that is represented by the dot: N ┌──────┬──────┐ │ │ │ │ 2 1 │ │ │ │ W │ ─── ─┼─ ─── │ E │ │ │ │ 3 4 │ │ . │ │ └──────┴──────┘ ▲ S │ closest coord Other three coordinates are taken to a measure as close as possible in case the closest coordinate is far off the center of the city. Let's take, for instance, Rio de Janeiro. Rio's center coordinates are: latitude: -22.876652 longitude: -43.227875 The closest data point collected would be the coordinate: (-23.0, -43.25). In some cases, the closest point is still far from the city itself, or could be in the sea, for example. Because of this, other three coordinates will be inserted and then the average value is returned from a certain date, defined in `extract_reanalysis.download()` method. The coordinates returned from Rio would be: [-23.0, -43.25] = S, W [-22.75, -43.0] = N, E """ closest_lat = min(_LATITUDES, key=lambda x: abs(x - lat)) closest_lon = min(_LONGITUDES, key=lambda x: abs(x - lon)) lat_diff = lat - closest_lat lon_diff = lon - closest_lon # 1st quadrant if lat_diff < 0 and lon_diff < 0: north, south, east, west = ( closest_lat, closest_lat - 0.25, closest_lon, closest_lon - 0.25, ) # 2nd quadrant elif lat_diff > 0 and lon_diff < 0: north, south, east, west = ( closest_lat + 0.25, closest_lat, closest_lon, closest_lon - 0.25, ) # 3rd quadrant elif lat_diff > 0 and lon_diff > 0: north, south, east, west = ( closest_lat + 0.25, closest_lat, closest_lon + 0.25, closest_lon, ) # 4th quadrant else: north, south, east, west = ( closest_lat, closest_lat - 0.25, closest_lon + 0.25, closest_lon, ) return north, south, east, west
/satellite_weather_downloader-1.9.0.tar.gz/satellite_weather_downloader-1.9.0/satellite/weather/brazil/extract_coordinates.py
0.770637
0.815563
extract_coordinates.py
pypi
import os from string import ascii_letters from typing import Optional, Union from cdsapi.api import Client from loguru import logger from .reanalysis.prompt import reanalysis_prompt # TODO: Allow area slicing in request def ERA5_reanalysis( filename: str, product_type: Optional[str] = None, variable: Optional[Union[str, list]] = None, year: Optional[Union[str, list]] = None, month: Optional[Union[str, list]] = None, day: Optional[Union[str, list]] = None, time: Optional[Union[str, list]] = None, # area: Optional[list] = None, format: Optional[str] = None, ) -> str: """ https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-single-levels Creates the request to Copernicus Reanalysis using CLI or by method call. Although the `copebr` extension in `satellite_weather` does not have support to all dataset variables, the request allows all options to be passed in, according to Copernicus API: product_type (str): data format type. variable (str or list): variable(s) available from the API year (str or list): year(s) since 1959. Format: f'{year:04d}' month (str or list): month(s) of the year. Format: f'{day:02d}' day (str or list): day(s) of the month. Format: f'{day:02d}' time (str or list): 24 hours available by day area (list): #Not available yet format (str): netcdf or grib filename (str): the name of the file when downloaded If one of these variables are not passed, it enters in the interactive shell and asks for the missing inputs. The request will fail if the data requested is too big. Please check the link above to more information. """ allowed_chars = ascii_letters + "/-_" for char in filename: if char not in allowed_chars: raise ValueError(f"Invalid character {char}") cdsapi_key = os.getenv("CDSAPI_KEY") if not cdsapi_key: raise EnvironmentError( "Environment variable CDSAPI_KEY not found in the system.\n" 'Execute `$ export CDSAPI_KEY="{MY_UID}:{MY_KEY}" to fix.\n' "These credentials are found in your Copernicus User Page \n" "https://cds.climate.copernicus.eu/user/{MY_USER}" ) conn = Client( url="https://cds.climate.copernicus.eu/api/v2", key=cdsapi_key, ) options = reanalysis_prompt( product_type=product_type, variable=variable, year=year, month=month, day=day, time=time, # area=area, format=format, ) _no_suffix = filename.split(".")[0] # Forcing correct suffix filename = _no_suffix + ".nc" if options["format"] == "netcdf" else ".grib" try: conn.retrieve("reanalysis-era5-single-levels", options, filename) except Exception as e: logger.error(e) raise e
/satellite_weather_downloader-1.9.0.tar.gz/satellite_weather_downloader-1.9.0/satellite/downloader/request.py
0.461259
0.177775
request.py
pypi
from datetime import datetime def str_range(range: str) -> list: """ Returns a list of sorted digits given a str range with `-`. Usage: str_range('2023-2020') -> ['2020', '2021', '2022', '2023'] str_range('01-05') -> ['01', '02', '03', '04', '05'] """ ini, end = sorted(map(int, range.split("-"))) range_list = [] while ini <= end: range_list.append(str(ini)) ini += 1 return range_list NAME = "reanalysis-era5-single-levels" PRODUCT_TYPE = [ "ensemble_mean", "ensemble_members", "ensemble_spread", "reanalysis", ] VARIABLE = [ "100m_u_component_of_wind", "100m_v_component_of_wind", "10m_u_component_of_neutral_wind", "10m_u_component_of_wind", "10m_v_component_of_neutral_wind", "10m_v_component_of_wind", "10m_wind_gust_since_previous_post_processing", "2m_dewpoint_temperature", "2m_temperature", "air_density_over_the_oceans", "angle_of_sub_gridscale_orography", "anisotropy_of_sub_gridscale_orography", "benjamin_feir_index", "boundary_layer_dissipation", "boundary_layer_height", "charnock", "clear_sky_direct_solar_radiation_at_surface", "cloud_base_height", "coefficient_of_drag_with_waves", "convective_available_potential_energy", "convective_inhibition", "convective_precipitation", "convective_rain_rate", "convective_snowfall", "convective_snowfall_rate_water_equivalent", "downward_uv_radiation_at_the_surface", "duct_base_height", "eastward_gravity_wave_surface_stress", "eastward_turbulent_surface_stress", "evaporation", "forecast_albedo", "forecast_logarithm_of_surface_roughness_for_heat", "forecast_surface_roughness", "free_convective_velocity_over_the_oceans", "friction_velocity", "geopotential", "gravity_wave_dissipation", "high_cloud_cover", "high_vegetation_cover", "ice_temperature_layer_1", "ice_temperature_layer_2", "ice_temperature_layer_3", "ice_temperature_layer_4", "instantaneous_10m_wind_gust", "instantaneous_eastward_turbulent_surface_stress", "instantaneous_large_scale_surface_precipitation_fraction", "instantaneous_moisture_flux", "instantaneous_northward_turbulent_surface_stress", "instantaneous_surface_sensible_heat_flux", "k_index", "lake_bottom_temperature", "lake_cover", "lake_depth", "lake_ice_depth", "lake_ice_temperature", "lake_mix_layer_depth", "lake_mix_layer_temperature", "lake_shape_factor", "lake_total_layer_temperature", "land_sea_mask", "large_scale_precipitation", "large_scale_precipitation_fraction", "large_scale_rain_rate", "large_scale_snowfall", "large_scale_snowfall_rate_water_equivalent", "leaf_area_index_high_vegetation", "leaf_area_index_low_vegetation", "low_cloud_cover", "low_vegetation_cover", "maximum_2m_temperature_since_previous_post_processing", "maximum_individual_wave_height", "maximum_total_precipitation_rate_since_previous_post_processing", "mean_boundary_layer_dissipation", "mean_convective_precipitation_rate", "mean_convective_snowfall_rate", "mean_direction_of_total_swell", "mean_direction_of_wind_waves", "mean_eastward_gravity_wave_surface_stress", "mean_eastward_turbulent_surface_stress", "mean_evaporation_rate", "mean_gravity_wave_dissipation", "mean_large_scale_precipitation_fraction", "mean_large_scale_precipitation_rate", "mean_large_scale_snowfall_rate", "mean_northward_gravity_wave_surface_stress", "mean_northward_turbulent_surface_stress", "mean_period_of_total_swell", "mean_period_of_wind_waves", "mean_potential_evaporation_rate", "mean_runoff_rate", "mean_sea_level_pressure", "mean_snow_evaporation_rate", "mean_snowfall_rate", "mean_snowmelt_rate", "mean_square_slope_of_waves", "mean_sub_surface_runoff_rate", "mean_surface_direct_short_wave_radiation_flux", "mean_surface_direct_short_wave_radiation_flux_clear_sky", "mean_surface_downward_long_wave_radiation_flux", "mean_surface_downward_long_wave_radiation_flux_clear_sky", "mean_surface_downward_short_wave_radiation_flux", "mean_surface_downward_short_wave_radiation_flux_clear_sky", "mean_surface_downward_uv_radiation_flux", "mean_surface_latent_heat_flux", "mean_surface_net_long_wave_radiation_flux", "mean_surface_net_long_wave_radiation_flux_clear_sky", "mean_surface_net_short_wave_radiation_flux", "mean_surface_net_short_wave_radiation_flux_clear_sky", "mean_surface_runoff_rate", "mean_surface_sensible_heat_flux", "mean_top_downward_short_wave_radiation_flux", "mean_top_net_long_wave_radiation_flux", "mean_top_net_long_wave_radiation_flux_clear_sky", "mean_top_net_short_wave_radiation_flux", "mean_top_net_short_wave_radiation_flux_clear_sky", "mean_total_precipitation_rate", "mean_vertical_gradient_of_refractivity_inside_trapping_layer", "mean_vertically_integrated_moisture_divergence", "mean_wave_direction", "mean_wave_direction_of_first_swell_partition", "mean_wave_direction_of_second_swell_partition", "mean_wave_direction_of_third_swell_partition", "mean_wave_period", "mean_wave_period_based_on_first_moment", "mean_wave_period_based_on_first_moment_for_swell", "mean_wave_period_based_on_first_moment_for_wind_waves", "mean_wave_period_based_on_second_moment_for_swell", "mean_wave_period_based_on_second_moment_for_wind_waves", "mean_wave_period_of_first_swell_partition", "mean_wave_period_of_second_swell_partition", "mean_wave_period_of_third_swell_partition", "mean_zero_crossing_wave_period", "medium_cloud_cover", "minimum_2m_temperature_since_previous_post_processing", "minimum_total_precipitation_rate_since_previous_post_processing", "minimum_vertical_gradient_of_refractivity_inside_trapping_layer", "model_bathymetry", "near_ir_albedo_for_diffuse_radiation", "near_ir_albedo_for_direct_radiation", "normalized_energy_flux_into_ocean", "normalized_energy_flux_into_waves", "normalized_stress_into_ocean", "northward_gravity_wave_surface_stress", "northward_turbulent_surface_stress", "ocean_surface_stress_equivalent_10m_neutral_wind_direction", "ocean_surface_stress_equivalent_10m_neutral_wind_speed", "peak_wave_period", "period_corresponding_to_maximum_individual_wave_height", "potential_evaporation", "precipitation_type", "runoff", "sea_ice_cover", "sea_surface_temperature", "significant_height_of_combined_wind_waves_and_swell", "significant_height_of_total_swell", "significant_height_of_wind_waves", "significant_wave_height_of_first_swell_partition", "significant_wave_height_of_second_swell_partition", "significant_wave_height_of_third_swell_partition", "skin_reservoir_content", "skin_temperature", "slope_of_sub_gridscale_orography", "snow_albedo", "snow_density", "snow_depth", "snow_evaporation", "snowfall", "snowmelt", "soil_temperature_level_1", "soil_temperature_level_2", "soil_temperature_level_3", "soil_temperature_level_4", "soil_type", "standard_deviation_of_filtered_subgrid_orography", "standard_deviation_of_orography", "sub_surface_runoff", "surface_latent_heat_flux", "surface_net_solar_radiation", "surface_net_solar_radiation_clear_sky", "surface_net_thermal_radiation", "surface_net_thermal_radiation_clear_sky", "surface_pressure", "surface_runoff", "surface_sensible_heat_flux", "surface_solar_radiation_downward_clear_sky", "surface_solar_radiation_downwards", "surface_thermal_radiation_downward_clear_sky", "surface_thermal_radiation_downwards", "temperature_of_snow_layer", "toa_incident_solar_radiation", "top_net_solar_radiation", "top_net_solar_radiation_clear_sky", "top_net_thermal_radiation", "top_net_thermal_radiation_clear_sky", "total_cloud_cover", "total_column_cloud_ice_water", "total_column_cloud_liquid_water", "total_column_ozone", "total_column_rain_water", "total_column_snow_water", "total_column_supercooled_liquid_water", "total_column_water", "total_column_water_vapour", "total_precipitation", "total_sky_direct_solar_radiation_at_surface", "total_totals_index", "trapping_layer_base_height", "trapping_layer_top_height", "type_of_high_vegetation", "type_of_low_vegetation", "u_component_stokes_drift", "uv_visible_albedo_for_diffuse_radiation", "uv_visible_albedo_for_direct_radiation", "v_component_stokes_drift", "vertical_integral_of_divergence_of_cloud_frozen_water_flux", "vertical_integral_of_divergence_of_cloud_liquid_water_flux", "vertical_integral_of_divergence_of_geopotential_flux", "vertical_integral_of_divergence_of_kinetic_energy_flux", "vertical_integral_of_divergence_of_mass_flux", "vertical_integral_of_divergence_of_moisture_flux", "vertical_integral_of_divergence_of_ozone_flux", "vertical_integral_of_divergence_of_thermal_energy_flux", "vertical_integral_of_divergence_of_total_energy_flux", "vertical_integral_of_eastward_cloud_frozen_water_flux", "vertical_integral_of_eastward_cloud_liquid_water_flux", "vertical_integral_of_eastward_geopotential_flux", "vertical_integral_of_eastward_heat_flux", "vertical_integral_of_eastward_kinetic_energy_flux", "vertical_integral_of_eastward_mass_flux", "vertical_integral_of_eastward_ozone_flux", "vertical_integral_of_eastward_total_energy_flux", "vertical_integral_of_eastward_water_vapour_flux", "vertical_integral_of_energy_conversion", "vertical_integral_of_kinetic_energy", "vertical_integral_of_mass_of_atmosphere", "vertical_integral_of_mass_tendency", "vertical_integral_of_northward_cloud_frozen_water_flux", "vertical_integral_of_northward_cloud_liquid_water_flux", "vertical_integral_of_northward_geopotential_flux", "vertical_integral_of_northward_heat_flux", "vertical_integral_of_northward_kinetic_energy_flux", "vertical_integral_of_northward_mass_flux", "vertical_integral_of_northward_ozone_flux", "vertical_integral_of_northward_total_energy_flux", "vertical_integral_of_northward_water_vapour_flux", "vertical_integral_of_potential_and_internal_energy", "vertical_integral_of_potential_internal_and_latent_energy", "vertical_integral_of_temperature", "vertical_integral_of_thermal_energy", "vertical_integral_of_total_energy", "vertically_integrated_moisture_divergence", "volumetric_soil_water_layer_1", "volumetric_soil_water_layer_2", "volumetric_soil_water_layer_3", "volumetric_soil_water_layer_4", "wave_spectral_directional_width", "wave_spectral_directional_width_for_swell", "wave_spectral_directional_width_for_wind_waves", "wave_spectral_kurtosis", "wave_spectral_peakedness", "wave_spectral_skewness", "zero_degree_level", ] YEAR = sorted(str_range(f"{datetime.now().year}-1959"), reverse=True) MONTH = [ "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", ] DAY = [ "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", ] TIME = [ "00:00", "01:00", "02:00", "03:00", "04:00", "05:00", "06:00", "07:00", "08:00", "09:00", "10:00", "11:00", "12:00", "13:00", "14:00", "15:00", "16:00", "17:00", "18:00", "19:00", "20:00", "21:00", "22:00", "23:00", ] FORMAT = ["grib", "netcdf"]
/satellite_weather_downloader-1.9.0.tar.gz/satellite_weather_downloader-1.9.0/satellite/downloader/reanalysis/api_vars.py
0.88819
0.434161
api_vars.py
pypi
from pyproj import Proj from rasterio import open as rasopen from rasterio.crs import CRS class BBox(object): def __init__(self): self.west = None self.east = None self.north = None self.south = None def as_tuple(self, order='wsen'): """ Find 4-tuple of extent :param order: order of cardinal directions, default='wsen' :return: 4-Tuple """ if order == 'wsen': return self.west, self.south, self.east, self.north elif order == 'swne': return self.south, self.west, self.north, self.east elif order == 'nsew': return self.north, self.south, self.east, self.west def to_web_mercator(self): in_proj = Proj({'init': 'epsg:3857'}) w, n = in_proj(self.west, self.north) e, s = in_proj(self.east, self.south) return w, s, e, n class GeoBounds(BBox): """Spatial bounding box By default, represents a buffered bounding box around the conterminous U.S. """ def __init__(self, west_lon=-126.0, south_lat=22.0, east_lon=-64.0, north_lat=53.0): BBox.__init__(self) self.west = west_lon self.south = south_lat self.east = east_lon self.north = north_lat class RasterBounds(BBox): """ Spatial bounding box from raster extent. :param raster """ def __init__(self, raster=None, affine_transform=None, profile=None, latlon=True): BBox.__init__(self) if raster: with rasopen(raster, 'r') as src: affine_transform = src.transform profile = src.profile col, row = 0, 0 w, n = affine_transform * (col, row) col, row = profile['width'], profile['height'] e, s = affine_transform * (col, row) if latlon and profile['crs'] != CRS({'init': 'epsg:4326'}): in_proj = Proj(init=profile['crs']['init']) self.west, self.north = in_proj(w, n, inverse=True) self.east, self.south = in_proj(e, s, inverse=True) else: self.north, self.west, self.south, self.east = n, w, s, e def get_nwse_tuple(self): return self.north, self.west, self.south, self.east if __name__ == '__main__': pass # ========================= EOF ====================================================================
/satellite_image-0.1.1.tar.gz/satellite_image-0.1.1/sat_image/bounds.py
0.833155
0.270634
bounds.py
pypi
from __future__ import print_function try: import StringIO except ImportError: from io import StringIO import re import os import glob import logging import datetime # Elements from the file format used for parsing GRPSTART = "GROUP = " GRPEND = "END_GROUP = " ASSIGNCHAR = " = " FINAL = "END" # A state machine is used to parse the file. There are 5 states (0 to 4): STATUSCODE = [ "begin", "enter metadata group", "add metadata item", "leave metadata group", "end" ] # Landsat metadata files end in _MTL.txt or _MTL.TXT METAPATTERN = "*_MTL*" class MTLParseError(Exception): """Custom exception: parse errors in Landsat or EO-1 MTL metadata files""" pass def parsemeta(metadataloc): """Parses the metadata from a Landsat image bundle. Arguments: metadataloc: a filename or a directory. Returns metadata dictionary """ # filename or directory? if several fit, use first one and warn if os.path.isdir(metadataloc): metalist = glob.glob(os.path.join(metadataloc, METAPATTERN)) if not metalist: raise MTLParseError( "No files matching metadata file pattern in directory %s." % metadataloc) elif len(metalist) > 0: metadatafn = metalist[0] filehandle = open(metadatafn, 'rU') if len(metalist) > 1: logging.warning( "More than one file in directory match metadata " + "file pattern. Using %s." % metadatafn) elif os.path.isfile(metadataloc): metadatafn = metadataloc filehandle = open(metadatafn, 'rU') logging.info("Using file %s." % metadatafn) elif 'L1_METADATA_FILE' in metadataloc: filehandle = StringIO(metadataloc) else: raise MTLParseError( "File location %s is unavailable " % metadataloc + "or doesn't contain a suitable metadata file.") # Reading file line by line and inserting data into metadata dictionary status = 0 metadata = {} grouppath = [] dictpath = [metadata] for line in filehandle: if status == 4: # we reached the end in the previous iteration, # but are still reading lines logging.warning( "Metadata file %s appears to " % metadatafn + "have extra lines after the end of the metadata. " + "This is probably, but not necessarily, harmless.") status = _checkstatus(status, line) grouppath, dictpath = _transstat(status, grouppath, dictpath, line) return metadata # Help functions to identify the current line and extract information def _islinetype(line, testchar): """Checks for various kinds of line types based on line head""" return line.strip().startswith(testchar) def _isassignment(line): """Checks if the line is a key-value assignment""" return ASSIGNCHAR in line def _isfinal(line): """Checks if line finishes a group""" return line.strip() == FINAL def _getgroupname(line): """Returns group name, if used with group start lines""" return line.strip().split(GRPSTART)[-1] def _getendgroupname(line): """Returns group name, if used with group end lines""" return line.strip().split(GRPEND)[-1] def _getmetadataitem(line): """Returns key/value pair for assignment type lines""" return line.strip().split(ASSIGNCHAR) # After reading a line, what state we're in depends on the line # and the state before reading def _checkstatus(status, line): """Returns state/status after reading the next line. The status codes are:: 0 - BEGIN parsing; 1 - ENTER METADATA GROUP, 2 - READ METADATA LINE, 3 - END METDADATA GROUP, 4 - END PARSING Permitted Transitions:: 0 --> 1, 0 --> 4 1 --> 1, 1 --> 2, 1 --> 3 2 --> 2, 2 --> 3 3 --> 1, 1 --> 3, 3 --> 4 """ newstatus = 0 if status == 0: # begin --> enter metadata group OR end if _islinetype(line, GRPSTART): newstatus = 1 elif _isfinal(line): newstatus = 4 elif status == 1: # enter metadata group --> enter metadata group # OR add metadata item OR leave metadata group if _islinetype(line, GRPSTART): newstatus = 1 elif _islinetype(line, GRPEND): newstatus = 3 elif _isassignment(line): # test AFTER start and end, as both are also assignments newstatus = 2 elif status == 2: if _islinetype(line, GRPEND): newstatus = 3 elif _isassignment(line): # test AFTER start and end, as both are also assignments newstatus = 2 elif status == 3: if _islinetype(line, GRPSTART): newstatus = 1 elif _islinetype(line, GRPEND): newstatus = 3 elif _isfinal(line): newstatus = 4 if newstatus != 0: return newstatus elif status != 4: raise MTLParseError( "Cannot parse the following line after status " + "'%s':\n%s" % (STATUSCODE[status], line)) # Function to execute when reading a line in a given state def _transstat(status, grouppath, dictpath, line): """Executes processing steps when reading a line""" if status == 0: raise MTLParseError( "Status should not be '%s' after reading line:\n%s" % (STATUSCODE[status], line)) elif status == 1: currentdict = dictpath[-1] currentgroup = _getgroupname(line) grouppath.append(currentgroup) currentdict[currentgroup] = {} dictpath.append(currentdict[currentgroup]) elif status == 2: currentdict = dictpath[-1] newkey, newval = _getmetadataitem(line) # USGS has started quoting the scene center time. If this # happens strip quotes before post processing. if newkey == 'SCENE_CENTER_TIME' and newval.startswith('"') \ and newval.endswith('"'): # logging.warning('Strip quotes off SCENE_CENTER_TIME.') newval = newval[1:-1] currentdict[newkey] = _postprocess(newval) elif status == 3: oldgroup = _getendgroupname(line) if oldgroup != grouppath[-1]: raise MTLParseError( "Reached line '%s' while reading group '%s'." % (line.strip(), grouppath[-1])) del grouppath[-1] del dictpath[-1] try: currentgroup = grouppath[-1] except IndexError: currentgroup = None elif status == 4: if grouppath: raise MTLParseError( "Reached end before end of group '%s'" % grouppath[-1]) return grouppath, dictpath # Identifying data type of a metadata item and def _postprocess(valuestr): """ Takes value as str, returns str, int, float, date, datetime, or time """ # USGS has started quoting time sometimes. Grr, strip quotes in this case intpattern = re.compile(r'^\-?\d+$') floatpattern = re.compile(r'^\-?\d+\.\d+(E[+-]?\d\d+)?$') datedtpattern = '%Y-%m-%d' datedttimepattern = '%Y-%m-%dT%H:%M:%SZ' timedtpattern = '%H:%M:%S.%f' timepattern = re.compile(r'^\d{2}:\d{2}:\d{2}(\.\d{6})?') if valuestr.startswith('"') and valuestr.endswith('"'): # it's a string return valuestr[1:-1] elif re.match(intpattern, valuestr): # it's an integer return int(valuestr) elif re.match(floatpattern, valuestr): # floating point number return float(valuestr) # now let's try the datetime objects; throws exception if it doesn't match try: return datetime.datetime.strptime(valuestr, datedtpattern).date() except ValueError: pass try: return datetime.datetime.strptime(valuestr, datedttimepattern) except ValueError: pass # time parsing is complicated: Python's datetime module only accepts # fractions of a second only up to 6 digits mat = re.match(timepattern, valuestr) if mat: test = mat.group(0) try: return datetime.datetime.strptime(test, timedtpattern).time() except ValueError: pass # If we get here, we still haven't returned anything. logging.info( "The value %s couldn't be parsed as " % valuestr + "int, float, date, time, datetime. Returning it as string.") return valuestr def pretty(d, indent=0): for key, value in d.items(): print('\t' * indent + str(key)) if isinstance(value, dict): pretty(value, indent + 1) else: print('\t' * (indent + 1) + str(value)) if __name__ == '__main__': home = os.path.expanduser('~') # ========================= EOF ====================================================================
/satellite_image-0.1.1.tar.gz/satellite_image-0.1.1/sat_image/mtl.py
0.592549
0.245379
mtl.py
pypi
import os import shutil from rasterio import open as rasopen from numpy import where, pi, cos, nan, inf, true_divide, errstate, log from numpy import float32, sin, deg2rad, array, isnan from shapely.geometry import Polygon, mapping from fiona import open as fiopen from fiona.crs import from_epsg from tempfile import mkdtemp from datetime import datetime from sat_image.bounds import RasterBounds from sat_image import mtl class UnmatchedStackGeoError(ValueError): pass class InvalidObjectError(TypeError): pass class LandsatImage(object): ''' Object to process landsat images. The parent class: LandsatImage takes a directory containing untarred files, for now this ingests images that have been downloaded from USGS earth explorer, using our Landsat578 package. ''' def __init__(self, obj): ''' :param obj: Directory containing an unzipped Landsat 5, 7, or 8 image. This should include at least a tif for each band, and a .mtl file. ''' self.obj = obj if os.path.isdir(obj): self.isdir = True self.date_acquired = None self.file_list = os.listdir(obj) self.tif_list = [x for x in os.listdir(obj) if x.endswith('.TIF')] self.tif_list.sort() # parse metadata file into attributes # structure: {HEADER: {SUBHEADER: {key(attribute), val(attribute value)}}} self.mtl = mtl.parsemeta(obj) self.meta_header = list(self.mtl)[0] self.super_dict = self.mtl[self.meta_header] for key, val in self.super_dict.items(): for sub_key, sub_val in val.items(): # print(sub_key.lower(), sub_val) setattr(self, sub_key.lower(), sub_val) self.satellite = self.landsat_scene_id[:3] # create numpy nd_array objects for each band self.band_list = [] self.tif_dict = {} for i, tif in enumerate(self.tif_list): raster = os.path.join(self.obj, tif) # set all lower case attributes tif = tif.lower() front_ind = tif.index('b') end_ind = tif.index('.tif') att_string = tif[front_ind: end_ind] self.band_list.append(att_string) self.tif_dict[att_string] = raster self.band_count = i + 1 if i == 0: with rasopen(raster) as src: affine = src.affine profile = src.profile # get rasterio metadata/geospatial reference for one tif meta = src.meta.copy() self.rasterio_geometry = meta self.profile = profile self.transform = src.affine bounds = RasterBounds(affine_transform=affine, profile=profile, latlon=False) self.bounds = bounds self.north, self.west, self.south, self.east = bounds.get_nwse_tuple() self.coords = bounds.as_tuple('nsew') self.solar_zenith = 90. - self.sun_elevation self.solar_zenith_rad = self.solar_zenith * pi / 180 self.sun_elevation_rad = self.sun_elevation * pi / 180 self.earth_sun_dist = self.earth_sun_d(self.date_acquired) dtime = datetime.strptime(str(self.date_acquired), '%Y-%m-%d') julian_day = dtime.strftime('%j') self.doy = int(julian_day) self.scene_coords_deg = self._scene_centroid() self.scene_coords_rad = deg2rad(self.scene_coords_deg[0]), deg2rad(self.scene_coords_deg[1]) def _get_band(self, band_str): path = self.tif_dict[band_str] with rasopen(path) as src: arr = src.read(1) arr = array(arr, dtype=float32) arr[arr < 1.] = nan return arr def _scene_centroid(self): """ Compute image center coordinates :return: Tuple of image center in lat, lon """ ul_lat = self.corner_ul_lat_product ll_lat = self.corner_ll_lat_product ul_lon = self.corner_ul_lon_product ur_lon = self.corner_ur_lon_product lat = (ul_lat + ll_lat) / 2. lon = (ul_lon + ur_lon) / 2. return lat, lon @staticmethod def earth_sun_d(dtime): """ Earth-sun distance in AU :param dtime time, e.g. datetime.datetime(2007, 5, 1) :type datetime object :return float(distance from sun to earth in astronomical units) """ doy = int(dtime.strftime('%j')) rad_term = 0.9856 * (doy - 4) * pi / 180 distance_au = 1 - 0.01672 * cos(rad_term) return distance_au @staticmethod def _divide_zero(a, b, replace=0): with errstate(divide='ignore', invalid='ignore'): c = true_divide(a, b) c[c == inf] = replace return c def get_tile_geometry(self, output_filename=None, geographic_coords=False): if not output_filename: temp_dir = mkdtemp() temp = os.path.join(temp_dir, 'shape.shp') else: temp = output_filename # corners = {'ul': (self.corner_ul_projection_x_product, # self.corner_ul_projection_y_product), # 'll': (self.corner_ll_projection_x_product, # self.corner_ll_projection_y_product), # 'lr': (self.corner_lr_projection_x_product, # self.corner_lr_projection_y_product), # 'ur': (self.corner_ur_projection_x_product, # self.corner_ur_projection_y_product)} if geographic_coords: points = [(self.north, self.west), (self.south, self.west), (self.south, self.east), (self.north, self.east), (self.north, self.west)] else: points = [(self.west, self.north), (self.west, self.south), (self.east, self.south), (self.east, self.north), (self.west, self.north)] polygon = Polygon(points) schema = {'geometry': 'Polygon', 'properties': {'id': 'int'}} crs = from_epsg(int(self.rasterio_geometry['crs']['init'].split(':')[1])) with fiopen(temp, 'w', 'ESRI Shapefile', schema=schema, crs=crs) as shp: shp.write({ 'geometry': mapping(polygon), 'properties': {'id': 1}}) if output_filename: return None with fiopen(temp, 'r') as src: features = [f['geometry'] for f in src] if not output_filename: try: shutil.rmtree(temp_dir) except UnboundLocalError: pass return features def save_array(self, arr, output_filename): geometry = self.rasterio_geometry arr = arr.reshape(1, arr.shape[0], arr.shape[1]) geometry['dtype'] = arr.dtype try: with rasopen(output_filename, 'w', **geometry) as dst: dst.write(arr) except TypeError: print('Warning: this wont take float64, reverting to float32.') geometry['dtype'] = float32 arr = arr.astype(float32) with rasopen(output_filename, 'w', **geometry) as dst: dst.write(arr) return None def mask_by_image(self, arr): image = self._get_band('b1') image = array(image, dtype=float32) image[image < 1.] = nan arr = where(isnan(image), nan, arr) return arr def mask(self): image = self._get_band('b1') image = array(image, dtype=float32) image[image < 1.] = nan arr = where(isnan(image), 0, 1) return arr class Landsat5(LandsatImage): def __init__(self, obj): LandsatImage.__init__(self, obj) if self.satellite != 'LT5': raise ValueError('Must init Landsat5 object with Landsat5 data, not {}'.format(self.satellite)) # https://landsat.usgs.gov/esun self.ex_atm_irrad = (1958.0, 1827.0, 1551.0, 1036.0, 214.9, nan, 80.65) # old values from fmask.exe # self.ex_atm_irrad = (1983.0, 1796.0, 1536.0, 1031.0, 220.0, nan, 83.44) self.k1, self.k2 = 607.76, 1260.56 def radiance(self, band): qcal_min = getattr(self, 'quantize_cal_min_band_{}'.format(band)) qcal_max = getattr(self, 'quantize_cal_max_band_{}'.format(band)) l_min = getattr(self, 'radiance_minimum_band_{}'.format(band)) l_max = getattr(self, 'radiance_maximum_band_{}'.format(band)) qcal = self._get_band('b{}'.format(band)) rad = ((l_max - l_min) / (qcal_max - qcal_min)) * (qcal - qcal_min) + l_min return rad.astype(float32) def brightness_temp(self, band, temp_scale='K'): if band in [1, 2, 3, 4, 5, 7]: raise ValueError('LT5 brightness must be band 6') rad = self.radiance(band) brightness = self.k2 / (log((self.k1 / rad) + 1)) if temp_scale == 'K': return brightness elif temp_scale == 'F': return brightness * (9 / 5.0) - 459.67 elif temp_scale == 'C': return brightness - 273.15 else: raise ValueError('{} is not a valid temperature scale'.format(temp_scale)) def reflectance(self, band): """ :param band: An optical band, i.e. 1-5, 7 :return: At satellite reflectance, [-] """ if band == 6: raise ValueError('LT5 reflectance must be other than band 6') rad = self.radiance(band) esun = self.ex_atm_irrad[band - 1] toa_reflect = (pi * rad * self.earth_sun_dist ** 2) / (esun * cos(self.solar_zenith_rad)) return toa_reflect def albedo(self, model='smith'): """Finds broad-band surface reflectance (albedo) Smith (2010), “The heat budget of the earth’s surface deduced from space” LT5 toa reflectance bands 1, 3, 4, 5, 7 # normalized i.e. 0.356 + 0.130 + 0.373 + 0.085 + 0.07 = 1.014 Should have option for Liang, 2000; Tasumi (2008), "At-Surface Reflectance and Albedo from Satellite for Operational Calculation of Land Surface Energy Balance" :return albedo array of floats """ if model == 'smith': blue, red, nir, swir1, swir2 = (self.reflectance(1), self.reflectance(3), self.reflectance(4), self.reflectance(5), self.reflectance(7)) alb = (0.356 * blue + 0.130 * red + 0.373 * nir + 0.085 * swir1 + 0.072 * swir2 - 0.0018) / 1.014 elif model == 'tasumi': pass # add tasumi algorithm TODO return alb def saturation_mask(self, band, value=255): """ Mask saturated pixels, 1 (True) is saturated. :param band: Image band with dn values, type: array :param value: Maximum (saturated) value, i.e. 255 for 8-bit data, type: int :return: boolean array """ dn = self._get_band('b{}'.format(band)) mask = self.mask() mask = where((dn == value) & (mask > 0), True, False) return mask def ndvi(self): """ Normalized difference vegetation index. :return: NDVI """ red, nir = self.reflectance(3), self.reflectance(4) ndvi = self._divide_zero((nir - red), (nir + red), nan) return ndvi def lai(self): """ Leaf area index (LAI), or the surface area of leaves to surface area ground. Trezza and Allen, 2014 :param ndvi: normalized difference vegetation index [-] :return: LAI [-] """ ndvi = self.ndvi() lai = 7.0 * (ndvi ** 3) lai = where(lai > 6., 6., lai) return lai def emissivity(self, approach='tasumi'): ndvi = self.ndvi() if approach == 'tasumi': lai = self.lai() # Tasumi et al., 2003 # narrow-band emissivity nb_epsilon = where((ndvi > 0) & (lai <= 3), 0.97 + 0.0033 * lai, nan) nb_epsilon = where((ndvi > 0) & (lai > 3), 0.98, nb_epsilon) nb_epsilon = where(ndvi <= 0, 0.99, nb_epsilon) return nb_epsilon if approach == 'sobrino': # Sobrino et el., 2004 red = self.reflectance(3) bound_ndvi = where(ndvi > 0.5, ndvi, 0.99) bound_ndvi = where(ndvi < 0.2, red, bound_ndvi) pv = ((ndvi - 0.2) / (0.5 - 0.2)) ** 2 pv_emiss = 0.004 * pv + 0.986 emissivity = where((ndvi >= 0.2) & (ndvi <= 0.5), pv_emiss, bound_ndvi) return emissivity def land_surface_temp(self): """ Mean values from Allen (2007) :return: """ rp = 0.91 tau = 0.866 rsky = 1.32 epsilon = self.emissivity(approach='tasumi') radiance = self.radiance(6) rc = ((radiance - rp) / tau) - ((1 - epsilon) * rsky) lst = self.k2 / (log((epsilon * self.k1 / rc) + 1)) return lst def ndsi(self): """ Normalized difference snow index. :return: NDSI """ green, swir1 = self.reflectance(2), self.reflectance(5) ndsi = self._divide_zero((green - swir1), (green + swir1), nan) return ndsi class Landsat7(LandsatImage): def __init__(self, obj): LandsatImage.__init__(self, obj) if self.satellite != 'LE7': raise ValueError('Must init Landsat7 object with Landsat5 data, not {}'.format(self.satellite)) # https://landsat.usgs.gov/esun; Landsat 7 Handbook self.ex_atm_irrad = (1970.0, 1842.0, 1547.0, 1044.0, 255.700, nan, 82.06, 1369.00) self.k1, self.k2 = 666.09, 1282.71 def radiance(self, band): if band == 6: band = '6_vcid_1' qcal_min = getattr(self, 'quantize_cal_min_band_{}'.format(band)) qcal_max = getattr(self, 'quantize_cal_max_band_{}'.format(band)) l_min = getattr(self, 'radiance_minimum_band_{}'.format(band)) l_max = getattr(self, 'radiance_maximum_band_{}'.format(band)) qcal = self._get_band('b{}'.format(band)) rad = ((l_max - l_min) / (qcal_max - qcal_min)) * (qcal - qcal_min) + l_min return rad def brightness_temp(self, band=6, gain='low', temp_scale='K'): if band in [1, 2, 3, 4, 5, 7, 8]: raise ValueError('LE7 brightness must be either vcid_1 or vcid_2') if gain == 'low': # low gain : b6_vcid_1 band_gain = '6_vcid_1' else: band_gain = '6_vcid_2' rad = self.radiance(band_gain) brightness = self.k2 / (log((self.k1 / rad) + 1)) if temp_scale == 'K': return brightness elif temp_scale == 'F': return brightness * (9 / 5.0) - 459.67 elif temp_scale == 'C': return brightness - 273.15 else: raise ValueError('{} is not a valid temperature scale'.format(temp_scale)) def reflectance(self, band): """ :param band: An optical band, i.e. 1-5, 7 :return: At satellite reflectance, [-] """ if band in ['b6_vcid_1', 'b6_vcid_2']: raise ValueError('LE7 reflectance must not be b6_vcid_1 or b6_vcid_2') rad = self.radiance(band) esun = self.ex_atm_irrad[band - 1] toa_reflect = (pi * rad * self.earth_sun_dist ** 2) / (esun * cos(self.solar_zenith_rad)) return toa_reflect def albedo(self): """Finds broad-band surface reflectance (albedo) Smith (2010), “The heat budget of the earth’s surface deduced from space” Should have option for Liang, 2000; LE7 toa reflectance bands 1, 3, 4, 5, 7 # normalized i.e. 0.356 + 0.130 + 0.373 + 0.085 + 0.07 = 1.014 :return albedo array of floats """ blue, red, nir, swir1, swir2 = (self.reflectance(1), self.reflectance(3), self.reflectance(4), self.reflectance(5), self.reflectance(7)) alb = (0.356 * blue + 0.130 * red + 0.373 * nir + 0.085 * swir1 + 0.072 * swir2 - 0.0018) / 1.014 return alb def saturation_mask(self, band, value=255): """ Mask saturated pixels, 1 (True) is saturated. :param band: Image band with dn values, type: array :param value: Maximum (saturated) value, i.e. 255 for 8-bit data, type: int :return: boolean array """ dn = self._get_band('b{}'.format(band)) mask = where((dn == value) & (self.mask() > 0), True, False) return mask def ndvi(self): """ Normalized difference vegetation index. :return: NDVI """ red, nir = self.reflectance(3), self.reflectance(4) ndvi = self._divide_zero((nir - red), (nir + red), nan) return ndvi def lai(self): """ Leaf area index (LAI), or the surface area of leaves to surface area ground. Trezza and Allen, 2014 :param ndvi: normalized difference vegetation index [-] :return: LAI [-] """ ndvi = self.ndvi() lai = 7.0 * (ndvi ** 3) lai = where(lai > 6., 6., lai) return lai def emissivity(self, approach='tasumi'): ndvi = self.ndvi() if approach == 'tasumi': lai = self.lai() # Tasumi et al., 2003 # narrow-band emissivity nb_epsilon = where((ndvi > 0) & (lai <= 3), 0.97 + 0.0033 * lai, nan) nb_epsilon = where((ndvi > 0) & (lai > 3), 0.98, nb_epsilon) nb_epsilon = where(ndvi <= 0, 0.99, nb_epsilon) return nb_epsilon if approach == 'sobrino': # Sobrino et el., 2004 red = self.reflectance(3) bound_ndvi = where(ndvi > 0.5, ndvi, 0.99) bound_ndvi = where(ndvi < 0.2, red, bound_ndvi) pv = ((ndvi - 0.2) / (0.5 - 0.2)) ** 2 pv_emiss = 0.004 * pv + 0.986 emissivity = where((ndvi >= 0.2) & (ndvi <= 0.5), pv_emiss, bound_ndvi) return emissivity def land_surface_temp(self): rp = 0.91 tau = 0.866 rsky = 1.32 epsilon = self.emissivity() rc = ((self.radiance(6) - rp) / tau) - ((1 - epsilon) * rsky) lst = self.k2 / (log((epsilon * self.k1 / rc) + 1)) return lst def ndsi(self): """ Normalized difference snow index. :return NDSI """ green, swir1 = self.reflectance(2), self.reflectance(5) ndsi = self._divide_zero((green - swir1), (green + swir1), nan) return ndsi class Landsat8(LandsatImage): def __init__(self, obj): LandsatImage.__init__(self, obj) self.oli_bands = [1, 2, 3, 4, 5, 6, 7, 8, 9] def brightness_temp(self, band, temp_scale='K'): """Calculate brightness temperature of Landsat 8 as outlined here: http://landsat.usgs.gov/Landsat8_Using_Product.php T = K2 / log((K1 / L) + 1) and L = ML * Q + AL where: T = At-satellite brightness temperature (degrees kelvin) L = TOA spectral radiance (Watts / (m2 * srad * mm)) ML = Band-specific multiplicative rescaling factor from the metadata (RADIANCE_MULT_BAND_x, where x is the band number) AL = Band-specific additive rescaling factor from the metadata (RADIANCE_ADD_BAND_x, where x is the band number) Q = Quantized and calibrated standard product pixel values (DN) (ndarray img) K1 = Band-specific thermal conversion constant from the metadata (K1_CONSTANT_BAND_x, where x is the thermal band number) K2 = Band-specific thermal conversion constant from the metadata (K1_CONSTANT_BAND_x, where x is the thermal band number) Returns -------- ndarray: float32 ndarray with shape == input shape """ if band in self.oli_bands: raise ValueError('Landsat 8 brightness should be TIRS band (i.e. 10 or 11)') k1 = getattr(self, 'k1_constant_band_{}'.format(band)) k2 = getattr(self, 'k2_constant_band_{}'.format(band)) rad = self.radiance(band) brightness = k2 / log((k1 / rad) + 1) if temp_scale == 'K': return brightness elif temp_scale == 'F': return brightness * (9 / 5.0) - 459.67 elif temp_scale == 'C': return brightness - 273.15 else: raise ValueError('{} is not a valid temperature scale'.format(temp_scale)) def reflectance(self, band): """Calculate top of atmosphere reflectance of Landsat 8 as outlined here: http://landsat.usgs.gov/Landsat8_Using_Product.php R_raw = MR * Q + AR R = R_raw / cos(Z) = R_raw / sin(E) Z = 90 - E (in degrees) where: R_raw = TOA planetary reflectance, without correction for solar angle. R = TOA reflectance with a correction for the sun angle. MR = Band-specific multiplicative rescaling factor from the metadata (REFLECTANCE_MULT_BAND_x, where x is the band number) AR = Band-specific additive rescaling factor from the metadata (REFLECTANCE_ADD_BAND_x, where x is the band number) Q = Quantized and calibrated standard product pixel values (DN) E = Local sun elevation angle. The scene center sun elevation angle in degrees is provided in the metadata (SUN_ELEVATION). Z = Local solar zenith angle (same angle as E, but measured from the zenith instead of from the horizon). Returns -------- ndarray: float32 ndarray with shape == input shape """ if band not in self.oli_bands: raise ValueError('Landsat 8 reflectance should OLI band (i.e. bands 1-8)') elev = getattr(self, 'sun_elevation') dn = self._get_band('b{}'.format(band)) mr = getattr(self, 'reflectance_mult_band_{}'.format(band)) ar = getattr(self, 'reflectance_add_band_{}'.format(band)) if elev < 0.0: raise ValueError("Sun elevation must be non-negative " "(sun must be above horizon for entire scene)") rf = ((mr * dn.astype(float32)) + ar) / sin(deg2rad(elev)) return rf def radiance(self, band): """Calculate top of atmosphere radiance of Landsat 8 as outlined here: http://landsat.usgs.gov/Landsat8_Using_Product.php L = ML * Q + AL where: L = TOA spectral radiance (Watts / (m2 * srad * mm)) ML = Band-specific multiplicative rescaling factor from the metadata (RADIANCE_MULT_BAND_x, where x is the band number) AL = Band-specific additive rescaling factor from the metadata (RADIANCE_ADD_BAND_x, where x is the band number) Q = Quantized and calibrated standard product pixel values (DN) (ndarray img) Returns -------- ndarray: float32 ndarray with shape == input shape """ ml = getattr(self, 'radiance_mult_band_{}'.format(band)) al = getattr(self, 'radiance_add_band_{}'.format(band)) dn = self._get_band('b{}'.format(band)) rad = ml * dn.astype(float32) + al return rad def albedo(self): """Smith (2010), finds broad-band surface reflectance (albedo) Should have option for Liang, 2000; Tasumi, 2008; LC8 toa reflectance bands 2, 4, 5, 6, 7 # normalized i.e. 0.356 + 0.130 + 0.373 + 0.085 + 0.07 = 1.014 :return albedo array of floats """ blue, red, nir, swir1, swir2 = (self.reflectance(2), self.reflectance(4), self.reflectance(5), self.reflectance(6), self.reflectance(7)) alb = (0.356 * blue + 0.130 * red + 0.373 * nir + 0.085 * swir1 + 0.072 * swir2 - 0.0018) / 1.014 return alb def ndvi(self): """ Normalized difference vegetation index. :return: NDVI """ red, nir = self.reflectance(4), self.reflectance(5) ndvi = self._divide_zero((nir - red), (nir + red), nan) return ndvi def lai(self): """ Leaf area index (LAI), or the surface area of leaves to surface area ground. Trezza and Allen, 2014 :param ndvi: normalized difference vegetation index [-] :return: LAI [-] """ ndvi = self.ndvi() lai = 7.0 * (ndvi ** 3) lai = where(lai > 6., 6., lai) return lai def emissivity(self, approach='tasumi'): ndvi = self.ndvi() if approach == 'tasumi': lai = self.lai() # Tasumi et al., 2003 # narrow-band emissivity nb_epsilon = where((ndvi > 0) & (lai <= 3), 0.97 + 0.0033 * lai, nan) nb_epsilon = where((ndvi > 0) & (lai > 3), 0.98, nb_epsilon) nb_epsilon = where(ndvi <= 0, 0.99, nb_epsilon) return nb_epsilon if approach == 'sobrino': # Sobrino et el., 2004 red = self.reflectance(3) bound_ndvi = where(ndvi > 0.5, ndvi, 0.99) bound_ndvi = where(ndvi < 0.2, red, bound_ndvi) pv = ((ndvi - 0.2) / (0.5 - 0.2)) ** 2 pv_emiss = 0.004 * pv + 0.986 emissivity = where((ndvi >= 0.2) & (ndvi <= 0.5), pv_emiss, bound_ndvi) return emissivity def land_surface_temp(self): band = 10 k1 = getattr(self, 'k1_constant_band_{}'.format(band)) k2 = getattr(self, 'k2_constant_band_{}'.format(band)) rp = 0.91 tau = 0.866 rsky = 1.32 epsilon = self.emissivity() rc = ((self.radiance(band) - rp) / tau) - ((1 - epsilon) * rsky) lst = k2 / (log((epsilon * k1 / rc) + 1)) return lst def ndsi(self): """ Normalized difference snow index. :return: NDSI """ green, swir1 = self.reflectance(3), self.reflectance(6) ndsi = self._divide_zero((green - swir1), (green + swir1), nan) return ndsi # =============================================================================================
/satellite_image-0.1.1.tar.gz/satellite_image-0.1.1/sat_image/image.py
0.478285
0.215722
image.py
pypi
import csv import requests import pkg_resources import logging from sgp4.earth_gravity import wgs72 from sgp4.io import twoline2rv from spacetrack import SpaceTrackClient logger = logging.getLogger(__name__) SOURCES_LIST = pkg_resources.resource_filename('satellite_tle', 'sources.csv') REQUESTS_TIMEOUT = 20 # seconds def get_tle_sources(): ''' Returns a list of (source, url)-tuples for well-known TLE sources. ''' sources = [] with open(SOURCES_LIST) as csvfile: csv_reader = csv.reader(csvfile, delimiter=',', quotechar='\'', quoting=csv.QUOTE_NONNUMERIC) for row in csv_reader: source, url = row sources.append((source, url)) return sources def fetch_tle_from_celestrak(norad_cat_id, verify=True): ''' Returns the TLE for a given norad_cat_id as currently available from CelesTrak. Raises IndexError if no data is available for the given norad_cat_id. Parameters ---------- norad_cat_id : string Satellite Catalog Number (5-digit) verify : boolean or string, optional Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. (from python-requests) ''' r = requests.get('https://celestrak.org/NORAD/elements/gp.php?CATNR={}'.format(norad_cat_id), verify=verify, timeout=REQUESTS_TIMEOUT) r.raise_for_status() if r.text == 'No TLE found': raise LookupError tle = r.text.split('\r\n') return tle[0].strip(), tle[1].strip(), tle[2].strip() def parse_TLE_file(content): ''' Parses TLE file with 3le format. Returns a dictionary of the form {norad_id1: tle1, norad_id2: tle2} for all TLEs found. tleN is returned as list of three strings: [satellite_name, line1, line2]. ''' tles = dict() lines = content.strip().splitlines() if len(lines) % 3 != 0: raise ValueError # Loop over TLEs for i in range(len(lines) - 2): if (lines[i + 1][0] == "1") & (lines[i + 2][0] == "2"): try: twoline2rv(lines[i + 1], lines[i + 2], wgs72) norad_cat_id = int(lines[i + 1][2:7].encode('ascii')) tles[norad_cat_id] = (lines[i].strip(), lines[i + 1], lines[i + 2]) except ValueError: logging.warning('Failed to parse TLE for {}\n({}, {})'.format( lines[i], lines[i + 1], lines[i + 2])) return tles def fetch_tles_from_spacetrack(norad_ids, spacetrack_config): ''' Downloads the TLE set from Space-Track.org. Returns a dictionary of the form {norad_id1: tle1, norad_id2: tle2, ...} for all TLEs found. tleN is returned as list of three strings: [satellite_name, line1, line2]. Parameters ---------- norad_ids : set of integers Set of Satellite Catalog Numbers (5-digit) spacetrack_config : dictionary Credentials for log in Space-Track.org following this format: {'identity': <username>, 'password': <password>} verify : boolean or string, optional Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. (from python-requests) ''' st = SpaceTrackClient(spacetrack_config['identity'], spacetrack_config['password']) tles_3le = st.tle_latest(norad_cat_id=norad_ids, ordinal=1, format='3le') try: return parse_TLE_file(tles_3le) except ValueError: logging.error('TLE source is malformed.') raise ValueError def fetch_tles_from_url(url, verify=True): ''' Downloads the TLE set from the given url. Returns a dictionary of the form {norad_id1: tle1, norad_id2: tle2} for all TLEs found. tleN is returned as list of three strings: [satellite_name, line1, line2]. Parameters ---------- url : string URL of the TLE source verify : boolean or string, optional Either a boolean, in which case it controls whether we verify the server's TLS certificate, or a string, in which case it must be a path to a CA bundle to use. Defaults to ``True``. (from python-requests) ''' r = requests.get(url, verify=verify, timeout=REQUESTS_TIMEOUT) r.raise_for_status() try: return parse_TLE_file(r.text) except ValueError: logging.error('TLE source {} is malformed.'.format(url)) raise ValueError
/satellitetle-0.14.0.tar.gz/satellitetle-0.14.0/satellite_tle/fetch_tle.py
0.707506
0.22579
fetch_tle.py
pypi
import requests import logging from sgp4.earth_gravity import wgs72 from sgp4.io import twoline2rv from . import (get_tle_sources, fetch_tles_from_url, fetch_tle_from_celestrak, fetch_tles_from_spacetrack) def fetch_all_tles(requested_norad_ids, sources=get_tle_sources(), spacetrack_config=None, verify=True): ''' Returns all TLEs found for the requested satellites available via custom TLE sources or via the default sources, Celestrak, CalPoly and AMSAT. ''' return fetch_tles(requested_norad_ids, sources, spacetrack_config, verify, only_latest=False) def fetch_latest_tles(requested_norad_ids, sources=get_tle_sources(), spacetrack_config=None, verify=True): ''' Returns the most recent TLEs found for the requested satellites available via custom TLE sources or via the default sources, Celestrak, CalPoly and AMSAT. ''' return fetch_tles(requested_norad_ids, sources, spacetrack_config, verify) def fetch_tles(requested_norad_ids, sources=get_tle_sources(), spacetrack_config=None, verify=True, only_latest=True): ''' Returns the most recent or all TLEs found for the requested satellites available via custom TLE sources or via the default sources, Celestrak, CalPoly and AMSAT. ''' # Dictionary of NORAD IDs with each has as value either a list of # 2-tuples of the form (source, tle) or just one 2-tuples # depending on only_latest parameter # source is a human-readable string # tle is a 3-tuple of strings tles = dict() def update_tles(norad_id, source, tle): if norad_id not in requested_norad_ids: # Satellite not requested, # skip. return tle_tuple = source, tle if norad_id not in tles.keys(): # Satellite requested and first occurence in the downloaded data, # store new TLE. if only_latest: tles[norad_id] = tle_tuple else: tles[norad_id] = [tle_tuple] return if only_latest: # There are multiple TLEs for this satellite available. # Parse and compare epoch of both TLEs and choose the most recent one. current_sat = twoline2rv(tles[norad_id][1][1], tles[norad_id][1][2], wgs72) new_sat = twoline2rv(tle[1], tle[2], wgs72) if new_sat.epoch > current_sat.epoch: # Found a more recent TLE than the current one, # store the new TLE. logging.debug('Updated {}, epoch ' '{:%Y-%m-%d %H:%M:%S} > {:%Y-%m-%d %H:%M:%S}'.format( norad_id, new_sat.epoch, current_sat.epoch)) tles[norad_id] = tle_tuple else: tles[norad_id].append(tle_tuple) for source, url in sources: logging.info('Fetch from {}'.format(url)) try: new_tles = fetch_tles_from_url(url=url, verify=verify) logging.debug('Found TLEs for {}'.format(list(new_tles.keys()))) except (requests.HTTPError, requests.Timeout): logging.warning('Failed to download from {}.'.format(source)) continue except ValueError: logging.warning('Failed to parse catalog from {}.'.format(source)) continue for norad_id, tle in new_tles.items(): update_tles(norad_id, source, tle) if spacetrack_config: # Limit the requested NORAD IDs to 400 per request. The tested limit is 574 NORAD IDs. limit = 400 requests_num = len(requested_norad_ids) // limit + 1 try: for request in range(0, requests_num): norad_ids = list(requested_norad_ids)[request * limit:(request + 1) * limit] new_tles = fetch_tles_from_spacetrack(norad_ids, spacetrack_config) logging.debug('Found TLEs for {}'.format(list(new_tles.keys()))) for norad_id, tle in new_tles.items(): update_tles(norad_id, 'Space-Track.org', tle) except (requests.HTTPError, requests.Timeout): logging.warning('Failed to download from Space-Track.org') except ValueError: logging.warning('Failed to parse catalog from Space-Track.org') # Try fetching missing sats from another Celestrak endoint missing_norad_ids = set(requested_norad_ids) - set(tles.keys()) for norad_id in missing_norad_ids: try: logging.info('Fetch {} from Celestrak (satcat)'.format(norad_id)) tle = fetch_tle_from_celestrak(norad_id, verify=verify) update_tles(norad_id, 'Celestrak (satcat)', tle) except (LookupError, requests.HTTPError, requests.Timeout): logging.warning('Fetch {} from Celestrak (satcat) failed!'.format(norad_id)) continue return tles
/satellitetle-0.14.0.tar.gz/satellitetle-0.14.0/satellite_tle/fetch_tles.py
0.530236
0.253503
fetch_tles.py
pypi
import numpy as np class QuaternionError(Exception): pass DEFAULT_TOLERANCE = 1e-8 class GeneralQuaternion(object): """ represents a quaternion, considered a member in Lie algebra of quaternions. for backward compatibility shares the same interface with Quaternion. unlike quaternion, it's not defined up to scale """ def __init__(self, qr, qi, qj, qk): self.qr = qr self.qi = qi self.qj = qj self.qk = qk @property def real(self): return self.qr @property def imaginary(self): return np.array([self.qi, self.qj, self.qk]) def __add__(self, p): validate_is_quaternion(p) return GeneralQuaternion(self.qr + p.qr, self.qi + p.qi, self.qj + p.qj, self.qk + p.qk) def __sub__(self, p): validate_is_quaternion(p) return GeneralQuaternion(self.qr - p.qr, self.qi - p.qi, self.qj - p.qj, self.qk - p.qk) def __neg__(self): return self.__class__(-self.qr, -self.qi, -self.qj, -self.qk) def __mul__(self, p): if isinstance(p, GeneralQuaternion): mat = np.array([ [self.qr, -self.qi, -self.qj, -self.qk], # noqa [self.qi, self.qr, self.qk, -self.qj], # noqa [self.qj, -self.qk, self.qr, self.qi], # noqa [self.qk, self.qj, -self.qi, self.qr] # noqa ]) result = mat.dot(np.array(p.coordinates)) return self.__class__(*result) else: return self.__class__(self.qr * p, self.qi * p, self.qj * p, self.qk * p) def __rmul__(self, p): return self.__mul__(p) def __truediv__(self, p): return self * (1 / p) def __rtruediv__(self, p): return p * self.inverse() def conjugate(self): return self.__class__(self.qr, -self.qi, -self.qj, -self.qk) def inverse(self): return self.conjugate() * (1 / self._squarenorm()) def __invert__(self): return self.inverse() def _squarenorm(self): return self.qr * self.qr + self.qi * self.qi + self.qj * self.qj + self.qk * self.qk def __repr__(self): return '{}{}'.format(self.__class__.__name__, tuple(self.coordinates)) def __str__(self): return '({qr:.6g}{qi:+.6g}i{qj:+.6g}j{qk:+.6g}k)'.format(**self.__dict__) def is_real(self, tolerance=DEFAULT_TOLERANCE): """ True if i, j, k components are zero. """ complex_norm = np.linalg.norm([self.qi, self.qj, self.qk]) return complex_norm < tolerance def is_equal(self, other, tolerance=DEFAULT_TOLERANCE): """ compares as quaternions up to tolerance. Note: tolerance in coords, not in quaternions metrics. Note: unlike quaternions, equality is not up to scale. """ return np.linalg.norm(self.coordinates - other.coordinates) < tolerance def __eq__(self, other): return self.is_equal(other) def norm(self): return np.sqrt(self._squarenorm()) def normalized(self): return self / self.norm() def euclidean_distance(self, other): """ Returns the euclidean distance between two quaternions. Note: differs from unitary quaternions distance. """ return (self - other).norm() def is_unitary(self, tolerance=DEFAULT_TOLERANCE): return abs(self.norm() - 1) < tolerance @property def coordinates(self): return np.array([self.qr, self.qi, self.qj, self.qk]) @classmethod def unit(cls): return cls(1, 0, 0, 0) @classmethod def zero(cls): return GeneralQuaternion(0, 0, 0, 0) def exp(self): return exp(self) def log(self): return log(self) def validate_is_quaternion(q): if not isinstance(q, GeneralQuaternion): raise QuaternionError('expected quaternion, got %s' % q.__class__.__name__) def exp(q): """ exponent quaternion :param q: GeneralQuaternion (or any derived) :return: same class as q (GeneralQuaternion or any derived) """ validate_is_quaternion(q) cls = type(q) exp_norm = np.exp(q.real) imag_norm = np.linalg.norm(q.imaginary) if imag_norm == 0: i, j, k = 0, 0, 0 else: i, j, k = np.sin(imag_norm) * q.imaginary / imag_norm q_exp = GeneralQuaternion(*(exp_norm * np.array([np.cos(imag_norm), i, j, k]))) return cls(*q_exp.coordinates) # to enable derived classes def log(q): """ logarithm of quaternion :param q: GeneralQuaternion (or any derived) :return: GeneralQuaternion """ validate_is_quaternion(q) norm = q.norm() imag = np.array((q.qi, q.qj, q.qk)) / norm imag_norm = np.linalg.norm(imag) if imag_norm == 0: i, j, k = 0 if q.qr > 0 else np.pi, 0, 0 else: i, j, k = imag / imag_norm * np.arctan2(imag_norm, q.qr / norm) return GeneralQuaternion(np.log(norm), i, j, k)
/satellogic_quaternions-0.1.7-py3-none-any.whl/quaternions/general_quaternion.py
0.910214
0.447219
general_quaternion.py
pypi
import functools import numpy as np from collections.abc import Iterable import numbers from quaternions.utils import (covariance_matrix_from_angles, sigma_lerner, xi_matrix) from quaternions.general_quaternion import ( GeneralQuaternion, QuaternionError, DEFAULT_TOLERANCE, exp ) import warnings class Quaternion(GeneralQuaternion): ''' A class that holds unit quaternions (norm==1, aka versors). It actually holds Q^op, as this is the way Schaub-Jenkins work with them. Note: Quaternion is equal up to sign. ''' tolerance = 1e-8 def __init__(self, qr, qi, qj, qk): q = [qr, qi, qj, qk] norm = np.linalg.norm(q) if norm < DEFAULT_TOLERANCE: raise QuaternionError('provided numerically unstable quaternion: %s' % q) super().__init__(*q / norm) def __mul__(self, p): if isinstance(p, Quaternion) or isinstance(p, numbers.Number): mul = GeneralQuaternion(*self.coordinates) * p return Quaternion(*mul.coordinates) elif isinstance(p, GeneralQuaternion): return GeneralQuaternion(*self.coordinates) * p elif isinstance(p, Iterable) and len(p) == 3: # applies quaternion rotation on vector return self.matrix.dot(p) else: raise QuaternionError('cant multiply by %s' % type(p)) def __call__(self, p): """ applies quaternion on vector :param p: array of 3 elements :return: ndarray of 3 elements """ try: return self * p except Exception as e: raise QuaternionError( 'expected list of 3 elements, got %s, caused error: %s' % (p.__class__.__name__, e)) def is_equal(self, other, tolerance=DEFAULT_TOLERANCE): """ compares as quaternions, i.e. up to sign. """ return super().is_equal(other, tolerance) or super().is_equal(-other, tolerance) def __eq__(self, other): return self.is_equal(other) def distance(self, other): """ Returns the distance [rad] between two unitary quaternions. """ diff = self * ~other return diff.rotation_angle() @property def positive_representant(self): """ Unitary quaternions q and -q correspond to the same element in SO(3). In order to perform some computations (v.g., distance), it is important to fix one of them. Though the following computations can be done for any quaternion, we allow them only for unitary ones. """ for coord in self.coordinates: if coord > 0: return self if coord < 0: return -self @property def matrix(self): """ returns 3x3 rotation matrix representing the same rotation. """ qr, qi, qj, qk = self.coordinates return np.array([ [qr * qr + qi * qi - qj * qj - qk * qk, 2 * (qi * qj + qr * qk), 2 * (qi * qk - qr * qj)], [2 * (qi * qj - qr * qk), qr * qr - qi * qi + qj * qj - qk * qk, 2 * (qj * qk + qr * qi)], [2 * (qi * qk + qr * qj), 2 * (qj * qk - qr * qi), qr * qr - qi * qi - qj * qj + qk * qk] ]) @classmethod def _first_eigenvector(cls, matrix): """ matrix must be a 4x4 symmetric matrix. """ vals, vecs = np.linalg.eigh(matrix) # q is the eigenvec with heighest eigenvalue (already normalized) q = vecs[:, -1] if q[0] < 0: q = -q return cls(*q) @classmethod def average(cls, *quaternions, weights=None): """ Return the quaternion such that its matrix minimizes the square distance to the matrices of the quaternions in the argument list. See Averaging Quaternions, by Markley, Cheng, Crassidis, Oschman. """ b = np.array([q.coordinates for q in quaternions]) if weights is None: weights = np.ones(len(quaternions)) m = b.T.dot(np.diag(weights)).dot(b) return cls._first_eigenvector(m) @property def basis(self): warnings.warn('This property will be deprecated. Use matrix instead', DeprecationWarning) m = self.matrix return m[0, :], m[1, :], m[2, :] @property def rotation_vector(self): """ returns [x, y, z]: direction is rotation axis, norm is angle [rad] """ return (2 * self.log()).coordinates[1:] def rotation_axis(self): """ returns unit rotation axis: [x, y, z] """ v = self.rotation_vector return v / np.linalg.norm(v) def rotation_angle(self): """ returns rotation angle [rad], in [0, 2 * pi) """ angle = np.linalg.norm(self.rotation_vector) angle %= 2 * np.math.pi return angle @property def ra_dec_roll(self): '''Returns ra, dec, roll for quaternion [deg]. The Euler angles are those called Tait-Bryan XYZ, as defined in https://en.wikipedia.org/wiki/Euler_angles#Tait-Bryan_angles ''' m = self.matrix ra_rad = np.arctan2(-m[0][1], m[0][0]) dec_rad = np.arctan2(m[0][2], np.sqrt(m[1][2] ** 2 + m[2][2] ** 2)) roll_rad = np.arctan2(-m[1][2], m[2][2]) return np.rad2deg(np.array([ra_rad, dec_rad, roll_rad])) @property def astrometry_ra_dec_roll(self): '''Returns ra, dec, roll as reported by astrometry [deg]. Notice that Tetra gives a different roll angle, so this is not a fixed standard. ''' warnings.warn('This method will be deprecated', DeprecationWarning) twisted = self.OpticalAxisFirst() * self ra, dec, roll = twisted.ra_dec_roll return np.array([-ra, dec, roll - 180]) @staticmethod def from_matrix(mat): """ Returns the quaternion corresponding to the unitary matrix mat. """ mat = np.array(mat) tr = np.trace(mat) d = 1 + 2 * mat.diagonal() - tr qsquare = 1 / 4 * np.array([1 + tr, d[0], d[1], d[2]]) qsquare = qsquare.clip(0, None) # avoid numerical errors # compute signs matrix signs = np.sign([mat[1, 2] - mat[2, 1], mat[2, 0] - mat[0, 2], mat[0, 1] - mat[1, 0], mat[0, 1] + mat[1, 0], mat[2, 0] + mat[0, 2], mat[1, 2] + mat[2, 1]]) signs_m = np.zeros((4, 4)) signs_m[np.triu_indices(4, 1)] = signs signs_m += signs_m.T signs_m[np.diag_indices(4)] = 1. # choose appropriate signs max_idx = qsquare.argmax() coords = np.sqrt(qsquare) * signs_m[max_idx] return Quaternion(*coords) @staticmethod def from_rotation_vector(xyz): """ Returns the quaternion corresponding to the rotation xyz. Explicitly: rotation occurs along the axis xyz and has angle norm(xyz) This corresponds to the exponential of the quaternion with real part 0 and imaginary part 1/2 * xyz. """ a, b, c = .5 * np.array(xyz) q_exp = exp(GeneralQuaternion(0, a, b, c)) return Quaternion(*q_exp.coordinates) @staticmethod def from_qmethod(source, target, probabilities=None): """ Returns the quaternion corresponding to solving with qmethod. See: Closed-form solution of absolute orientation using unit quaternions, Berthold K. P. Horn, J. Opt. Soc. Am. A, Vol. 4, No. 4, April 1987 It "sends" the (3xn) matrix source to the (3xn) matrix target. Vectors are multiplied by probabilities too, if available. "sends" means that if q = Quaternion.from_qmethod(s, t) then q.matrix will be a rotation matrix (not a coordinate changing matrix). In other words, q.matrix.dot(s) ~ t The method can also produce the change of basis quaternion in this way: assume that there are vectors v1,..., vn for which we have coordinates in two frames, F1 and F2. If s and t are the 3xn matrices of v1,..., vn in frames F1 and F2, then Quaternion.from_qmethod(s, t) is the quaternion corresponding to the change of basis from F1 to F2. """ if probabilities is not None: B = source.dot(np.diag(probabilities)).dot(target.T) else: B = source.dot(target.T) sigma = np.trace(B) S = B + B.T Z = B - B.T i, j, k = Z[2, 1], Z[0, 2], Z[1, 0] K = np.zeros((4, 4)) K[0] = [sigma, i, j, k] K[1:4, 0] = [i, j, k] K[1:4, 1:4] = S - sigma * np.identity(3) return Quaternion._first_eigenvector(K) @staticmethod def average_and_std_naive(*quaternions, weights=None): """ Naive implementation of std. dev. calculation and average. Returns average quaternion and stddev of input quaternion list in deg """ if weights is None: weights = np.ones(len(quaternions)) q_average = Quaternion.average(*quaternions, weights=weights) diffs = np.array([q_average.distance(quat) for quat in quaternions]) stddev = np.degrees(np.sqrt(sum((diffs ** 2) * weights) / np.sum(weights))) return q_average, stddev @staticmethod def average_and_std_lerner(*quaternions, weights=None): """ Returns the average quaternion and the sigma lerner in deg. Computes sigma lerner using Lerner's method as explained in 'The attitude determination system of the RAX satellite', page 133, doi:10.1016/j.actaastro.2012.02.001, with the slight difference that the small angle aproximation of euler angles is used instead of gibbs vectors, leading to a factor a 2. :param quaternions: Quaternion objects :param weights: :return: average quaternions, sigma lerner """ q_average = Quaternion.average(*quaternions, weights=weights) diffs = [quat / q_average for quat in quaternions] angles_list = [2 * diff.coordinates[1:] for diff in diffs] covariance_matrix = covariance_matrix_from_angles(angles_list) return q_average, np.degrees(sigma_lerner(covariance_matrix)) @staticmethod def average_and_covariance(*quaternions, R=np.eye(3)): ''' Returns the quaternion such that its matrix minimizes the square distance to the matrices of the quaternions in the argument list, and the resulting covariance matrix associated with that quaternion. Input matrix R (3x3) is assume to be the same for all input quaternions, and in rads**2 See Averaging Quaternions, by Markley, Cheng, Crassidis, Oschman. ''' q_average = Quaternion.average(*quaternions) R_inverse = np.linalg.inv(R) orthogonal_matrix_sum = np.zeros((4, 4)) for q in quaternions: orthogonal_matrix_sum += xi_matrix(q).dot( R_inverse.dot(xi_matrix(q).T)) cov_dev_matrix = np.linalg.inv(xi_matrix(q_average).T.dot( orthogonal_matrix_sum.dot(xi_matrix(q_average)))) return q_average, cov_dev_matrix @staticmethod def integrate_from_velocity_vectors(vectors): '''vectors must be an iterable of 3-d vectors. This method just exponentiates all vectors/2, multiplies them and takes 2*log. Thus, the return value corresponds to the resultant rotation vector of a body under all rotations in the iterable. ''' qs = list(map(Quaternion.from_rotation_vector, vectors))[::-1] prod = functools.reduce(Quaternion.__mul__, qs, Quaternion.unit()) return prod.rotation_vector @staticmethod def from_ra_dec_roll(ra, dec, roll): '''constructs a quaternion from ra/dec/roll params using Tait-Bryan angles XYZ. ra stands for right ascencion, and usually lies in [0, 360] dec stands for declination, and usually lies in [-90, 90] roll stands for rotation/rolling, and usually lies in [0, 360] ''' raq = exp(GeneralQuaternion(0, 0, 0, -np.deg2rad(ra) / 2)) decq = exp(GeneralQuaternion(0, 0, -np.deg2rad(dec) / 2, 0)) rollq = exp(GeneralQuaternion(0, -np.deg2rad(roll) / 2, 0, 0)) q = rollq * decq * raq return Quaternion(*q.coordinates) @staticmethod def OpticalAxisFirst(): ''' This quaternion is useful for changing from camera coordinates in two standard frames: Let the sensor plane have axes R (pointing horizontally to the right) D (pointing vertically down) and let P be the optical axis, pointing "outwards", i.e., from the focus to the center of the focal plane. One typical convention is taking the frame [R, D, P]. The other one is taking the frame [P, -R, -D]. This quaternion gives the change of basis from the first to the second. ''' return Quaternion(0.5, 0.5, -.5, 0.5)
/satellogic_quaternions-0.1.7-py3-none-any.whl/quaternions/quaternion.py
0.873039
0.571348
quaternion.py
pypi
# Satip <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> [![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-) <!-- ALL-CONTRIBUTORS-BADGE:END --> [![PyPI version](https://badge.fury.io/py/satip.svg)](https://badge.fury.io/py/satip) [![codecov](https://codecov.io/gh/openclimatefix/Satip/branch/main/graph/badge.svg?token=GTQDR2ZZ2S)](https://codecov.io/gh/openclimatefix/Satip) > Satip is a library for <b>sat</b>ellite <b>i</b>mage <b>p</b>rocessing, and provides all of the functionality necessary for retrieving, and storing EUMETSAT data <br> ### Installation To install the `satip` library please run: ```bash pip install satip ``` Or if you're working in the development environment you can run the following from the directory root: ```bash pip install -e . ``` #### Conda Or, if you want to use `conda` from the a cloned Satip repository: ```bash conda env create -f environment.yml conda activate satip pip install -e . ``` If you plan to work on the development of Satip then also consider installing these development tools: ```bash conda install pytest flake8 jedi mypy black pre-commit pre-commit install ``` ## Operation ### Getting your own API key In order to contribute to development or just test-run some scripts, you will need your own Eumetsat-API-key. Please follow these steps: 1. Go to https://eoportal.eumetsat.int and register an account. 2. You can log in and got to https://data.eumetsat.int/ to check available data services. From there go to your profile and choose the option "API key" or go to https://api.eumetsat.int/api-key/ directly. 3. Please make sure that you added the key and secret to your user's environment variables. ### Downloading EUMETSAT Data The following command will download the last 2 hours of RSS imagery into NetCDF files at the specified location ```bash python satip/app.py --api-key=<EUMETSAT API Key> --api-secret=<EUMETSAT API Secret> --save-dr="/path/to/saving/files/" --history="2 hours" ``` To download more historical data, the command below will download the native files, compress with bz2, and save into a subdirectory. ```bash python satip/get_raw_eumetsat_data.py --user-key=<EUMETSAT API Key> --user-secret=<EUMETSAT API Secret> ``` ### Converting Native files to Zarr `scripts/convert_native_to_zarr.py` converts EUMETSAT `.nat` files to Zarr datasets, using very mild lossy [JPEG-XL](https://en.wikipedia.org/wiki/JPEG_XL) compression. (JPEG-XL is the "new kid on the block" of image compression algorithms). JPEG-XL makes the files about a quarter the size of the equivalent `bz2` compressed files, whilst the images are visually indistinguishable. JPEG-XL cannot represent NaNs so NaNs. JPEG-XL understands float32 values in the range `[0, 1]`. NaNs are encoded as the value `0.025`. All "real" values are in the range `[0.075, 1]`. We leave a gap between "NaNs" and "real values" because there is very slight "ringing" around areas of constant value (see [this comment for more details](https://github.com/openclimatefix/Satip/issues/67#issuecomment-1036456502)). Use `satip.jpeg_xl_float_with_nans.JpegXlFloatWithNaNs` to decode the satellite data. This class will reconstruct the NaNs and rescale the data to the range `[0, 1]`. ## Running in Production The live service uses `app.py` as the entrypoint for running the live data download for OCF's forecasting service, and has a few configuration options, configurable by command line argument or environment variable. `--api-key` or `API_KEY` is the EUMETSAT API key `--api-secret` or `API_SECRET` is the EUMETSAT API secret `--save-dir` or `SAVE_DIR` is the top level directory to save the output files, a `latest` subfolder will be added to that directory to contain the latest data `--history` or `HISTORY` is the amount of history timesteps to use in the `latest.zarr` files `--db-url` or `DB_URL` is the URL to the database to save to when a run has finished `--use-rescaler` or `USE_RESCALER` tells whether to rescale the satellite data to between 0 and 1 or not when saving to disk. Primarily used as backwards compatibility for the current production models, all new training and production Zarrs should use the rescaled data. ## Testing To run tests, simply run ```pytest .``` from the root of the repository. To generate the test plots, run ```python scripts/generate_test_plots.py```. ## Contributors ✨ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> <table> <tr> <td align="center"><a href="https://www.jacobbieker.com"><img src="https://avatars.githubusercontent.com/u/7170359?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jacob Bieker</b></sub></a><br /><a href="https://github.com/openclimatefix/Satip/commits?author=jacobbieker" title="Code">💻</a></td> <td align="center"><a href="http://jack-kelly.com"><img src="https://avatars.githubusercontent.com/u/460756?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jack Kelly</b></sub></a><br /><a href="https://github.com/openclimatefix/Satip/commits?author=JackKelly" title="Code">💻</a></td> <td align="center"><a href="https://github.com/AyrtonB"><img src="https://avatars.githubusercontent.com/u/29051639?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ayrton Bourn</b></sub></a><br /><a href="https://github.com/openclimatefix/Satip/commits?author=AyrtonB" title="Code">💻</a></td> <td align="center"><a href="http://laurencewatson.com"><img src="https://avatars.githubusercontent.com/u/1125376?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Laurence Watson</b></sub></a><br /><a href="https://github.com/openclimatefix/Satip/commits?author=Rabscuttler" title="Code">💻</a></td> <td align="center"><a href="https://github.com/notger"><img src="https://avatars.githubusercontent.com/u/1180540?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Notger Heinz</b></sub></a><br /><a href="https://github.com/openclimatefix/Satip/commits?author=notger" title="Documentation">📖</a></td> <td align="center"><a href="https://github.com/peterdudfield"><img src="https://avatars.githubusercontent.com/u/34686298?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Peter Dudfield</b></sub></a><br /><a href="https://github.com/openclimatefix/Satip/commits?author=peterdudfield" title="Documentation">📖</a></td> </tr> </table> <!-- markdownlint-restore --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END --> This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
/satip-2.11.10.tar.gz/satip-2.11.10/README.md
0.469277
0.803097
README.md
pypi
### Welcome to Satis ![logo](https://cerfacs.fr/coop/images/satis/logo_satis.png) *Spectral Analysis for TImes Signals.* Satis is a python3 / scipy implementation of the Fourier Spectrums in Amplitude ans Power Spectral Density. It is particularly suited for CFD signals with the following characteristics: - Short sampling time, - Potentially short recording time, - Low signal-to-noise ratio, - Multiple measures available. ##### Installation The package is available on [PyPI](https://pypi.org/) so you can install it using pip: ```bash pip install satis ``` ##### How to use it ```bash (my_env)rossi@pluto:~>satis Usage: satis [OPTIONS] COMMAND [ARGS]... --------------- SATIS -------------------- You are now using the Command line interface of Satis, a simple tool for spectral analysis optimized to signals from CFD, created at CERFACS (https://cerfacs.fr). This is a python package currently installed in your python environment. Options: --help Show this message and exit. Commands: datasetforbeginners Copy a set of signals to train using Satis. fourierconvergence Plot discrete Fourier transform of the complete... fouriervariability Plot the Fourier variability diagnostic results. psdconvergence Plot the PSD convergence diagnostic results. psdvariability Plot the spectral energy at the target frequency. time Plot the temporal signal and its time-average. ``` Several command lines are available on satis. You can display them running the command `satis --help`. ###### Dataset for beginners ```bash satis datasetforbeginners ``` With this command , you can copy in your local directory a file `my_first_dataset.dat` to start using satis. It contains several signals of a CFD simulation. These signals have been recorded at different locations to create an average signal less sensitive to noise. For your first time with satis, we recommand to do the following diagnostics in the order with `my_first_dataset.dat`. ###### Time ```bash satis time my_first_dataset.dat ``` This diagnostic plots a time graph of your signals. This plot aims at showing you if the average signal is well converged or if there is a transient behavior. To delete a transient behavior, you can add at the end of the diagnostic command `-t *starting_time*` to declare the beginning of the converged behavior. If a periodic pattern is visible, you should calculate its frequency and declare it with `-f *calculated_frequency*` There is also a cumulative time-average. If this curve is not almost flat, you did probably not remove enough transient behavior. ![time diagnostic](https://cerfacs.fr/coop/images/satis/time.png) ###### Fourier variability ```bash satis fouriervariability my_first_dataset.dat -t 0.201 -f 560 ``` In this diagnostic, the Fourier coefficients of each signal at the specified frequency is plotted so that you can check the signals are equivalent. If a signal seems have different characteristics to the others, you should think about removing it. The average signal would be cleaner. To do so, declare the subset of signals you want to use with: `--subset 1 3 14 ...` ![fourier variability diagnostic](https://cerfacs.fr/coop/images/satis/fouriervariability.png) ###### Fourier convergence ```bash satis fourierconvergence my_first_dataset.dat -t 0.201 -f 560 ``` Since this diagnostic is based on the average signal, the user should have checked beforehand that all input signals are equivalent thanks to the `fouriervariability` diagnostic. The top plots show the amplitude of the Discrete Fourier Transform performed on the complete average signal, the last “half” of the signal and the last “quarter” of the signal. The bottom plots show the convergence over increasing time of the amplitude and phase of the signal at the specified frequency. ![fourier convergence diagnostic](https://cerfacs.fr/coop/images/satis/fourierconvergence.png) ###### PSD variability ```bash satis psdvariability my_first_dataset.dat -t 0.201 -f 560 ``` This diagnostic shows the distribution of the spectral energy of fluctuations on the target frequency, its first and second harmonic and the rest of the frequencies. Note that this distribution is related to the fluctuations and that the time-average has been removed from the signal. ![psd variability diagnostic](https://cerfacs.fr/coop/images/satis/psdvariability.png) ###### PSD convergence ```bash satis psdconvergence my_first_dataset.dat -t 0.201 -f 560 ``` Just as the Fourier convergence, the PSD convergence diagnostic shows the Power Spectral Density obtained on the complete signal, the last half and the last quarter. The left uses a standard linear scale while the right plot shows the same result with log scales. ![psd convergence diagnostic]https://cerfacs.fr/coop/images/satis/psdconvergence.png) ##### Satis as a package Of course, you can use satis in your own project importing it as a package: ```python import os import glob import satis import matplotlib.pyplot as plt *you awesome code* time, signals = satis.read_signal('your_dataset.dat') clean_time = satis.define_good_time_array(time, signals) clean_signals = satis.interpolate_signals(time, signals, clean_time) new_time, new_signals = satis.get_clean_signals(clean_time, signals, calculated_frequency) plt.plot(new_time, new_signals) fourier = satis.get_coeff_fourier(new_time, new_signals, calculated_frequency) *your awesome code ``` ## Acknowledgements This package is the result of work done at Cerfacs's COOP Team. The contributors of this project are: - Franchine Ni - Antoine Dauptain - Tamon Nakano - Matthieu Rossi
/satis-0.0.5.tar.gz/satis-0.0.5/README.md
0.76074
0.987865
README.md
pypi
from pathlib import Path import nlib3 from . import define, recipe from .define import Building, Gas, Ingredients, Item, Liquid, Purity class RecipeIO(): """レシピの入出力を定義する""" def __init__(self, item: Item | None = None, speed_pm: float | None = None) -> None: self.items = [] if item is not None and speed_pm is not None: self.add_item(item, speed_pm) return def add_item(self, item: Item, speed_pm: float): self.items.append((item, speed_pm)) return self def get_items(self) -> tuple: return tuple(self.items) def get_item_names(self) -> tuple: return tuple([row[0] for row in self.items]) @staticmethod def from_items(item_list): """get_items メソッドで取得した値から RecipeIO クラスを生成する Args: item_list: get_items メソッドで取得した値 Returns: RecipeIO クラス """ cls = RecipeIO() for row in item_list: cls.add_item(row[0], row[1]) return cls def __len__(self): return len(self.items) class Recipe(): """レシピを格納する""" def __init__(self, in_items: RecipeIO, out_items: RecipeIO, building: Building, clock_speed: float = 1, purity: Purity = Purity.normal) -> None: self.in_items = in_items self.out_items = out_items self.building = building self.clock_speed = clock_speed self.purity = purity if self.purity != Purity.normal and len(self.in_items) != 0: nlib3.print_error_log("入力アイテムの設定されているレシピに資源ノードの純度を設定することはできません") return def with_clock_speed(self, clock_speed: float): """オーバークロックのスピードを設定する Args: clock_speed: オーバークロックの倍率 ( 0 ~ 2.5 ) Returns: 指定されたオーバークロックの値に変更した Recipe クラス """ return self.__class__(self.in_items, self.out_items, self.building, clock_speed, self.purity) def with_purity(self, purity: Purity): """資源ノードの純度を指定する ( レシピに入力材料がない場合のみ使用可能 ) Args: purity: 純度の enum Returns: 指定された純度の値に変更した Recipe クラス """ return self.__class__(self.in_items, self.out_items, self.building, self.clock_speed, purity) def get_in_items(self) -> tuple: """入力アイテム情報のリストを取得する Returns: 入力アイテム情報のリスト """ return tuple([(item_name, speed_pm * self.clock_speed) for item_name, speed_pm in self.in_items.get_items()]) def get_in_item_names(self) -> tuple[Item]: """入力アイテム名のリストを取得する Returns: 入力アイテム名のリスト """ return self.in_items.get_item_names() def get_out_items(self) -> tuple: """出力アイテム情報のリストを取得する Returns: 出力アイテム情報リスト """ result = [] for item_name, speed_pm in self.out_items.get_items(): out_num = speed_pm * self.purity.value * self.clock_speed if type(item_name) is Ingredients and out_num > define.CONVEYOR_BELT_MAX: out_num = define.CONVEYOR_BELT_MAX elif (type(item_name) is Liquid or type(item_name) is Gas) and out_num > define.PIPE_MAX: out_num = define.PIPE_MAX result.append((item_name, out_num)) return tuple(result) def get_out_item_names(self) -> tuple[Item]: """出力アイテム名のリストを取得する Returns: 出力アイテム名のリスト """ return self.out_items.get_item_names() def get_out_item_speed_pm(self, item: Item): for item_name, speed_pm in self.get_out_items(): if item == item_name: return speed_pm def to_dict(self) -> dict: result = { "in_item": self.in_items.get_items(), "out_item": self.out_items.get_items(), "building": self.building, } return result @staticmethod def from_dict(recipe_dict): return Recipe(RecipeIO.from_items(recipe_dict["in_item"]), RecipeIO.from_items(recipe_dict["out_item"]), recipe_dict["building"]) def save_recipe_list(file_path: str | Path, recipe_list: list[Recipe] | tuple[Recipe, ...]) -> None: recipe_dict_list = [row.to_dict() for row in recipe_list] nlib3.save_json(file_path, recipe_dict_list) return def load_recipe_list(file_path: str | Path): recipe_dict_list = nlib3.load_json(file_path) return [Recipe.from_dict(row) for row in recipe_dict_list] class RecipeNode(): """一つのレシピを木構造のノードとして保持するクラス ( 子ノードの情報のみ保持する )""" def __init__(self, recipe: Recipe, parent=None, main_item=False) -> None: self.recipe = recipe self.input_recipe_node_list = [] self.main_item = main_item if parent is not None: parent.add_input_recipe_node(self) return def add_input_recipe_node(self, recipe_node) -> bool: """子ノードを追加する Args: recipe_node: 子ノード Returns: 正常に追加できたら True """ for out_item in recipe_node.recipe.out_items.get_item_names(): if out_item in self.recipe.in_items.get_item_names(): self.input_recipe_node_list.append(recipe_node) return True nlib3.print_error_log("指定されたレシピが正しくありません") return False def get_input_nodes(self, item: Item) -> list: """出力するアイテムを指定して保持している子ノードを取得する Args: item: 子ノードが出力するアイテム Returns: 子ノードを格納したリスト """ result_list = [] for row in self.input_recipe_node_list: if item in row.recipe.get_out_item_names(): result_list.append(row) return result_list def get_out_machines_num_based_main_item(self) -> float | None: """メインレシピノードのアイテム数を基準に設置すべき施設の台数を取得する Returns: 必要な施設の数 """ if self.main_item: # 入力アイテムがなければ return 1 for in_item, in_speed_pm in self.recipe.get_in_items(): # 全ての入力アイテム input_node_speed_pm_list = [] # 現在接続されている前ノードの出力アイテムと現在のノードの入力ノードが一致する出力速度 for input_recipe_node in self.input_recipe_node_list: # 全ての前ノード if in_item in input_recipe_node.recipe.get_out_item_names(): # 今回求めている入力素材が、前のレシピノードの出力素材なら result = input_recipe_node.get_out_machines_num_based_main_item() # 前ノードのレシピの出力から今回必要な素材を取得する if result: # 前ノード以前にメインノードが存在すれば input_node_speed_pm_list.append(result * input_recipe_node.recipe.get_out_item_speed_pm(in_item)) # このレシピに渡される in_item の数 if input_node_speed_pm_list: # 一つでも入力される素材があれば return ((sum(input_node_speed_pm_list)) / in_speed_pm) return None def get_out_machines_num(self, out_speed_item: Item | None = None, out_speed_pm: float | None = None) -> float | None: """設置すべき施設の台数を取得する ( 一番高頻度で搬入された素材に合わせて計算する ) Args: out_speed_item: 出力速度を指定する場合は必要とするアイテム out_speed_pm: 出力速度を指定する場合は、out_speed_item で指定したアイテムの毎分必要数 Returns: 全ての素材で最大になる施設数 """ if out_speed_item and out_speed_pm: for item_name, speed_pm in self.recipe.get_out_items(): if item_name == out_speed_item: return out_speed_pm / speed_pm if not self.recipe.get_in_items(): # 入力アイテムがなければ return 1 result_machines_num = None for in_item, in_speed_pm in self.recipe.get_in_items(): # 全ての入力アイテム input_node_machines_num_list = [] # 現在接続されている前ノードの出力アイテムと現在のノードの入力ノードが一致する出力速度 for input_recipe_node in self.input_recipe_node_list: # 全ての前ノード if in_item in input_recipe_node.recipe.get_out_item_names(): # 今回求めている入力素材が、前のレシピノードの出力素材なら result = input_recipe_node.get_out_machines_num() # このレシピに渡される前のレシピの台数 if result: input_node_machines_num_list.append(result * input_recipe_node.recipe.get_out_item_speed_pm(in_item)) # このレシピに渡される in_item の数 if input_node_machines_num_list: # 一つでも入力される素材があれば machines_temp = sum(input_node_machines_num_list) / in_speed_pm if result_machines_num is None or result_machines_num < machines_temp: # 1つ目の input アイテムか、それ移行で今までのインプットアイテム量より効率が良ければ result_machines_num = machines_temp return result_machines_num def detailed_recipe_tree_dumps(self) -> str: """詳細な情報を付加したレシピツリーを出力する Returns: レシピツリーの文字列 """ result = "(" for item_name, speed_pm in self.recipe.get_out_items(): info_result = self.get_out_machines_num() result += f"{{item: {item_name}, out: {info_result * speed_pm}, machines: {info_result}}}, " result = result[:-2] result += ")" if self.input_recipe_node_list: result += " ← " for i, row in enumerate(self.input_recipe_node_list): if len(row.input_recipe_node_list) >= 1: # 入力素材の入力素材が一つ以上あれば if i == len(self.input_recipe_node_list) - 1: result += "[" + row.detailed_recipe_tree_dumps() + "]" else: result += "[" + row.detailed_recipe_tree_dumps() + "], " else: result += row.detailed_recipe_tree_dumps() return result def detailed_recipe_tree_dumps_based_main_item(self, out_machines_num: float | None = None) -> str: """詳細な情報を付加したレシピツリーを出力する 必要資源を計算するときに main_item が指定されているノードを元に他の全資源を計算する Returns: レシピツリーの文字列 """ if out_machines_num is None: out_machines_num = self.get_out_machines_num_based_main_item() if out_machines_num is None: nlib3.print_error_log("メインアイテムが指定されていません") return "" result = "(" for item_name, speed_pm in self.recipe.get_out_items(): result += f"{{item: {item_name}, out: {out_machines_num * speed_pm}, machines: {out_machines_num}}}, " result = result[:-2] result += ")" if self.input_recipe_node_list: result += " ← " for i, row in enumerate(self.input_recipe_node_list): for in_item_name, in_item_speed_pm in self.recipe.get_in_items(): # このレシピノードの入力素材が if in_item_name in row.recipe.get_out_item_names(): # 入力レシピノードの出力素材に存在すれば if not row.main_item: need_speed_pm = row.get_out_machines_num(in_item_name, in_item_speed_pm * out_machines_num) # 再帰するときに入力レシピノードに要求する素材の数を計算する else: need_speed_pm = row.get_out_machines_num() # メインアイテムの場合は普通に計算に計算しないと、複数の採掘機が設定されていた場合は、その合計に再計算されてしまう recipe_tree_dumps_result = row.detailed_recipe_tree_dumps_based_main_item(need_speed_pm) # 入力レシピノードに要求素材数を渡してツリー図を要求する if len(row.input_recipe_node_list) >= 1: # 入力素材の入力素材が一つ以上あれば if i == len(self.input_recipe_node_list) - 1: result += "[" + recipe_tree_dumps_result + "]" else: result += "[" + recipe_tree_dumps_result + "], " else: result += recipe_tree_dumps_result return result def automatic_node_generation(self): """基本レシピを使用して子ノードを自動で生成する""" for in_item_name in self.recipe.get_in_item_names(): # 入力レシピノードの出力素材に存在すれば if not recipe.RECIPE.get(in_item_name): nlib3.print_error_log(f"入力素材のレシピが存在しません [item={in_item_name}]") continue exist = False for row in self.input_recipe_node_list: if in_item_name in row.recipe.get_out_item_names(): exist = True if exist: print(f"既に存在するノードの生成をスキップしました [item={in_item_name}]") continue child_node = RecipeNode(recipe.RECIPE[in_item_name], parent=self) child_node.automatic_node_generation() return def __str__(self) -> str: result = "(" for row in self.recipe.get_out_item_names(): result += f"{row}, " result = result[:-2] result += ")" if self.input_recipe_node_list: result += " ← " for i, row in enumerate(self.input_recipe_node_list): if len(row.input_recipe_node_list) >= 1: # 入力素材の入力素材が一つ以上あれば if i == len(self.input_recipe_node_list) - 1: result += "[" + str(row) + "]" else: result += "[" + str(row) + "], " else: result += str(row) return result
/satisfactory_calc-1.2.0-py3-none-any.whl/satisfactory_calc/sf_calc.py
0.747063
0.286132
sf_calc.py
pypi
from typing import Final from .define import Building, Item, Ingredients, Liquid from .sf_calc import Recipe, RecipeIO def alternate(product: Item, num: int = 1) -> str: """代替レシピのキーを生成する Args: product: 生成されるアイテム名 num: 代替レシピの番号 ( n番目 ) Returns: キー """ return f"alternate{num}_{product}" def byproduct(product: Item, num: int = 1) -> str: """副産物からレシピを探すためのサブキーを生成する Args: product: 生成される副産物のアイテム num: 副産物レシピの番号 ( n番目 ) Returns: キー """ return f"byproduct{num}_{product}" RECIPE: Final[dict[str | Item, Recipe]] = { # Limestone Ingredients.limestone: Recipe( RecipeIO(), RecipeIO(Ingredients.limestone, 240), Building.miner_mk3, ), Ingredients.concrete: Recipe( RecipeIO(Ingredients.limestone, 45), RecipeIO(Ingredients.concrete, 15), Building.smelter, ), # Iron Ingredients.iron_ore: Recipe( RecipeIO(), RecipeIO(Ingredients.iron_ore, 240), Building.miner_mk3, ), Ingredients.iron_ingot: Recipe( RecipeIO(Ingredients.iron_ore, 30), RecipeIO(Ingredients.iron_ingot, 30), Building.smelter, ), Ingredients.iron_plate: Recipe( RecipeIO(Ingredients.iron_ingot, 30), RecipeIO(Ingredients.iron_plate, 20), Building.constructor, ), Ingredients.iron_rod: Recipe( RecipeIO(Ingredients.iron_ingot, 15), RecipeIO(Ingredients.iron_rod, 15), Building.constructor, ), Ingredients.screw: Recipe( RecipeIO(Ingredients.iron_rod, 10), RecipeIO(Ingredients.screw, 40), Building.constructor, ), Ingredients.reinforced_iron_plate: Recipe( RecipeIO(Ingredients.iron_plate, 30).add_item(Ingredients.screw, 60), RecipeIO(Ingredients.reinforced_iron_plate, 5), Building.assembler, ), Ingredients.rotor: Recipe( RecipeIO(Ingredients.iron_rod, 20).add_item(Ingredients.screw, 100), RecipeIO(Ingredients.rotor, 4), Building.assembler, ), # Steel Ingot Ingredients.steel_ingot: Recipe( RecipeIO(Ingredients.iron_ore, 45).add_item(Ingredients.coal, 45), RecipeIO(Ingredients.steel_ingot, 45), Building.foundry, ), Ingredients.steel_beam: Recipe( RecipeIO(Ingredients.steel_ingot, 60), RecipeIO(Ingredients.steel_beam, 15), Building.constructor, ), Ingredients.steel_pipe: Recipe( RecipeIO(Ingredients.steel_ingot, 30), RecipeIO(Ingredients.steel_pipe, 20), Building.constructor, ), Ingredients.encased_industrial_beam: Recipe( RecipeIO(Ingredients.steel_beam, 24).add_item(Ingredients.concrete, 30), RecipeIO(Ingredients.encased_industrial_beam, 6), Building.assembler, ), # Copper Ingredients.copper_ore: Recipe( RecipeIO(), RecipeIO(Ingredients.copper_ore, 240), Building.miner_mk3, ), Ingredients.copper_ingot: Recipe( RecipeIO(Ingredients.copper_ore, 30), RecipeIO(Ingredients.copper_ingot, 30), Building.smelter, ), Ingredients.copper_powder: Recipe( RecipeIO(Ingredients.copper_ingot, 300), RecipeIO(Ingredients.copper_powder, 50), Building.constructor, ), Ingredients.copper_sheet: Recipe( RecipeIO(Ingredients.copper_ingot, 20), RecipeIO(Ingredients.copper_sheet, 10), Building.constructor, ), Ingredients.wire: Recipe( RecipeIO(Ingredients.copper_ingot, 15), RecipeIO(Ingredients.wire, 30), Building.constructor, ), Ingredients.cable: Recipe( RecipeIO(Ingredients.wire, 60), RecipeIO(Ingredients.cable, 30), Building.constructor, ), # Raw Quartz Ingredients.raw_quartz: Recipe( RecipeIO(), RecipeIO(Ingredients.raw_quartz, 240), Building.miner_mk3, ), Ingredients.quartz_crystal: Recipe( RecipeIO(Ingredients.raw_quartz, 37.5), RecipeIO(Ingredients.quartz_crystal, 22.5), Building.constructor, ), Ingredients.silica: Recipe( RecipeIO(Ingredients.raw_quartz, 22.5), RecipeIO(Ingredients.silica, 37.5), Building.constructor, ), # Caterium Ingredients.caterium_ore: Recipe( RecipeIO(), RecipeIO(Ingredients.caterium_ore, 240), Building.miner_mk3, ), Ingredients.caterium_ingot: Recipe( RecipeIO(Ingredients.caterium_ore, 45), RecipeIO(Ingredients.caterium_ingot, 15), Building.smelter, ), alternate(Ingredients.caterium_ingot): Recipe( RecipeIO(Ingredients.caterium_ore, 24).add_item(Liquid.water, 24), RecipeIO(Ingredients.caterium_ingot, 12), Building.smelter, ), Ingredients.quickwire: Recipe( RecipeIO(Ingredients.caterium_ingot, 12), RecipeIO(Ingredients.quickwire, 60), Building.constructor, ), alternate(Ingredients.quickwire): Recipe( RecipeIO(Ingredients.caterium_ingot, 7.5).add_item(Ingredients.copper_ingot, 37.5), RecipeIO(Ingredients.quickwire, 90), Building.constructor, ), # Sulfur Ingredients.sulfur: Recipe( RecipeIO(), RecipeIO(Ingredients.sulfur, 240), Building.miner_mk3, ), Ingredients.black_powder: Recipe( RecipeIO(Ingredients.coal, 15).add_item(Ingredients.sulfur, 15), RecipeIO(Ingredients.black_powder, 30), Building.assembler, ), Ingredients.compacted_coal: Recipe( RecipeIO(Ingredients.coal, 25).add_item(Ingredients.sulfur, 25), RecipeIO(Ingredients.compacted_coal, 25), Building.assembler, ), # Liquid Liquid.water: Recipe( RecipeIO(), RecipeIO(Liquid.water, 120), Building.water_extractor, ), Liquid.crude_oil: Recipe( RecipeIO(), RecipeIO(Liquid.crude_oil, 120), Building.oil_extractor, ), Liquid.sulfuric_acid: Recipe( RecipeIO(Ingredients.sulfur, 50).add_item(Liquid.water, 50), RecipeIO(Liquid.sulfuric_acid, 50), Building.refinery, ), # Intermediate material Ingredients.stator: Recipe( RecipeIO(Ingredients.steel_pipe, 15).add_item(Ingredients.wire, 40), RecipeIO(Ingredients.stator, 5), Building.assembler, ), Ingredients.ai_limiter: Recipe( RecipeIO(Ingredients.copper_sheet, 25).add_item(Ingredients.quickwire, 100), RecipeIO(Ingredients.ai_limiter, 5), Building.assembler, ), Ingredients.electromagnetic_control_rod: Recipe( RecipeIO(Ingredients.stator, 6).add_item(Ingredients.ai_limiter, 4), RecipeIO(Ingredients.electromagnetic_control_rod, 4), Building.assembler, ), # Nuclear power Ingredients.uranium: Recipe( RecipeIO(), RecipeIO(Ingredients.uranium, 240), Building.miner_mk3, ), Ingredients.encased_uranium_cell: Recipe( RecipeIO(Ingredients.uranium, 50).add_item(Ingredients.concrete, 15).add_item(Liquid.sulfuric_acid, 40), RecipeIO(Ingredients.encased_uranium_cell, 25).add_item(Liquid.sulfuric_acid, 10), Building.blender, ), alternate(Ingredients.encased_uranium_cell): Recipe( RecipeIO(Ingredients.uranium, 25).add_item(Ingredients.silica, 15).add_item(Ingredients.sulfur, 25).add_item(Ingredients.quickwire, 75), RecipeIO(Ingredients.encased_uranium_cell, 20), Building.manufacturer, ), Ingredients.uranium_fuel_rod: Recipe( RecipeIO(Ingredients.encased_uranium_cell, 20).add_item(Ingredients.encased_industrial_beam, 1.2).add_item(Ingredients.electromagnetic_control_rod, 2), RecipeIO(Ingredients.uranium_fuel_rod, 0.4), Building.manufacturer, ), Ingredients.uranium_waste: Recipe( RecipeIO(Ingredients.uranium_fuel_rod, 0.2).add_item(Liquid.water, 240), RecipeIO(Ingredients.uranium_waste, 10), Building.nuclear_power_plant, ), }
/satisfactory_calc-1.2.0-py3-none-any.whl/satisfactory_calc/recipe.py
0.744563
0.318684
recipe.py
pypi
from .item import Item from .recipe import Recipe from .coproduct_recipes import Coproduct_Recipes all_requirements = [] class CraftingTree(): def __init__(self, product_name: str, product_rate: float, coproduct_recipes_list: list): """ Initialize tree with target item name and desired production rate. """ init_item = Item(product_name, 'solid', product_rate) self._coproduct_recipes_list = coproduct_recipes_list self._root_node = CraftingNode(init_item, self._coproduct_recipes_list, 0, []) # self._tree_height = 0 # self._all_reqs = [] self.calc() @property def root(self): return self._root_node @root.setter def root(self, root): self._root_node = root @property def recipes_list(self): return self._coproduct_recipes_list @root.setter def recipes_list(self, recipes_list): self._coproduct_recipes_list = recipes_list @property def tree_height(self): return self._tree_height @property def reqs(self): return self._all_reqs def calc(self): self.root.calc() def traverse(self): self.root.traverse() class CraftingNode(): MAX_CHILDREN = 4 def __init__(self, init_item: Item, coproduct_recipes_list: list, level: int, cached_recipes: list): """ Initialize node using Item class definition. """ self.coproduct_recipes_list = coproduct_recipes_list self.cached_recipes = cached_recipes self.num_buildings = 0.0 self.goal = init_item self.byproducts = [] self.children = [] self.level = level self.recipe = '' def __str__(self): return('Crafting node for {} at {}/min.'.format(self.goal.name, self.goal.rate)) def __repr__(self): return('CraftingNode(Item({}, \'solid\', {}))'.format(self.goal.name, self.goal.rate)) def display(self): """ Print summary of CraftingNode, as part of CraftingTree. """ # Set spacer strings for the following text align_str_header = '\t'*self.level align_str_body = '\t'*self.level # Exception for first node printed (root) if self.level > 0: align_str_header = '\t'*self.level + 'L_' align_str_body = '\t'*(self.level) + ' ' # Display input names and required rates self.display_header(align_str_header) # Display names and rates of byproducts if any self.display_byproduct(align_str_body) # Display building / to extract self.display_building(align_str_body) # Print whitespace separator self.spacer() def display_header(self, align_str): """ Print header of current CraftingNode. """ print(align_str, self.unpack_list()) def display_byproduct(self, align_str): """ Print byproduct section of current CraftingNode. """ if self.byproducts: print(align_str, 'Byproduct: {}'.format(self.byproducts[0])) def display_building(self, align_str): """ Print building section of current CraftingNode. """ if self.recipe: if self.recipe._building: print(align_str, 'Made in {:.2f}x {}.'.format(self.num_buildings, self.recipe.building)) else: raise Exception('Recipe exists with no building.') else: print(align_str, 'Mine/Extract resource from the world.') def spacer(self): print() def unpack_list(self): """ Return appropriate print method from Item instace of self.goal. """ return self.goal.__str__() def user_recipe_select(self, potential_recipes): """ Offer user choice of which recipe to use for the crafting step. """ # Check for edge cases if potential_recipes.num_recipes == 0: return None if potential_recipes.num_recipes == 1: return potential_recipes.recipes[0] # If no edge case, display options potential_recipes.print_summary() # Prompt user for resonable selection try: selected_idx = int(input('Enter recipe # to use: ')) except ValueError as err: selected_idx = int(input('Enter valid recipe # to use: ')) self.spacer() while selected_idx > potential_recipes.num_recipes or selected_idx < 0: selected_idx = int(input('Enter valid recipe # to use: ')) # Return the Recipe at the adjusted index (1-indexed) return potential_recipes.recipes[selected_idx-1] @property def num_children(self): """ Return number of children a node already has. """ return len(self.children) def add_child(self, new_child): """ Add a child to node. Handles max amount of children already existing. """ if self.num_children < self.MAX_CHILDREN: self.children.append(new_child) else: raise Exception('Max number of allowed children ({}) exceeded.'.format(self.MAX_CHILDREN)) def get_suitable_CR(self, desired_output): """ Return the CR instance containing Recipes for the desired output. """ for coproduct_recipe in self.coproduct_recipes_list: if desired_output == coproduct_recipe.product: return coproduct_recipe return None def recipe_is_cached(self, recipe): """ Return True if recipe been used before in the Crafting Tree, False otherwise. """ if recipe in self.cached_recipes: return True return False def calc(self): """ Take root node of tree, with user assistance, compute the crafting requirements and build the tree. """ # Find appropriate recipes suitable_CR = self.get_suitable_CR(self.goal.name) # If recipe for desired goal exists if suitable_CR: # If a non-raw recipe has been returned, calculate production requirements if suitable_CR.recipes: # If recipe has been cached for recipe in suitable_CR.recipes: if self.recipe_is_cached(recipe): self.recipe = recipe # If recipe was not cached if not self.recipe: self.recipe = self.user_recipe_select(suitable_CR) self.cached_recipes.append(self.recipe) # Get inputs/outputs for selected recipe all_inputs = self.recipe.input_items all_output_names = self.recipe.output_names # Build crafting tree for each input for recipe for inp in all_inputs: # Calculate the requirements for the step multiplier = self.recipe.get_ratio(inp.name, self.goal.name) # Calculate number of buildings required for the step self.num_buildings = self.goal.rate / self.recipe.get_output_rate_for(self.goal.name) # Set goal for next child next_goal = Item(inp.name, inp.form, self.goal.rate * multiplier) # Add next steps as child CraftingNode self.add_child(CraftingNode(next_goal, self.coproduct_recipes_list, self.level+1, self.cached_recipes)) # Find and report byproducts for the step if present if len(all_output_names) > 1: # Remove step goal from outputs list all_output_names.remove(self.goal.name) # Convert output names to output Item instances all_output_items = [self.recipe.get_output_item_from_name(output) for output in all_output_names] # Scale byproduct rates appropriately self.byproducts = [output.scale_by(self.num_buildings) for output in all_output_items] # Recurse for child in self.children: child.calc() # Otherwise, end branch else: # print('Reached leaf node.') all_requirements.append(self.goal) # When no recipe for requested component exists else: raise Exception('No match for desired output in any available recipe.', self.goal.name) def traverse(self): """ Print Crafting Nodes as tree is being traversed depth-first. """ self.display() for child in self.children: child.traverse()
/satisfy_calc-1.1.3-py3-none-any.whl/satisfy_calc/tree.py
0.836388
0.183155
tree.py
pypi
from .coproduct_recipes import Coproduct_Recipes as CR from .building import Building from .recipe import Recipe from .item import Item from bs4 import BeautifulSoup from bs4 import SoupStrainer import requests import re def get_recipe_name(table_td): """ Return name of recipe from Soup. """ return str(table_td.contents[0]) def get_recipe_rate(string): """ Return item input/output rate from string. """ return float(re.match('[0-9]*[.]*[0-9]*', string).group(0)) def get_input_output(table_td): """ Return list of items and rates from given table. """ items_list = [] rates_list = [] while table_td: try: items_list.append(table_td.div.div.a.get('title')) rates_list.append(get_recipe_rate(table_td.div.next_sibling.string)) except: break table_td = table_td.next_sibling return [items_list, rates_list] def get_recipe_inputs(table_td): """ Return list of all input names, list of all input rates. """ return get_input_output(table_td) def get_recipe_outputs(table_td): """ Return list of all output names, list of all output rates. """ return get_input_output(table_td) def get_building(table_td): """ Return the building recipe is made in. """ try: return table_td.span.a.get('title') except: return None def get_prereq(table_td): """ Return what prerequisite exists for recipe unlock. """ return str(table_td.span.text) def get_is_alternate(table_td): """ Return if the recipe is an alternate recipe (locked by default). """ return True if table_td.br else False def extract_product(extension: str): """ Return full product name from URL extension. """ return re.search('[a-zA-Z_-]+$', extension)[0] def get_recipe_rows(recipe_soup): """ Return non-header rows from crafting table on the item's Wiki page soup. """ # Get all rows for recipe page try: crafting_table = recipe_soup.find_all(class_='wikitable')[0] except: raise Exception('Problem parsing wiki page soup.') crafting_rows = crafting_table.find_all('tr') # Select all non-header rows non_header_rows = crafting_rows[1:] return non_header_rows def get_all_URLs_to_scrape(extensions_list): """ Return list of full item URLs for scraping. """ base_URL = 'https://satisfactory.fandom.com' return [base_URL + extension for extension in extensions_list] def itemify_components(names, rates): """ Return Item instances list given names and rates. TODO: include other item forms besides 'solid' if necessary """ return [Item(i, 'solid', r) for i, r in zip(names, rates)] def scrape_recipe_page(recipes_soup): """ Return Coproduct Recipes list for given Wiki page Soup. """ # Select all non-header rows select_rows = get_recipe_rows(recipes_soup) # Define function-internal lists final_recipe_list = [] temp_inputs = [] temp_irates = [] temp_outputs = [] temp_orates = [] # For each row in table (besides column names) for i in range(len(select_rows)): # Get first row's input item names and rates listed on HTML structure with 'class' attr if select_rows[i].has_attr('class'): # Get name for recipe, always index 0 recipe_name = get_recipe_name(select_rows[i].find_all('td')[0]) # Get if recipe is alt, always index 0 recipe_is_alt = get_is_alternate(select_rows[i].find_all('td')[0]) # Get primary row input values. always index 1+ inps, irts = get_recipe_inputs(select_rows[i].find_all('td')[1]) temp_inputs = inps temp_irates = irts # Get proper index for building info location in row if len(temp_inputs) < 2: building_index = 2 else: building_index = 3 # If exists, get first row's secondary inputs listed on HTML structure with no 'class' attr try: if not select_rows[i+1].has_attr('class'): # Append secondary row input values to primary ones inps, rts = get_recipe_inputs(select_rows[i+1].find_all('td')[0]) temp_inputs += inps temp_irates += rts except: pass # Get building info recipe_building = get_building(select_rows[i].find_all('td')[building_index]) # Get outputs for recipe, one index up from building outs, orts = get_recipe_outputs(select_rows[i].find_all('td')[building_index+1]) temp_outputs = outs temp_orates = orts # Get prereqs for recipe # recipe_prereqs = get_prereq() # If hit row with no primary values, skip else: continue # Arrange items and rates into correct classes inputs = itemify_components(temp_inputs, temp_irates) outputs = itemify_components(temp_outputs, temp_orates) # Add to list of recipes for the page final_recipe_list.append(Recipe(recipe_name, inputs, outputs, recipe_building, recipe_is_alt)) return final_recipe_list def underscore_2_space(string: str): """ Return string with underscores replaced by spaces. """ return re.sub('[_]', ' ', string) def get_recipe_soup(recipe_URL: str): """ Return Soup of given URL. """ # Get HTML of recipe page recipe_page = requests.get(recipe_URL) # Only parse and soup-ify the recipes table only_recipe_table = SoupStrainer(class_='wikitable') recipe_soup = BeautifulSoup(recipe_page.content, 'html.parser', parse_only=only_recipe_table) return recipe_soup def get_all_coproduct_recipes(extensions_list: list): """ Return Coproduct Recipes list for all recipes on the Wiki. """ # Get list of item name URLs, convert to full URLs for scraping. all_item_URLs = get_all_URLs_to_scrape(extensions_list) # Get Soup list from all item URLs. all_recipe_soups = [get_recipe_soup(recipe_page) for recipe_page in all_item_URLs] # Scrape recipes from all Soups. all_recipe_lists = [scrape_recipe_page(recipe_soup) for recipe_soup in all_recipe_soups] # Make CR list from extensions and Recipe instances. all_coproduct_recipes = [CR(underscore_2_space(extract_product(extension)), recipe_list) for extension, recipe_list in zip(extensions_list, all_recipe_lists)] # Add Water, Fuel as a resource because it is missing all_coproduct_recipes.append(CR('Water', [])) return all_coproduct_recipes
/satisfy_calc-1.1.3-py3-none-any.whl/satisfy_calc/fetch_recipes.py
0.554229
0.25557
fetch_recipes.py
pypi
from .item import Item from re import sub class Recipe(): """ Combines up to 4 Item instances to output up to 2 Item instances. """ def __init__(self, recipe_name: bool, inputs_list: list, outputs_list: list, building: str, is_alternate: bool): """ Initialize instance with name string, input Item instances list, output Item instances list, building name, whether is an alternate recipe. """ self._recipe_name = recipe_name self._inputs = inputs_list self._outputs = outputs_list self._building = building self._is_alternate = is_alternate def __str__(self): """ Return all details of Recipe. """ return f'Recipe name: {self.name}\nInputs: {self.input_names}\nOutputs: {self.output_names}\nMade in: {self.building}\nIs alt. recipe: {self.is_alt}\n' def __repr__(self): """ Return Recipe name. """ return f'Recipe for {self.name}' def scale_by(self, multiplier): """ Scale inputs and outputs according to multiplier. """ self.scale_inputs_by(multiplier) self.scale_outputs_by(multiplier) def scale_inputs_by(self, multiplier): """ Scale inputs of recipe according to multiplier. """ self._inputs = [inp.scale_by(multiplier) for inp in self._inputs] def scale_outputs_by(self, multiplier): """ Scale inputs of recipe according to multiplier. """ self._outputs = [outp.scale_by(multiplier) for outp in self._outputs] @property def summary(self): """ Return summary of the Recipe instance. """ return '[{}] made from {}'.format(self.name, self.list_formatter(self.input_names)) def list_formatter(self, l): return '[' + ', '.join(l) + ']' @property def name(self): """ Return Recipe instance name. """ return self._recipe_name @name.setter def name(self, name): self._recipe_name = name @property def is_raw(self): """ Return True if the item is a raw material (not craftable/no inputs). """ return self._inputs is None @property def input_items(self): """ Return all inputs as list of Item instances. """ return self._inputs @input_items.setter def input_items(self, input_items): self._inputs = input_items @property def input_names(self): """ Return all inputs as list of item name strings. """ return [inp.name for inp in self._inputs] @property def input_rates(self): """ Return all inputs as list of item rates. """ return [inp.rate for inp in self._inputs] @property def output_items(self): """ Return all outputs as list of Item instances. """ return self._outputs @output_items.setter def output_items(self, output_items): self._outputs = output_items @property def output_names(self): """ Return all outputs as list of item names. """ return [outp.name for outp in self._outputs] @property def output_rates(self): """ Return all outputs as list of item rates. """ return [outp.rate for outp in self._outputs] @property def building(self): """ Return building name. """ return self._building @building.setter def building(self, building): self._building = building @property def is_base(self): """ Return whether recipe is unlocked by default. """ return self._is_alternate == False @property def is_alt(self): """ Return whether recipe is locked by default. """ return self._is_alternate @is_alt.setter def is_alt(self, is_alternate): self._is_alternate = is_alternate def get_output_rate_for(self, output_name): return self.output_rates[self.output_names.index(output_name)] def get_input_item_from_name(self, item_name: str): """ Return Item instance from self.inputs given item name. """ return [inp for inp in self.input_items if item_name == inp.name][0] def get_output_item_from_name(self, item_name: str): """ Return Item instance from self.outputs given item name. """ return [outp for outp in self.output_items if item_name == outp.name][0] def get_ratio(self, inp: str, outp: str): """ Return input/output ratio given one input, one output item name. """ if inp is None: return None else: return self.get_input_item_from_name(inp).rate /\ self.get_output_item_from_name(outp).rate def get_ratio_rev(self, inp: str, outp: str): """ Return output/input ratio given one input, one output item name. """ if inp is None: return None else: return self.get_output_item_from_name(outp).rate /\ self.get_input_item_from_name(inp).rate
/satisfy_calc-1.1.3-py3-none-any.whl/satisfy_calc/recipe.py
0.865764
0.309245
recipe.py
pypi
import math import matplotlib.pyplot as plt from .Generaldistribution import Distribution class Gaussian(Distribution): """ Gaussian distribution class for calculating and visualizing a Gaussian distribution. Attributes: mean (float) representing the mean value of the distribution stdev (float) representing the standard deviation of the distribution data_list (list of floats) a list of floats extracted from the data file """ def __init__(self, mu=0, sigma=1): Distribution.__init__(self, mu, sigma) def calculate_mean(self): """Function to calculate the mean of the data set. Args: None Returns: float: mean of the data set """ avg = 1.0 * sum(self.data) / len(self.data) self.mean = avg return self.mean def calculate_stdev(self, sample=True): """Function to calculate the standard deviation of the data set. Args: sample (bool): whether the data represents a sample or population Returns: float: standard deviation of the data set """ if sample: n = len(self.data) - 1 else: n = len(self.data) mean = self.calculate_mean() sigma = 0 for d in self.data: sigma += (d - mean) ** 2 sigma = math.sqrt(sigma / n) self.stdev = sigma return self.stdev def plot_histogram(self): """Function to output a histogram of the instance variable data using matplotlib pyplot library. Args: None Returns: None """ plt.hist(self.data) plt.title('Histogram of Data') plt.xlabel('data') plt.ylabel('count') def pdf(self, x): """Probability density function calculator for the gaussian distribution. Args: x (float): point for calculating the probability density function Returns: float: probability density function output """ return (1.0 / (self.stdev * math.sqrt(2*math.pi))) * math.exp(-0.5*((x - self.mean) / self.stdev) ** 2) def plot_histogram_pdf(self, n_spaces = 50): """Function to plot the normalized histogram of the data and a plot of the probability density function along the same range Args: n_spaces (int): number of data points Returns: list: x values for the pdf plot list: y values for the pdf plot """ mu = self.mean sigma = self.stdev min_range = min(self.data) max_range = max(self.data) # calculates the interval between x values interval = 1.0 * (max_range - min_range) / n_spaces x = [] y = [] # calculate the x values to visualize for i in range(n_spaces): tmp = min_range + interval*i x.append(tmp) y.append(self.pdf(tmp)) # make the plots fig, axes = plt.subplots(2,sharex=True) fig.subplots_adjust(hspace=.5) axes[0].hist(self.data, density=True) axes[0].set_title('Normed Histogram of Data') axes[0].set_ylabel('Density') axes[1].plot(x, y) axes[1].set_title('Normal Distribution for \n Sample Mean and Sample Standard Deviation') axes[0].set_ylabel('Density') plt.show() return x, y def __add__(self, other): """Function to add together two Gaussian distributions Args: other (Gaussian): Gaussian instance Returns: Gaussian: Gaussian distribution """ result = Gaussian() result.mean = self.mean + other.mean result.stdev = math.sqrt(self.stdev ** 2 + other.stdev ** 2) return result def __repr__(self): """Function to output the characteristics of the Gaussian instance Args: None Returns: string: characteristics of the Gaussian """ return "mean {}, standard deviation {}".format(self.mean, self.stdev)
/satiyam_simple_stats-0.2.tar.gz/satiyam_simple_stats-0.2/satiyam_simple_stats/Gaussiandistribution.py
0.688364
0.853058
Gaussiandistribution.py
pypi
# Numerical Propagation (with Scipy) ## Propagating Orbits with Scipy Numerical propagation means integrating the equations of motion using numerical Ordinary Differential Equation (ODE) Solvers. If this sounds a mouthful, it is because it really is - there is a significant literature describing how to achieve high accuracy and computational performance for different families of problems. The good news is that, [Scipy ODE integration algorithms](https://docs.scipy.org/doc/scipy/reference/integrate.html) handle most of the hard work and all we need to do is to describe the differential equations describing the motion. The ODE that describes the two-body motion is: $$ \ddot{\vec{r}} = - \dfrac{\mu}{r^3} \vec{r} $$ where $\ddot{\vec{r}}$ is the inertial acceleration, $\vec{r}$ is the position vector (with $r$ its norm). $\mu$ is equal to the constant $GM$ (Gravitational Constant times the Mass of the main attracting body). For more complicated force models, this differential equation becomes significantly more complicated, but the procedure is still the same. While the available propagation methods are those described by the [Scipy ODE solvers](https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.solve_ivp.html#scipy.integrate.solve_ivp), we have shown with [extensive analyses](https://satmad-applications.readthedocs.io/en/latest/analyses/propagation/num_prop_performance_1.html) that DOP853 (Explicit Runge-Kutta Order 8(5,3) due to Dormand and Prince) gives the best results in terms of accuracy and computational performance. Hence, this is the default propagator. ## Usage The Numerical Propagator is initialised with an output stepsize (e.g. 120 seconds for a Low-Earth Orbit satellite) as well as relative and absolute tolerances that determine the propagation error. How to choose these tolerances have been investigated in this `[numerical propagation analysis](https://satmad-applications.readthedocs.io/en/latest/analyses/propagation/num_prop_performance_2.html). To generate the trajectory :meth:`.NumericalPropagator.gen_trajectory` method is called with an initial state and a propagation interval. A trajectory is then generated through this interval with the required output stepsize. The following example generates an initial state, initialises a DOP853 numerical propagator with a stepsize of 120 seconds and `rtol` and `atol` of 1e-13 and 1-15, respectively. Then it generates a trajectory, starting from 1 hour after the initial state and ending 1 day later. ```python from astropy import units as u from astropy.coordinates import ( GCRS, CartesianDifferential, CartesianRepresentation, SkyCoord, ) from astropy.time import Time from satmad.propagation.numerical_propagators import ODESolverType, NumericalPropagator from satmad.utils.timeinterval import TimeInterval time = Time("2004-04-06T07:51:28.386009", scale="utc") v_gcrs = CartesianDifferential( [-4.7432201610, 0.7905364950, 5.5337557240], unit=u.km / u.s ) r_gcrs = CartesianRepresentation( [5102.50895290, 6123.01139910, 6378.13693380], unit=u.km ) rv_init = SkyCoord( r_gcrs.with_differentials(v_gcrs), obstime=time, frame=GCRS, representation_type="cartesian", differential_type="cartesian", ) # Set up propagation config stepsize = 120 * u.s solver_type = ODESolverType.DOP853 rtol = 1e-13 atol = 1e-15 prop_start = rv_init.obstime + 1 * u.hr prop_duration = 1.0 * u.day # init propagator prop = NumericalPropagator(stepsize, rtol=rtol, atol=atol) # run propagation and get trajectory trajectory = prop.gen_trajectory(rv_init, TimeInterval(prop_start, prop_duration)) print(trajectory) ``` Propagating an orbit around some other planet or celestial body is carried out similarly. The satellite has to be initialised around the celestial body (e.g. inertial frame around Moon), and the propagator has to be set up accordingly (with a force model for the Moon). The following code initialises a satellite around Moon (frame set to `MoonCRS` or the ICRF centred at Moon), sets up the numerical propagator and propagates the satellite around the Moon starting 0.5 days after the initial condition and for a duration of 3 days. ```python from astropy import units as u from astropy.coordinates import ( CartesianDifferential, CartesianRepresentation, SkyCoord ) from astropy.time import Time from satmad.core.celestial_bodies_lib import MOON from satmad.coordinates.frames import MoonCRS from satmad.propagation.numerical_propagators import NumericalPropagator, ODESolverType from satmad.utils.timeinterval import TimeInterval # Initialises a Moon low-orbit satellite. time = Time("2020-01-01T11:00:00.000", scale="utc") v_moon_crs = CartesianDifferential([1, -1, 0.6], unit=u.km / u.s) r_moon_crs = CartesianRepresentation([1000, 1000, 2000], unit=u.km) rv_init = SkyCoord( r_moon_crs.with_differentials(v_moon_crs), obstime=time, frame=MoonCRS, representation_type="cartesian", differential_type="cartesian", ) # Set up propagation config stepsize = 60 * u.s solver_type = ODESolverType.DOP853 rtol = 1e-13 atol = 1e-15 init_time_offset = 0.5 * u.day duration = 3.00 * u.day # init propagator prop = NumericalPropagator( stepsize, solver_type=solver_type, rtol=rtol, atol=atol, name="", central_body=MOON, ) prop_start = rv_init.obstime + init_time_offset prop_duration = duration # run the propagation trajectory = prop.gen_trajectory(rv_init, TimeInterval(prop_start, prop_duration)) # print the final element print(trajectory.coord_list[-1]) ``` ## Reference/API ```{eval-rst} .. automodule:: satmad.propagation.numerical_propagators :members: :undoc-members: ```
/satmad-0.1.2.tar.gz/satmad-0.1.2/docs/propagation/numerical_propagation.md
0.696475
0.993015
numerical_propagation.md
pypi
# Working with Multiple TLEs ## Lists of Mixed TLEs: {py:class}`.TleStorage` Many applications require working with TLEs from a number of satellites (for example satellites from the same launch or belonging to the same constellation). SatMAD enables loading and flexible filtering of such TLE lists using the {py:class}`.TleStorage` class. For this usecase, the most common application is to load a file (or a string) containing TLE data in text format and filtering satellites with a certain parameter: ```python from pathlib import Path from astropy.time import Time from satmad.propagation.tle_storage import TleFilterParams, TleStorage # use case 1, load from TLE file, filter for a certain satellite number file_path = Path("my_data_dir", "my_tle_file.txt") tle_storage_1 = TleStorage.from_path(file_path) filtered_list_1 = tle_storage_1.filter_by_value(TleFilterParams.SAT_NUMBER, 46495) # use case 2, load from TLE string, filter for a certain epoch with open(file_path, "r") as f: tle_source_str = f.read() tle_storage_2 = TleStorage.from_string(tle_source_str) threshold_time = Time("2021-04-01T00:00:00.000") filtered_list_2 = tle_storage_2.filter_by_range(TleFilterParams.EPOCH, min_value=threshold_time) ``` The example above shows a number of important functionalities. A {py:class}`.TleStorage` object can be initialised using {py:meth}`.TleStorage.from_path` method (from a TLE file) or {py:meth}`.TleStorage.from_string` method (from a string containing a list of TLEs). The latter can be useful to download TLE data from a remote location without saving it to a file. The example shows filtering functionality, which is detailed in the next section. ## Extracting Specific Data from the Lists (Filtering) Once initialised, the TLE list can be filtered using the enumerator {py:class}`.TleFilterParams` and a filtering value. To filter with an element like an identifier (e.g. name or catalogue number) where an exact match can be found, `filter_by_value` method should be used. In the example above, a satellite with the catalogue number "46495" is extracted from the list. Conversely, if a range rather than an exact match is sought (e.g. semimajor axis, epoch or eccentricity), then `filter_by_range` method should be used. In the example above, a threshold epoch is given and all TLE values after this threshold are extracted. This method can accept a minimum, a maximum or both, such that: max_value > param > min_value Continuing the example above, we can illustrate a few other filtering examples: ``` # filtering with a max and min epoch dates min_threshold_time = Time("2021-04-01T00:00:00.000") max_threshold_time = Time("2021-06-01T00:00:00.000") filtered_list_3 = tle_storage_2.filter_by_range(TleFilterParams.EPOCH, min_value=min_threshold_time, max_value=max_threshold_time) from astropy import units as u # filtering with a min inclination min_inclination = 90 * u.deg filtered_list_4 = tle_storage_2.filter_by_range(TleFilterParams.INCLINATION, min_value=min_inclination) # filtering with a max semimajor axis max_sma = 7000 * u.km filtered_list_5 = tle_storage_2.filter_by_range(TleFilterParams.SM_AXIS, max_value=max_sma) ``` One important thing to note is that, the filtering value should be given as a {py:class}`astropy.units.quantity.Quantity` i.e., with a unit as the values are kept as Quantities under the hood. The code simply does not know how to interpret "7000" without units (kilometres or metres?). This saves from the all too usual interfacing and unit specification errors. The second thing to note is that the resulting filtered list is another `TleStorage` object, with its internal `tle_list` backed by the source object. In other words, the filtering does not create new TLE objects. Clearly, if the backing list is somehow changed, then all the other filtered lists may change as well. Finally, if the filter results in an empty list, then a new `TleStorage` object is still returned, with an empty internal `tle_list`. In addition to the `filter_by_value` and `filter_by_range` methods, there is a third and very powerful method to filter the TLEs through user defined functions. In `filter_by_func`, a user-defined function takes one parameter related to the TLE and returns `True` or `False` through some test. It is even possible for this filter function to accept the entire TLE (as opposed to a single parameter, for more complicated computations). The semimajor axis filter above can be written with this method, sending the semimajor axis or the entire TLE. ```python from pathlib import Path from astropy import units as u from satmad.propagation.tle_storage import TleFilterParams, TleStorage # load TLEs from file file_path = Path("my_data_dir", "my_tle_file.txt") tle_storage = TleStorage.from_path(file_path) # define the filter function and filter the list def sma_filter(a): """Semimajor axis filter min/max.""" return True if 7100 * u.km > a > 7000 * u.km else False filtered_list_sma_1 = tle_storage.filter_by_func(TleFilterParams.SM_AXIS, sma_filter) # define the filter function and filter the list def tle_filter(tle): """Semimajor axis filter min/max.""" return True if 7100 * u.km > tle.sm_axis > 7000 * u.km else False filtered_list_sma_2 = tle_storage.filter_by_func(TleFilterParams.TLE, tle_filter) ``` Note that, `TleFilterParams.TLE` is available for `filter_by_func` method only, as the behaviour with an entire TLE is not well-defined with `filter_by_value` and `filter_by_range` methods. ## Lists of TLEs of the Same Satellite: {py:class}`.TleTimeSeries` A specific class {py:class}`.TleTimeSeries` exists to store the multiple TLEs from a single satellite with time ordering (epoch values). This is particularly useful to plot the orbit or to feed it to a propagator to propagate the satellite orbit through multiple TLEs. The ideal way to initialise it is to initialise a `TleStorage` from a file or another source and then filter for a single orbit. The code below initialises a `TleStorage` from a file and filters for the satellites with the catalogue number `37791`. ```python from pathlib import Path from satmad.propagation.tle_storage import TleStorage file_path = Path("my_data_dir", "my_tle_file.txt") tle_timeseries = TleStorage.from_path(file_path).to_tle_timeseries(37791) ```` Filtering is possible using the same methods as `TleStorage` given in the [TLE Filtering](#extracting-specific-data-from-the-lists-filtering) section. ## Reference/API ```{eval-rst} .. automodule:: satmad.propagation.tle_storage :members: :undoc-members: ```
/satmad-0.1.2.tar.gz/satmad-0.1.2/docs/propagation/tle_storage.md
0.829457
0.982574
tle_storage.md
pypi
# Representing Orbits with Classical (Keplerian) Elements ## Introduction to Keplerian Orbital Elements Perhaps the most well-known representation of the orbit is the Classical or Keplerian Elements. These elements are based on 6 parameters (conic geometry and its orientation in space) and are equivalent to the 6 element cartesian coordinates (position and velocity). A long and detailed definition is well beyond the scope of this documentation. More information can be found in the [TLE page in Wikipedia](https://en.wikipedia.org/wiki/Orbital_elements). However, it must be noted that, these elements have singularities and ill-defined parameters for some special but common cases (such as true anomaly and argument of periapsis when the orbit is equatorial), and the implementation generally handles them gracefully. That said, parabolic orbits (eccentricity = 1.0) cannot be handled. ## Mean vs Osculating Elements A not very obvious fact to those learning about the Keplerian Orbital Elements is that it is just a format to represent the orbit; without further definition, it is not very useful. This is similar to cartesian coordinates needing a coordinate system definition to actually represent a position in space. The actual implementation of the Keplerian Elements rests on the force model under which they are generated. For example, the [TLEs ](tle.md) are Mean Keplerian Orbital Elements generated with a specific theory that includes linearised J2, J3 and J4 zonal harmonics and the elements are defined in True Equator, Mean Equinox coordinate frame. They would be incompatible with other Mean Elements generated with other force models and theories. Osculating Keplerian Orbital Elements are generated with a two-body force model. Therefore, over a trajectory generated with a two-body force model, the Osculating Keplerian Orbital Elements (apart from true anomaly) should stay constant, limited by the accuracy of the trajectory generation algorithm. On the other hand, osculating orbital elements should be used with care, particularly in contexts where instantaneous orbital elements are computed on a trajectory generated by a non-two-body model (e.g. including geopotentials). The orbital elements will *not* stay constant along the trajectory, simply because the force model over successive points are not strictly two-body. ## Initialising and Using the Keplerian Orbital Elements There is an Abstract Base Class {py:class}`.AbstractKeplerianOrbitElements`, from which the concrete implementation {py:class}`.OsculatingKeplerianOrbElems` derive. It represents the Osculating Orbital Elements for coordinates in the local inertial frame (e.g. GCRS for the Earth). The usual way to initialise the class is via initial orbital elements (note the initialisation with units): ```python from astropy.time import Time from astropy import units as u from satmad.core.celestial_bodies_lib import EARTH from satmad.propagation.classical_orb_elems import OsculatingKeplerianOrbElems time = Time("2020-01-11T11:00:00.000", scale="utc") central_body = EARTH sm_axis = 7055.95320378 * u.km ecc = 0.0020835 * u.dimensionless_unscaled incl = 1.71234602 * u.rad raan = 4.42402394 * u.rad arg_perigee = 5.23982923 * u.rad true_an = 1.5 * u.rad orb_elems = OsculatingKeplerianOrbElems( time, sm_axis, ecc, incl, raan, arg_perigee, true_an, central_body ) ``` The second way to initialise the orbital elements is via cartesian coordinates, through the {py:meth}`.OsculatingKeplerianOrbElems.from_cartesian` method. The initial cartesian coordinates can be in any frame, they are automatically converted to the inertial frame of the central body. Once the Osculating Keplerian Elements are initialised, it is possible to query the parameters, and some derived parameters like period or radius of periapsis and apoapsis. ```python from astropy.time import Time from astropy import units as u from astropy.coordinates import GCRS, CartesianDifferential, CartesianRepresentation from satmad.core.celestial_bodies_lib import EARTH from satmad.coordinates.frames import init_pvt from satmad.propagation.classical_orb_elems import OsculatingKeplerianOrbElems time = Time("2020-01-11T11:00:00.000", scale="utc") central_body = EARTH r = CartesianRepresentation([7.213392947764267e+03, 8.523654531348812e+01, 2.783146976770290e-16], unit=u.km) v = CartesianDifferential([5.902225938368851e-02, 7.421779936019859e+00, 1.595360086373873e-18], unit=u.km / u.s) rv_init = init_pvt(GCRS, time, r.with_differentials(v)) orb_elems = OsculatingKeplerianOrbElems.from_cartesian(rv_init, central_body) # Query parameters print(f"Semimajor axis: {orb_elems.sm_axis}") print(f"Period: {orb_elems.period}") print(f"Radius of Periapsis: {orb_elems.periapsis}") print(f"Period: {orb_elems.true_anomaly.to(u.deg)}") ``` Another useful output of the Osculating Keplerian Elements to convert them to the cartesian position and velocity in the inertial coordinate frame belonging to the orbital elements. Just appending the following line to the first example will yield the cartesian coordinates in a `SkyCoord` object. >>> rv = orb_elems.to_cartesian() >>> print(rv) The conversions to and from the cartesian coordinates are based on GMAT [[OM3]](../references.md#orbital-mechanics). Note that the classical orbital elements have a number of singularities for a lot of common orbits (e.g. circular and/or equatorial). GMAT Mathematical Specifications handles these cases gracefully, but care must be taken when interpreting the results. In some cases, return-trip testing may not be successful. However, the code is tested against GMAT and is working as expected. ## Reference/API ```{eval-rst} .. automodule:: satmad.propagation.classical_orb_elems :members: :undoc-members: ```
/satmad-0.1.2.tar.gz/satmad-0.1.2/docs/propagation/classical_orb_elems.md
0.810704
0.994667
classical_orb_elems.md
pypi
# Representing Orbits with Two-Line Elements (TLEs) ## Introduction to TLEs A two-line element set (TLE) is a data format containing a set of TEME (True Equator, Mean Equinox) mean orbital elements of an Earth-orbiting object for a given point in time, called the Epoch Time. These orbital elements are solely for use with the SGP4 propagator as the two are coupled with the underlying analytical orbit theory. [[OM1]](../references.md#orbital-mechanics) See the [TLE page in Wikipedia](https://en.wikipedia.org/wiki/Two-line_element_set) or [Space-Track definition](https://www.space-track.org/documentation#tle) for more information. An example TLE is given as: ISS (ZARYA) 1 25544U 98067A 08264.51782528 -.00002182 00000-0 -11606-4 0 2927 2 25544 51.6416 247.4627 0006703 130.5360 325.0288 15.72125391563537 A TLE object is usually initialised from these two lines of strings: >>> line1 = "1 25544U 98067A 08264.51782528 -.00002182 00000-0 -11606-4 0 2927" >>> line2 = "2 25544 51.6416 247.4627 0006703 130.5360 325.0288 15.72125391563537" >>> tle = TLE.from_tle(line1, line2, "ISS (ZARYA)") ## Components of a TLE A TLE contains the well-known mean classical (or Keplerian) orbital elements such as Mean Anomaly, Right Ascension of the Ascending Node or Argument of Perigee. A semimajor axis is not directly defined, but the mean motion term given in revolutions/day can be used to derive the semimajor axis in a straightforward fashion. For example, a mean motion of 14.5 revolutions/day is equivalent to an orbital period of 5958.62 seconds, or a mean motion ($n$) of 0.00106 radians/second. Then the usual semimajor axis ($a$) can be derived from $a^3 n^2=\mu$, where $\mu$ is equal to the Gravitational Constant ($G$) times the mass of the Earth ($M$). In this example, the semimajor axis is equal to 7079.056 km. In addition to the usual classical orbital elements, other components of the TLE are (adapted from the [Space-Track definition](https://www.space-track.org/documentation#tle)): * Satellite catalog number (NORAD ID): The unique string representation of the object in space, assigned by USSTRATCOM. For example, the input integer of `25544` means ISS ZARYA module * International Designator (COSPAR ID or NSSDCA ID): The unique string representation of the object in space. The field in the TLE `98067A` means 1998-067A, which means the Object A belonging to the 67th launch in the year 1998. * Ballistic Coefficient: Also called the first derivative of mean motion, this is the daily rate of change in the number of revs the object completes each day, divided by 2. Units are revs/day. This is "catch all" drag term used in the Simplified General Perturbations (SGP4) USSPACECOM predictor. * Second Derivative of Mean Motion: The second derivative of mean motion is a second order drag term in the SGP4 propagator used to model terminal orbit decay. It measures the second time derivative in daily mean motion, divided by 6. Units are $revs/day^3$. * Drag Term (BSTAR): Also called the radiation pressure coefficient, the parameter is another drag term in the SGP4 predictor. Units are $1/earth radii$. ## Initialising the TLEs While a TLE can be initialised using the regular {py:class}`.TLE` constructor by specifying the large number of initial parameters, by far the most usual way is to use the {py:meth}`.TLE.from_tle` method, with the regular two line input from an external source (see [Introduction to TLEs Section](#introduction-to-tles) for an example). Some external sources to retrieve TLEs are listed in [TLE Repositories Section](#common-tle-repositories). Another way to initialise the TLE is by orbit type. For example, initialising a geostationary satellite TLE is as easy as defining a reference time and a target longitude: >>> from astropy import units as u >>> from satmad.propagation.tle import TLE >>> tle_geo = TLE.init_geo(Time("2020-06-10T12:13:14.000"), 42 * u.deg) >>> print(tle_GEO) No Name 1 99999U 12345A 20162.50918981 .00000000 00000-0 00000+0 0 15 2 99999 0.0000 124.6202 0000000 0.0000 0.0000 1.00273791 04 Similarly, a circular sun-synchronous orbit at 800 km reference altitude (at Equator) and at a Local Time of the Ascending Node (LTAN) at 10:30 can be initialised simply with: >>> from astropy import units as u >>> from satmad.propagation.tle import TLE >>> alt = 800 * u. km >>> ltan = 10.5 >>> tle_sso = TLE.init_sso(Time("2020-06-10T12:13:14.000"), alt, ltan) >>> print(tle_sso) No Name 1 99999U 12345A 20162.50918981 .00000000 00000-0 00000+0 0 15 2 99999 98.6032 56.8119 0000000 0.0000 0.0000 14.27530325 07 Other parameters such as eccentricity, argument of perigee or mean anomaly can be optionally set to initialise with the requested values. ## Checking the Orbit Properties Once the TLE is initialised, it is then possible to query orbit parameters such as inclination, eccentricity or node rotation rate (to check whether the satellite is sun-synchronous): >>> tle.sm_axis() <Quantity 6796.50623984 km> >>> tle.period() <Quantity 5576.21313766 s> The parameters have their quantities attached, so it is possible to easily convert them to more convenient units: >>> tle.inclination.to(u.deg) <Quantity 51.6454 deg> Please see the example [Analysis of a Repeating Sun-Synchronous Orbit](../tutorials/sso_analysis.ipynb)_ for more information. See [[OM2]](../references.md#orbital-mechanics) for more information on Sun-Synchronous Orbits. ## Common TLE Repositories * Space-Track: <https://www.space-track.org/> * Celestrak: <http://celestrak.com/NORAD/elements/> * Heavens Above: <https://heavens-above.com> ## Reference/API ```{eval-rst} .. automodule:: satmad.propagation.tle :members: :undoc-members: ```
/satmad-0.1.2.tar.gz/satmad-0.1.2/docs/propagation/tle.md
0.912597
0.988016
tle.md
pypi
# Coordinate Systems and Frames In SatMAD, frames and coordinate systems as well as conversions between them are handled through [Astropy](https://docs.astropy.org/en/latest/coordinates/index.html). This section introduces the additional frames defined by SatMAD. ## Local Frames of Celestial Bodies ({py:class}`.CelestialBody`, {py:class}`.CelestialBodyJ2000Equatorial` and {py:class}`.CelestialBodyTODEquatorial`) In addition to Earth, it is possible to define a Celestial Body in space through the {py:class}`.CelestialBody` class. For each such Celestial Body, it is then possible to realise local reference frames. The first of them is a local inertial or "Celestial Reference System" (CRS) ({py:class}`.CelestialBodyCRS`). This class simply translates the ICRS coordinate system to the centre of the celestial body. As such, the XY plane does not correspond to the equator plane. This enables the user to define coordinates in this local inertial coordinate system and then (as an example) run an orbit propagation around it or run an analysis. For example, the following would define a "Sun CRS" (equivalent to Heliocentric Celestial Reference System), and a "Moon CRS" by simply subclassing {py:class}`.CelestialBodyCRS`. ```python from satmad.coordinates.frames import CelestialBodyCRS class SunCRS(CelestialBodyCRS): body = "Sun" class MoonCRS(CelestialBodyCRS): body = "Moon" ephemeris_type = "jpl" ``` In the latter, the optional `ephemeris_type` parameter determines which ephemeris to use when computing the location of the Celestial Bodies. Note that, while some frames like {py:class}`.MoonCRS` and {py:class}`.MarsCRS` are predefined, and other Planets can be easily created as shown. Similarly, one other inertial and one nutating-precessing frame can be defined for each Celestial Body: {py:class}`.CelestialBodyJ2000Equatorial` and {py:class}`.CelestialBodyTODEquatorial`. The former is an inertial equatorial frame with the alignment fixed at J2000 Epoch. The latter is an equatorial frame but its orientation is computed with the instantaneous orientation due to planetary nutation and precession: $$ \vec{r}_{CRS} = R_x(90+ \alpha) R_z(90- \delta)\times \vec{r}_{TOD} $$ New frames can be defined, inspecting the preset Mars frames: ```python from satmad.coordinates.frames import CelestialBodyJ2000Equatorial, CelestialBodyTODEquatorial, MarsCRS class MarsTODEquatorial(CelestialBodyTODEquatorial): body_name = "Mars" cb_crs = MarsCRS class MarsJ2000Equatorial(CelestialBodyJ2000Equatorial): body_name = "Mars" cb_crs = MarsCRS ``` Similar to the {py:class}`.CelestialBody` class, `body_name` defines the name of the body, such that its coordinates can be computed within the ICRS using builtin or JPL DE4XX ephemerides. The `cb_crs` parameter links this frame to CRS inertial frame of this body, as SatMAD (or Astropy) would not know how to chain the coordinate conversions from this frame to (for example) HCRS. The definition of these coordinate systems require the modelling of how the planet is oriented with respect to ICRS. This is done via the Celestial Body Rotation parameters: right ascension and declination of the celestial body North Pole, and prime meridian angle. As can be imagined, these are different for each planet - the values used in this model are taken from [Report on IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015 [TCF2]](../references.md#time-and-coordinate-frames), except for the Moon, which is taken from the 2009 version of the same report. As such, these values are incompatible with, yet much more up-to-date than GMAT and [NASA HORIZONS Web Interface](https://ssd.jpl.nasa.gov/horizons.cgi), which use the much simpler 2000 version of these models. The TOD and J2000 Equatorial frame definitions are given in [[OM1], [OM3] and [OM4]](../references.md#time-and-coordinate-frames). The {py:class}`.CelestialBodyCRS` class corresponds to setting the frame as "ICRF" around a central body in GMAT. The {py:class}`.CelestialBodyJ2000Equatorial` is equivalent to "Body Inertial" and {py:class}`.CelestialBodyTODEquatorial` to "Body Equatorial" in GMAT. ## Earth Based Additional Frames (J2000) The built-in frames offered by [Astropy](https://docs.astropy.org/en/latest/coordinates/index.html) do not include some frames that are used in satellite applications. To bridge this gap, this package offers Mean Pole and Equinox at J2000.0 Reference System ({py:class}`.J2000`). {py:class}`.J2000` coordinate frame is similar to GCRS but rotated by a constant frame bias [[TCF1]](../references.md#time-and-coordinate-frames): $$ \vec{r}_{J2000} = B \times \vec{r}_{GCRS} $$ This rotation is applicable only to the equinox based approach, and is only an approximation. The difference between GCRS and J2000 is less than 1 metre for the Low Earth Orbit, therefore these two can be used interchangeably with a small error. The {py:class}`.J2000` class is similar to (and compatible with) the [Astropy Built-in Frames](https://docs.astropy.org/en/latest/coordinates/index.html#built-in-frame-classes). ```python from astropy import units as u from astropy.coordinates import CartesianRepresentation, CartesianDifferential from satmad.coordinates.frames import J2000 from astropy.time import Time time = Time("2020-01-11T11:00:00.000", scale="utc") v_j2000 = CartesianDifferential([-4.7432196000, 0.7905366000, 5.5337561900], unit=u.km / u.s) r_j2000 = CartesianRepresentation([5102.50960000, 6123.01152000, 6378.13630000], unit=u.km) rv_j2000 = J2000(r_j2000.with_differentials(v_j2000), obstime=time, representation_type="cartesian", differential_type="cartesian") ``` ## Reference / API ```{eval-rst} .. automodule:: satmad.coordinates.frames :members: :undoc-members: .. automodule:: satmad.coordinates.planetary_rot_elems :members: :undoc-members: ```
/satmad-0.1.2.tar.gz/satmad-0.1.2/docs/coordinates/frames.md
0.728555
0.99174
frames.md
pypi
# Finding Events and Intervals in Discrete Time Data ## Introduction A common family of problems in satellite mission analysis involve finding *events* and *intervals* such as finding the communication times of a satellite with a groundstation, satellite eclipse entrance and exit times or finding the exact time a satellite crosses the Equator. They require the precise calculation of the time when a calculated value (or its derivative) crosses a certain threshold. Usually the data is not defined as a continuous and differentiable function, but only as a discrete data set corresponding to the variation of a value with respect to time. To be able to solve this problem, the {py:mod}`.discrete_time_intervals` module provides the {py:class}`.DiscreteTimeEvents` class. This class generates an interpolator for the data set and computes the roots to find the start / end events that mark intervals within this data set. Similarly, it computes the derivative of this interpolator and computes the roots again to find the max / min events within this data set. ## Using the {py:class}`.DiscreteTimeEvents` Class The {py:class}`.DiscreteTimeEvents` class is designed as a helper to interpret the values representing the behaviour of a parameter. A simple use case would be to "for a given ground location, compute the sunrise and sunset times as well as the time of the highest point of the Sun in the sky". If the location has mountains around it, limiting the view of the Sun, a minimum elevation can also be defined. The altitude or elevation values of the Sun as seen from a ground location would be computed elsewhere and fed into this class. Therefore, in this problem formulation, the `value_list` would be the Sun altitude values in degrees over several days and the `time_list` would be the times corresponding to these altitude values. `crossing_value` would be zero for horizon or perhaps 5, to illustrate the minimum altitude. Finally, as sunrise is defined as the altitude crossing from negative to positive, the `neg_to_pos_is_start` parameter would be set to `True`. If the night duration was sought, then this would be set to `False`, as night is defined as the time when the altitude of the Sun changes from positive to negative (except things are a bit more complicated than that, see here for more information on [different types of twilight](https://www.timeanddate.com/astronomy/different-types-twilight.html)). To retrieve the sunrise / sunset intervals, the `start_end_intervals` can be queried, yielding a list of intervals. Similarly, to find the times when the Sun is at the highest point, the `max_min_table` can be queried. Note that, by definition, only the max / min events inside the intervals are shown, and the remaining events are filtered. Therefore, the max / min table will only have the Sun highest points where it is above horizon and not the lowest points where it is well below the horizon and is technically midnight. The class also supports events that has no definite start or end. For example, if the Sun was already up at the first element of the `time_list`, then the first interval starts at that time. Similarly, if the Sun has not set at the final element of the `time_list`, then the last interval is closed with this last element. If the Sun was up all through the `time_list`, then there will be a single interval from beginning to the end. Conversely, if the Sun was not up at all throughout the data points, then there will be no intervals. ## Interpolation, Time Step and Accuracy The interpolator {py:class}`scipy.interpolate.CubicSpline` is used under the hood to interpolate the values. The accuracy of the start / end as well as max / min events is defined by the time step of the data, depending on the problem. For example, the sunrise / sunset problem above is very slowly varying and would not require a time step of 60 seconds. On the other hand, finding the communication times of a LEO satellite accurately would potentially require a stepsize of 20-40 seconds. Therefore, it is highly recommended checking the convergence with smaller time steps and decide on a time step for the specific problem and required level of accuracy. Coarse data with large time steps can still yield reasonably accurate results if the slope around the "root" is steep (i.e., transition from negative to positive values happening very quickly and clearly). On the other hand, slowly varying events and coarse data do not play well, as it becomes extremely difficult to find the exact point where the maximum point occurs. For example, for an observer on the ground, the Sun moves very slowly around its highest point, with its derivative changing from positive to negative. With a coarse data set, it is very challenging for a numerical algorithm to find the exact time with a high accuracy. Finally, best results can be had with continuous and smooth data. Heavy non-linearities require very small time steps and there is no guarantee that discontinuities will be handled well. As with all numerical algorithms, you should *"know thy problem"*. ## Reference/API ```{eval-rst} .. automodule:: satmad.utils.discrete_time_events :members: :undoc-members: ```
/satmad-0.1.2.tar.gz/satmad-0.1.2/docs/utils/discrete_time_events.md
0.91275
0.996205
discrete_time_events.md
pypi
# Time Intervals and Time Interval Lists ## Introduction Time intervals are critical to define the start and end of certain events such as start and end of communications with a groundstation, entering and exiting the eclipse or start and end of a thruster firing. This is particularly useful when two intervals (or sets of intervals) can be evaluated through operations such as *union* and *intersection*. This enables us to answer questions such as "What are the time intervals where thruster firings occur during communications?" (an intersection operation between 'intervals of thruster firings' and 'communications interval lists') or "When can I see a satellite at night?" (an intersection operation between intervals of 'satellite above horizon', 'sun below horizon' and 'satellite not in eclipse'). The {py:mod}`.timeinterval` module provides the basic time interval functionality with the {py:class}`.TimeInterval` class i.e., a time interval with a start and end time/date, using the high precision {py:class}`astropy.time.Time` classes under the hood to represent time and {py:class}`portion.interval.Interval` class to manage and manipulate the time intervals. A {py:class}`.TimeInterval` can interact with other intervals through {py:meth}`.TimeInterval.union` and {py:meth}`.TimeInterval.intersect` methods. They can change their size through {py:meth}`.TimeInterval.expand` and they can check whether they contain ({py:meth}`.TimeInterval.contains`) or intersect with ({py:meth}`.TimeInterval.is_intersecting`) another time interval. A list of such time intervals constitute {py:class}`.TimeIntervalList` class. A list also has a start and end of validity. This usually marks the start and end of an analysis. For example, a communications list that is valid for one day and containing no time intervals would mean that there are no communication opportunities for that day. The list can simply be inverted ({py:meth}`.TimeIntervalList.invert`) to get a list of 'no communication duration', which would then show a list with a single {py:class}`.TimeInterval` that spans the entire duration of validity. ## Using the Basic {py:class}`.TimeInterval` Class A {py:class}`.TimeInterval` class can be simply initialised with a start time and either with an end time ({py:class}`astropy.time.Time`) or with a duration ({py:class}`astropy.time.TimeDelta`). These start and end times can be retrieved by the properties {py:meth}`.TimeInterval.start` and {py:meth}`.TimeInterval.end`. ```python from astropy.time import Time, TimeDelta from satmad.utils.timeinterval import TimeInterval interval_with_end_time = TimeInterval( Time("2020-04-11T00:00:00.000", scale="utc"), Time("2020-04-11T00:10:00.000", scale="utc"), ) interval_with_duration = TimeInterval( Time("2020-04-11T00:00:00", scale="utc"), TimeDelta(60.0, format='sec'), ) ``` The resulting time intervals can be quickly shown as: >>> str(interval_with_end_time) '[ 2020-04-11T00:00:00.000 2020-04-11T00:10:00.000 ]\n' >>> str(interval_with_duration) '[ 2020-04-11T00:00:00.000 2020-04-11T00:01:00.000 ]\n' > The end time of the interval should be later than the start time. Otherwise, a `ValueError` will be raised. The {py:class}`.TimeInterval` class can answer some questions: - {py:meth}`.TimeInterval.is_in_interval`: Is a given time within this interval? - {py:meth}`.TimeInterval.is_equal`: Is a given interval equal to this interval? - {py:meth}`.TimeInterval.is_intersecting`: Does a given interval have an intersection with this interval? - {py:meth}`.TimeInterval.contains`: Does a given interval contain this interval? - {py:meth}`.TimeInterval.duration`: What is the duration of this interval? Some examples are given below: >>> interval_with_end_time.is_in_interval(Time("2020-04-11T00:05:00.000", scale="utc")) True >>> interval_with_end_time.is_equal(TimeInterval(Time("2020-04-09T00:00:00", scale="utc"), TimeDelta(600.0, format="sec"))) True >>> interval_with_end_time.is_intersecting(TimeInterval(Time("2020-04-11T00:05:00", scale="utc"), TimeDelta(600.0, format="sec"))) True >>> interval_with_end_time.contains(TimeInterval(Time("2020-04-11T00:05:00", scale="utc"), TimeDelta(60.0, format="sec"))) True >>> interval_with_end_time.duration().sec 599.9999999999931 The intervals can be expanded or shrunk through the {py:meth}`.TimeInterval.expand` method and defining positive or negative {py:class}`astropy.time.TimeDelta` values to modify the start and end times of the interval. >>> str(interval_with_end_time) '[ 2020-04-11T00:00:00.000 2020-04-11T00:10:00.000 ]\n' >>> expanded = interval_with_end_time.expand(start_delta=TimeDelta(60.0, format="sec"), end_delta=TimeDelta(-120.0, format="sec")) >>> str(expanded) '[ 2020-04-10T23:59:00.000 2020-04-11T00:08:00.000 ]\n' Time intervals can be subjected to an intersection (a new `TimeInterval` that is the intersection of two intervals) or union (a new `TimeInterval` that is the union of two intervals) operator. These operators are possible only when these two intervals have some intersection - otherwise the result will be a `None`. >>> str(interval_with_end_time.union(expanded)) '[ 2020-04-10T23:59:00.000 2020-04-11T00:10:00.000 ]\n' >>> str(interval_with_end_time.intersect(expanded)) '[ 2020-04-11T00:00:00.000 2020-04-11T00:08:00.000 ]\n' ## List of time intervals: The {py:class}`.TimeIntervalList` Class The {py:class}`.TimeIntervalList` usually will not be generated explicitly by a user, except, for example, as an external constraint such as the durations when a groundstation is not available. Usually such lists are results of certain analyses such as eclipse intervals for a location on ground or different attitude profiles for a satellite. The {py:class}`.TimeIntervalList` class stores the {py:class}`.TimeInterval` objects as well as another `TimeInterval` to represent the bounds of the validity of this list. If this validity interval is not defined explicitly, then it is assumed to start with the beginning of the first `TimeInterval` and end with the end of the final `TimeInterval`. Operations such as {py:meth}`.TimeIntervalList.intersection` and {py:meth}`.TimeIntervalList.union` are also possible for two `TimeIntervalList` objects. As a `TimeIntervalList` is defined for a certain validity interval, the union or intersection of two `TimeIntervalList` objects will yield another `TimeIntervalList` that is only valid for the intersection of validity of these two intervals. Any interval within the list can be queried through {py:meth}`.TimeIntervalList.get_interval` method. Similarly, the `TimeInterval` that keeps the interval of validity can be queried through {py:meth}`.TimeIntervalList.valid_interval` property. The `TimeIntervalList` will yield a new, inverted (or complementing) version of itself through the {py:meth}`.TimeIntervalList.invert` method. For example, for a single interval of `[t0, t1]` in a validity interval `[T0,T1]`, the inverted interval list would be `[T0,t0]` and `[t1,T1]`. If there are no intervals, the inverse becomes the entire validity interval. ## Reference/API ```{eval-rst} .. automodule:: satmad.utils.timeinterval :members: :undoc-members: ```
/satmad-0.1.2.tar.gz/satmad-0.1.2/docs/utils/timeinterval.md
0.822439
0.993537
timeinterval.md
pypi
# First Steps in SatMAD: Propagating an Orbit with a TLE This tutorial illustrates some of the basic functionalities of SatMAD (see the [documentation](https://satmad.readthedocs.io) for the latest or more advanced functionalities). Many of the satellite mission analysis and design problems have four steps: 1. Initialise an orbit 2. Propagate the orbit to generate the trajectory over a duration 3. Do some analysis with this trajectory 4. Plot the results In this tutorial we will go over these four basic steps to show how SatMAD works. The first step is to initialise the orbit. For this task we will start with a telecommunications satellite on a geostationary orbit. The up-to-date orbital elements of Turksat-4A can be retrieved from [Celestrak website](https://celestrak.com/satcat/tle.php?CATNR=39522). ``` from satmad.propagation.tle import TLE name = "TURKSAT 4A" line1 = "1 39522U 14007A 20193.17132507 .00000144 00000-0 00000+0 0 9992" line2 = "2 39522 0.0769 271.0842 0000679 241.5624 240.5627 1.00268861 23480" tle = TLE.from_tle(line1, line2, name) print(tle) ``` This initialises the orbit from the [Two-Line-Element](https://celestrak.com/NORAD/documentation/tle-fmt.php) data. The next step is to propagate the orbit. In this example, we define the propagator `sgp4` with an output stepsize of 120 seconds. We then define an interval with a start time and a duration. Finally, we propagate the orbit with `gen_trajectory()`, taking the inputs of `tle` (initial orbit) and propagation interval. The output is the trajectory in GCRS coordinate frame. ``` from satmad.utils.timeinterval import TimeInterval from satmad.propagation.sgp4_propagator import SGP4Propagator from astropy import units as u from astropy.time import Time # init SGP4 sgp4 = SGP4Propagator(stepsize=120 * u.s) # Propagate 3 days into future interval = TimeInterval(Time("2020-07-11T00:10:00.000", scale="utc"), 3.0 * u.day) rv_gcrs = sgp4.gen_trajectory(tle, interval) print(rv_gcrs) ``` The third step is to do some analysis with this trajectory. In theory, a geostationary orbit is *stationary* with respect to the rotating Earth. For this simple example, we can check whether this definition holds and how the satellite moves in the Earth-fixed frame. To this end, we should first convert the internal coordinates data in GCRS to the Earth-fixed (ITRS) coordinates. The next step is to set a reference value and check how much the satellite position deviate in time from this reference position. Note that the coordinate transformations are handled by [Astropy](https://www.astropy.org/). ``` # convert GCRS to ITRS rv_itrs = rv_gcrs.coord_list.transform_to("itrs") # set reference coordinates and generate position & velocity differences rv_itrs_ref = rv_itrs[0] r_diff = ( rv_itrs.cartesian.without_differentials() - rv_itrs_ref.cartesian.without_differentials() ) v_diff = rv_itrs.velocity - rv_itrs_ref.velocity # Compute max position and velocity deviation print(f"Max position deviation: {r_diff.norm().max()}") print(f"Max velocity deviation: {v_diff.norm().max().to(u.m / u.s)}") ``` This shows that the maximum deviation from the reference position was more than 80 km. Similarly, the maximum velocity difference was more than 5 m/s. These are not small differences, and they are actually due to the force model assumptions and orbit maintenance strategy in GEO. However, we would like to understand these differences a bit more and this necessitates the final step: plotting the results. ``` from astropy.visualization import time_support from astropy.visualization import quantity_support from matplotlib import pyplot as plt quantity_support() time_support() fig1 = plt.figure() ax1 = fig1.add_subplot(2,1,1) ax2 = fig1.add_subplot(2,1,2) plt.suptitle("Departure from Initial Position and Velocity") fig1.subplots_adjust(hspace=0.5) ax1.set_ylabel("Pos diff (km)") ax1.plot(rv_itrs.obstime, r_diff.norm()) ax2.set_ylabel("Vel diff (m/s)") ax2.plot(rv_itrs.obstime, v_diff.norm().to(u.m / u.s)) plt.show() ``` The results show a periodic motion with respect to the initial point, as well as a linear departure. Perhaps more useful is to see this motion on a latitude-longitude plot, where we can see how *geostationary* the satellite is. Usually satellite operators define a control box in this coordinate frame and make sure the satellite stays in this box. ``` from matplotlib.ticker import FormatStrFormatter from astropy.coordinates import EarthLocation # Generate lat-lon data lla = EarthLocation.from_geocentric( rv_itrs.cartesian.x, rv_itrs.cartesian.y, rv_itrs.cartesian.z ) # Show lat-lon plot fig2, ax = plt.subplots() ax.grid() ax.xaxis.set_major_formatter(FormatStrFormatter("% 3.3f")) ax.yaxis.set_major_formatter(FormatStrFormatter("% 3.3f")) ax.set_xlabel("Longitude (deg)") ax.set_ylabel("Latitude (deg)") ax.plot(lla.lon, lla.lat) plt.show() ``` We see further proof that there is a periodic motion as well as a linear drift. Any further analysis is beyond the scope of this simple tutorial. That said, we have shown the four fundamental steps of approaching a problem with SatMAD: initialisation, propagation, analysis and plotting the results.
/satmad-0.1.2.tar.gz/satmad-0.1.2/docs/tutorials/satmad_first_steps.ipynb
0.745213
0.986389
satmad_first_steps.ipynb
pypi
# Numerical Orbit Propagation - Part 2 Continuing from the previous tutorial on [Earth-bound numerical orbit propagation](numerical_prop_1.ipynb), this tutorial introduces two concepts: 1. Propagating an orbit around the Moon 2. Propagating an orbit around the Saturn While propagation itself does not differ from the Earth-bound case, each of them is slightly different in the coordinate frames used in the propagation. ## Propagating an Orbit around the Moon For a propagation around the Moon, the procedure is very similar to the Earth-bound case. The first step is to initialise the orbit. Note that the orbit is initialised in the Lunar inertial coordinate frame `MoonCRS`. This frame is provided by `SatMAD`. ``` from astropy import units as u from astropy.coordinates import CartesianDifferential, CartesianRepresentation from astropy.time import Time from satmad.coordinates.frames import init_pvt, MoonCRS, CelestialBodyCRS from satmad.core.celestial_bodies_lib import MOON from satmad.core.celestial_body import CelestialBody from satmad.propagation.numerical_propagators import NumericalPropagator from satmad.utils.timeinterval import TimeInterval # Initialises a Moon low-altitude satellite. time_moon = Time("2020-01-01T11:00:00.000", scale="utc") v_moon_crs = CartesianDifferential([1, -1, 0.6], unit=u.km / u.s) r_moon_crs = CartesianRepresentation([1000, 1000, 2000], unit=u.km) rv_moon_crs = init_pvt(MoonCRS, time_moon, r_moon_crs, v_moon_crs) print(rv_moon_crs) ``` The second step is to initialise the numerical propagator around Moon. Note that, the central body is given explicitly as `MOON`. This is a ["CelestialBody" object](../core/celestial_bodies.md) and a number of default Celestial Bodies are already provided (such as `EARTH` and `MOON`) in the ["celestial_bodies" module](../core/celestial_bodies.md). ``` # propagation config params output_stepsize = 60 * u.s # init propagator prop_moon = NumericalPropagator( output_stepsize, rtol=1e-12, atol=1e-14, central_body=MOON ) ``` The final step is to propagate the orbit. This is not any different from propagation around the Earth. ``` #propagation run params prop_duration = 3 * u.day prop_start = rv_moon_crs.obstime + 0.5 * u.day # run propagation trajectory_moon = prop_moon.gen_trajectory(rv_moon_crs, TimeInterval(prop_start, prop_duration)) print(trajectory_moon) print(f"Coords at time {prop_start + 0.12345 * u.day}:\n{trajectory_moon(prop_start + 0.12345 * u.day)}") ``` ## Propagating an Orbit around the Saturn The last example is doing the same procedure for Saturn. However, Saturn is not one of the default objects made available by SatMAD. So we will have to create the `SATURN` object and the `SaturnCRS`, the Saturn Celestial Reference Frame. ``` class SaturnCRS(CelestialBodyCRS): """Saturn Celestial Reference System. This is simply the ICRS shifted to the centre of the Saturn.""" body = "Saturn" ephemeris_type = "builtin" SATURN = CelestialBody( "Saturn", "User Generated Saturn Model.", 3.7931187E16 * u.m ** 3 / u.s ** 2, inert_coord=SaturnCRS, ) ``` It is important to note that, the name "Saturn" defined in the Celestial Reference Frame (CRS) definition can only be a Solar System Body, given in the list `solar_system_ephemeris.bodies`. This ensures that the planet is recognised, its coordinates are computed and coordinate transformations from another (e.g. Heliocentric) coordinate system can be properly computed. Also note that the `ephemeris_type` is set to `builtin`. This uses the builtin models found in Astropy, which are accurate enough for most applications. It is possible to set this to `jpl` for the default internal implementation of the current JPL model (e.g. DE430), but this may download a very large file the first time it is called. Now that coordinate systems are initialised, we can generate the initial conditions using the `SaturnCRS` coordinate system. ``` # Initialises a Saturn-based satellite. time_saturn = Time("2018-01-01T11:00:00.000", scale="utc") v_saturn_crs = CartesianDifferential([7, 26, 0.5], unit=u.km / u.s) r_saturn_crs = CartesianRepresentation([2000, 10000, 70000], unit=u.km) rv_saturn_crs = init_pvt(SaturnCRS, time_saturn, r_saturn_crs, v_saturn_crs) print(rv_saturn_crs) ``` The next step is to initialise the numerical propagator around Saturn. Note that, the central body is given explicitly as `SATURN`, which is the `CelestialBody` object defined above. This time we initialise with higher tolerance values, but feel free to experiment. ``` # propagation config params output_stepsize = 120 * u.s # init propagator prop_saturn = NumericalPropagator( output_stepsize, rtol=1e-10, atol=1e-11, central_body=SATURN ) ``` The final step is to propagate the orbit. Once again, this is not any different from propagation around the Saturn. ``` #propagation run params prop_duration = 1 * u.day prop_start = rv_saturn_crs.obstime + 0.5 * u.day # run propagation trajectory_saturn = prop_saturn.gen_trajectory(rv_saturn_crs, TimeInterval(prop_start, prop_duration)) print(trajectory_saturn) print(f"Coords at time {prop_start + 0.45321 * u.day}:\n{trajectory_saturn(prop_start + 0.45321 * u.day)}") ```
/satmad-0.1.2.tar.gz/satmad-0.1.2/docs/tutorials/numerical_prop_2.ipynb
0.880618
0.983263
numerical_prop_2.ipynb
pypi
# Getting Familiarised with the TLE object: Analysis of a Repeating Sun-Synchronous Orbit Many Earth observation satellites at Low Earth Orbit (LEO) are in [Sun-Synchronous Orbit](https://en.wikipedia.org/wiki/Sun-synchronous_orbit), where the orbital plane of the satellite keeps a fixed (or changing around a mean) orientation with respect to the sun. This enables the satellite to keep a predictable sun-Earth-satellite orientation, increasing the data production quality. Some of these satellites also keep the orbit in such a way that the satellite [ground-track](https://en.wikipedia.org/wiki/Ground_track) repeats a certain pattern. Some are even in [Frozen Orbits](https://en.wikipedia.org/wiki/Frozen_orbit), where the eccentricity vector (or argument of perigee value is fixed). This enables the satellite to have a fixed (and known) altitude over a given latitude. All of these properties enable the satellite orbit (hence observation conditions as well as mission planning) to be predictable over the course of the mission lifetime. [European Space Agency's Sentinel-2A](https://www.esa.int/Applications/Observing_the_Earth/Copernicus/Sentinel-2) optical earth observation satellite is an example of missions utilising such orbits. It is possible to observe these orbital characteristics from their orbital elements. The up-to-date orbital elements of Sentinel-2A can be retrieved from [Celestrak website](https://celestrak.com/satcat/tle.php?CATNR=40697). The orbital elements are in [Two-Line-Element format](https://celestrak.com/NORAD/documentation/tle-fmt.php). The first step of the analysis is to read the orbital elements to a TLE object. ``` from satmad.propagation.tle import TLE line1 = "1 40697U 15028A 20164.50828565 .00000010 00000-0 20594-4 0 9999" line2 = "2 40697 98.5692 238.8182 0001206 86.9662 273.1664 14.30818200259759" tle = TLE.from_tle(line1, line2, "Sentinel 2A") print(f"Sentinel-2A true semimajor axis: {tle.sm_axis}") ``` Unlike ideal (and unrealistic) two-body dynamics, orbital planes of the satellites rotate due to the primary term of the oblateness of the Earth, or $J_2$ in orbital mechanics parlance. Sun-synchronous orbits are designed to fix that rotation rate to one full rotation per year i.e, this rotation has a period of exactly one year. This keeps the orientation of the orbital plane (ideally) at a fixed angle to the Sun. Therefore, the rate of rotation of the orbital plane (or the node) should be equal to: $$ \frac{360 \deg}{365.25 \text{ days}} = 0.9856262833675564 \deg / \text{day}$$ Coming back to the orbit of Sentinel-2A, once the orbital elements are read, it is possible to query the node rotation rate using the command `node_rotation_rate()`. ``` print(f"Sentinel-2A true node rotation rate: {tle.node_rotation_rate}") ``` As expected, the node rotation rate of Sentinel-2A is very close to (but not exactly equal to) the ideal node rotation rate. In reality, the node rotation rate depends on other forces (like drag and other geopotential terms) and Sentinel-2 orbit is maintained with high accuracy, executing orbit maintenance manoeuvres periodically. It should also be emphasised the TLE orbit parameters are not the high precision values supplied by ESA, but are the measurements from the US Space Surveillance Network and distributed by the [18 SPCS](https://www.space-track.org). Therefore, the mathematical models and the orbit determination precision all play a role in matching the values derived from the simplified analytical models presented here (and the orbital mechanics textbooks). The next step is to check the frozen orbit conditions. Orbit theory suggests that, for frozen orbit, the following conditions should apply: $$ \text{eccentricity} = -\frac{J_3 R_E \sin{i} }{2 J_2 a} $$ $$ \text{argument of perigee} = \omega = 90 \deg $$ We can easily check this with Sentinel-2A: ``` import numpy as np from astropy import units as u a = tle.sm_axis e = tle.eccentricity i = tle.inclination j2 = 0.001082616 j3 = -0.00000253881 r_e = 6378.135 * u.km print(f"ideal eccentricity : {-(j3 * r_e * np.sin(i)) / (2 * j2 * a)}" ) print(f"true eccentricity : {tle.eccentricity}") print(f"true arg of perigee : {tle.arg_perigee.to(u.deg)}") ``` Once again, the results are *close enough*, but not exactly the same. The same caveats apply as before. This example is limited to the basic uses of the `TLE` object, therefore more advanced analyses will not be shown.
/satmad-0.1.2.tar.gz/satmad-0.1.2/docs/tutorials/sso_analysis.ipynb
0.549157
0.987911
sso_analysis.ipynb
pypi
"""Collection of project definitions.""" import logging import os __author__ = "Ian_Hoskins" __credits__ = ["Ian Hoskins"] __license__ = "GPLv3" __maintainer__ = "Ian Hoskins" __email__ = "[email protected]" __status__ = "Development" PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__)) PROJECT_LAB = "Can_Cenik_lab" PROJECT_AUTHOR = "Ian_Hoskins" APPRIS_CONTIG_IDS = "appris_human_v1_actual_regions_contigs.txt" APPRIS_TRX_IDS = "appris_human_v1_actual_regions_trx_ids.txt" APPRIS_GENE_IDS = "appris_human_v1_actual_regions_gene_ids.txt" APPRIS_TRX_FASTA = "appris_human_24_01_2019_selected.fa" GENCODE_TRX_GFF = "gencode.v29.annotation.gtf" GRCH38_FASTA = "GRCh38.fa.gz" NEB_ADAPTER_P5 = "AGACGTGTGCTCTTCCGATCT" # 5' tail of tile-seq R primers NEB_ADAPTER_P5_RC = "AGATCGGAAGAGCACACGTCT" # to be trimmed from 3' end of R1 in tile-seq with NEBNext adapters NEB_ADAPTER_P7 = "TACACGACGCTCTTCCGATCT" # 5' tail of tile-seq F primers NEB_ADAPTER_P7_RC = "AGATCGGAAGAGCGTCGTGTA" # to be trimmed from 3' end of R2 in tile-seq with NEBNext adapters PEZY3_ATTB2_P5 = "ACCACTTTGTACAAGAAAGTTGG" # exists only on the terminal R primer (for last tile) PEZY3_ATTB2_P5_RC = "CCAACTTTCTTGTACAAAGTGGT" PEZY3_ATTB1_P7 = "CAAGTTTGTACAAAAAAGTTGGC" # exists only on the terminal F primer (for tile 1) PEZY3_ATTB1_P7_RC = "GCCAACTTTTTTGTACAAACTTG" PEZY3_ATTB1_EXT_P7 = "TGCTGGAATTGATTAATA" # 5' Extension for tile_1_F primer TILESEQ_UMI_LEN = 8 TILESEQ_NM_ALLOWANCE = 2 TILESEQ_UMI_REGEX = "(?P<umi_1>[ATCG]{%i})" % TILESEQ_UMI_LEN + \ "(?P<discard_1>%s){e<=%i}" % (PEZY3_ATTB1_EXT_P7, TILESEQ_NM_ALLOWANCE) # CR=12 bp adapter duplex "common region" plus T from A tail ligation (13 bp) AMP_CR = "AACCGCCAGGAGT" AMP_CR_RC = "ACTCCTGGCGGTT" AMP_GSP2_TAIL = "GTTCAGACGTGTGCTCTTCCGATCT" AMP_GSP2_TAIL_RC = "AGATCGGAAGAGCACACGTCTGAAC" AMP_UMI_LEN = 8 AMP_UMI_BUFFER = 6 AMP_CR_NM_ALLOWANCE = 2 AMP_UMI_NM_ALLOWANCE = 1 # The final UMI will be composed of the 8 bp MBC, and the first bases of the start site determined by the buffer # This uses the python regex library syntax with named capture groups and fuzzy matching AMP_UMI_REGEX = "(?P<umi_1>[ATCG]{%i})" % AMP_UMI_LEN + \ "(?P<discard_1>%s){e<=%i}" % (AMP_CR, AMP_CR_NM_ALLOWANCE) # For primer masking, some input read names (qnames) may need a different sort key than these two ILLUMINA_QNAME_DELIM = ":" ILLUMINA_QNAME_NFIELDS = 7 ILLUMINA_FORMAT_INDEX = 0 ILLUMINA_QNAME_INDEX_DELIM = " " INT_FORMAT_INDEX = 1 ILLUMINA_QNAME_SORT = ("sort", "-t:", "-k1,1", "-k2,2n", "-k3,3", "-k4,4n", "-k5,5n", "-k6,6n", "-k7,7n") INT_QNAME_SORT = ("sort", "-k1,1n") QNAME_SORTS = (ILLUMINA_QNAME_SORT, INT_QNAME_SORT) DEFAULT_MUT_SIG = "NNN" VALID_MUT_SIGS = {"NNN", "NNK", "NNS"} KEEP_INTERMEDIATES = False DEFAULT_QUALITY_OFFSET = 33 PRE_V1p8_QUALITY_OFFSET = 64 LOG_FORMATTER = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') DEFAULT_TEMPDIR = os.getenv("SCRATCH", "/tmp")
/satmut_utils-1.0.4-py3-none-any.whl/satmut_utils/definitions.py
0.402157
0.18797
definitions.py
pypi
"""Collection of string manipulation utilities.""" import random import string __author__ = "Ian Hoskins" __credits__ = ["Ian Hoskins"] __license__ = "GPLv3" __maintainer__ = "Ian Hoskins" __email__ = "[email protected]" __status__ = "Development" DEFAULT_RANDOMER_LETTERS = string.ascii_uppercase + string.digits DEFAULT_RANDOMER_DIGITS = string.digits def make_random_str(str_len=10, prefix="", letters=DEFAULT_RANDOMER_DIGITS): """Make a random string from a selection of the letters. :param int str_len: length of randomer :param str prefix: optional prefix to include for string :param str letters: string of characters to use to generate randomer :return str: randomer string """ randomer = prefix + "".join(random.choice(letters) for _ in range(str_len)) return randomer def make_unique_ids(n_ids, str_len=10, prefix="", letters=DEFAULT_RANDOMER_DIGITS): """Make a list of randomer strings. :param int n_ids: number of IDs to create :param int str_len: length of randomer :param str prefix: optional prefix to include for string :param str letters: string of characters to use to generate randomer :return list: randomer strings """ uniq_ids = set() while len(uniq_ids) < n_ids: uniq_ids.add(make_random_str(str_len, prefix, letters)) uniq_ids = list(uniq_ids) return uniq_ids def is_number(s): """Checks if a string can be cast to a number. :param str s: string to check :return bool: whether or not the string represents a number """ try: float(s) except ValueError: return False else: return True def none_or_str(value): """Converts None string to proper type. :param str value: str :return str | None: appropriate type """ if value == 'None': return None return value def none_or_int(value): """Converts None string to proper type. :param str value: str :return int | None: appropriate type """ if value == 'None': return None return int(value)
/satmut_utils-1.0.4-py3-none-any.whl/core_utils/string_utils.py
0.815526
0.223886
string_utils.py
pypi
"""Collection of feature file (BED, GFF, etc.) manipulation utilities.""" import collections import os import pybedtools import subprocess import tempfile from analysis.aligners import BowtieConfig import analysis.seq_utils as su from core_utils.file_utils import FILE_DELIM, replace_extension __author__ = "Ian Hoskins" __credits__ = ["Ian Hoskins"] __license__ = "GPLv3" __maintainer__ = "Ian Hoskins" __email__ = "[email protected]" __status__ = "Development" tempfile.tempdir = os.getenv("SCRATCH", "/tmp") BED_FILETYPE = "bed" GFF_FILETYPE = "gff" GTF_FILETYPE = "gtf" GFF_FEATURE_TYPE_FIELD = 2 GFF_ATTR_FIELD_DELIM = "; " GFF_ATTR_SUBFIELD_DELIM1 = "=" GFF_ATTR_SUBFIELD_DELIM2 = " " GFF_ATTR_SUBFIELD_VAL_STR = '"' GFF_ATTR_GENE_ID = "gene_id" GFF_ATTR_TRANSCRIPT_ID = "transcript_id" GFF_ATTR_EXON_ID = "exon_number" GFF_ATTR_ID_ID = "ID" PYBEDTOOLS_NULL_CHARS = {".", ""} DEFAULT_BP_SLOP = 25 GFF_ATTR_FIELD = 8 GFF_NFIELDS = 9 # Indices from the start for SAM/BAM fields intersected in -wb mode BED_INTERSECT_WB_READ_CONTIG_INDEX = 0 BED_INTERSECT_WB_READ_START_INDEX = 1 BED_INTERSECT_WB_READ_STOP_INDEX = 2 BED_INTERSECT_WB_READ_QNAME_INDEX = 3 BED_INTERSECT_WB_READ_STRAND_INDEX = 5 BED_INTERSECT_WB_READ_NFIELDS = 12 # Offsets from the B contig field; field length to be determined dynamically, as feature files may have various nfields # Note the contig field index is just the -(nfields of B); the below offsets should be added to the nfields of B # to get the respective B field, depending on the type of B feature file BED_INTERSECT_WB_B_BED_START_OFFSET = 1 BED_INTERSECT_WB_B_BED_STOP_OFFSET = 2 BED_INTERSECT_WB_B_BED_NAME_OFFSET = 3 BED_INTERSECT_WB_B_BED_SCORE_OFFSET = 4 BED_INTERSECT_WB_B_BED_STRAND_OFFSET = 5 BED_INTERSECT_WB_B_GFF_TYPE_OFFSET = 2 BED_INTERSECT_WB_B_GFF_START_OFFSET = 3 BED_INTERSECT_WB_B_GFF_STOP_OFFSET = 4 BED_INTERSECT_WB_B_GFF_SCORE_OFFSET = 5 BED_INTERSECT_WB_B_GFF_STRAND_OFFSET = 6 BED_INTERSECT_WB_B_GFF_ATTR_OFFSET = 8 BED_GROUPBY_DELIM = "," COORD_TUPLE = collections.namedtuple("coord_tuple", "contig, start, stop, name, strand, score, allowable_coords") def intersect_features(ff1, ff2, outfile=None, as_bedtool=False, **kwargs): """bedtools intersect of two feature files. Feature file 2 is the smaller and held in memory. :param str ff1: first feature file, may be either VCF, BED, GFF, or BAM :param str ff2: second feature file, usually VCF, BED, GFF :param str | None outfile: optional output file :param bool as_bedtool: return results as a bedtool object? :return pybedtools.BedTool | str: if as_bedtool=True, a BedTool; otherwise the intersected result filename """ out = outfile if outfile is None and not as_bedtool: out = tempfile.NamedTemporaryFile(mode="w", suffix=".intersect", delete=False).name ff1_bt = pybedtools.BedTool(ff1) ff2_bt = pybedtools.BedTool(ff2) intersect_bt = ff1_bt.intersect(ff2_bt, **kwargs) if as_bedtool: return intersect_bt intersect_bt.moveto(out) return out def sort_feature_file(feature_file, output=None, *args, **kwargs): """Lexicographically sorts a BED. :param str feature_file: unsorted input feature file :param str | None output: optional name of the output file :param args: additional args to pass to the bedtools sort command :param kwargs: key-value arguments to pass to the bedtools sort command :return str: name of the output file """ bedtool = pybedtools.BedTool(feature_file) sorted_bedtool = bedtool.sort(*args, **kwargs) if output is not None: sorted_bedtool.moveto(output) return output else: return sorted_bedtool.fn def get_genome_file(ref, output_file=None): """Returns a genome file for the reference (a tab-delimited file containing contig lengths). :param str ref: bowtie2 indexed reference FASTA :param str | None output_file: Optional name of output file. If None a file will be written to same dir as ref. :return str: name of the genome file :raises RuntimeError: if no FM index files are found for the reference FASTA """ # Tests for index files by side effect bc = BowtieConfig(ref) try: bc.test_build() except RuntimeError: bc.build_fm_index() inspect_cmd = ("bowtie2-inspect", "-s", ref) grep_cmd = ("grep", "Sequence") cut_cmd = ("cut", "-f2-") outfile = output_file if output_file is None: outfile = os.path.join(os.path.dirname(ref), replace_extension(os.path.basename(ref), "genome_file.txt")) with open(outfile, "w") as out_fh: inspect_p = subprocess.Popen(inspect_cmd, stdout=subprocess.PIPE) grep_p = subprocess.Popen(grep_cmd, stdin=inspect_p.stdout, stdout=subprocess.PIPE) cut_p = subprocess.Popen(cut_cmd, stdin=grep_p.stdout, stdout=out_fh) _ = cut_p.wait() inspect_p.stdout.close() grep_p.stdout.close() return outfile def slop_features(feature_file, genome_file, bp_left=DEFAULT_BP_SLOP, bp_right=DEFAULT_BP_SLOP, by_strand=True, output=None): """Slop a feature file in one or both directions. :param str feature_file: BED, GFF, or GTF :param str genome_file: genome file giving lengths of the chromosomes/contigs; default hg19 :param int bp_left: number bases to slop to left; "left" defined by by_strand kwarg :param int bp_right: number bases to slop to right; "right" defined by by_strand kwarg :param bool by_strand: directionality is defined by strand- for (-) strand read, left is higher coordinate :param str output: Optional output file; if None, tempfile will be created :return str: path of the output file """ ff_bedtool = pybedtools.BedTool(feature_file) ff_slop_bedtool = ff_bedtool.slop(g=genome_file, l=bp_left, r=bp_right, s=by_strand) output_file = output if output is None: output_file = tempfile.NamedTemporaryFile(suffix=".slop.tmp", delete=False).name ff_slop_bedtool.moveto(output_file) return output_file class DuplicateFeatureException(Exception): """Exception for the existence of duplicate features (those with exact same coordinates).""" pass def store_coords(feature_file, use_name=True, start_buffer=0): r"""Stores primer coordinates from a feature file in a consistent dictionary format. :param str feature_file: BED, GFF, or GTF :param bool use_name: Should the feature name field be used as the key? Default True. Otherwise, use the contig \ and coordinate range as the key. :param int start_buffer: buffer about the start of the primer for allowable_coords. Useful for capturing the small proportion of reads that start slightly upstream of primer 5' ends (downstream for - strand primers). :return collections.OrderedDict: {"contig:start-stop" | name: COORD_TUPLE} :raises RuntimeError: if the strand field is absent or contains an invalid character """ feature_dict = collections.OrderedDict() observed_features = set() ff_bedtool = pybedtools.BedTool(feature_file) for feature in ff_bedtool: # Always generate a name even if it is redundant feature_coords = su.COORD_FORMAT_STRAND.format(str(feature.chrom), feature.start, feature.stop, feature.strand) if feature_coords in observed_features: raise DuplicateFeatureException( "%s is duplicated in %s. Please provide a feature file with unique features." % (feature_coords, feature_file)) # Get some other basic attrs if they exist feature_name = str(feature.name) if feature.name not in PYBEDTOOLS_NULL_CHARS else None feature_strand = su.Strand(str(feature.strand)) if feature.strand not in PYBEDTOOLS_NULL_CHARS else None feature_score = float(feature.score) if feature.score not in PYBEDTOOLS_NULL_CHARS else 1.0 feature_len = len(feature) # Allowable coordinates will contain 1-based coordinates # Note +1 on the 1-based stop coords includes the terminal base to be in the set (given python range behavior) if feature_strand is None: # If we don't know the strand of the primer, do not proceed raise RuntimeError("Absent strand information for %s" % FILE_DELIM.join(feature.fields)) elif feature_strand == su.Strand.PLUS: allowable_coords = frozenset(range(feature.start + 1 - start_buffer, feature.start + feature_len + 1)) elif feature_strand == su.Strand.MINUS: allowable_coords = frozenset(range(feature.stop - feature_len + 1, feature.stop + 1 + start_buffer)) else: raise RuntimeError("Unrecognized strand for feature %s" % FILE_DELIM.join(feature.fields)) feature_key = feature_name if use_name else feature_coords feature_dict[feature_key] = COORD_TUPLE(str(feature.chrom), feature.start, feature.stop, feature_name, feature_strand, feature_score, allowable_coords) observed_features.add(feature_coords) return feature_dict
/satmut_utils-1.0.4-py3-none-any.whl/core_utils/feature_file_utils.py
0.596316
0.271098
feature_file_utils.py
pypi
"""Objects for mapping between transcriptomic and protein coordinates.""" import collections import gzip import logging import pickle import pybedtools import re import tempfile import warnings import analysis.seq_utils as su import core_utils.feature_file_utils as ffu import core_utils.file_utils as fu import core_utils.vcf_utils as vu from satmut_utils.definitions import * __author__ = "Ian_Hoskins" __credits__ = ["Ian Hoskins"] __license__ = "GPLv3" __maintainer__ = "Ian Hoskins" __email__ = "[email protected]" __status__ = "Development" CODONS = ("GCC", "GCT", "GCA", "GCG", "TGC", "TGT", "GAC", "GAT", "GAG", "GAA", "TTC", "TTT", "GGC", "GGG", "GGA", "GGT", "CAC", "CAT", "ATC", "ATT", "ATA", "AAG", "AAA", "CTG", "CTC", "TTG", "CTT", "CTA", "TTA", "ATG", "AAC", "AAT", "CCC", "CCT", "CCA", "CCG", "CAG", "CAA", "CGC", "AGG", "CGG", "AGA", "CGA", "CGT", "AGC", "TCC", "TCT", "AGT", "TCA", "TCG", "ACC", "ACA", "ACT", "ACG", "GTG", "GTC", "GTT", "GTA", "TGG", "TAC", "TAT", "TGA", "TAA", "TAG") CODON_AAS = ["A"] * 4 + ["C"] * 2 + ["D"] * 2 + ["E"] * 2 + ["F"] * 2 + ["G"] * 4 + ["H"] * 2 + ["I"] * 3 + ["K"] * 2 + \ ["L"] * 6 + ["M"] + ["N"] * 2 + ["P"] * 4 + ["Q"] * 2 + ["R"] * 6 + ["S"] * 6 + ["T"] * 4 + ["V"] * 4 + ["W"] + \ ["Y"] * 2 + ["*"] * 3 CODON_AA_DICT = dict(zip(CODONS, CODON_AAS)) HGVS_AA_FORMAT = "p.{}{}{}" MUT_SIG_UNEXPECTED_WOBBLE_BPS = {"NNN": set(), "NNK": {"A", "C"}, "NNS": {"A", "T"}} EXON_COORDS_TUPLE = collections.namedtuple("EXON_COORDS_TUPLE", "exon_id, contig, start, stop, exon_len, strand") MUT_INFO_TUPLE = collections.namedtuple( "MUT_INFO_TUPLE", "location, wt_codons, mut_codons, wt_aas, mut_aas, aa_changes, aa_positions, matches_mut_sig") tempfile.tempdir = DEFAULT_TEMPDIR logger = logging.getLogger(__name__) class TranscriptNotFound(Exception): """Exception for when a transcript ID was not found in the CoordinateMapper.""" pass class TranscriptomicCoordNotFound(Warning): """Warning for when a coordinate is outside of transcript bounds.""" pass class MapperBase(object): """Base class for GTF/GFF related data parsing.""" # Some GFF/GTF type fields # Common feature types GENE_ID = "gene" TRX_ID = "transcript" PRIM_TRX_ID = "primary_transcript" MRNA_ID = "mRNA" CDS_ID = "CDS" EXON_ID = "exon" START_CODON_ID = "start_codon" STOP_CODON_ID = "stop_codon" UTR_ID = "UTR" ENSEMBL_GENE_PREFIX = "ENSG" ENSEMBL_TRX_PREFIX = "ENST" GFF_FEATURE_FIELD = 2 # RNA feature types R_RNA_ID = "rRNA" T_RNA_ID = "tRNA" MI_RNA_ID = "miRNA" SN_RNA_ID = "snRNA" SNO_RNA_ID = "snoRNA" NC_RNA_ID = "ncRNA" LNC_RNA_ID = "lnc_RNA" TELO_RNA_ID = "telomerase_RNA" DLOOP_ID = "D_loop" VAULT_RNA_ID = "vault_RNA" ANTIS_RNA_ID = "antisense_RNA" Y_RNA = "Y_RNA" RNASE_MRP_RNA_ID = "RNase_MRP_RNA" RNASE_P_RNA_ID = "RNase_P_RNA" SRP_RNA_ID = "SRP_RNA" # DNA feature types PROMOTER_ID = "promoter" ENHANCER_ID = "enhancer" # Misc. feature types REPEAT_ID = "repeat_region" REGION_ID = "region" SEQ_FEAT_ID = "sequence_feature" MATCH_ID = "match" CDNA_MATCH_ID = "cDNA_match" SELENOCYSTEINE_ID = "Selenocysteine" # Immunoglobulin locus feature types V_GENE_SEG_ID = "V_gene_segment" D_GENE_SEG_ID = "D_gene_segment" J_GENE_SEG_ID = "J_gene_segment" C_GENE_SEG_ID = "C_gene_segment" # Omit transcripts on non-NC contigs CONTIGS_TO_OMIT = re.compile("|".join(["NT", "NW"])) FEATURES_TO_OMIT = [R_RNA_ID, T_RNA_ID, MI_RNA_ID, SN_RNA_ID, SNO_RNA_ID, NC_RNA_ID, LNC_RNA_ID, TELO_RNA_ID, DLOOP_ID, VAULT_RNA_ID, ANTIS_RNA_ID, Y_RNA, RNASE_MRP_RNA_ID, RNASE_P_RNA_ID, SRP_RNA_ID, PROMOTER_ID, ENHANCER_ID, REPEAT_ID, REGION_ID, SEQ_FEAT_ID, MATCH_ID, CDNA_MATCH_ID, V_GENE_SEG_ID, D_GENE_SEG_ID, J_GENE_SEG_ID, C_GENE_SEG_ID, SELENOCYSTEINE_ID] class AminoAcidMapper(MapperBase): """Class for determining the codon and AA change(s) given a transcriptomic variant.""" FEATURES_TO_OMIT = re.compile("|".join(MapperBase.FEATURES_TO_OMIT + [MapperBase.GENE_ID, MapperBase.TRX_ID, MapperBase.MRNA_ID, MapperBase.UTR_ID, MapperBase.START_CODON_ID])) VALID_CDS_FEATURES = {MapperBase.CDS_ID, MapperBase.STOP_CODON_ID} TRX_LEN = "trx_len" CDS_START_OFFSET = "cds_start_offset" # local transcript offset from start of transcript to start of start codon CDS_STOP_OFFSET = "cds_stop_offset" # local transcript offset from start of transcript to start of stop codon CDS_NT_SEQ = "cds_nt_seq" FIVEPRIME_UTR = "5_UTR" THREEPRIME_UTR = "3_UTR" INTERGENIC = "intergenic" UNTRANSLATED = "untranslated" MUT_INFO_DELIM = "," DEFAULT_OUTDIR = "." MUT_SIG_ANY = "NNN" CDS_INFO_TRX_LEN_INDEX = 0 CDS_INFO_CDS_START_INDEX = 1 CDS_INFO_CDS_STOP_INDEX = 2 CDS_INFO_TRX_SEQ_INDEX = 3 CDS_INFO_CDS_SEQ_INDEX = 4 DEFAULT_ARGS = MUT_INFO_TUPLE._fields[1:] DEFAULT_KWARGS = dict(zip(DEFAULT_ARGS, [su.R_COMPAT_NA] * len(DEFAULT_ARGS))) def __init__(self, gff, ref, outdir=DEFAULT_OUTDIR, use_pickle=True, make_pickle=True, overwrite_pickle=False, mut_sig=MUT_SIG_ANY, filter_unexpected=False): r"""Constructor for AminoAcidMapper. :param str gff: GFF/GTF to create a mapper for; must have "transcript_id" and "CDS", "stop_codon" features. :param str ref: reference FASTA corresponding to GFF features :param str outdir: output directory to write pickles to, if make_pickle=True. :param bool use_pickle: Use a previously generated pickle for annotations if one exists? Default True. Otherwise \ re-create the data structure. :param bool make_pickle: Should a new pickle be made? Default True. :param bool overwrite_pickle: if make_pickle=True and use_pickle=True, should the existing pickle be \ overwritten? Default False. This is useful if one makes dynamic edits to an existing GFF. Otherwise, the older \ pickle will be used. :param str mut_sig: mutagenesis signature- one of {NNN, NNK, NNS}. Default NNN. :param bool filter_unexpected: Filter changes that did not match an expected mutagenesis signature? Default False. Warning! The exon feature GFF attributes must have transcript_id and exon_number or exon_ID, key-value pairs, and \ features should be from 5' to 3', regardless of strand! For example, a transcript on the (-) will NOT be sorted \ by coordinate if features are ordered 5' to 3'. """ file_ext = fu.get_extension(gff) if not (re.match(ffu.GFF_FILETYPE, file_ext) or re.match(ffu.GTF_FILETYPE, file_ext)): raise NotImplementedError("Input file must be a GFF/GTF filetype.") self.gff = gff self.ref = ref self.outdir = outdir self.use_pickle = use_pickle self.make_pickle = make_pickle self.overwrite_pickle = overwrite_pickle self.filter_unexpected = filter_unexpected self.mut_sig = mut_sig self.output_dir = outdir if outdir is None: self.output_dir = tempfile.mkdtemp(suffix=__class__.__name__) if not os.path.exists(self.output_dir): os.mkdir(self.output_dir) self.pkl_filepath = os.path.join(self.output_dir, fu.replace_extension(os.path.basename(self.gff), "cds.pkl.gz")) pkl_exists = os.path.exists(self.pkl_filepath) if self.use_pickle and pkl_exists: logger.info("Loading pickled transcript CDS annotations.") with open(self.pkl_filepath, "rb") as info_pkl: self.cds_info = pickle.load(info_pkl) else: self.gff_bedtool = pybedtools.BedTool(self.gff) logger.info("Collecting transcript CDS annotations.") self.cds_info = self._get_cds_info() if (self.make_pickle and not pkl_exists) or self.overwrite_pickle: logger.info("Pickling transcript CDS annotations to %s for %s" % (self.pkl_filepath, self.gff)) self.generate_pickle() @staticmethod def _add_cds_info(trx_id, transcript_cds_info, trx_seq, cds_seq): """Adds CDS information for a transcript. :param str trx_id: transcript ID :param dict transcript_cds_info: dict for storing information on each transcript :param str trx_seq: transcript sequence, from 5'-3' :param str cds_seq: CDS sequence, including the stop codon, from 5'-3' """ # The information we need is the CDS sequence (including stop codon), the total transcript length # and the index into the transcript where the CDS starts (from these we know the location of UTRs) trx_len = len(trx_seq) # If we have a pseudogene or other non-translated transcript, we must set the CDS offsets to None cds_start_offset = None cds_stop_offset = None if len(cds_seq) > 0: cds_start_offset = trx_seq.index(cds_seq) # 0-based start (BED) cds_stop_offset = cds_start_offset + len(cds_seq) # 1-based stop (BED) transcript_cds_info[trx_id] = (trx_len, cds_start_offset, cds_stop_offset, trx_seq, cds_seq) def _get_cds_info(self): """Stores CDS information for each transcript.""" transcript_cds_info = {} trx_id = None last_trx_id = None trx_seq = "" cds_seq = "" # feature will be a pybedtools.Interval object for feature in self.gff_bedtool: # Filter the feature file of certain features so we have exon, CDS, and stop codon features only if self.FEATURES_TO_OMIT.match(feature.fields[ffu.GFF_FEATURE_TYPE_FIELD]): continue # Assuming we can identify the transcript, store the CDS data trx_id = feature.attrs[ffu.GFF_ATTR_TRANSCRIPT_ID] if ffu.GFF_ATTR_TRANSCRIPT_ID in feature.attrs else None if trx_id is not None and trx_id not in ffu.PYBEDTOOLS_NULL_CHARS: feature_strand = su.Strand(feature.strand) # Store the results of the last transcript and reset the sequences every time we switch between # blocks of features belonging to the same transcript if last_trx_id is not None and trx_id != last_trx_id: self._add_cds_info( trx_id=last_trx_id, transcript_cds_info=transcript_cds_info, trx_seq=trx_seq, cds_seq=cds_seq) # Once we have added the information for the transcript in question, reset the sequence strings trx_seq = "" cds_seq = "" # Get the sequence of the entire transcript; we might normally just extract this from the transcriptome # reference FASTA, but we want this to be as extensible as possible (e.g. to store novel isoforms) if feature.fields[ffu.GFF_FEATURE_TYPE_FIELD] == self.EXON_ID: exon_seq = su.extract_seq( contig=str(feature.chrom), start=feature.start + 1, stop=feature.stop, ref=self.ref) exon_seq = su.reverse_complement(exon_seq) if feature_strand == su.Strand.MINUS else exon_seq trx_seq += exon_seq elif feature.fields[ffu.GFF_FEATURE_TYPE_FIELD] in self.VALID_CDS_FEATURES: cds_exon_seq = su.extract_seq( contig=str(feature.chrom), start=feature.start + 1, stop=feature.stop, ref=self.ref) cds_exon_seq = su.reverse_complement(cds_exon_seq) if feature_strand == su.Strand.MINUS else cds_exon_seq cds_seq += cds_exon_seq last_trx_id = trx_id # Make sure to add the information for the last transcript block if trx_id is not None: self._add_cds_info( trx_id=trx_id, transcript_cds_info=transcript_cds_info, trx_seq=trx_seq, cds_seq=cds_seq) return transcript_cds_info def _concat_multi_mut_info(self, mut_info_tuple): """Concatenates multi-position mutation changes into comma-delimited strings. :param collections.namedtuple mut_info_tuple: MUT_INFO_TUPLE with multi-position mutations in list :return collections.namedtuple MUT_INFO_TUPLE: MUT_INFO_TUPLE with multi-position mutations in str """ wt_codons = self.MUT_INFO_DELIM.join(mut_info_tuple.wt_codons) mut_codons = self.MUT_INFO_DELIM.join(mut_info_tuple.mut_codons) wt_aas = self.MUT_INFO_DELIM.join(mut_info_tuple.wt_aas) mut_aas = self.MUT_INFO_DELIM.join(mut_info_tuple.mut_aas) aa_changes = self.MUT_INFO_DELIM.join(mut_info_tuple.aa_changes) aa_pos_list = [re.sub("[p.A-Z*]", "", aa) for aa in mut_info_tuple.aa_changes] aa_positions = self.MUT_INFO_DELIM.join(aa_pos_list) matches_mut_sig = self.MUT_INFO_DELIM.join(list(map(str, mut_info_tuple.matches_mut_sig))) new_mut_info_tuple = MUT_INFO_TUPLE( location=mut_info_tuple.location, wt_codons=wt_codons, mut_codons=mut_codons, wt_aas=wt_aas, mut_aas=mut_aas, aa_changes=aa_changes, aa_positions=aa_positions, matches_mut_sig=matches_mut_sig) return new_mut_info_tuple def _get_mut_info(self, wt_cds_seq, mut_cds_seq): """Finds codon and amino acid changes given a WT and mutant CDS. :param str wt_cds_seq: WT CDS sequence :param str mut_cds_seq: Mutant CDS sequence :return collections.namedtuple: MUT_INFO_TUPLE """ # If we weren't interested in reporting silent mutations, we might just translate the whole sequences then # compare AAs; but multi-base MNPs (haplotypes) make optimization logic a little tricky, as the MNP may # span multiple codons. For now just iterate over all the codons/AAs codon_comparitors = zip( [wt_cds_seq[i:i + 3] for i in range(0, len(wt_cds_seq), 3)], [mut_cds_seq[i:i + 3] for i in range(0, len(mut_cds_seq), 3)] ) # In the future this may need to be modified to handle InDels # Checking codons is needed to call synonymous AA changes wt_codons = [] mut_codons = [] wt_aas = [] mut_aas = [] mut_pos = set() aa_changes = [] matches_mut_sig = [] for i, (wt_codon, mut_codon) in enumerate(codon_comparitors): if wt_codon != mut_codon: wt_codons.append(wt_codon) mut_codons.append(mut_codon) # Either mark or filter changes that are unexpected by looking at the wobble bp wt_wobble = wt_codon[2] mut_wobble = mut_codon[2] # Determine if the mutation matches the mutagenesis signature matches_sig = True if self.mut_sig != self.MUT_SIG_ANY and wt_wobble != mut_wobble and \ mut_wobble in MUT_SIG_UNEXPECTED_WOBBLE_BPS[self.mut_sig]: matches_sig = False if self.filter_unexpected: continue matches_mut_sig.append(matches_sig) wt_aa = translate(wt_codon) mut_aa = translate(mut_codon) wt_aas.append(wt_aa) mut_aas.append(mut_aa) mut_pos.add(i + 1) aa_changes.append(HGVS_AA_FORMAT.format(wt_aa, i + 1, mut_aa)) # Collect the data into a mutation info tuple mut_info_tuple = MUT_INFO_TUPLE( location=self.CDS_ID, wt_codons=wt_codons, mut_codons=mut_codons, wt_aas=wt_aas, mut_aas=mut_aas, aa_changes=aa_changes, aa_positions=[], matches_mut_sig=matches_mut_sig) concat_mut_info_tuple = self._concat_multi_mut_info(mut_info_tuple) return concat_mut_info_tuple def get_codon_and_aa_changes(self, trx_id, pos, ref, alt): """Given a transcript ID and variant position, determines stats associated with a transcriptomic variant. :param str trx_id: transcript ID; must correspond to the gff used in this object's init :param int pos: 1-based position of the variant within the transcript :param str ref: reference bases :param str alt: alternate bases :return collections.namedtuple: MUT_INFO_TUPLE for variant. If the variant is outside the CDS but within \ the transcript bounds, then either '5_UTR' or '3_UTR' is returned for location; if the variant is outside the \ transcript bounds, 'intergenic' is returned; if no CDS exists for the transcript, 'untranslated' is returned. :raises TranscriptNotFound: if the transcript ID was not found in the mapper object :raises RuntimeError: if the REF field of the variant does not match the reference sequence """ if trx_id not in self.cds_info: raise TranscriptNotFound("No transcript %s found in the annotations." % trx_id) # cds_start_offset is 0-based offset of the first base of the start codon # cds_stop_offset is 0-based offset of the base _after_ the stop codon trx_len, cds_start_offset, cds_stop_offset, trx_seq, cds_seq = self.cds_info[trx_id] if pos > trx_len or pos < 1: var_key = vu.VARIANT_FORMAT.format(trx_id, pos, ref, alt) msg_str = "Variant %s position is not within transcript bounds." % var_key warnings.warn(msg_str, TranscriptomicCoordNotFound) logger.warning(msg_str) return MUT_INFO_TUPLE(location=self.INTERGENIC, **self.DEFAULT_KWARGS) # One more sanity-check zbased_pos = pos - 1 expected_ref = trx_seq[zbased_pos:zbased_pos + len(ref)] if ref.upper() != expected_ref.upper(): var_key = vu.VARIANT_FORMAT.format(trx_id, pos, ref, alt) msg_str = "REF %s of %s does not match the expected reference sequence of the transcript: %s" \ % (ref, var_key, expected_ref) logger.exception(msg_str) raise RuntimeError(msg_str) # Now that we have ensured our variant is valid, we can check for its placement if cds_start_offset is None and cds_stop_offset is None: return MUT_INFO_TUPLE(location=self.UNTRANSLATED, **self.DEFAULT_KWARGS) elif zbased_pos < cds_start_offset: return MUT_INFO_TUPLE(location=self.FIVEPRIME_UTR, **self.DEFAULT_KWARGS) elif zbased_pos >= cds_stop_offset: return MUT_INFO_TUPLE(location=self.THREEPRIME_UTR, **self.DEFAULT_KWARGS) else: # To determine the AA change, translate the mutant CDS sequence and find the differences cds_len = len(cds_seq) ref_len = len(ref) # Create the ALT within the CDS sequence cds_pos = zbased_pos - cds_start_offset mut_cds_seq = cds_seq[:cds_pos] + alt + cds_seq[cds_pos + ref_len:] mut_cds_seq = mut_cds_seq[:cds_len] # Extract the information about the consequences of the variant change mut_info_tuple = self._get_mut_info(wt_cds_seq=cds_seq, mut_cds_seq=mut_cds_seq) return mut_info_tuple def generate_pickle(self): """Makes a pickle of the object.""" with open(self.pkl_filepath, "wb") as info_pkl: pickle.dump(obj=self.cds_info, file=info_pkl) gzip.GzipFile(self.pkl_filepath) def translate(codon): """Translates a codon. :param str codon: codon string :return str: shorthand amino acid string :raises RuntimeError: if the codon is not in the recognized set of 64 codons """ codon_upper = codon.upper() if codon_upper not in CODON_AA_DICT: raise RuntimeError("Unrecognized codon %s." % codon) aa = CODON_AA_DICT[codon_upper] return aa
/satmut_utils-1.0.4-py3-none-any.whl/analysis/coordinate_mapper.py
0.571408
0.275766
coordinate_mapper.py
pypi
"""Utilities for extracting reference files from Ensembl IDs.""" import logging import pybedtools import pysam import re import subprocess from analysis.aligners import BowtieConfig import analysis.seq_utils as su from analysis.coordinate_mapper import MapperBase import core_utils.file_utils as fu import core_utils.feature_file_utils as ffu from satmut_utils.definitions import * __author__ = "Ian_Hoskins" __credits__ = ["Ian Hoskins"] __license__ = "GPLv3" __maintainer__ = "Ian Hoskins" __email__ = "[email protected]" __status__ = "Development" APPRIS_CONTIG_DELIM = "|" APPRIS_TRX_INDEX = 0 APPRIS_GENE_INDEX = 1 logger = logging.getLogger(__name__) class EnsemblIdNotFound(Exception): """Exception for when an Ensembl transcript or gene ID was not found in curated APPRIS reference files.""" pass class InvalidEnsemblId(Exception): """Exception for when an Ensembl transcript or gene ID is not in valid format.""" pass def ensembl_id_exists(reference_dir, ensembl_id): """Determines if ensembl_id is present in curated APPRIS reference files. :param str reference_dir: directory containing curated APPRIS reference files :param str ensembl_id: Ensembl gene or transcript ID, with version number :return tuple: (bool, str | None) if ensembl_id is in the references, alternative ID if present :raises InvalidEnsemblId: if the Ensembl ID does not start with ENST or ENSG """ if re.search(MapperBase.ENSEMBL_TRX_PREFIX, ensembl_id): with open(os.path.join(reference_dir, APPRIS_TRX_IDS), "r") as id_file: ids = {line.rstrip(fu.FILE_NEWLINE) for line in id_file} elif re.search(MapperBase.ENSEMBL_GENE_PREFIX, ensembl_id): with open(os.path.join(reference_dir, APPRIS_GENE_IDS), "r") as id_file: ids = {line.rstrip(fu.FILE_NEWLINE) for line in id_file} else: raise InvalidEnsemblId("Ensembl ID %s was passed. Please provide a valid Ensembl identifier." % ensembl_id) if ensembl_id in ids: return True, None else: ensembl_id_base = ensembl_id.split(".")[0] # See if we have the base ID but a different version for appris_id in ids: base_id = appris_id.split(".")[0] if ensembl_id_base == base_id: logger.info( "Ensembl ID %s was not found; however, curated reference files contain %s" % (ensembl_id, appris_id)) return False, appris_id else: return False, None def get_trx_id_from_gene_id(reference_dir, ensembl_gene_id): """Determines if ensembl_id is present in curated APPRIS reference files. :param str reference_dir: directory containing curated APPRIS reference files :param str ensembl_gene_id: Ensembl gene ID, with version number :return str | None: transcript ID corresponding to the ensembl_gene_id; None if the gene ID not found """ with open(os.path.join(reference_dir, APPRIS_CONTIG_IDS), "r") as contig_file: for line in contig_file: gene_id = line.split(APPRIS_CONTIG_DELIM)[APPRIS_GENE_INDEX] # Use the first transcript found for the gene ID if ensembl_gene_id == gene_id: return line.split(APPRIS_CONTIG_DELIM)[APPRIS_TRX_INDEX] else: return None def extract_fasta_reference(reference_dir, ensembl_id, outdir="."): """Extracts the reference FASTA given an Ensembl gene or transcript ID. :param str reference_dir: directory containing curated APPRIS reference files :param str ensembl_id: Ensembl gene or transcript ID, with version number :param str outdir: optional output directory for the reference files :return str: filepath of the output FASTA """ if not os.path.exists(outdir): os.mkdir(outdir) output_fasta = os.path.join(outdir, fu.add_extension(ensembl_id, su.FASTA_FILETYPE)) with open(os.path.join(reference_dir, APPRIS_CONTIG_IDS), "r") as contig_id_file: contig_id = [line.rstrip(fu.FILE_NEWLINE) for line in contig_id_file if ensembl_id in set( line.split(APPRIS_CONTIG_DELIM)[:2])][0] logger.info("Extracting transcript reference FASTA for %s." % ensembl_id) fa = pysam.faidx(os.path.join(reference_dir, APPRIS_TRX_FASTA), contig_id) with open(output_fasta, "w") as out_fasta_fh: out_fasta_fh.write(fa) return output_fasta def extract_gff_reference(reference_dir, ensembl_id, outdir="."): """Extracts the reference GFF records given an Ensembl gene or transcript ID. :param str reference_dir: directory containing curated APPRIS reference files :param str ensembl_id: Ensembl gene or transcript ID, with version number :param str outdir: optional output directory for the reference files :return str: filepath of the output FASTA """ if not os.path.exists(outdir): os.mkdir(outdir) logger.info("Extracting GFF transcript annotations for %s." % ensembl_id) output_gff = os.path.join(outdir, fu.add_extension(ensembl_id, su.GFF_DEFAULT_EXT)) extract_call = ("fgrep", ensembl_id, os.path.join(reference_dir, GENCODE_TRX_GFF)) with open(output_gff, "w") as out_gff: subprocess.call(extract_call, stdout=out_gff) return output_gff def faidx_ref(ref): """samtools faidx a reference file. :param str ref: reference FASTA """ # Occasional issues with pysam.faidx(ref) subprocess.call(("samtools", "faidx", ref)) def index_reference(ref): """samtools and bowtie2-indexes the reference FASTA. :param str ref: reference FASTA """ # Need to index the reference with samtools and create a FM-index with bowtie2 if it has not been done if not os.path.exists(fu.add_extension(ref, su.FASTA_INDEX_SUFFIX)): logger.info("Generating FASTA index file for %s." % ref) faidx_ref(ref) # Build the bowtie2 index if it doesn't exist try: _ = BowtieConfig(ref=ref).test_build() except RuntimeError: logger.info("Building FM index files for %s." % ref) # This exception is passed if the reference is not FM-indexed _ = BowtieConfig(ref=ref).build_fm_index() def get_ensembl_references(reference_dir, ensembl_id, outdir="."): """Extracts reference files given an Ensembl gene or transcript ID. :param str reference_dir: directory containing curated APPRIS reference files :param str ensembl_id: Ensembl gene or transcript ID, with version number :param str outdir: optional output directory for the reference files :return tuple: (transcript_fasta, transcript_gff) :raises EnsemblIdNotFound: if the ensembl ID is not valid or the ID was not found in the APPRIS set """ id_exists, alternative_id = ensembl_id_exists(reference_dir, ensembl_id) if not id_exists: if alternative_id is not None: raise EnsemblIdNotFound( "Ensembl ID %s was not found in the references; however, an alternative ID is %s." % (ensembl_id, alternative_id)) else: raise EnsemblIdNotFound( "Ensembl ID %s was not found in the references. Please provide custom reference files.") # Always select a transcript ID if a gene ID was passed; this ensures we get only one transcript reference # when filtering the GFF ensembl_trx_id = ensembl_id if re.search(MapperBase.ENSEMBL_GENE_PREFIX, ensembl_id): ensembl_trx_id = get_trx_id_from_gene_id(reference_dir=reference_dir, ensembl_gene_id=ensembl_id) if ensembl_trx_id is None: raise EnsemblIdNotFound( "No Ensembl transcript associated with Ensembl ID %s" % ensembl_id) if not os.path.exists(outdir): os.mkdir(outdir) fa = extract_fasta_reference(reference_dir, ensembl_id, outdir) gff = extract_gff_reference(reference_dir, ensembl_trx_id, outdir) index_reference(fa) return fa, gff
/satmut_utils-1.0.4-py3-none-any.whl/analysis/references.py
0.77806
0.179495
references.py
pypi
"""Aligner interfaces.""" import os import datetime import logging import re import subprocess import tempfile import analysis.seq_utils as su import core_utils.file_utils as fu from satmut_utils.definitions import DEFAULT_QUALITY_OFFSET, PRE_V1p8_QUALITY_OFFSET, DEFAULT_TEMPDIR __author__ = "Ian Hoskins" __credits__ = ["Ian Hoskins"] __license__ = "GPLv3" __maintainer__ = "Ian Hoskins" __email__ = "[email protected]" __status__ = "Development" tempfile.tempdir = DEFAULT_TEMPDIR logger = logging.getLogger(__name__) class BowtieConfig(object): """Class for configuring bowtie2 call.""" DEFAULT_LOCAL = True DEFAULT_NTHREADS = 1 INDEX_EXTENSIONS_RE = re.compile(r".[0-9].bt2") DEFAULT_FLAGS = ["--maxins", "1000", "--no-discordant", "--fr"] DEFAULT_SCORES = ["--mp", "4", "--rdg", "6,4", "--rfg", "6,4"] def __init__(self, ref, local=DEFAULT_LOCAL, nthreads=DEFAULT_NTHREADS, quality_encoding=DEFAULT_QUALITY_OFFSET, *args, **kwargs): """Constructor for BowtieConfig. :param str ref: path of indexed reference FASTA :param bool local: should a local alignment be done instead of global alignment (default True) :param int nthreads: number of threads to use in alignments. Default 1. :param int quality_encoding: base quality encoding for ASCII characters. Default 33. :param sequence args: single flags to pass, use no - prefix :param kwargs: two-field configuration parameters, must use long arg format as key (--arg) """ self.ref = ref self.local = local self.nthreads = nthreads self.quality_encoding = quality_encoding self.args = args self.kwargs = kwargs def test_build(self): """Tests that valid index files exist for the reference. :raises RuntimeError: if no FM index files are found for the reference FASTA """ fasta_dir = os.path.dirname(self.ref) fasta_basename = os.path.basename(self.ref) dir_files = os.listdir(fasta_dir) matches = [self.INDEX_EXTENSIONS_RE.search(f) for f in dir_files if re.match(fasta_basename, f)] if not any(matches): raise RuntimeError("No FM-index files found for the reference FASTA.") def build_fm_index(self): """Builds and FM index with bowtie2. :param str ref: reference FASTA """ build_call = ("bowtie2-build", "--quiet", self.ref, self.ref) subprocess.call(build_call) class Bowtie2(object): """Class for bowtie2 alignment.""" DEFAULT_OUTDIR = "." DEFAULT_OUTBAM = None def __init__(self, config, f1, f2=None, output_dir=DEFAULT_OUTDIR, output_bam=DEFAULT_OUTBAM): """Constructor for Bowtie2. :param aligners.BowtieConfig config: config object :param str f1: path to FASTA or FASTQ 1 :param str | None f2: optional path to FASTA or FASTQ 2 :param str output_dir: optional output directory to write the output BAM to. Default current working directory. :param str | None output_bam: optional output BAM filename. Default None, use f1 basename. """ self.config = config self.f1 = f1 self.f2 = f2 self.output_dir = output_dir if not os.path.exists(output_dir): os.mkdir(output_dir) self.output_bam = output_bam if output_bam is None: if f2 is None: out_name = fu.replace_extension(self.f1, su.BAM_SUFFIX) else: out_name = fu.add_extension(os.path.basename(os.path.commonprefix([f1, f2])), su.BAM_SUFFIX) self.output_bam = os.path.join(output_dir, out_name) if f2 is None: rg_id = os.path.basename(fu.remove_extension(f1)) else: rg_id = os.path.basename(os.path.commonprefix([fu.remove_extension(f1), fu.remove_extension(f2)])) self.alignment_kwargs = {"rg-id": rg_id} self.alignment_kwargs.update(config.kwargs) self.workflow() def _align(self): """Aligns reads. :return tuple: return codes of each process in the pipeline """ with open(self.output_bam, "wb") as out_file, \ open(os.path.join(os.path.dirname(os.path.abspath(self.output_bam)), "Bowtie2.stderr.log"), "a") as bowtie2_stderr: call = ["bowtie2", "-p", str(self.config.nthreads)] call.extend(self.config.DEFAULT_FLAGS + self.config.DEFAULT_SCORES) if self.config.quality_encoding == PRE_V1p8_QUALITY_OFFSET: call.append("--phred64") if self.config.local: call.append("--local") else: call.append("--end-to-end") # Add the configuration parameters for f in self.config.args: call.extend(["-" + str(f)]) for k, i in self.alignment_kwargs.items(): call.extend(["--{} {}".format(k, i)]) call.extend(["-x", self.config.ref]) if self.f2 is not None: call.extend(["-1", self.f1, "-2", self.f2]) else: call.extend(["-U", self.f1]) # Record a time stamp for each new alignment bowtie2_stderr.write( " ".join(["{}.{}".format(__name__, self.__class__.__name__), datetime.datetime.now().strftime("%d%b%Y %I%M%p")]) + fu.FILE_NEWLINE) bowtie2_stderr.write(" ".join(call) + fu.FILE_NEWLINE) align_p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=bowtie2_stderr) tobam_p = subprocess.Popen(("samtools", "view", "-u", "-"), stdin=align_p.stdout, stdout=subprocess.PIPE, stderr=bowtie2_stderr) sort_p = subprocess.Popen(("samtools", "sort", "-"), stdin=tobam_p.stdout, stdout=out_file, stderr=bowtie2_stderr) sort_p.wait() align_p.stdout.close() tobam_p.stdout.close() return align_p.poll(), tobam_p.poll(), sort_p.poll() def workflow(self): """Runs the bowtie2 alignment workflow. :return str: name of the output BAM. """ logger.info("Started bowtie2 aligner workflow.") logger.info("Writing output BAM %s" % self.output_bam) _ = self._align() su.index_bam(self.output_bam) logger.info("Completed bowtie2 aligner workflow.")
/satmut_utils-1.0.4-py3-none-any.whl/analysis/aligners.py
0.658088
0.153359
aligners.py
pypi
"""Runs FASTQ preprocessing (adapter, quality trimming).""" import argparse import logging import os import sys from core_utils.file_utils import replace_extension from core_utils.string_utils import none_or_str from satmut_utils.definitions import LOG_FORMATTER from analysis.read_preprocessor import FastqPreprocessor __author__ = "Ian_Hoskins" __credits__ = ["Ian Hoskins"] __license__ = "GPLv3" __maintainer__ = "Ian Hoskins" __email__ = "[email protected]" __status__ = "Development" LOGFILE = replace_extension(os.path.basename(__file__), "log") logger = logging.getLogger(__name__) console_handler = logging.StreamHandler() console_handler.setFormatter(LOG_FORMATTER) logger.addHandler(console_handler) def parse_commandline_params(args): """Parses command line parameters. :param list args: command line arguments, no script name :return argparse.Namespace: namespace object with dict-like access """ parser = argparse.ArgumentParser(description="%s arguments" % __name__) # Add new arguments for command line passing of files, options, etc; see argparse docs parser.add_argument("-1", "--fastq1", type=str, required=True, help='R1 FASTQ') parser.add_argument("-2", "--fastq2", type=str, required=True, help='R2 FASTQ') parser.add_argument("--r1_fiveprime_adapters", type=none_or_str, default="None", help='Comma-delimited R1 5\' adapters, or None if no R1 5\' adapters exist.') parser.add_argument("--r1_threeprime_adapters", type=none_or_str, default="None", help='Comma-delimited R1 3\' adapters, or None if no R1 3\' adapters exist.') parser.add_argument("--r2_fiveprime_adapters", type=none_or_str, default="None", help='Comma-delimited R2 5\' adapters, or None if no R2 5\' adapters exist.') parser.add_argument("--r2_threeprime_adapters", type=none_or_str, default="None", help='Comma-delimited R2 3\' adapters, or None if no R2 3\' adapters exist.') parser.add_argument("-o", "--output_dir", type=str, default=FastqPreprocessor.OUTDIR, help='Optional output directory. Default current working directory.') parser.add_argument("-c", "--cores", type=int, default=FastqPreprocessor.NCORES, help='Number of cores to use for cutadapt. Default %i.' % FastqPreprocessor.NCORES) parser.add_argument("-n", "--ntrimmed", type=int, default=FastqPreprocessor.NTRIMMED, help='Max number of adapters to trim from each read. Useful for trimming terminal tiles ' 'with vector-transgene alignment. Default %i.' % FastqPreprocessor.NTRIMMED) parser.add_argument("-l", "--overlap_length", type=int, default=FastqPreprocessor.OVERLAP_LEN, help='Number of read bases overlapping the adapter sequence(s) to consider for cutadapt trimming. ' 'Default %i.' % FastqPreprocessor.OVERLAP_LEN) parser.add_argument("-b", "--trim_bq", type=int, default=FastqPreprocessor.TRIM_QUALITY, help='Base quality for cutadapt 3\' trimming. Default %i.' % FastqPreprocessor.TRIM_QUALITY) parsed_args = vars(parser.parse_args(args)) return parsed_args def workflow(f1, f2, r1_fiveprime_adapters=FastqPreprocessor.DEFAULT_ADAPTER, r1_threeprime_adapters=FastqPreprocessor.DEFAULT_ADAPTER, r2_fiveprime_adapters=FastqPreprocessor.DEFAULT_ADAPTER, r2_threeprime_adapters=FastqPreprocessor.DEFAULT_ADAPTER, outdir=FastqPreprocessor.OUTDIR, ncores=FastqPreprocessor.NCORES, ntrimmed=FastqPreprocessor.NTRIMMED, overlap_len=FastqPreprocessor.OVERLAP_LEN, trim_bq=FastqPreprocessor.TRIM_QUALITY): """Runs the FASTQ preprocessor workflow. :param str f1: path of the R1 FASTQ :param str f2: path of the R2 FASTQ :param str | None r1_fiveprime_adapters: comma-delimited 5' adapters to trim from R1. Default None. :param str | None r1_threeprime_adapters: comma-delimited 3' adapters to trim from R1. Default None. :param str | None r2_fiveprime_adapters: comma-delimited 5' adapters to trim from R2. Default None. :param str | None r2_threeprime_adapters: comma-delimited 3' adapters to trim from R2. Default None. :param str outdir: optional output dir for the results :param int ncores: Number of CPU cores to use for cutadapt. Default 0 (autodetect). :param int ntrimmed: Max number of adapters to trim from each read. Default 3. :param int overlap_len: number of bases to match in read to trim. Default 8. :param int trim_bq: quality score for cutadapt quality trimming at the 3' end. Default 15. :return tuple: (str, str) R1 and R2 trimmed FASTQ filepaths """ fqp = FastqPreprocessor( f1=f1, f2=f2, r1_fiveprime_adapters=r1_fiveprime_adapters, r1_threeprime_adapters=r1_threeprime_adapters, r2_fiveprime_adapters=r2_fiveprime_adapters, r2_threeprime_adapters=r2_threeprime_adapters, outdir=outdir, ncores=ncores, trim_bq=trim_bq, ntrimmed=ntrimmed, overlap_len=overlap_len, no_trim=False) return fqp.trimmed_f1, fqp.trimmed_f2 def main(): """Runs the workflow when called from command line.""" parsed_args = parse_commandline_params(sys.argv[1:]) outdir = parsed_args["output_dir"] if not os.path.exists(outdir): os.mkdir(outdir) log_handler = logging.FileHandler(os.path.join(outdir, LOGFILE)) log_handler.setFormatter(LOG_FORMATTER) logger.addHandler(log_handler) logger.info("Started %s" % sys.argv[0]) workflow(f1=parsed_args["fastq1"], f2=parsed_args["fastq2"], r1_fiveprime_adapters=parsed_args["r1_fiveprime_adapters"], r1_threeprime_adapters=parsed_args["r1_threeprime_adapters"], r2_fiveprime_adapters=parsed_args["r2_fiveprime_adapters"], r2_threeprime_adapters=parsed_args["r2_threeprime_adapters"], outdir=parsed_args["output_dir"], ncores=parsed_args["cores"], ntrimmed=parsed_args["ntrimmed"], overlap_len=parsed_args["overlap_length"], trim_bq=parsed_args["trim_bq"]) logger.info("Completed %s" % sys.argv[0]) if __name__ == "__main__": main()
/satmut_utils-1.0.4-py3-none-any.whl/scripts/run_fastq_preprocessor.py
0.53607
0.151655
run_fastq_preprocessor.py
pypi
import json import logging import tempfile import h5py LOGGER = logging.getLogger(__name__) class Artifacts(): # pylint: disable=R0903 def __init__(self, waterfall, metadata): """Constructor. Arguments: waterfall_data: The Waterfall object to be stored metadata: A JSON-serializeable dictionary, structure: { 'observation_id': integer number, 'tle': 3-line string, 'frequency': integer number, 'location': { 'latitude': number, 'longitude': number, 'altitude': self.location['elev'] } } """ self.artifacts_file = None self._waterfall_data = waterfall.data self._metadata = json.dumps(metadata) def create(self): self.artifacts_file = tempfile.TemporaryFile() hdf5_file = h5py.File(self.artifacts_file, 'w') hdf5_file.attrs['artifact_version'] = 2 hdf5_file.attrs['metadata'] = self._metadata # Create waterfall group wf_group = hdf5_file.create_group('waterfall') # Store observation metadata # NOTE: start_time is not equal to observation start time wf_group.attrs['start_time'] = self._waterfall_data['timestamp'] # Store waterfall attributes wf_group.attrs['offset_in_stds'] = -2.0 wf_group.attrs['scale_in_stds'] = 8.0 # Store waterfall units wf_group.attrs['data_min_unit'] = 'dB' wf_group.attrs['data_max_unit'] = 'dB' wf_group.attrs['offset_unit'] = 'dB' wf_group.attrs['scale_unit'] = 'dB/div' wf_group.attrs['data_unit'] = 'div' wf_group.attrs['relative_time_unit'] = 'seconds' wf_group.attrs['absolute_time_unit'] = 'seconds' wf_group.attrs['frequency_unit'] = 'kHz' # Store waterfall datasets _dataset = wf_group.create_dataset('offset', data=self._waterfall_data['compressed']['offset'], compression='gzip') _dataset.dims[0].label = 'Time (seconds)' _dataset = wf_group.create_dataset('scale', data=self._waterfall_data['compressed']['scale'], compression='gzip') _dataset.dims[0].label = 'Time (seconds)' _dataset = wf_group.create_dataset('data', data=self._waterfall_data['compressed']['values'], compression='gzip') _dataset.dims[0].label = 'Frequency (kHz)' _dataset.dims[1].label = 'Time (seconds)' _dataset = wf_group.create_dataset('relative_time', data=self._waterfall_data['trel'], compression='gzip') _dataset.dims[0].label = 'Time (seconds)' _dataset = wf_group.create_dataset('absolute_time', data=self._waterfall_data['data']['tabs'], compression='gzip') _dataset.dims[0].label = 'Time (seconds)' _dataset = wf_group.create_dataset('frequency', data=self._waterfall_data['freq'], compression='gzip') _dataset.dims[0].label = 'Frequency (kHz)' hdf5_file.close() self.artifacts_file.seek(0)
/satnogs-client-1.8.1.tar.gz/satnogs-client-1.8.1/satnogsclient/artifacts.py
0.48438
0.184473
artifacts.py
pypi
import logging import Hamlib LOGGER = logging.getLogger(__name__) class Rotator(object): """Communicate and interface with rotators :param model: Model of rotator e.g. "ROT_MODEL_EASYCOMM3" or "ROT_MODEL_DUMMY" :type model: str :param baud: The baud rate of serial communication, e.g. 19200 :type baud: int, optional :param port: The port of the rotator, e.g. "/dev/ttyUSB0" :type port: str """ def __init__(self, model, baud, port): """Class constructor""" self.rot_port = port self.rot_baud = baud self.rot_name = getattr(Hamlib, model) self.rot = Hamlib.Rot(self.rot_name) self.rot.state.rotport.pathname = self.rot_port self.rot.state.rotport.parm.serial.rate = self.rot_baud def get_info(self): """Return information about the rotator :return: Information about the rotator :rtype: str """ return self.rot.get_info() @property def position(self): """Return the position in degrees of azimuth and elevation :return: Position in degrees :rtype: list[float, float] """ return self.rot.get_position() @position.setter def position(self, pos): """Set the position in degrees of azimuth and elevation :param pos: Position in degrees :type pos: list[float, float] """ self.rot.set_position(*pos) def get_conf(self, cmd): """Return the configuration of a register :param cmd: Number of the register :type cmd: int :return: Value of register :rtype: str """ return self.rot.get_conf(cmd) def reset(self): """Move the rotator to home position and return the current position :return: Current position in degrees :rtype: None or list[float, float] """ return self.rot.reset(Hamlib.ROT_RESET_ALL) def stop(self): """Stop the rotator and return the current position :return: Current position in degrees :rtype: None or list[float, float] """ return self.rot.stop() def park(self): """Move the rotator to park position and return the current position :return: Current position in degrees :rtype: None or list[float, float] """ return self.rot.park() def move(self, direction, speed): """Move the rotator with speed (mdeg/s) to specific direction :param direction: The direction of movement, e.g. ROT_MOVE_UP, ROT_MOVE_DOWN, ROT_MOVE_LEFT, ROT_MOVE_RIGHT :type direction: str :param speed: The velocity set point in mdeg/s :type speed: int """ direction = getattr(Hamlib, direction) self.rot.move(direction, abs(speed)) def open(self): """Start the communication with rotator""" self.rot.open() def close(self): """End the communication with rotator""" self.rot.close()
/satnogs-client-1.8.1.tar.gz/satnogs-client-1.8.1/satnogsclient/rotator.py
0.877713
0.5
rotator.py
pypi
import logging import matplotlib import numpy as np matplotlib.use('Agg') import matplotlib.pyplot as plt # isort:skip # noqa: E402 # pylint: disable=C0411,C0412,C0413 LOGGER = logging.getLogger(__name__) OFFSET_IN_STDS = -2.0 SCALE_IN_STDS = 8.0 class EmptyArrayError(Exception): """Empty data array exception""" def _read_waterfall(datafile_path): """Read waterfall data file :param datafile_path: Path to data file :type datafile_path: str :raises EmptyArrayError: Empty waterfall data :return: Waterfall data :rtype: dict """ LOGGER.info('Reading waterfall file') datafile = open(datafile_path, mode='rb') waterfall = { 'timestamp': np.fromfile(datafile, dtype='|S32', count=1)[0], 'nchan': np.fromfile(datafile, dtype='>i4', count=1)[0], 'samp_rate': np.fromfile(datafile, dtype='>i4', count=1)[0], 'nfft_per_row': np.fromfile(datafile, dtype='>i4', count=1)[0], 'center_freq': np.fromfile(datafile, dtype='>f4', count=1)[0], 'endianess': np.fromfile(datafile, dtype='>i4', count=1)[0] } data_dtypes = np.dtype([('tabs', 'int64'), ('spec', 'float32', (waterfall['nchan'], ))]) waterfall['data'] = np.fromfile(datafile, dtype=data_dtypes) if not waterfall['data'].size: raise EmptyArrayError datafile.close() return waterfall def _compress_waterfall(waterfall): """Compress spectra of waterfall :param waterfall: Watefall data :type waterfall: dict :return: Compressed spectra :rtype: dict """ spec = waterfall['data']['spec'] std = np.std(spec, axis=0) offset = np.mean(spec, axis=0) + OFFSET_IN_STDS * std scale = SCALE_IN_STDS * std / 255.0 values = np.clip((spec - offset) / scale, 0.0, 255.0).astype('uint8') return {'offset': offset, 'scale': scale, 'values': values} def _get_waterfall(datafile_path): """Get waterfall data :param datafile_path: Path to data file :type datafile_path: str_array :return: Waterfall data including compressed data :rtype: dict """ waterfall = _read_waterfall(datafile_path) nint = waterfall['data']['spec'].shape[0] waterfall['trel'] = np.arange(nint) * waterfall['nfft_per_row'] * waterfall['nchan'] / float( waterfall['samp_rate']) waterfall['freq'] = np.linspace(-0.5 * waterfall['samp_rate'], 0.5 * waterfall['samp_rate'], waterfall['nchan'], endpoint=False) waterfall['compressed'] = _compress_waterfall(waterfall) return waterfall class Waterfall(): # pylint: disable=R0903 """Parse waterfall data file :param datafile_path: Path to data file :type datafile_path: str_array """ def __init__(self, datafile_path): """Class constructor""" self.data = _get_waterfall(datafile_path) def plot(self, figure_path, vmin=None, vmax=None): """Plot waterfall into a figure :param figure_path: Path of figure file to save :type figure_path: str :param vmin: Minimum value range :type vmin: int :param vmax: Maximum value range :type vmax: int """ tmin = np.min(self.data['data']['tabs'] / 1000000.0) tmax = np.max(self.data['data']['tabs'] / 1000000.0) fmin = np.min(self.data['freq'] / 1000.0) fmax = np.max(self.data['freq'] / 1000.0) if vmin is None or vmax is None: vmin = -100 vmax = -50 c_idx = self.data['data']['spec'] > -200.0 if np.sum(c_idx) > 100: data_mean = np.mean(self.data['data']['spec'][c_idx]) data_std = np.std(self.data['data']['spec'][c_idx]) vmin = data_mean - 2.0 * data_std vmax = data_mean + 6.0 * data_std plt.figure(figsize=(10, 20)) plt.imshow(self.data['data']['spec'], origin='lower', aspect='auto', interpolation='None', extent=[fmin, fmax, tmin, tmax], vmin=vmin, vmax=vmax, cmap='viridis') plt.xlabel('Frequency (kHz)') plt.ylabel('Time (seconds)') fig = plt.colorbar(aspect=50) fig.set_label('Power (dB)') plt.savefig(figure_path, bbox_inches='tight') plt.close()
/satnogs-client-1.8.1.tar.gz/satnogs-client-1.8.1/satnogsclient/waterfall.py
0.673192
0.453746
waterfall.py
pypi
from __future__ import absolute_import, division, print_function import logging import sys from datetime import datetime import ephem import pytz LOGGER = logging.getLogger(__name__) def pinpoint(observer_dict, satellite_dict, timestamp=None): """Provides azimuth and altitude of tracked object. args: observer_dict: dictionary with details of observation point. satellite_dict: dictionary with details of satellite. time: timestamp we want to use for pinpointing the observed object. returns: Dictionary containing azimuth, altitude and "ok" for error detection. """ # pylint: disable=assigning-non-slot # Disable until pylint 2.4 is released, see # https://github.com/PyCQA/pylint/issues/2807 # observer object if all(x in observer_dict for x in ('lat', 'lon', 'elev')): LOGGER.debug('Observer data: %s', observer_dict) observer = ephem.Observer() observer.lon = str(observer_dict['lon']) observer.lat = str(observer_dict['lat']) observer.elevation = float(observer_dict['elev']) else: LOGGER.error('Something went wrong: %s', observer_dict) return {'ok': False} # satellite object if all(x in satellite_dict for x in ('tle0', 'tle1', 'tle2')): LOGGER.debug('Satellite data: %s', satellite_dict) tle0 = str(satellite_dict['tle0']) tle1 = str(satellite_dict['tle1']) tle2 = str(satellite_dict['tle2']) try: satellite = ephem.readtle(tle0, tle1, tle2) except ValueError: LOGGER.error('Something went wrong: %s', satellite_dict) LOGGER.error(sys.exc_info()[0]) return {'ok': False} else: return {'ok': False} # time of observation if not timestamp: timestamp = datetime.now(pytz.utc) # observation calculation observer.date = timestamp.strftime('%Y-%m-%d %H:%M:%S.%f') satellite.compute(observer) calculated_data = { 'alt': satellite.alt, 'az': satellite.az, 'rng': satellite.range, 'rng_vlct': satellite.range_velocity, 'ok': True } LOGGER.debug('Calculated data: %s', calculated_data) return calculated_data
/satnogs-client-1.8.1.tar.gz/satnogs-client-1.8.1/satnogsclient/observer/orbital.py
0.657868
0.269208
orbital.py
pypi
import json import logging import signal import subprocess import satnogsclient.settings as client_settings LOGGER = logging.getLogger(__name__) SATNOGS_FLOWGRAPH_SCRIPTS = { 'AFSK1K2': 'satnogs_afsk1200_ax25.py', 'AMSAT_DUV': 'satnogs_amsat_fox_duv_decoder.py', 'APT': 'satnogs_noaa_apt_decoder.py', 'ARGOS_BPSK_PMT_A3': 'satnogs_argos_bpsk_ldr.py', 'BPSK': 'satnogs_bpsk.py', 'CW': 'satnogs_cw_decoder.py', 'FM': 'satnogs_fm.py', 'FSK': 'satnogs_fsk.py', 'GFSK_RKTR': 'satnogs_reaktor_hello_world_fsk9600_decoder.py', 'GFSK/BPSK': 'satnogs_qubik_telem.py', 'SSTV': 'satnogs_sstv_pd120_demod.py' } SATNOGS_FLOWGRAPH_MODES = { 'AFSK': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['AFSK1K2'], 'has_baudrate': False, 'has_framing': False }, 'APT': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['APT'], 'has_baudrate': False, 'has_framing': False, }, 'BPSK': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['BPSK'], 'has_baudrate': True, 'has_framing': True, 'framing': 'ax25' }, 'BPSK PMT-A3': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['ARGOS_BPSK_PMT_A3'], 'has_baudrate': True, 'has_framing': False }, 'CW': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['CW'], 'has_baudrate': True, 'has_framing': False }, 'DUV': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['AMSAT_DUV'], 'has_baudrate': False, 'has_framing': False }, 'FM': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['FM'], 'has_baudrate': False, 'has_framing': False }, 'FSK': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['FSK'], 'has_baudrate': True, 'has_framing': True, 'framing': 'ax25' }, 'FSK AX.100 Mode 5': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['FSK'], 'has_baudrate': True, 'has_framing': True, 'framing': 'ax100_mode5' }, 'FSK AX.100 Mode 6': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['FSK'], 'has_baudrate': True, 'has_framing': True, 'framing': 'ax100_mode6' }, 'GFSK': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['FSK'], 'has_baudrate': True, 'has_framing': True, 'framing': 'ax25' }, 'GFSK Rktr': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['GFSK_RKTR'], 'has_baudrate': True, 'has_framing': False }, 'GFSK/BPSK': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['GFSK/BPSK'], 'has_baudrate': True, 'has_framing': False, }, 'GMSK': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['FSK'], 'has_baudrate': True, 'has_framing': True, 'framing': 'ax25' }, 'MSK': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['FSK'], 'has_baudrate': True, 'has_framing': True, 'framing': 'ax25' }, 'MSK AX.100 Mode 5': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['FSK'], 'has_baudrate': True, 'has_framing': True, 'framing': 'ax100_mode5' }, 'MSK AX.100 Mode 6': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['FSK'], 'has_baudrate': True, 'has_framing': True, 'framing': 'ax100_mode6' }, 'SSTV': { 'script_name': SATNOGS_FLOWGRAPH_SCRIPTS['SSTV'], 'has_baudrate': False, 'has_framing': False }, } SATNOGS_FLOWGRAPH_MODE_DEFAULT = 'FM' class Flowgraph(): """Execute SatNOGS Flowgraphs :param device: SoapySDR device :type device: str :param sampling_rate: Sampling rate :type sampling_rate: int :param frequency: RX frequency :type frequency: int :param mode: Mode of operation :type mode: str :param baud: Baud rate or WPM :type baud: int :param output_data: Dictionary of output data :type output_data: dict """ def __init__(self, device, sampling_rate, frequency, mode, baud, output_data): """Class constructor""" self.parameters = { 'soapy-rx-device': device, 'samp-rate-rx': str(sampling_rate), 'rx-freq': str(frequency), 'file-path': output_data['audio'], 'waterfall-file-path': output_data['waterfall'], 'decoded-data-file-path': output_data['decoded'], 'doppler-correction-per-sec': client_settings.SATNOGS_DOPPLER_CORR_PER_SEC, 'lo-offset': client_settings.SATNOGS_LO_OFFSET, 'ppm': client_settings.SATNOGS_PPM_ERROR, 'rigctl-port': str(client_settings.SATNOGS_RIG_PORT), 'gain-mode': client_settings.SATNOGS_GAIN_MODE, 'gain': client_settings.SATNOGS_RF_GAIN, 'antenna': client_settings.SATNOGS_ANTENNA, 'dev-args': client_settings.SATNOGS_DEV_ARGS, 'stream-args': client_settings.SATNOGS_STREAM_ARGS, 'tune-args': client_settings.SATNOGS_TUNE_ARGS, 'other-settings': client_settings.SATNOGS_OTHER_SETTINGS, 'dc-removal': client_settings.SATNOGS_DC_REMOVAL, 'bb-freq': client_settings.SATNOGS_BB_FREQ, 'bw': client_settings.SATNOGS_RX_BANDWIDTH, 'enable-iq-dump': str(int(client_settings.ENABLE_IQ_DUMP is True)), 'iq-file-path': client_settings.IQ_DUMP_FILENAME, 'udp-dump-host': client_settings.UDP_DUMP_HOST, 'udp-dump-port': client_settings.UDP_DUMP_PORT, 'wpm': None, 'baudrate': None, 'framing': None } if mode in SATNOGS_FLOWGRAPH_MODES: self.script = SATNOGS_FLOWGRAPH_MODES[mode]['script_name'] if baud and SATNOGS_FLOWGRAPH_MODES[mode]['has_baudrate']: # If this is a CW observation pass the WPM parameter if mode == 'CW': self.parameters['wpm'] = str(int(baud)) else: self.parameters['baudrate'] = str(int(baud)) # Apply framing mode if SATNOGS_FLOWGRAPH_MODES[mode]['has_framing']: self.parameters['framing'] = SATNOGS_FLOWGRAPH_MODES[mode]['framing'] else: self.script = SATNOGS_FLOWGRAPH_MODES[SATNOGS_FLOWGRAPH_MODE_DEFAULT]['script_name'] self.process = None @property def enabled(self): """Get flowgraph running status :return: Flowgraph running status :rtype: bool """ if self.process and self.process.poll() is None: return True return False @enabled.setter def enabled(self, status): """Start or stop running of flowgraph :param status: Running status :type status: bool """ if status: args = [self.script] for parameter, value in self.parameters.items(): if value is not None: args.append('--{}={}'.format(parameter, value)) try: self.process = subprocess.Popen(args) except OSError: LOGGER.exception('Could not start GNURadio python script') elif self.process: self.process.send_signal(signal.SIGINT) _, _ = self.process.communicate() @property def info(self): """Get information and parameters of flowgraph and radio :return: Information about flowgraph and radio :rtype: dict """ client_metadata = { 'radio': { 'name': 'gr-satnogs', 'version': None, 'parameters': self.parameters } } process = subprocess.Popen(['python3', '-m', 'satnogs.satnogs_info'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) gr_satnogs_info, _ = process.communicate() # pylint: disable=W0612 if process.returncode == 0: try: gr_satnogs_info = json.loads(gr_satnogs_info) except ValueError: client_metadata['radio']['version'] = 'invalid' else: if 'version' in gr_satnogs_info: client_metadata['radio']['version'] = gr_satnogs_info['version'] else: client_metadata['radio']['version'] = 'unknown' return client_metadata
/satnogs-client-1.8.1.tar.gz/satnogs-client-1.8.1/satnogsclient/radio/flowgraphs.py
0.494873
0.158012
flowgraphs.py
pypi
import logging from pathlib import Path import yaml LOGGER = logging.getLogger(__name__) class Config(): """Manage configuration file :param filename: File path of configuration :type filename: str """ def __init__(self, filename): """Class constructor""" self._filename = filename try: config = self._load_config() except FileNotFoundError: config = {} self.config = config or {} def _load_config(self): """Load and parse YAML configuration :return: Configuration dictionary :rtype: dict or NoneType """ with open(self._filename, 'r', encoding='utf-8') as file: return yaml.safe_load(file) def dump_config(self, to_file=False): """Dump configuration in YAML format :param to_file: Dump to file :type to_file: bool, optional :return: YAML configuration :rtype: str """ if to_file: Path(self._filename ).parent.mkdir(mode=0o700, parents=True, exist_ok=True) with open(self._filename, 'w', encoding='utf-8') as file: yaml_config = yaml.dump( self.config, file, default_flow_style=False ) self.config = self._load_config() else: yaml_config = yaml.dump(self.config, default_flow_style=False) return yaml_config def clear_config(self): """Clear configuration file""" with open(self._filename, 'w', encoding='utf-8'): pass self.config = self._load_config() def get_variable(self, variable): """Get variable value from configuration :param variable: Variable to get the value :type variable: str :return: Value of variable :rtype: str or bool or NoneType """ if self.config: return self.config.get(variable) return None def set_variable(self, variable, value): """Set variable value in configuration :param variable: Variable to set the value :type variable: str :param value: Value of variable :type value: str or bool or NoneType """ if value is not None: self.config[variable] = value else: self.config.pop(variable, None) self.dump_config(to_file=True)
/satnogs_config-0.13.2-py3-none-any.whl/satnogsconfig/config.py
0.552781
0.156073
config.py
pypi
import subprocess class Ansible(): """Call Ansible playbooks""" # pylint: disable=too-few-public-methods def __init__(self, ansible_dir): """Class constructor""" self._ansible_dir = ansible_dir def run(self, playbooks, tags=None, extra_args=None): """Run Ansible playbook :param playbooks: List of playbooks :type playbooks: list :param tags: List of tags :type tags: list, optional :param extra_args: List of extra arguments to pass to Ansible :type extra_args: list, optional :return: Whether Ansible execution succeeded :rtype: bool """ args = [] if extra_args: args += extra_args if tags: args += ['-t', ','.join(tags)] if playbooks: args += playbooks try: subprocess.run( ['ansible-playbook'] + args, cwd=self._ansible_dir, check=True ) except subprocess.CalledProcessError: return False return True def pull(self, playbooks, url, branch=None, tags=None, extra_args=None): """Pull and run Ansible playbook :param playbooks: List of playbooks :type playbooks: list :param url: Git URL to pull playbooks :type url: str :param branch: Git branch to pull playbooks :type branch: str, optional :param tags: List of tags :type tags: list, optional :param extra_args: List of extra arguments to pass to Ansible :type extra_args: list, optional :return: Whether Ansible execution succeeded :rtype: bool """ # pylint: disable=too-many-arguments args = [] if extra_args: args += extra_args if tags: args += ['-t', ','.join(tags)] if playbooks: args += playbooks if branch: args += ['-C', branch] try: subprocess.run( ['ansible-pull', '-d', self._ansible_dir, '-U', url] + args, check=True ) except subprocess.CalledProcessError: return False return True
/satnogs_config-0.13.2-py3-none-any.whl/satnogsconfig/helpers/ansible.py
0.598664
0.216012
ansible.py
pypi
import os import subprocess import sys from pathlib import Path from satnogsconfig import settings def get_package_version(package_name): """Get installed version of the given package :return: Version of the given package :rtype: str """ try: result = subprocess.run( f"dpkg-query --show -f='${{Version}}' {package_name}", shell=True, stdout=subprocess.PIPE, check=True ) except subprocess.CalledProcessError: return 'unknown' return result.stdout.decode('utf-8').strip() or 'unknown' class SatnogsSetup(): """Interract with satnogs-setup""" def __init__(self): """Class constructor""" self._satnogs_stamp_dir = settings.SATNOGS_SETUP_STAMP_DIR self._satnogs_upgrade_script = settings.SATNOGS_SETUP_UPGRADE_SCRIPT @staticmethod def restart(boot=False): """Restart satnogs-setup script :param boot: Whether to bootstrap or not :type boot: bool, optional """ if boot: os.execlp('satnogs-setup', 'satnogs-setup', '-b') else: os.execlp('satnogs-setup', 'satnogs-setup') @property def is_applied(self): """Check whether configuration has been applied :return: Whether configuration has been applied :rtype: bool """ install_stamp_path = Path(self._satnogs_stamp_dir).joinpath( settings.SATNOGS_SETUP_INSTALL_STAMP ) if install_stamp_path.exists(): with install_stamp_path.open(mode='r', encoding='utf-8') as file: if file.read(): return False return True return False @is_applied.setter def is_applied(self, install): """Mark that configuration has been applied :param install: Configuration has been installed :type install: bool """ install_stamp_path = Path(self._satnogs_stamp_dir).joinpath( settings.SATNOGS_SETUP_INSTALL_STAMP ) if install: with install_stamp_path.open(mode='w', encoding='utf-8'): pass else: try: install_stamp_path.unlink() except FileNotFoundError: pass @property def tags(self): """Get satnogs-setup tags :return: Set of tags :rtype: set """ tags_path = Path(self._satnogs_stamp_dir ).joinpath(settings.SATNOGS_SETUP_INSTALL_STAMP) if tags_path.exists(): with tags_path.open(mode='r', encoding='utf-8') as file: if contents := file.read(): return set(contents.split(',')) return None @tags.setter def tags(self, tags): """Set satnogs-setup tags :param tags: List of tags :type tags: list """ new_tags = self.tags.copy() if self.tags else set() new_tags.update(tags) tags_path = Path(self._satnogs_stamp_dir ).joinpath(settings.SATNOGS_SETUP_INSTALL_STAMP) if tags_path.exists(): with tags_path.open(mode='w', encoding='utf-8') as file: file.write(','.join(new_tags)) def upgrade_system(self): """Upgrade system packages""" try: subprocess.run( self._satnogs_upgrade_script, shell=True, check=True ) except subprocess.CalledProcessError: sys.exit(1) @property def satnogs_client_ansible_version(self): """Get installed SatNOGS Client Ansible version :return: Version of SatNOGS Client Ansible :rtype: str """ try: result = subprocess.run( 'cd "$HOME/.satnogs/ansible"' '&& TZ=UTC ' 'git show -s --format=%cd --date="format-local:%Y%m%d%H%M"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True ) except subprocess.CalledProcessError: return 'unknown' return result.stdout.decode('utf-8').strip() or 'unknown' @property def satnogs_client_version(self): """Get installed SatNOGS Client version :return: Version of SatNOGS Client :rtype: str """ try: result = subprocess.run( '/var/lib/satnogs/bin/pip show satnogs-client 2>/dev/null' " | awk '/^Version: / { print $2 }'", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True ) except subprocess.CalledProcessError: return 'unknown' return result.stdout.decode('utf-8').strip() or 'unknown' @property def gr_satnogs_version(self): """Get installed gr-satnogs version :return: Version of gr-satnogs :rtype: str """ return get_package_version('gr-satnogs') @property def satnogs_flowgraphs_version(self): """Get installed satnogs-flowgraphs version :return: Version of satnogs-flowgraphs :rtype: str """ return get_package_version('satnogs-flowgraphs') @property def gr_soapy_version(self): """Get installed gr-soapy version :return: Version of gr-soapy :rtype: str """ return get_package_version('gr-soapy') @property def gnuradio_version(self): """Get installed gnuradio version :return: Version of gr-soapy :rtype: str """ return get_package_version('gnuradio')
/satnogs_config-0.13.2-py3-none-any.whl/satnogsconfig/helpers/satnogssetup.py
0.537284
0.154919
satnogssetup.py
pypi
class OpenApiException(Exception): """The base exception class for all OpenAPIExceptions""" class ApiTypeError(OpenApiException, TypeError): def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None): """ Raises an exception for TypeErrors Args: msg (str): the exception message Keyword Args: path_to_item (list): a list of keys an indices to get to the current_item None if unset valid_classes (tuple): the primitive classes that current item should be an instance of None if unset key_type (bool): False if our value is a value in a dict True if it is a key in a dict False if our item is an item in a list None if unset """ self.path_to_item = path_to_item self.valid_classes = valid_classes self.key_type = key_type full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) super(ApiTypeError, self).__init__(full_msg) class ApiValueError(OpenApiException, ValueError): def __init__(self, msg, path_to_item=None): """ Args: msg (str): the exception message Keyword Args: path_to_item (list) the path to the exception in the received_data dict. None if unset """ self.path_to_item = path_to_item full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) super(ApiValueError, self).__init__(full_msg) class ApiAttributeError(OpenApiException, AttributeError): def __init__(self, msg, path_to_item=None): """ Raised when an attribute reference or assignment fails. Args: msg (str): the exception message Keyword Args: path_to_item (None/list) the path to the exception in the received_data dict """ self.path_to_item = path_to_item full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) super(ApiAttributeError, self).__init__(full_msg) class ApiKeyError(OpenApiException, KeyError): def __init__(self, msg, path_to_item=None): """ Args: msg (str): the exception message Keyword Args: path_to_item (None/list) the path to the exception in the received_data dict """ self.path_to_item = path_to_item full_msg = msg if path_to_item: full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) super(ApiKeyError, self).__init__(full_msg) class ApiException(OpenApiException): def __init__(self, status=None, reason=None, http_resp=None): if http_resp: self.status = http_resp.status self.reason = http_resp.reason self.body = http_resp.data self.headers = http_resp.getheaders() else: self.status = status self.reason = reason self.body = None self.headers = None def __str__(self): """Custom error messages for exception""" error_message = "({0})\n"\ "Reason: {1}\n".format(self.status, self.reason) if self.headers: error_message += "HTTP response headers: {0}\n".format( self.headers) if self.body: error_message += "HTTP response body: {0}\n".format(self.body) return error_message class NotFoundException(ApiException): def __init__(self, status=None, reason=None, http_resp=None): super(NotFoundException, self).__init__(status, reason, http_resp) class UnauthorizedException(ApiException): def __init__(self, status=None, reason=None, http_resp=None): super(UnauthorizedException, self).__init__(status, reason, http_resp) class ForbiddenException(ApiException): def __init__(self, status=None, reason=None, http_resp=None): super(ForbiddenException, self).__init__(status, reason, http_resp) class ServiceException(ApiException): def __init__(self, status=None, reason=None, http_resp=None): super(ServiceException, self).__init__(status, reason, http_resp) def render_path(path_to_item): """Returns a string representation of a path""" result = "" for pth in path_to_item: if isinstance(pth, int): result += "[{0}]".format(pth) else: result += "['{0}']".format(pth) return result
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/exceptions.py
0.769514
0.279315
exceptions.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError class Telemetry(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { ('version',): { 'max_length': 45, }, } @cached_property def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'sat_id': (str,), # noqa: E501 'norad_cat_id': (int,), # noqa: E501 'transmitter': (str,), # noqa: E501 'decoded': (str,), # noqa: E501 'frame': (str,), # noqa: E501 'associated_satellites': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 'version': (str,), # noqa: E501 'observation_id': (int, none_type,), # noqa: E501 'station_id': (int, none_type,), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'sat_id': 'sat_id', # noqa: E501 'norad_cat_id': 'norad_cat_id', # noqa: E501 'transmitter': 'transmitter', # noqa: E501 'decoded': 'decoded', # noqa: E501 'frame': 'frame', # noqa: E501 'associated_satellites': 'associated_satellites', # noqa: E501 'version': 'version', # noqa: E501 'observation_id': 'observation_id', # noqa: E501 'station_id': 'station_id', # noqa: E501 } read_only_vars = { 'sat_id', # noqa: E501 'norad_cat_id', # noqa: E501 'transmitter', # noqa: E501 'decoded', # noqa: E501 'frame', # noqa: E501 'associated_satellites', # noqa: E501 } _composed_schemas = {} @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, sat_id, norad_cat_id, transmitter, decoded, frame, associated_satellites, *args, **kwargs): # noqa: E501 """Telemetry - a model defined in OpenAPI Args: sat_id (str): norad_cat_id (int): transmitter (str): decoded (str): frame (str): associated_satellites ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) version (str): [optional] # noqa: E501 observation_id (int, none_type): [optional] # noqa: E501 station_id (int, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) self = super(OpenApiModel, cls).__new__(cls) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.sat_id = sat_id self.norad_cat_id = norad_cat_id self.transmitter = transmitter self.decoded = decoded self.frame = frame self.associated_satellites = associated_satellites for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) return self required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 """Telemetry - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) version (str): [optional] # noqa: E501 observation_id (int, none_type): [optional] # noqa: E501 station_id (int, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.")
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/telemetry.py
0.533884
0.152442
telemetry.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError def lazy_import(): from satnogsdbapiclient.model.optical_identification import OpticalIdentification globals()['OpticalIdentification'] = OpticalIdentification class OpticalObservation(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { } @cached_property def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ lazy_import() return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ lazy_import() return { 'id': (int,), # noqa: E501 'start': (datetime,), # noqa: E501 'station_id': (int,), # noqa: E501 'diagnostic_plot_url': (str,), # noqa: E501 'identifications': ([OpticalIdentification],), # noqa: E501 'uploader': (int, none_type,), # noqa: E501 'data': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'id': 'id', # noqa: E501 'start': 'start', # noqa: E501 'station_id': 'station_id', # noqa: E501 'diagnostic_plot_url': 'diagnostic_plot_url', # noqa: E501 'identifications': 'identifications', # noqa: E501 'uploader': 'uploader', # noqa: E501 'data': 'data', # noqa: E501 } read_only_vars = { 'id', # noqa: E501 'start', # noqa: E501 'station_id', # noqa: E501 'diagnostic_plot_url', # noqa: E501 'uploader', # noqa: E501 'data', # noqa: E501 } _composed_schemas = {} @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, id, start, station_id, diagnostic_plot_url, identifications, uploader, data, *args, **kwargs): # noqa: E501 """OpticalObservation - a model defined in OpenAPI Args: id (int): start (datetime): station_id (int): diagnostic_plot_url (str): identifications ([OpticalIdentification]): uploader (int, none_type): data ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) self = super(OpenApiModel, cls).__new__(cls) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.id = id self.start = start self.station_id = station_id self.diagnostic_plot_url = diagnostic_plot_url self.identifications = identifications self.uploader = uploader self.data = data for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) return self required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, identifications, *args, **kwargs): # noqa: E501 """OpticalObservation - a model defined in OpenAPI identifications ([OpticalIdentification]): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.identifications = identifications for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.")
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/optical_observation.py
0.580828
0.179674
optical_observation.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError class TypeEnum(ModelSimple): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { ('value',): { 'TRANSMITTER': "Transmitter", 'TRANSCEIVER': "Transceiver", 'TRANSPONDER': "Transponder", }, } validations = { } additional_properties_type = None _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'value': (str,), } @cached_property def discriminator(): return None attribute_map = {} read_only_vars = set() _composed_schemas = None required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, *args, **kwargs): """TypeEnum - a model defined in OpenAPI Note that value can be passed either in args or in kwargs, but not in both. Args: args[0] (str):, must be one of ["Transmitter", "Transceiver", "Transponder", ] # noqa: E501 Keyword Args: value (str):, must be one of ["Transmitter", "Transceiver", "Transponder", ] # noqa: E501 _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ # required up here when default value is not given _path_to_item = kwargs.pop('_path_to_item', ()) if 'value' in kwargs: value = kwargs.pop('value') elif args: args = list(args) value = args.pop(0) else: raise ApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), ) _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: raise ApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): """TypeEnum - a model defined in OpenAPI Note that value can be passed either in args or in kwargs, but not in both. Args: args[0] (str):, must be one of ["Transmitter", "Transceiver", "Transponder", ] # noqa: E501 Keyword Args: value (str):, must be one of ["Transmitter", "Transceiver", "Transponder", ] # noqa: E501 _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ # required up here when default value is not given _path_to_item = kwargs.pop('_path_to_item', ()) self = super(OpenApiModel, cls).__new__(cls) if 'value' in kwargs: value = kwargs.pop('value') elif args: args = list(args) value = args.pop(0) else: raise ApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), ) _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: raise ApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) return self
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/type_enum.py
0.577019
0.238196
type_enum.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError class ServiceEnum(ModelSimple): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { ('value',): { 'AERONAUTICAL': "Aeronautical", 'AMATEUR': "Amateur", 'BROADCASTING': "Broadcasting", 'EARTH_EXPLORATION': "Earth Exploration", 'FIXED': "Fixed", 'INTER-SATELLITE': "Inter-satellite", 'MARITIME': "Maritime", 'METEOROLOGICAL': "Meteorological", 'MOBILE': "Mobile", 'RADIOLOCATION': "Radiolocation", 'RADIONAVIGATIONAL': "Radionavigational", 'SPACE_OPERATION': "Space Operation", 'SPACE_RESEARCH': "Space Research", 'STANDARD_FREQUENCY_AND_TIME_SIGNAL': "Standard Frequency and Time Signal", 'UNKNOWN': "Unknown", }, } validations = { } additional_properties_type = None _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'value': (str,), } @cached_property def discriminator(): return None attribute_map = {} read_only_vars = set() _composed_schemas = None required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, *args, **kwargs): """ServiceEnum - a model defined in OpenAPI Note that value can be passed either in args or in kwargs, but not in both. Args: args[0] (str):, must be one of ["Aeronautical", "Amateur", "Broadcasting", "Earth Exploration", "Fixed", "Inter-satellite", "Maritime", "Meteorological", "Mobile", "Radiolocation", "Radionavigational", "Space Operation", "Space Research", "Standard Frequency and Time Signal", "Unknown", ] # noqa: E501 Keyword Args: value (str):, must be one of ["Aeronautical", "Amateur", "Broadcasting", "Earth Exploration", "Fixed", "Inter-satellite", "Maritime", "Meteorological", "Mobile", "Radiolocation", "Radionavigational", "Space Operation", "Space Research", "Standard Frequency and Time Signal", "Unknown", ] # noqa: E501 _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ # required up here when default value is not given _path_to_item = kwargs.pop('_path_to_item', ()) if 'value' in kwargs: value = kwargs.pop('value') elif args: args = list(args) value = args.pop(0) else: raise ApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), ) _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: raise ApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): """ServiceEnum - a model defined in OpenAPI Note that value can be passed either in args or in kwargs, but not in both. Args: args[0] (str):, must be one of ["Aeronautical", "Amateur", "Broadcasting", "Earth Exploration", "Fixed", "Inter-satellite", "Maritime", "Meteorological", "Mobile", "Radiolocation", "Radionavigational", "Space Operation", "Space Research", "Standard Frequency and Time Signal", "Unknown", ] # noqa: E501 Keyword Args: value (str):, must be one of ["Aeronautical", "Amateur", "Broadcasting", "Earth Exploration", "Fixed", "Inter-satellite", "Maritime", "Meteorological", "Mobile", "Radiolocation", "Radionavigational", "Space Operation", "Space Research", "Standard Frequency and Time Signal", "Unknown", ] # noqa: E501 _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ # required up here when default value is not given _path_to_item = kwargs.pop('_path_to_item', ()) self = super(OpenApiModel, cls).__new__(cls) if 'value' in kwargs: value = kwargs.pop('value') elif args: args = list(args) value = args.pop(0) else: raise ApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), ) _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: raise ApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) return self
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/service_enum.py
0.494873
0.226805
service_enum.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError class NewArtifact(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { } @cached_property def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'artifact_file': (str, none_type,), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'artifact_file': 'artifact_file', # noqa: E501 } read_only_vars = { } _composed_schemas = {} @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 """NewArtifact - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) artifact_file (str, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) self = super(OpenApiModel, cls).__new__(cls) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) return self required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 """NewArtifact - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) artifact_file (str, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.")
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/new_artifact.py
0.531209
0.204064
new_artifact.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError def lazy_import(): from satnogsdbapiclient.model.type_enum import TypeEnum globals()['TypeEnum'] = TypeEnum class TransmitterRequest(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { ('description',): { 'min_length': 1, }, ('uplink_low',): { 'inclusive_maximum': 40000000000, 'inclusive_minimum': 0, }, ('uplink_high',): { 'inclusive_maximum': 40000000000, 'inclusive_minimum': 0, }, ('uplink_drift',): { 'inclusive_maximum': 99999, 'inclusive_minimum': -99999, }, ('downlink_low',): { 'inclusive_maximum': 40000000000, 'inclusive_minimum': 0, }, ('downlink_high',): { 'inclusive_maximum': 40000000000, 'inclusive_minimum': 0, }, ('downlink_drift',): { 'inclusive_maximum': 99999, 'inclusive_minimum': -99999, }, ('baud',): { 'inclusive_minimum': 0, }, ('citation',): { 'max_length': 512, 'min_length': 1, }, ('iaru_coordination_url',): { 'max_length': 200, }, } @cached_property def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ lazy_import() return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ lazy_import() return { 'description': (str,), # noqa: E501 'updated': (datetime,), # noqa: E501 'type': (TypeEnum,), # noqa: E501 'uplink_low': (int, none_type,), # noqa: E501 'uplink_high': (int, none_type,), # noqa: E501 'uplink_drift': (int, none_type,), # noqa: E501 'downlink_low': (int, none_type,), # noqa: E501 'downlink_high': (int, none_type,), # noqa: E501 'downlink_drift': (int, none_type,), # noqa: E501 'invert': (bool,), # noqa: E501 'baud': (float, none_type,), # noqa: E501 'status': (bool, date, datetime, dict, float, int, list, str, none_type,), # noqa: E501 'citation': (str,), # noqa: E501 'service': (bool, date, datetime, dict, float, int, list, str, none_type,), # noqa: E501 'iaru_coordination': (bool, date, datetime, dict, float, int, list, str, none_type,), # noqa: E501 'iaru_coordination_url': (str,), # noqa: E501 'itu_notification': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)},), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'description': 'description', # noqa: E501 'updated': 'updated', # noqa: E501 'type': 'type', # noqa: E501 'uplink_low': 'uplink_low', # noqa: E501 'uplink_high': 'uplink_high', # noqa: E501 'uplink_drift': 'uplink_drift', # noqa: E501 'downlink_low': 'downlink_low', # noqa: E501 'downlink_high': 'downlink_high', # noqa: E501 'downlink_drift': 'downlink_drift', # noqa: E501 'invert': 'invert', # noqa: E501 'baud': 'baud', # noqa: E501 'status': 'status', # noqa: E501 'citation': 'citation', # noqa: E501 'service': 'service', # noqa: E501 'iaru_coordination': 'iaru_coordination', # noqa: E501 'iaru_coordination_url': 'iaru_coordination_url', # noqa: E501 'itu_notification': 'itu_notification', # noqa: E501 } read_only_vars = { } _composed_schemas = {} @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, description, updated, *args, **kwargs): # noqa: E501 """TransmitterRequest - a model defined in OpenAPI Args: description (str): Short description for this entry, like: UHF 9k6 AFSK Telemetry updated (datetime): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) type (TypeEnum): [optional] # noqa: E501 uplink_low (int, none_type): Frequency (in Hz) for the uplink, or bottom of the uplink range for a transponder. [optional] # noqa: E501 uplink_high (int, none_type): Frequency (in Hz) for the top of the uplink range for a transponder. [optional] # noqa: E501 uplink_drift (int, none_type): Receiver drift from the published uplink frequency, stored in parts per billion (PPB). [optional] # noqa: E501 downlink_low (int, none_type): Frequency (in Hz) for the downlink, or bottom of the downlink range for a transponder. [optional] # noqa: E501 downlink_high (int, none_type): Frequency (in Hz) for the top of the downlink range for a transponder. [optional] # noqa: E501 downlink_drift (int, none_type): Transmitter drift from the published downlink frequency, stored in parts per billion (PPB). [optional] # noqa: E501 invert (bool): True if this is an inverted transponder. [optional] # noqa: E501 baud (float, none_type): The number of modulated symbols that the transmitter sends every second. [optional] # noqa: E501 status (bool, date, datetime, dict, float, int, list, str, none_type): Functional state of this transmitter. [optional] # noqa: E501 citation (str): A reference (preferrably URL) for this entry or edit. [optional] # noqa: E501 service (bool, date, datetime, dict, float, int, list, str, none_type): The published usage category for this transmitter. [optional] # noqa: E501 iaru_coordination (bool, date, datetime, dict, float, int, list, str, none_type): IARU frequency coordination status for this transmitter. [optional] # noqa: E501 iaru_coordination_url (str): URL for more details on this frequency coordination. [optional] # noqa: E501 itu_notification ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) self = super(OpenApiModel, cls).__new__(cls) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.description = description self.updated = updated for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) return self required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, description, updated, *args, **kwargs): # noqa: E501 """TransmitterRequest - a model defined in OpenAPI Args: description (str): Short description for this entry, like: UHF 9k6 AFSK Telemetry updated (datetime): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) type (TypeEnum): [optional] # noqa: E501 uplink_low (int, none_type): Frequency (in Hz) for the uplink, or bottom of the uplink range for a transponder. [optional] # noqa: E501 uplink_high (int, none_type): Frequency (in Hz) for the top of the uplink range for a transponder. [optional] # noqa: E501 uplink_drift (int, none_type): Receiver drift from the published uplink frequency, stored in parts per billion (PPB). [optional] # noqa: E501 downlink_low (int, none_type): Frequency (in Hz) for the downlink, or bottom of the downlink range for a transponder. [optional] # noqa: E501 downlink_high (int, none_type): Frequency (in Hz) for the top of the downlink range for a transponder. [optional] # noqa: E501 downlink_drift (int, none_type): Transmitter drift from the published downlink frequency, stored in parts per billion (PPB). [optional] # noqa: E501 invert (bool): True if this is an inverted transponder. [optional] # noqa: E501 baud (float, none_type): The number of modulated symbols that the transmitter sends every second. [optional] # noqa: E501 status (bool, date, datetime, dict, float, int, list, str, none_type): Functional state of this transmitter. [optional] # noqa: E501 citation (str): A reference (preferrably URL) for this entry or edit. [optional] # noqa: E501 service (bool, date, datetime, dict, float, int, list, str, none_type): The published usage category for this transmitter. [optional] # noqa: E501 iaru_coordination (bool, date, datetime, dict, float, int, list, str, none_type): IARU frequency coordination status for this transmitter. [optional] # noqa: E501 iaru_coordination_url (str): URL for more details on this frequency coordination. [optional] # noqa: E501 itu_notification ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.description = description self.updated = updated for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.")
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/transmitter_request.py
0.532182
0.162214
transmitter_request.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError class Mode(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { ('name',): { 'max_length': 25, }, } @cached_property def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'id': (int,), # noqa: E501 'name': (str,), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'id': 'id', # noqa: E501 'name': 'name', # noqa: E501 } read_only_vars = { 'id', # noqa: E501 } _composed_schemas = {} @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, id, name, *args, **kwargs): # noqa: E501 """Mode - a model defined in OpenAPI Args: id (int): name (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) self = super(OpenApiModel, cls).__new__(cls) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.id = id self.name = name for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) return self required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, name, *args, **kwargs): # noqa: E501 """Mode - a model defined in OpenAPI name (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.name = name for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.")
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/mode.py
0.558207
0.216964
mode.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError class StatusEnum(ModelSimple): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { ('value',): { 'ACTIVE': "active", 'INACTIVE': "inactive", 'INVALID': "invalid", }, } validations = { } additional_properties_type = None _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'value': (str,), } @cached_property def discriminator(): return None attribute_map = {} read_only_vars = set() _composed_schemas = None required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, *args, **kwargs): """StatusEnum - a model defined in OpenAPI Note that value can be passed either in args or in kwargs, but not in both. Args: args[0] (str):, must be one of ["active", "inactive", "invalid", ] # noqa: E501 Keyword Args: value (str):, must be one of ["active", "inactive", "invalid", ] # noqa: E501 _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ # required up here when default value is not given _path_to_item = kwargs.pop('_path_to_item', ()) if 'value' in kwargs: value = kwargs.pop('value') elif args: args = list(args) value = args.pop(0) else: raise ApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), ) _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: raise ApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): """StatusEnum - a model defined in OpenAPI Note that value can be passed either in args or in kwargs, but not in both. Args: args[0] (str):, must be one of ["active", "inactive", "invalid", ] # noqa: E501 Keyword Args: value (str):, must be one of ["active", "inactive", "invalid", ] # noqa: E501 _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ # required up here when default value is not given _path_to_item = kwargs.pop('_path_to_item', ()) self = super(OpenApiModel, cls).__new__(cls) if 'value' in kwargs: value = kwargs.pop('value') elif args: args = list(args) value = args.pop(0) else: raise ApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), ) _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: raise ApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) return self
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/status_enum.py
0.531453
0.215805
status_enum.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError class OpticalIdentification(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { } @cached_property def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'norad_id': (int, none_type,), # noqa: E501 'satellite_id': (str,), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'norad_id': 'norad_id', # noqa: E501 'satellite_id': 'satellite_id', # noqa: E501 } read_only_vars = { 'norad_id', # noqa: E501 'satellite_id', # noqa: E501 } _composed_schemas = {} @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, norad_id, satellite_id, *args, **kwargs): # noqa: E501 """OpticalIdentification - a model defined in OpenAPI Args: norad_id (int, none_type): satellite_id (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) self = super(OpenApiModel, cls).__new__(cls) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.norad_id = norad_id self.satellite_id = satellite_id for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) return self required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 """OpticalIdentification - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.")
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/optical_identification.py
0.578329
0.191101
optical_identification.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError def lazy_import(): from satnogsdbapiclient.model.artifact import Artifact globals()['Artifact'] = Artifact class PaginatedArtifactList(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { } @cached_property def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ lazy_import() return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ lazy_import() return { 'count': (int,), # noqa: E501 'next': (str, none_type,), # noqa: E501 'previous': (str, none_type,), # noqa: E501 'results': ([Artifact],), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'count': 'count', # noqa: E501 'next': 'next', # noqa: E501 'previous': 'previous', # noqa: E501 'results': 'results', # noqa: E501 } read_only_vars = { } _composed_schemas = {} @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 """PaginatedArtifactList - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) count (int): [optional] # noqa: E501 next (str, none_type): [optional] # noqa: E501 previous (str, none_type): [optional] # noqa: E501 results ([Artifact]): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) self = super(OpenApiModel, cls).__new__(cls) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) return self required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 """PaginatedArtifactList - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) count (int): [optional] # noqa: E501 next (str, none_type): [optional] # noqa: E501 previous (str, none_type): [optional] # noqa: E501 results ([Artifact]): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.")
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/paginated_artifact_list.py
0.549278
0.201833
paginated_artifact_list.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError class IaruCoordinationEnum(ModelSimple): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { ('value',): { 'IARU_COORDINATED': "IARU Coordinated", 'IARU_DECLINED': "IARU Declined", 'IARU_UNCOORDINATED': "IARU Uncoordinated", 'N/A': "N/A", }, } validations = { } additional_properties_type = None _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'value': (str,), } @cached_property def discriminator(): return None attribute_map = {} read_only_vars = set() _composed_schemas = None required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, *args, **kwargs): """IaruCoordinationEnum - a model defined in OpenAPI Note that value can be passed either in args or in kwargs, but not in both. Args: args[0] (str):, must be one of ["IARU Coordinated", "IARU Declined", "IARU Uncoordinated", "N/A", ] # noqa: E501 Keyword Args: value (str):, must be one of ["IARU Coordinated", "IARU Declined", "IARU Uncoordinated", "N/A", ] # noqa: E501 _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ # required up here when default value is not given _path_to_item = kwargs.pop('_path_to_item', ()) if 'value' in kwargs: value = kwargs.pop('value') elif args: args = list(args) value = args.pop(0) else: raise ApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), ) _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: raise ApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): """IaruCoordinationEnum - a model defined in OpenAPI Note that value can be passed either in args or in kwargs, but not in both. Args: args[0] (str):, must be one of ["IARU Coordinated", "IARU Declined", "IARU Uncoordinated", "N/A", ] # noqa: E501 Keyword Args: value (str):, must be one of ["IARU Coordinated", "IARU Declined", "IARU Uncoordinated", "N/A", ] # noqa: E501 _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ # required up here when default value is not given _path_to_item = kwargs.pop('_path_to_item', ()) self = super(OpenApiModel, cls).__new__(cls) if 'value' in kwargs: value = kwargs.pop('value') elif args: args = list(args) value = args.pop(0) else: raise ApiTypeError( "value is required, but not passed in args or kwargs and doesn't have default", path_to_item=_path_to_item, valid_classes=(self.__class__,), ) _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.value = value if kwargs: raise ApiTypeError( "Invalid named arguments=%s passed to %s. Remove those invalid named arguments." % ( kwargs, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) return self
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/iaru_coordination_enum.py
0.546012
0.208219
iaru_coordination_enum.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError def lazy_import(): from satnogsdbapiclient.model.telemetry import Telemetry globals()['Telemetry'] = Telemetry class PaginatedTelemetryList(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { } @cached_property def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ lazy_import() return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ lazy_import() return { 'count': (int,), # noqa: E501 'next': (str, none_type,), # noqa: E501 'previous': (str, none_type,), # noqa: E501 'results': ([Telemetry],), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'count': 'count', # noqa: E501 'next': 'next', # noqa: E501 'previous': 'previous', # noqa: E501 'results': 'results', # noqa: E501 } read_only_vars = { } _composed_schemas = {} @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 """PaginatedTelemetryList - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) count (int): [optional] # noqa: E501 next (str, none_type): [optional] # noqa: E501 previous (str, none_type): [optional] # noqa: E501 results ([Telemetry]): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) self = super(OpenApiModel, cls).__new__(cls) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) return self required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 """PaginatedTelemetryList - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) count (int): [optional] # noqa: E501 next (str, none_type): [optional] # noqa: E501 previous (str, none_type): [optional] # noqa: E501 results ([Telemetry]): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.")
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/paginated_telemetry_list.py
0.533884
0.166574
paginated_telemetry_list.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError class TelemetryRequest(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { ('version',): { 'max_length': 45, }, } @cached_property def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'version': (str,), # noqa: E501 'observation_id': (int, none_type,), # noqa: E501 'station_id': (int, none_type,), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'version': 'version', # noqa: E501 'observation_id': 'observation_id', # noqa: E501 'station_id': 'station_id', # noqa: E501 } read_only_vars = { } _composed_schemas = {} @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, *args, **kwargs): # noqa: E501 """TelemetryRequest - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) version (str): [optional] # noqa: E501 observation_id (int, none_type): [optional] # noqa: E501 station_id (int, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) self = super(OpenApiModel, cls).__new__(cls) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) return self required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 """TelemetryRequest - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) version (str): [optional] # noqa: E501 observation_id (int, none_type): [optional] # noqa: E501 station_id (int, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.")
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/telemetry_request.py
0.522689
0.19235
telemetry_request.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError class Artifact(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { } @cached_property def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'id': (int,), # noqa: E501 'network_obs_id': (int, none_type,), # noqa: E501 'artifact_file': (str, none_type,), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'id': 'id', # noqa: E501 'network_obs_id': 'network_obs_id', # noqa: E501 'artifact_file': 'artifact_file', # noqa: E501 } read_only_vars = { 'id', # noqa: E501 } _composed_schemas = {} @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, id, *args, **kwargs): # noqa: E501 """Artifact - a model defined in OpenAPI Args: id (int): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) network_obs_id (int, none_type): [optional] # noqa: E501 artifact_file (str, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) self = super(OpenApiModel, cls).__new__(cls) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.id = id for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) return self required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, *args, **kwargs): # noqa: E501 """Artifact - a model defined in OpenAPI Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) network_obs_id (int, none_type): [optional] # noqa: E501 artifact_file (str, none_type): [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.")
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/artifact.py
0.483892
0.16872
artifact.py
pypi
import re # noqa: F401 import sys # noqa: F401 from satnogsdbapiclient.model_utils import ( # noqa: F401 ApiTypeError, ModelComposed, ModelNormal, ModelSimple, cached_property, change_keys_js_to_python, convert_js_args_to_python_args, date, datetime, file_type, none_type, validate_get_composed_info, ) from ..model_utils import OpenApiModel from satnogsdbapiclient.exceptions import ApiAttributeError class OpticalObservationCreate(ModelNormal): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the allowed value and an allowed value. These dicts store the allowed enum values. attribute_map (dict): The key is attribute name and the value is json key in definition. discriminator_value_class_map (dict): A dict to go from the discriminator variable value to the discriminator class name. validations (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict that stores validations for max_length, min_length, max_items, min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum, inclusive_minimum, and regex. additional_properties_type (tuple): A tuple of classes accepted as additional properties values. """ allowed_values = { } validations = { } @cached_property def additional_properties_type(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded """ return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501 _nullable = False @cached_property def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ return { 'data': (str,), # noqa: E501 'diagnostic_plot': (str,), # noqa: E501 } @cached_property def discriminator(): return None attribute_map = { 'data': 'data', # noqa: E501 'diagnostic_plot': 'diagnostic_plot', # noqa: E501 } read_only_vars = { } _composed_schemas = {} @classmethod @convert_js_args_to_python_args def _from_openapi_data(cls, data, diagnostic_plot, *args, **kwargs): # noqa: E501 """OpticalObservationCreate - a model defined in OpenAPI Args: data (str): diagnostic_plot (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) self = super(OpenApiModel, cls).__new__(cls) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.data = data self.diagnostic_plot = diagnostic_plot for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) return self required_properties = set([ '_data_store', '_check_type', '_spec_property_naming', '_path_to_item', '_configuration', '_visited_composed_classes', ]) @convert_js_args_to_python_args def __init__(self, data, diagnostic_plot, *args, **kwargs): # noqa: E501 """OpticalObservationCreate - a model defined in OpenAPI Args: data (str): diagnostic_plot (str): Keyword Args: _check_type (bool): if True, values for parameters in openapi_types will be type checked and a TypeError will be raised if the wrong type is input. Defaults to True _path_to_item (tuple/list): This is a list of keys or values to drill down to the model in received_data when deserializing a response _spec_property_naming (bool): True if the variable names in the input data are serialized names, as specified in the OpenAPI document. False if the variable names in the input data are pythonic names, e.g. snake case (default) _configuration (Configuration): the instance to use when deserializing a file_type parameter. If passed, type conversion is attempted If omitted no type conversion is done. _visited_composed_classes (tuple): This stores a tuple of classes that we have traveled through so that if we see that class again we will not use its discriminator again. When traveling through a discriminator, the composed schema that is is traveled through is added to this set. For example if Animal has a discriminator petType and we pass in "Dog", and the class Dog allOf includes Animal, we move through Animal once using the discriminator, and pick Dog. Then in Dog, we will make an instance of the Animal class but this time we won't travel through its discriminator because we passed in _visited_composed_classes = (Animal,) """ _check_type = kwargs.pop('_check_type', True) _spec_property_naming = kwargs.pop('_spec_property_naming', False) _path_to_item = kwargs.pop('_path_to_item', ()) _configuration = kwargs.pop('_configuration', None) _visited_composed_classes = kwargs.pop('_visited_composed_classes', ()) if args: raise ApiTypeError( "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % ( args, self.__class__.__name__, ), path_to_item=_path_to_item, valid_classes=(self.__class__,), ) self._data_store = {} self._check_type = _check_type self._spec_property_naming = _spec_property_naming self._path_to_item = _path_to_item self._configuration = _configuration self._visited_composed_classes = _visited_composed_classes + (self.__class__,) self.data = data self.diagnostic_plot = diagnostic_plot for var_name, var_value in kwargs.items(): if var_name not in self.attribute_map and \ self._configuration is not None and \ self._configuration.discard_unknown_keys and \ self.additional_properties_type is None: # discard variable. continue setattr(self, var_name, var_value) if var_name in self.read_only_vars: raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate " f"class with read only attributes.")
/satnogs_db_api_client-1.51-py3-none-any.whl/satnogsdbapiclient/model/optical_observation_create.py
0.589835
0.230378
optical_observation_create.py
pypi
import django_filters from django import forms from django.core.exceptions import ValidationError from django_filters import Filter from django_filters import rest_framework as filters from django_filters.rest_framework import FilterSet from db.base.models import SATELLITE_STATUS, Artifact, DemodData, LatestTleSet, Mode, Satellite, \ Transmitter class NumberInFilter(django_filters.BaseInFilter, django_filters.NumberFilter): """Filter for comma separated numbers""" class ListFilter(Filter): """Custom Filter to use list""" def filter(self, qs, value): """Returns a QuerySet using list of values as input""" if value: value_list = value.replace(' ', '').split(u',') kwargs = {'{0}__in'.format(self.field_name): value_list} return qs.filter(**kwargs) return qs class TransmitterViewFilter(FilterSet): """SatNOGS DB Transmitter API View Filter""" alive = filters.BooleanFilter(field_name='status', label='Alive', method='filter_status') mode = django_filters.ModelChoiceFilter( field_name='downlink_mode', lookup_expr='exact', queryset=Mode.objects.all() ) # see https://django-filter.readthedocs.io/en/master/ref/filters.html for # W0613 def filter_status(self, queryset, name, value): # pylint: disable=W0613,R0201 """Returns Transmitters that are either functional or non-functional""" if value: transmitters = queryset.filter(status='active') else: transmitters = queryset.exclude(status='active') return transmitters satellite__norad_cat_id = filters.NumberFilter( field_name='satellite__satellite_entry__norad_cat_id', label='Satellite NORAD ID' ) sat_id = django_filters.CharFilter( method='get_current_sat_transmitter_from_sat_id', label='Satellite ID' ) # pylint: disable=W0613,R0201 def get_current_sat_transmitter_from_sat_id(self, queryset, field_name, value): """Return the transmitter from the parent satellite in case a merged satellite id is searched """ if value: id_list = value.replace(' ', '').split(u',') parent_id_list = [] qs = Satellite.objects.select_related('associated_satellite').filter( satellite_entry__approved=True, satellite_identifier__sat_id__in=id_list ) try: sats = qs.all() for sat in sats: if sat.associated_satellite is None: parent_id_list.append(sat.id) else: parent_id_list.append(sat.associated_satellite.id) except Satellite.DoesNotExist: return qs return Transmitter.objects.select_related('satellite__associated_satellite').filter( satellite__satellite_entry__approved=True, satellite__id__in=parent_id_list ) return queryset class Meta: model = Transmitter fields = [ 'uuid', 'mode', 'uplink_mode', 'type', 'satellite__norad_cat_id', 'alive', 'status', 'service' ] class SatelliteViewFilter(FilterSet): """SatNOGS DB Satellite API View Filter filter on decayed field """ in_orbit = filters.BooleanFilter( field_name='satellite_entry__decayed', label='In orbit', lookup_expr='isnull' ) status = filters.ChoiceFilter( field_name='satellite_entry__status', label='Satellite Status', choices=list(zip(SATELLITE_STATUS, SATELLITE_STATUS)) ) norad_cat_id = filters.NumberFilter( field_name='satellite_entry__norad_cat_id', label='Satellite NORAD ID' ) sat_id = django_filters.CharFilter(method='get_current_sat_from_sat_id', label='Satellite ID') # pylint: disable=W0613,R0201 def get_current_sat_from_sat_id(self, queryset, field_name, value): """Return the parent Satellite in case a merged satellite id is searched """ if value: qs = Satellite.objects.select_related('associated_satellite').filter( satellite_entry__approved=True, satellite_identifier__sat_id=value ) try: sat = qs.get() if sat.associated_satellite is None: return qs qs = Satellite.objects.filter( satellite_entry__approved=True, id=sat.associated_satellite.id ) return qs except Satellite.DoesNotExist: return qs return queryset class Meta: model = Satellite fields = ['norad_cat_id', 'status', 'in_orbit'] class TelemetryViewFilter(FilterSet): """SatNOGS DB Telemetry API View Filter""" satellite = django_filters.NumberFilter( field_name='satellite__satellite_entry__norad_cat_id', lookup_expr='exact', label='Satellite NORAD ID' ) sat_id = ListFilter(field_name='satellite__satellite_identifier__sat_id', label='Satellite ID') start = django_filters.IsoDateTimeFilter(field_name='timestamp', lookup_expr='gte') end = django_filters.IsoDateTimeFilter(field_name='timestamp', lookup_expr='lte') class Meta: model = DemodData fields = ['satellite', 'app_source', 'observer', 'transmitter', 'is_decoded'] class LatestTleSetViewFilter(FilterSet): """SatNOGS DB LatestTleSet API View Filter""" norad_cat_id = django_filters.NumberFilter( field_name='satellite__satellite_entry__norad_cat_id', lookup_expr='exact', label='Satellite NORAD ID' ) tle_source = django_filters.CharFilter( field_name='tle_source', lookup_expr='icontains', label='Source of TLE' ) sat_id = ListFilter(field_name='satellite__satellite_identifier__sat_id', label='Satellite ID') class Meta: model = LatestTleSet fields = ['norad_cat_id', 'tle_source'] class ArtifactViewFilter(FilterSet): """SatNOGS DB Artifact API View Filter""" observation_ids = NumberInFilter(field_name='network_obs_id', label="Observation ID(s)") class Meta: model = Artifact fields = [ 'network_obs_id', ] class OpticalObservationForm(forms.Form): """Form for validating OpticalObservationViewFilter parameters""" def clean_last_n(self): """Validate last_n parameter is positive integer""" last_n = self.cleaned_data.get('last_n') if last_n and last_n < 1: raise ValidationError("'last_n' must be a positive integer") return last_n def clean(self): """Validate that 'before' datetime is chronologically after 'after' parameter""" before = self.cleaned_data.get('before') after = self.cleaned_data.get('after') if after and before and after >= before: raise ValidationError("'after' datetime must be earlier than 'before'") return super().clean() class OpticalObservationViewFilter(FilterSet): """SatNOGS DB OpticalObservation API View Filter""" before = django_filters.IsoDateTimeFilter( widget=forms.DateTimeInput(attrs={'placeholder': 'Enter a date'}), field_name='start', lookup_expr='lte', label="Search observations before date:" ) after = django_filters.IsoDateTimeFilter( widget=forms.DateTimeInput(attrs={'placeholder': 'Enter a date'}), field_name='start', lookup_expr='gte', label="Search observations after date:" ) last_n = django_filters.NumberFilter( field_name='start', method='get_last_observations', label='Last N observations:' ) @staticmethod def get_last_observations(queryset, _, value): # pylint:disable=W0613 """Get the latest n observations""" return queryset[:value] class Meta: form = OpticalObservationForm
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/api/filters.py
0.71123
0.207094
filters.py
pypi
from django.contrib.sites.models import Site from pyld import jsonld class StructuredData: """Generic structered data class for models""" def __init__(self, data): self.context = {} self.data = data def get_jsonld(self): """Return JSONLD structure""" return {"@context": self.context, "@graph": self.data} def get_context(self): """Return the context of structured data""" return self.context def get_data(self): """Return the data of structured data""" return self.data def get_expanded(self): """Return expanded document form of JSONLD structure""" return jsonld.expand(self.get_jsonld()) def get_compacted(self, context): """Return compacted document form of JSONLD structure given a context""" return jsonld.compact(self.get_jsonld(), context) def get_flattened(self): """Return flattened document form of JSONLD structure""" return jsonld.flatten(self.get_jsonld()) def get_framed(self, frame): """Return framed document form of JSONLD structure given a frame""" return jsonld.frame(self.get_jsonld(), frame) class ModeStructuredData(StructuredData): """Generic structered data class for Mode model""" def __init__(self, data): super().__init__(data) self.context = {"@vocab": "https://schema.space/metasat/", "name": "modulation"} structured_data = [] for mode in data: structured_data.append({"name": mode['name']}) self.data = structured_data class SatelliteStructuredData(StructuredData): """Generic structered data class for Satellite model""" def __init__(self, data): super().__init__(data) self.context = { "@vocab": "https://schema.space/metasat/", "schema": "http://schema.org/", "satellite": "satellite", "sat_id": "schema:identifier", "name": "schema:name", "names": "schema:alternateName", "norad_cat_id": "noradID", "status": "status", "decoder": "decoder", "citation": "schema:citation", } self.frame = { "@context": self.context, 'satellite': { "@requireAll": True, "name": {}, "status": {}, "citation": {}, } } if isinstance(data, dict): self.data = self.structure_satellite_data(data) return structured_data = [] for satellite in data: data_to_append = self.structure_satellite_data(satellite) structured_data.append(data_to_append) self.data = structured_data @staticmethod def structure_satellite_data(satellite): """Return structured data for one satellite. :param satellite: the satellite to be structured """ satellite_id_domain = Site.objects.get_current().domain + '/satellite/' data_to_append = { "satellite": { "@id": satellite_id_domain + str(satellite['sat_id']), "sat_id": satellite['sat_id'], "norad_cat_id": satellite['norad_cat_id'], "name": satellite['name'], "status": satellite['status'], "citation": satellite['citation'] } } if satellite['names']: data_to_append['satellite']['names'] = satellite['names'].replace('\r', '').split('\n') if satellite['telemetries']: data_to_append['satellite']['decoder'] = [] for decoder in satellite['telemetries']: data_to_append['satellite']['decoder'].append(decoder["decoder"]) return data_to_append class TransmitterStructuredData(StructuredData): """Generic structered data class for Transmitter model""" def __init__(self, data): super().__init__(data) self.context = { "@vocab": "https://schema.space/metasat/", "schema": "http://schema.org/", "transmitter": "transmitter", "uuid": "schema:identifier", "type": None, "description": "schema:description", "status": "status", "mode": "modulation", "frequency": "frequency", "minimum": "schema:minimum", "maximum": "schema:maximum", "drift": "drift", "downlink": "downlink", "uplink": "uplink", "invert": None, "baud": "baudRate", "satellite": "satellite", "norad_cat_id": "noradID", "citation": "schema:citation", "service": "service" } self.frame = { "@context": self.context, 'transmitter': { "@requireAll": True, "description": {}, "status": {}, "citation": {}, "service": {}, "satellite": { "@requireAll": True, "norad_cat_id": {} }, } } structured_data = [] transmitter_id_domain = Site.objects.get_current().domain + '/transmitter/' satellite_id_domain = Site.objects.get_current().domain + '/satellite/' for transmitter in data: data_to_append = { "transmitter": { "@id": transmitter_id_domain + transmitter['uuid'], "uuid": transmitter['uuid'], "description": transmitter['description'], "type": transmitter['type'], "satellite": { "@id": satellite_id_domain + str(transmitter['sat_id']), "norad_cat_id": transmitter['norad_cat_id'] }, "status": transmitter['status'], "citation": transmitter['citation'], "service": transmitter['service'] } } if transmitter['downlink_low']: if transmitter['downlink_high']: data_to_append['transmitter']['downlink'] = { "frequency": { "minimum": transmitter['downlink_low'], "maximum": transmitter['downlink_high'] }, "mode": transmitter['mode'] } else: data_to_append['transmitter']['downlink'] = { "frequency": transmitter['downlink_low'], "mode": transmitter['mode'] } if transmitter['downlink_drift']: data_to_append['transmitter']['downlink']['drift'] = transmitter[ 'downlink_drift'] if transmitter['uplink_low']: if transmitter['uplink_high']: data_to_append['transmitter']['uplink'] = { "frequency": { "minimum": transmitter['uplink_low'], "maximum": transmitter['uplink_high'] }, "mode": transmitter['uplink_mode'] } else: data_to_append['transmitter']['uplink'] = { "frequency": transmitter['uplink_low'], "mode": transmitter['uplink_mode'] } if transmitter['uplink_drift']: data_to_append['transmitter']['uplink']['drift'] = transmitter['uplink_drift'] if transmitter['invert']: data_to_append['transmitter']['invert'] = transmitter['invert'] if transmitter['baud']: data_to_append['transmitter']['baud'] = transmitter['baud'] structured_data.append(data_to_append) self.data = structured_data class DemodDataStructuredData(StructuredData): """Generic structered data class for DemodData model""" def __init__(self, data): super().__init__(data) self.context = { "@vocab": "https://schema.space/metasat/", "schema": "http://schema.org/", "frame": "frame", "satellite": "satellite", "norad_cat_id": "noradID", "observer": "groundStation", "ground_station_locator": "maidenheadLocator", "ground_station_name": "schema:name", "status": "schema:status", "timestamp": "timestamp" } structured_data = [] satellite_id_domain = Site.objects.get_current().domain + '/satellite/' for frame in data: observer_splitted = frame['observer'].split('-') ground_station_locator = observer_splitted.pop() ground_station_name = observer_splitted data_to_append = { "frame": frame['frame'], "satellite": { "@id": satellite_id_domain + str(frame['sat_id']), "norad_cat_id": frame['norad_cat_id'] }, "observer": { "ground_station_name": ground_station_name, "ground_station_locator": ground_station_locator }, "timestamp": frame['timestamp'] } if frame['decoded']: data_to_append['status'] = "decoded" structured_data.append(data_to_append) self.data = structured_data def get_structured_data(basename, data): """Return structered data instance based on the given basename and given data""" if basename == "mode": return ModeStructuredData(data) if basename in ("satellite", "latestsatellite"): return SatelliteStructuredData(data) if basename == "transmitter": return TransmitterStructuredData(data) if basename == "demoddata": return DemodDataStructuredData(data) return None
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/base/structured_data.py
0.809238
0.494446
structured_data.py
pypi
import logging import re from datetime import datetime from os import path from uuid import uuid4 import satnogsdecoders from django.conf import settings from django.contrib.auth import get_user_model from django.core.cache import cache from django.core.exceptions import ValidationError from django.core.validators import MaxLengthValidator, MaxValueValidator, MinLengthValidator, \ MinValueValidator, URLValidator from django.db import models from django.db.models import OuterRef, Subquery from django.utils.timezone import now from django_countries.fields import CountryField from markdown import markdown from nanoid import generate from shortuuidfield import ShortUUIDField LOGGER = logging.getLogger('db') DATA_SOURCES = ['manual', 'network', 'sids'] SATELLITE_STATUS = ['alive', 'dead', 'future', 're-entered'] TRANSMITTER_STATUS = ['active', 'inactive', 'invalid'] TRANSMITTER_TYPE = ['Transmitter', 'Transceiver', 'Transponder'] SERVICE_TYPE = [ 'Aeronautical', 'Amateur', 'Broadcasting', 'Earth Exploration', 'Fixed', 'Inter-satellite', 'Maritime', 'Meteorological', 'Mobile', 'Radiolocation', 'Radionavigational', 'Space Operation', 'Space Research', 'Standard Frequency and Time Signal', 'Unknown' ] IARU_COORDINATION_STATUS = ['IARU Coordinated', 'IARU Declined', 'IARU Uncoordinated', 'N/A'] BAD_COORDINATIONS = ['IARU Declined', 'IARU Uncoordinated'] # 'violations' URL_REGEX = r"(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$" MIN_FREQ = 0 MAX_FREQ = 40000000000 MIN_FREQ_MSG = "Ensure this value is greater than or equal to 0Hz" MAX_FREQ_MSG = "Ensure this value is less than or equal to 40Ghz" def _name_diagnostic_plot(instance, filename): # pylint: disable=W0613 """Returns a path for OpticalObservation diagnostic_plot""" timestamp = datetime.now() return 'data_optical_obs/{0}/{1}/{2}/{3}/{4}'.format( timestamp.year, timestamp.month, timestamp.day, timestamp.hour, filename ) def _name_exported_frames(instance, filename): # pylint: disable=W0613 """Returns path for a exported frames file""" return path.join('download/', filename) def _name_payload_frame(instance, filename): # pylint: disable=W0613 """Returns a unique, timestamped path and filename for a payload :param filename: the original filename submitted :returns: path string with timestamped subfolders and filename """ today = now() folder = 'payload_frames/{0}/{1}/{2}/'.format(today.year, today.month, today.day) ext = 'raw' filename = '{0}_{1}.{2}'.format(filename, uuid4().hex, ext) return path.join(folder, filename) class OpticalObservation(models.Model): """An model for SatNOGS optical observations""" diagnostic_plot = models.ImageField(upload_to=_name_diagnostic_plot) data = models.JSONField() start = models.DateTimeField() station_id = models.PositiveBigIntegerField() uploader = models.ForeignKey( settings.AUTH_USER_MODEL, blank=True, null=True, on_delete=models.SET_NULL, ) def __str__(self): return f"Optical Observation #{str(self.id)}" class Meta: unique_together = ["start", "station_id"] class OpticalIdentification(models.Model): """A Satnogs Optical Identification""" observation = models.ForeignKey( OpticalObservation, on_delete=models.CASCADE, related_name="identifications" ) norad_id = models.PositiveIntegerField(blank=True, null=True) satellite = models.ForeignKey( "base.Satellite", blank=True, null=True, on_delete=models.SET_NULL ) class Mode(models.Model): """A satellite transmitter RF mode. For example: FM""" name = models.CharField(max_length=25, unique=True) class CacheOptions: # pylint: disable=C0115,R0903 default_cache_key = "mode" cache_purge_keys = ["mode"] def __str__(self): return self.name class Operator(models.Model): """Satellite Owner/Operator""" name = models.CharField(max_length=255, unique=True) names = models.TextField(blank=True) description = models.TextField(blank=True) website = models.URLField( blank=True, validators=[URLValidator(schemes=['http', 'https'], regex=URL_REGEX)] ) def __str__(self): return self.name def validate_sat_id(value): """Validate a Satellite Identifier""" if not re.compile(r'^[A-Z]{4,4}(?:-\d\d\d\d){4,4}$').match(value): raise ValidationError( '%(value)s is not a valid Satellite Identifier. Satellite Identifier should have the \ format "CCCC-NNNN-NNNN-NNNN-NNNN" where C is {A-Z} and N is {0-9}', params={'value': value}, ) def generate_sat_id(): """Generate Satellite Identifier""" numeric = "0123456789" uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" first_segment = generate(uppercase, 4) second_segment = generate(numeric, 4) third_segment = generate(numeric, 4) fourth_segment = generate(numeric, 4) fifth_segment = generate(numeric, 4) return "{0}-{1}-{2}-{3}-{4}".format( first_segment, second_segment, third_segment, fourth_segment, fifth_segment ) def get_default_itu_notification_field(): """Generate default value for itu_notification field of TransmitterEntry model""" return {'urls': []} class SatelliteIdentifier(models.Model): """Model for Satellite Identifier.""" sat_id = models.CharField( default=generate_sat_id, unique=True, max_length=24, validators=[validate_sat_id] ) created = models.DateTimeField(auto_now_add=True) def __str__(self): return '{0}'.format(self.sat_id) class SatelliteEntry(models.Model): """Model for all the satellite entries.""" satellite_identifier = models.ForeignKey( SatelliteIdentifier, null=True, related_name='satellite_entries', on_delete=models.PROTECT ) norad_cat_id = models.PositiveIntegerField(blank=True, null=True) norad_follow_id = models.PositiveIntegerField(blank=True, null=True) name = models.CharField(max_length=45) names = models.TextField(blank=True) description = models.TextField(blank=True) dashboard_url = models.URLField( blank=True, null=True, max_length=200, validators=[URLValidator(schemes=['http', 'https'], regex=URL_REGEX)] ) image = models.ImageField(upload_to='satellites', blank=True, help_text='Ideally: 250x250') status = models.CharField( choices=list(zip(SATELLITE_STATUS, SATELLITE_STATUS)), max_length=10, default='alive' ) decayed = models.DateTimeField(null=True, blank=True) # new fields below, metasat etc # countries is multiple for edge cases like ISS/Zarya countries = CountryField(blank=True, multiple=True, blank_label='(select countries)') website = models.URLField( blank=True, validators=[URLValidator(schemes=['http', 'https'], regex=URL_REGEX)] ) launched = models.DateTimeField(null=True, blank=True) deployed = models.DateTimeField(null=True, blank=True) operator = models.ForeignKey( Operator, blank=True, null=True, on_delete=models.SET_NULL, related_name='satellite_operator' ) # Fields related to suggestion reviews reviewer = models.ForeignKey( get_user_model(), related_name='reviewed_satellites', blank=True, null=True, on_delete=models.SET_NULL ) reviewed = models.DateTimeField(blank=True, null=True, help_text='Timestamp of review') approved = models.BooleanField(default=False) created = models.DateTimeField(default=now, help_text='Timestamp of creation/edit') created_by = models.ForeignKey( get_user_model(), related_name='created_satellites', null=True, on_delete=models.SET_NULL ) citation = models.CharField( max_length=512, default='', help_text='A reference (preferrably URL) for this entry or edit', blank=False ) class Meta: ordering = ['norad_cat_id'] verbose_name_plural = 'Satellite Entries' unique_together = ("satellite_identifier", "reviewed") def get_description(self): """Returns the markdown-processed satellite description :returns: the markdown-processed satellite description """ return markdown(self.description) def get_image(self): """Returns an image for the satellite :returns: the saved image for the satellite, or a default """ if self.image and hasattr(self.image, 'url'): image = self.image.url else: image = settings.SATELLITE_DEFAULT_IMAGE return image @property def countries_str(self): """Returns countries for this Satellite in comma seperated string format :returns: countries for this Satellite in comma seperated string format """ return ','.join(map(str, self.countries)) def __str__(self): return '{0} - {1}'.format(self.norad_cat_id, self.name) class SatelliteSuggestionManager(models.Manager): # pylint: disable=R0903 """Django Manager for SatelliteSuggestions SatelliteSuggestions are SatelliteEntry objects that have been submitted (suggested) but not yet reviewed """ def get_queryset(self): # pylint: disable=R0201 """Returns SatelliteEntries that have not been reviewed""" return SatelliteEntry.objects.filter(reviewed__isnull=True) class SatelliteSuggestion(SatelliteEntry): """Proxy model for unreviewed SatelliteEntry objects""" objects = SatelliteSuggestionManager() class Meta: proxy = True permissions = ( ('approve_satellitesuggestion', 'Can approve/reject satellite suggestions'), ) class SatelliteManager(models.Manager): # pylint: disable=R0903 """Django Manager for Satellites Satellite objects rarely used without referencing their SatelliteIdentifier and SatelliteEntry foreign key fields, thus follow these relationships to get the related-objects data by using select_related(). """ def get_queryset(self): # pylint: disable=R0201 """Returns SatelliteEntries that have not been reviewed""" return super().get_queryset().select_related('satellite_identifier', 'satellite_entry') class Satellite(models.Model): """ Model for the lastest satellite entry for each Satellite Identifier.""" objects = SatelliteManager() satellite_identifier = models.OneToOneField( SatelliteIdentifier, related_name='satellite', on_delete=models.CASCADE ) satellite_entry = models.ForeignKey(SatelliteEntry, null=True, on_delete=models.SET_NULL) associated_satellite = models.ForeignKey( 'self', null=True, related_name='associated_with', on_delete=models.PROTECT ) last_modified = models.DateTimeField(auto_now=True) class Meta: permissions = (('merge_satellites', 'Can merge satellites'), ) class CacheOptions: # pylint: disable=C0115,R0903 default_cache_key = "satellite" cache_purge_keys = ["satellite"] def __str__(self): if self.satellite_entry: name = self.satellite_entry.name norad_cat_id = self.satellite_entry.norad_cat_id else: name = '-' norad_cat_id = '-' return '{1} ({2}) | {0}'.format(self.satellite_identifier.sat_id, name, norad_cat_id) @property def transmitters(self): """Returns valid transmitters for this Satellite :returns: the valid transmitters for this Satellite """ transmitters = Transmitter.objects.filter(satellite=self.id).exclude(status='invalid') return transmitters @property def invalid_transmitters(self): """Returns invalid transmitters for this Satellite :returns: the invalid transmitters for this Satellite """ transmitters = Transmitter.objects.filter(satellite=self.id).filter(status='invalid') return transmitters @property def transmitter_suggestion_count(self): """Returns number of pending transmitter suggestions for this Satellite :returns: number of pending transmitter suggestions for this Satellite """ pending_count = TransmitterSuggestion.objects.filter(satellite=self.id).count() return pending_count @property def satellite_suggestion_count(self): """Returns number of pending satellite suggestions for this Satellite :returns: number of pending satellite suggestions for this Satellite """ pending_count = SatelliteSuggestion.objects.filter( satellite_identifier=self.satellite_identifier ).count() return pending_count @property def telemetry_data_count(self): """Returns number of DemodData for this Satellite :returns: number of DemodData for this Satellite """ cached_satellite = cache.get(self.id) if cached_satellite: data_count = cached_satellite['count'] else: satellites_list = list(self.associated_with.all().values_list('pk', flat=True)) satellites_list.append(self.pk) data_count = DemodData.objects.filter(satellite__in=satellites_list).count() return data_count @property def telemetry_decoder_count(self): """Returns number of Telemetry objects for this Satellite :returns: number of Telemetry objects for this Satellite """ decoder_count = Telemetry.objects.filter(satellite=self.id).exclude(decoder='').count() return decoder_count @property def latest_data(self): """Returns the latest DemodData for this Satellite :returns: dict with most recent DemodData for this Satellite """ satellites_list = list(self.associated_with.all().values_list('pk', flat=True)) satellites_list.append(self.pk) data = DemodData.objects.filter(satellite__in=satellites_list).order_by('-id')[:1] if data: latest_datum = data[0] return { 'data_id': latest_datum.data_id, 'payload_frame': latest_datum.payload_frame, 'timestamp': latest_datum.timestamp, 'is_decoded': latest_datum.is_decoded, 'station': latest_datum.station, 'observer': latest_datum.observer, } return None @property def needs_help(self): """Returns a boolean based on whether or not this Satellite could use some editorial help based on a configurable threshold :returns: bool """ score = 0 if self.satellite_entry.description and self.satellite_entry.description != '': score += 1 if self.satellite_entry.countries and self.satellite_entry.countries != '': score += 1 if self.satellite_entry.website and self.satellite_entry.website != '': score += 1 if self.satellite_entry.names and self.satellite_entry.names != '': score += 1 if self.satellite_entry.launched and self.satellite_entry.launched != '': score += 1 if self.satellite_entry.operator and self.satellite_entry.operator != '': score += 1 if self.satellite_entry.image and self.satellite_entry.image != '': score += 1 return score <= 2 @property def has_bad_transmitter(self): """Returns a boolean based on whether or not this Satellite has a transmitter associated with it that is considered uncoordinated or otherwise bad :returns: bool """ violation = cache.get("violator_" + self.satellite_identifier.sat_id) if violation is not None: return violation['status'] result = False for transmitter in Transmitter.objects.filter(satellite=self.id).exclude(status='invalid'): if transmitter.bad_transmitter: result = True break cache.set( "violator_" + str(self.satellite_entry.norad_cat_id), { 'status': result, 'id': str(self.id) }, None ) cache.set( "violator_" + self.satellite_identifier.sat_id, { 'status': result, 'id': str(self.id) }, None ) for merged_satellite in self.associated_with.all(): cache.set( "violator_" + merged_satellite.satellite_identifier.sat_id, { 'status': result, 'id': str(self.id) }, None ) return result class TransmitterEntry(models.Model): """Model for satellite transmitters.""" uuid = ShortUUIDField(db_index=True) description = models.TextField( help_text='Short description for this entry, like: UHF 9k6 AFSK Telemetry' ) status = models.CharField( choices=list(zip(TRANSMITTER_STATUS, TRANSMITTER_STATUS)), max_length=8, default='active', help_text='Functional state of this transmitter' ) type = models.CharField( choices=list(zip(TRANSMITTER_TYPE, TRANSMITTER_TYPE)), max_length=11, default='Transmitter' ) uplink_low = models.BigIntegerField( blank=True, null=True, validators=[ MinValueValidator(MIN_FREQ, message=MIN_FREQ_MSG), MaxValueValidator(MAX_FREQ, message=MAX_FREQ_MSG) ], help_text='Frequency (in Hz) for the uplink, or bottom of the uplink range for a \ transponder' ) uplink_high = models.BigIntegerField( blank=True, null=True, validators=[ MinValueValidator(MIN_FREQ, message=MIN_FREQ_MSG), MaxValueValidator(MAX_FREQ, message=MAX_FREQ_MSG) ], help_text='Frequency (in Hz) for the top of the uplink range for a transponder' ) uplink_drift = models.IntegerField( blank=True, null=True, validators=[MinValueValidator(-99999), MaxValueValidator(99999)], help_text='Receiver drift from the published uplink frequency, stored in parts \ per billion (PPB)' ) downlink_low = models.BigIntegerField( blank=True, null=True, validators=[ MinValueValidator(MIN_FREQ, message=MIN_FREQ_MSG), MaxValueValidator(MAX_FREQ, message=MAX_FREQ_MSG) ], help_text='Frequency (in Hz) for the downlink, or bottom of the downlink range \ for a transponder' ) downlink_high = models.BigIntegerField( blank=True, null=True, validators=[ MinValueValidator(MIN_FREQ, message=MIN_FREQ_MSG), MaxValueValidator(MAX_FREQ, message=MAX_FREQ_MSG) ], help_text='Frequency (in Hz) for the top of the downlink range for a transponder' ) downlink_drift = models.IntegerField( blank=True, null=True, validators=[MinValueValidator(-99999), MaxValueValidator(99999)], help_text='Transmitter drift from the published downlink frequency, stored in \ parts per billion (PPB)' ) downlink_mode = models.ForeignKey( Mode, blank=True, null=True, on_delete=models.SET_NULL, related_name='transmitter_downlink_entries', help_text='Modulation mode for the downlink' ) uplink_mode = models.ForeignKey( Mode, blank=True, null=True, on_delete=models.SET_NULL, related_name='transmitter_uplink_entries', help_text='Modulation mode for the uplink' ) invert = models.BooleanField( default=False, help_text='True if this is an inverted transponder' ) baud = models.FloatField( validators=[MinValueValidator(0)], blank=True, null=True, help_text='The number of modulated symbols that the transmitter sends every second' ) satellite = models.ForeignKey( Satellite, null=True, related_name='transmitter_entries', on_delete=models.SET_NULL ) citation = models.CharField( max_length=512, default='', help_text='A reference (preferrably URL) for this entry or edit', blank=False ) service = models.CharField( choices=zip(SERVICE_TYPE, SERVICE_TYPE), max_length=34, default='Unknown', help_text='The published usage category for this transmitter' ) iaru_coordination = models.CharField( choices=list(zip(IARU_COORDINATION_STATUS, IARU_COORDINATION_STATUS)), max_length=20, default='N/A', help_text='IARU frequency coordination status for this transmitter' ) iaru_coordination_url = models.URLField( blank=True, help_text='URL for more details on this frequency coordination', validators=[URLValidator(schemes=['http', 'https'], regex=URL_REGEX)] ) itu_notification = models.JSONField(default=get_default_itu_notification_field) reviewer = models.ForeignKey( get_user_model(), related_name='reviewed_transmitters', blank=True, null=True, on_delete=models.SET_NULL ) reviewed = models.DateTimeField(blank=True, null=True, help_text='Timestamp of review') approved = models.BooleanField(default=False) created = models.DateTimeField(default=now, help_text='Timestamp of creation/edit') created_by = models.ForeignKey( get_user_model(), related_name='created_transmitters', null=True, on_delete=models.SET_NULL ) unconfirmed = models.BooleanField(default=False, null=True) # NOTE: future fields will need to be added to forms.py and to # api/serializers.py class CacheOptions: # pylint: disable=C0115,R0903 default_cache_key = "transmitter" cache_purge_keys = ["transmitter"] @property def bad_transmitter(self): """Returns a boolean that indicates whether this transmitter should be flagged as bad with regard to frequency coordination or rejection :returns: bool """ if self.iaru_coordination in BAD_COORDINATIONS: return True return False class Meta: unique_together = ("uuid", "reviewed") verbose_name_plural = 'Transmitter entries' def __str__(self): return self.description def clean(self): if self.type == TRANSMITTER_TYPE[0]: if self.uplink_low is not None or self.uplink_high is not None \ or self.uplink_drift is not None: raise ValidationError("Uplink shouldn't be filled in for a transmitter") if self.downlink_high: raise ValidationError( "Downlink high frequency shouldn't be filled in for a transmitter" ) elif self.type == TRANSMITTER_TYPE[1]: if self.uplink_high is not None or self.downlink_high is not None: raise ValidationError("Frequency range shouldn't be filled in for a transceiver") elif self.type == TRANSMITTER_TYPE[2]: if self.downlink_low is not None and self.downlink_high is not None: if self.downlink_low > self.downlink_high: raise ValidationError( "Downlink low frequency must be lower or equal \ than downlink high frequency" ) if self.uplink_low is not None and self.uplink_high is not None: if self.uplink_low > self.uplink_high: raise ValidationError( "Uplink low frequency must be lower or equal \ than uplink high frequency" ) class TransmitterSuggestionManager(models.Manager): # pylint: disable=R0903 """Django Manager for TransmitterSuggestions TransmitterSuggestions are TransmitterEntry objects that have been submitted (suggested) but not yet reviewed """ def get_queryset(self): # pylint: disable=R0201 """Returns TransmitterEntries that have not been reviewed""" return TransmitterEntry.objects.filter(reviewed__isnull=True) class TransmitterSuggestion(TransmitterEntry): """TransmitterSuggestion is an unreviewed TransmitterEntry object""" objects = TransmitterSuggestionManager() def __str__(self): return self.description class Meta: proxy = True permissions = ( ('approve_transmittersuggestion', 'Can approve/reject transmitter suggestions'), ) class TransmitterManager(models.Manager): # pylint: disable=R0903 """Django Manager for Transmitter objects""" def get_queryset(self): """Returns query of TransmitterEntries :returns: the latest revision of a TransmitterEntry for each TransmitterEntry uuid associated with this Satellite that is both reviewed and approved """ subquery = TransmitterEntry.objects.filter( reviewed__isnull=False, approved=True ).filter(uuid=OuterRef('uuid')).order_by('-reviewed') return super().get_queryset().filter( reviewed__isnull=False, approved=True ).select_related('satellite', 'downlink_mode', 'uplink_mode').filter(reviewed=Subquery(subquery.values('reviewed')[:1])) class Transmitter(TransmitterEntry): """Associates a generic Transmitter object with their TransmitterEntries that are managed by TransmitterManager """ objects = TransmitterManager() def __str__(self): return self.description class Meta: proxy = True class Tle(models.Model): """Model for TLEs.""" tle0 = models.CharField( max_length=69, blank=True, validators=[MinLengthValidator(1), MaxLengthValidator(69)] ) tle1 = models.CharField( max_length=69, blank=True, validators=[MinLengthValidator(69), MaxLengthValidator(69)] ) tle2 = models.CharField( max_length=69, blank=True, validators=[MinLengthValidator(69), MaxLengthValidator(69)] ) tle_source = models.CharField(max_length=300, blank=True) updated = models.DateTimeField(auto_now=True, blank=True) satellite = models.ForeignKey( Satellite, null=True, blank=True, related_name='tle_sets', on_delete=models.SET_NULL ) url = models.URLField(max_length=200, blank=True, null=True) class Meta: ordering = ['-updated'] indexes = [ models.Index(fields=['-updated']), ] permissions = [('access_all_tles', 'Access all TLEs')] def __str__(self): return '{:d} - {:s}'.format(self.id, self.tle0) @property def str_array(self): """Return TLE in string array format""" # tle fields are unicode, pyephem and others expect python strings return [str(self.tle0), str(self.tle1), str(self.tle2)] class LatestTleSet(models.Model): """LatestTleSet holds the latest entry of a Satellite Tle Set""" satellite = models.OneToOneField( Satellite, related_name='latest_tle_set', on_delete=models.CASCADE ) latest = models.ForeignKey(Tle, null=True, related_name='latest', on_delete=models.SET_NULL) latest_distributable = models.ForeignKey( Tle, null=True, related_name='latest_distributable', on_delete=models.SET_NULL ) last_modified = models.DateTimeField(auto_now=True) class CacheOptions: # pylint: disable=C0115,R0903 cache_purge_keys = ["latesttleset_with_perms", "latesttleset_without_perms"] class Telemetry(models.Model): """Model for satellite telemetry decoders.""" satellite = models.ForeignKey( Satellite, null=True, related_name='telemetries', on_delete=models.SET_NULL ) name = models.CharField(max_length=45) decoder = models.CharField(max_length=200, blank=True) class Meta: ordering = ['satellite__satellite_entry__norad_cat_id'] verbose_name_plural = 'Telemetries' def __str__(self): return self.name def get_kaitai_fields(self): """Return an empty-value dict of fields for this kaitai.io struct Beware the overuse of "decoder" in satnogsdecoders and "decoder" the field above in this Telemetry model""" results = {} try: decoder_class = getattr(satnogsdecoders.decoder, self.decoder.capitalize()) results = satnogsdecoders.decoder.get_fields(decoder_class, empty=True) except AttributeError: pass return results class DemodData(models.Model): """Model for satellite for observation data.""" satellite = models.ForeignKey( Satellite, null=True, related_name='telemetry_data', on_delete=models.SET_NULL ) transmitter = models.ForeignKey( TransmitterEntry, null=True, blank=True, on_delete=models.SET_NULL ) app_source = models.CharField( choices=list(zip(DATA_SOURCES, DATA_SOURCES)), max_length=7, default='sids' ) observation_id = models.IntegerField(blank=True, null=True) station_id = models.IntegerField(blank=True, null=True) data_id = models.PositiveIntegerField(blank=True, null=True) payload_frame = models.FileField(upload_to=_name_payload_frame, blank=True, null=True) payload_decoded = models.TextField(blank=True) payload_telemetry = models.ForeignKey( Telemetry, null=True, blank=True, on_delete=models.SET_NULL ) station = models.CharField(max_length=45, default='Unknown') observer = models.CharField(max_length=60, blank=True) lat = models.FloatField(validators=[MaxValueValidator(90), MinValueValidator(-90)], default=0) lng = models.FloatField( validators=[MaxValueValidator(180), MinValueValidator(-180)], default=0 ) is_decoded = models.BooleanField(default=False, db_index=True) timestamp = models.DateTimeField(null=True, db_index=True) version = models.CharField(max_length=45, blank=True) class Meta: ordering = ['-timestamp'] def __str__(self): return 'data-for-{0}'.format(self.satellite.satellite_identifier.sat_id) def display_frame(self): """Returns the contents of the saved frame file for this DemodData :returns: the contents of the saved frame file for this DemodData """ try: with open(self.payload_frame.path) as frame_file: return frame_file.read() except IOError as err: LOGGER.error( err, exc_info=True, extra={ 'payload frame path': self.payload_frame.path, } ) return None except ValueError: # unlikely to happen in prod, but if an entry is made without a file return None class ExportedFrameset(models.Model): """Model for exported frames.""" created = models.DateTimeField(auto_now_add=True) user = models.ForeignKey(get_user_model(), null=True, on_delete=models.SET_NULL) satellite = models.ForeignKey(Satellite, null=True, on_delete=models.SET_NULL) exported_file = models.FileField(upload_to=_name_exported_frames, blank=True, null=True) start = models.DateTimeField(blank=True, null=True) end = models.DateTimeField(blank=True, null=True) class Artifact(models.Model): """Model for observation artifacts.""" artifact_file = models.FileField(upload_to='artifacts/', blank=True, null=True) network_obs_id = models.BigIntegerField(blank=True, null=True) def __str__(self): return 'artifact-{0}'.format(self.id)
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/base/models.py
0.675551
0.179243
models.py
pypi
from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone def add_review_details(apps, schema_editor): TransmitterEntry = apps.get_model('base', 'TransmitterEntry') orphans = TransmitterEntry.objects.filter(created_by__isnull=True, is_reviewed=True) for entry in orphans: entry.reviewed = entry.created entry.save() ids = [] non_orphans = TransmitterEntry.objects.filter(created_by__isnull=False, is_reviewed=True).order_by('created') for entry in non_orphans: if entry.id in ids: entry.delete() continue next_entries = TransmitterEntry.objects.filter(created_by__isnull=False, is_reviewed=True).filter(uuid=entry.uuid).filter(created__gt=entry.created).order_by('created') for next_entry in next_entries: if (entry.uuid == next_entry.uuid and entry.description == next_entry.description and entry.status == next_entry.status and entry.type == next_entry.type and entry.uplink_low == next_entry.uplink_low and entry.uplink_high == next_entry.uplink_high and entry.uplink_drift == next_entry.uplink_drift and entry.downlink_low == next_entry.downlink_low and entry.downlink_high == next_entry.downlink_high and entry.downlink_drift == next_entry.downlink_drift and entry.downlink_mode == next_entry.downlink_mode and entry.uplink_mode == next_entry.uplink_mode and entry.invert == next_entry.invert and entry.baud == next_entry.baud and entry.satellite == next_entry.satellite and entry.reviewed == next_entry.reviewed and entry.approved == next_entry.approved and entry.citation == next_entry.citation and entry.service == next_entry.service and entry.coordination == next_entry.coordination and entry.coordination_url == next_entry.coordination_url): ids.append(next_entry.id) entry.reviewed = next_entry.created entry.reviewer = next_entry.created_by entry.save() break else: entry.reviewed = entry.created entry.reviewer = entry.created_by entry.save() def remove_review_details(apps, schema_editor): TransmitterEntry = apps.get_model('base', 'TransmitterEntry') non_orphans = TransmitterEntry.objects.filter(created_by__isnull=False, is_reviewed=True).order_by('created') for entry in non_orphans: entry.pk = None entry.created = entry.reviewed entry.created_by = entry.reviewer entry.save() class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('base', '0036_rename_reviewed_field_on_transmitter_entry_model'), ] operations = [ migrations.AddField( model_name='transmitterentry', name='reviewed', field=models.DateTimeField(blank=True, help_text='Timestamp of review', null=True), ), migrations.AddField( model_name='transmitterentry', name='reviewer', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_transmitters', to=settings.AUTH_USER_MODEL), ), migrations.AlterField( model_name='transmitterentry', name='created', field=models.DateTimeField(default=django.utils.timezone.now, help_text='Timestamp of creation/edit'), ), migrations.AlterField( model_name='transmitterentry', name='created_by', field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_transmitters', to=settings.AUTH_USER_MODEL), ), migrations.AlterUniqueTogether( name='transmitterentry', unique_together={('uuid', 'reviewed')}, ), migrations.RunPython(add_review_details, remove_review_details), ]
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/base/migrations/0037_add_reviewer_and_date_fields_on_transmitter_entry_model.py
0.411229
0.198588
0037_add_reviewer_and_date_fields_on_transmitter_entry_model.py
pypi
import db.base.models from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone def initialize_satellites(apps, schema_editor): SatelliteEntry = apps.get_model('base', 'SatelliteEntry') SatelliteIdentifier = apps.get_model('base', 'SatelliteIdentifier') Satellite = apps.get_model('base', 'Satellite') satellite_entries = SatelliteEntry.objects.all() for satellite_entry in satellite_entries: satellite_identifier = SatelliteIdentifier.objects.create() created = django.utils.timezone.now() satellite_entry.satellite_identifier = satellite_identifier satellite_entry.created = created satellite_entry.reviewed = created satellite_entry.approved = True satellite_entry.save() Satellite.objects.create(satellite_identifier=satellite_identifier, satellite_entry=satellite_entry) def reverse_initialize_satellites(apps, schema_editor): pass class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('base', '0039_rename_transmitter_satellite_field_to_satellite_entry'), ] operations = [ migrations.CreateModel( name='SatelliteIdentifier', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('sat_id', models.CharField(default=db.base.models.generate_sat_id, max_length=24, unique=True, validators=[db.base.models.validate_sat_id])), ('created', models.DateTimeField(auto_now_add=True)), ], ), migrations.CreateModel( name='SatelliteSuggestion', fields=[ ], options={ 'permissions': (('approve', 'Can approve/reject satellite suggestions'),), 'proxy': True, 'indexes': [], 'constraints': [], }, bases=('base.satelliteentry',), ), migrations.AddField( model_name='satelliteentry', name='approved', field=models.BooleanField(default=False), ), migrations.AddField( model_name='satelliteentry', name='citation', field=models.CharField(default='CITATION NEEDED - https://xkcd.com/285/', help_text='A reference (preferrably URL) for this entry or edit', max_length=512), ), migrations.AddField( model_name='satelliteentry', name='created', field=models.DateTimeField(default=django.utils.timezone.now, help_text='Timestamp of creation/edit'), ), migrations.AddField( model_name='satelliteentry', name='created_by', field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_satellites', to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='satelliteentry', name='reviewed', field=models.DateTimeField(blank=True, help_text='Timestamp of review', null=True), ), migrations.AddField( model_name='satelliteentry', name='reviewer', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reviewed_satellites', to=settings.AUTH_USER_MODEL), ), migrations.CreateModel( name='Satellite', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('last_modified', models.DateTimeField(auto_now=True)), ('associated_satellite', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='associated_with', to='base.satellite')), ('satellite_entry', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='base.satelliteentry')), ('satellite_identifier', models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='satellite', to='base.satelliteidentifier')), ], ), migrations.AddField( model_name='satelliteentry', name='satellite_identifier', field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, related_name='satellite_entries', to='base.satelliteidentifier'), ), migrations.AlterUniqueTogether( name='satelliteentry', unique_together={('satellite_identifier', 'reviewed')}, ), migrations.RunPython(initialize_satellites, reverse_initialize_satellites), ]
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/base/migrations/0040_update_and_create_satellite_models.py
0.569613
0.17259
0040_update_and_create_satellite_models.py
pypi
import django.core.validators import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('base', '0021_auto_20200808_1725'), ] operations = [ migrations.CreateModel( name='Tle', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('tle0', models.CharField(blank=True, max_length=69, validators=[django.core.validators.MinLengthValidator(1), django.core.validators.MaxLengthValidator(69)])), ('tle1', models.CharField(blank=True, max_length=69, validators=[django.core.validators.MinLengthValidator(69), django.core.validators.MaxLengthValidator(69)])), ('tle2', models.CharField(blank=True, max_length=69, validators=[django.core.validators.MinLengthValidator(69), django.core.validators.MaxLengthValidator(69)])), ('tle_source', models.CharField(blank=True, max_length=300)), ('updated', models.DateTimeField(auto_now=True)), ('satellite', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='tles', to='base.Satellite')), ], options={ 'ordering': ['-updated'], }, ), migrations.CreateModel( name='LatestTle', fields=[ ], options={ 'proxy': True, 'indexes': [], 'constraints': [], }, bases=('base.tle',), ), migrations.AddIndex( model_name='tle', index=models.Index(fields=['-updated'], name='base_tle_updated_8936f7_idx'), ), migrations.AddIndex( model_name='tle', index=models.Index(fields=['tle1', 'tle2', 'tle_source', 'satellite'], name='base_tle_tle1_30ea48_idx'), ), migrations.AddConstraint( model_name='tle', constraint=models.UniqueConstraint(fields=('tle1', 'tle2', 'tle_source', 'satellite'), name='unique_entry_from_source_for_satellite'), ), ]
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/base/migrations/0022_add_tle_model.py
0.54359
0.190009
0022_add_tle_model.py
pypi
import django.core.validators import django.db.models.deletion import shortuuidfield.fields from django.conf import settings from django.db import migrations, models import db.base.models # Functions from the following migrations need manual copying. # Move them and any dependencies into this file, then update the # RunPython operations to refer to the local versions: # db.base.migrations.0009_auto_20180103_1931 class Migration(migrations.Migration): replaces = [('base', '0001_initial'), ('base', '0002_auto_20150908_2054'), ('base', '0003_auto_20160504_2104'), ('base', '0004_auto_20170302_1641'), ('base', '0005_demoddata_observer'), ('base', '0006_auto_20170323_1715'), ('base', '0007_satellite_status'), ('base', '0008_satellite_description'), ('base', '0009_auto_20180103_1931')] initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Mode', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=10, unique=True)), ], ), migrations.CreateModel( name='Satellite', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('norad_cat_id', models.PositiveIntegerField()), ('name', models.CharField(max_length=45)), ('names', models.TextField(blank=True)), ('image', models.ImageField(blank=True, help_text='Ideally: 250x250', upload_to='satellites')), ('tle1', models.CharField(blank=True, max_length=200)), ('tle2', models.CharField(blank=True, max_length=200)), ('status', models.CharField(choices=[('alive', 'alive'), ('dead', 'dead'), ('re-entered', 're-entered')], default='alive', max_length=10)), ('description', models.TextField(blank=True)), ], options={ 'ordering': ['norad_cat_id'], }, ), migrations.CreateModel( name='Transmitter', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('uuid', shortuuidfield.fields.ShortUUIDField(blank=True, db_index=True, editable=False, max_length=22, unique=True)), ('description', models.TextField()), ('alive', models.BooleanField(default=True)), ('uplink_low', models.PositiveIntegerField(blank=True, null=True)), ('uplink_high', models.PositiveIntegerField(blank=True, null=True)), ('downlink_low', models.PositiveIntegerField(blank=True, null=True)), ('downlink_high', models.PositiveIntegerField(blank=True, null=True)), ('invert', models.BooleanField(default=False)), ('baud', models.FloatField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)])), ('approved', models.BooleanField(default=False)), ], ), migrations.CreateModel( name='Suggestion', fields=[ ('transmitter_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='base.Transmitter')), ('citation', models.CharField(blank=True, max_length=255)), ], bases=('base.transmitter',), ), migrations.AddField( model_name='transmitter', name='mode', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='transmitters', to='base.Mode'), ), migrations.AddField( model_name='transmitter', name='satellite', field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='transmitters', to='base.Satellite'), ), migrations.AddField( model_name='suggestion', name='transmitter', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='suggestions', to='base.Transmitter'), ), migrations.AddField( model_name='suggestion', name='user', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), ), migrations.CreateModel( name='DemodData', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('data_id', models.PositiveIntegerField(blank=True, null=True)), ('transmitter', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='base.Transmitter')), ('lat', models.FloatField(default=0, validators=[django.core.validators.MaxValueValidator(90), django.core.validators.MinValueValidator(-90)])), ('lng', models.FloatField(default=0, validators=[django.core.validators.MaxValueValidator(180), django.core.validators.MinValueValidator(-180)])), ('payload_decoded', models.TextField(blank=True)), ('payload_frame', models.FileField(blank=True, null=True, upload_to=db.base.models._name_payload_frame)), ('satellite', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='telemetry_data', to='base.Satellite')), ('source', models.CharField(choices=[('manual', 'manual'), ('network', 'network'), ('sids', 'sids')], default='sids', max_length=7)), ('station', models.CharField(default='Unknown', max_length=45)), ('timestamp', models.DateTimeField(null=True)), ], options={ 'ordering': ['-timestamp'], }, ), migrations.CreateModel( name='Telemetry', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=45)), ('schema', models.TextField(blank=True)), ('decoder', models.CharField(blank=True, max_length=20)), ('satellite', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='telemetries', to='base.Satellite')), ], options={ 'ordering': ['satellite__norad_cat_id'], 'verbose_name_plural': 'Telemetries', }, ), migrations.AddField( model_name='demoddata', name='payload_telemetry', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='base.Telemetry'), ), migrations.AddField( model_name='demoddata', name='observer', field=models.CharField(blank=True, max_length=60), ), ]
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/base/migrations/0001_squashed_0009_auto_20180103_1931.py
0.544317
0.153137
0001_squashed_0009_auto_20180103_1931.py
pypi
;(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' && typeof require === 'function' ? factory(require('../moment')) : typeof define === 'function' && define.amd ? define(['../moment'], factory) : factory(global.moment) }(this, (function (moment) { 'use strict'; //! moment.js locale configuration var translator = { words: { //Different grammatical cases ss: ['секунда', 'секунде', 'секунди'], m: ['један минут', 'једне минуте'], mm: ['минут', 'минуте', 'минута'], h: ['један сат', 'једног сата'], hh: ['сат', 'сата', 'сати'], dd: ['дан', 'дана', 'дана'], MM: ['месец', 'месеца', 'месеци'], yy: ['година', 'године', 'година'], }, correctGrammaticalCase: function (number, wordKey) { return number === 1 ? wordKey[0] : number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]; }, translate: function (number, withoutSuffix, key) { var wordKey = translator.words[key]; if (key.length === 1) { return withoutSuffix ? wordKey[0] : wordKey[1]; } else { return ( number + ' ' + translator.correctGrammaticalCase(number, wordKey) ); } }, }; var srCyrl = moment.defineLocale('sr-cyrl', { months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split( '_' ), monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split( '_' ), monthsParseExact: true, weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'), weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'), weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'), weekdaysParseExact: true, longDateFormat: { LT: 'H:mm', LTS: 'H:mm:ss', L: 'D. M. YYYY.', LL: 'D. MMMM YYYY.', LLL: 'D. MMMM YYYY. H:mm', LLLL: 'dddd, D. MMMM YYYY. H:mm', }, calendar: { sameDay: '[данас у] LT', nextDay: '[сутра у] LT', nextWeek: function () { switch (this.day()) { case 0: return '[у] [недељу] [у] LT'; case 3: return '[у] [среду] [у] LT'; case 6: return '[у] [суботу] [у] LT'; case 1: case 2: case 4: case 5: return '[у] dddd [у] LT'; } }, lastDay: '[јуче у] LT', lastWeek: function () { var lastWeekDays = [ '[прошле] [недеље] [у] LT', '[прошлог] [понедељка] [у] LT', '[прошлог] [уторка] [у] LT', '[прошле] [среде] [у] LT', '[прошлог] [четвртка] [у] LT', '[прошлог] [петка] [у] LT', '[прошле] [суботе] [у] LT', ]; return lastWeekDays[this.day()]; }, sameElse: 'L', }, relativeTime: { future: 'за %s', past: 'пре %s', s: 'неколико секунди', ss: translator.translate, m: translator.translate, mm: translator.translate, h: translator.translate, hh: translator.translate, d: 'дан', dd: translator.translate, M: 'месец', MM: translator.translate, y: 'годину', yy: translator.translate, }, dayOfMonthOrdinalParse: /\d{1,2}\./, ordinal: '%d.', week: { dow: 1, // Monday is the first day of the week. doy: 7, // The week that contains Jan 1st is the first week of the year. }, }); return srCyrl; })));
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/static/lib/admin-lte/plugins/moment/locale/sr-cyrl.js
0.508544
0.54958
sr-cyrl.js
pypi
## jquery.flot.navigate.js This flot plugin is used for adding the ability to pan and zoom the plot. A higher level overview is available at [interactions](interactions.md) documentation. The default behaviour is scrollwheel up/down to zoom in, drag to pan. The plugin defines plot.zoom({ center }), plot.zoomOut() and plot.pan( offset ) so you easily can add custom controls. It also fires "plotpan" and "plotzoom" events, useful for synchronizing plots. The plugin supports these options: ```js zoom: { interactive: false, active: false, amount: 1.5 // 2 = 200% (zoom in), 0.5 = 50% (zoom out) } pan: { interactive: false, active: false, cursor: "move", // CSS mouse cursor value used when dragging, e.g. "pointer" frameRate: 60, mode: "smart" // enable smart pan mode } xaxis: { axisZoom: true, //zoom axis when mouse over it is allowed plotZoom: true, //zoom axis is allowed for plot zoom axisPan: true, //pan axis when mouse over it is allowed plotPan: true, //pan axis is allowed for plot pan panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units zoomRange: [undefined, undefined], // no limit on zoom range, or [closest zoom, furthest zoom] in axis units } yaxis: { axisZoom: true, //zoom axis when mouse over it is allowed plotZoom: true, //zoom axis is allowed for plot zoom axisPan: true, //pan axis when mouse over it is allowed plotPan: true //pan axis is allowed for plot pan panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units zoomRange: [undefined, undefined], // no limit on zoom range, or [closest zoom, furthest zoom] in axis units } ``` **interactive** enables the built-in drag/click behaviour. If you enable interactive for pan, then you'll have a basic plot that supports moving around; the same for zoom. **active** is true after a touch tap on plot. This enables plot navigation. Once activated, zoom and pan cannot be deactivated. When the plot becomes active, "plotactivated" event is triggered. **amount** specifies the default amount to zoom in (so 1.5 = 150%) relative to the current viewport. **cursor** is a standard CSS mouse cursor string used for visual feedback to the user when dragging. **frameRate** specifies the maximum number of times per second the plot will update itself while the user is panning around on it (set to null to disable intermediate pans, the plot will then not update until the mouse button is released). **mode** a string specifies the pan mode for mouse interaction. Accepted values: 'manual': no pan hint or direction snapping; 'smart': The graph shows pan hint bar and the pan movement will snap to one direction when the drag direction is close to it; 'smartLock'. The graph shows pan hint bar and the pan movement will always snap to a direction that the drag diorection started with. Example API usage: ```js plot = $.plot(...); // zoom default amount in on the pixel ( 10, 20 ) plot.zoom({ center: { left: 10, top: 20 } }); // zoom out again plot.zoomOut({ center: { left: 10, top: 20 } }); // zoom 200% in on the pixel (10, 20) plot.zoom({ amount: 2, center: { left: 10, top: 20 } }); // pan 100 pixels to the left (changing x-range in a positive way) and 20 down plot.pan({ left: -100, top: 20 }) ``` Here, "center" specifies where the center of the zooming should happen. Note that this is defined in pixel space, not the space of the data points (you can use the p2c helpers on the axes in Flot to help you convert between these). **amount** is the amount to zoom the viewport relative to the current range, so 1 is 100% (i.e. no change), 1.5 is 150% (zoom in), 0.7 is 70% (zoom out). You can set the default in the options. */ /* eslint-enable */ (function($) { 'use strict'; var options = { zoom: { interactive: false, active: false, amount: 1.5 // how much to zoom relative to current position, 2 = 200% (zoom in), 0.5 = 50% (zoom out) }, pan: { interactive: false, active: false, cursor: "move", frameRate: 60, mode: 'smart' }, recenter: { interactive: true }, xaxis: { axisZoom: true, //zoom axis when mouse over it is allowed plotZoom: true, //zoom axis is allowed for plot zoom axisPan: true, //pan axis when mouse over it is allowed plotPan: true, //pan axis is allowed for plot pan panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units zoomRange: [undefined, undefined] // no limit on zoom range, or [closest zoom, furthest zoom] in axis units }, yaxis: { axisZoom: true, plotZoom: true, axisPan: true, plotPan: true, panRange: [undefined, undefined], // no limit on pan range, or [min, max] in axis units zoomRange: [undefined, undefined] // no limit on zoom range, or [closest zoom, furthest zoom] in axis units } }; var saturated = $.plot.saturated; var browser = $.plot.browser; var SNAPPING_CONSTANT = $.plot.uiConstants.SNAPPING_CONSTANT; var PANHINT_LENGTH_CONSTANT = $.plot.uiConstants.PANHINT_LENGTH_CONSTANT; function init(plot) { plot.hooks.processOptions.push(initNevigation); } function initNevigation(plot, options) { var panAxes = null; var canDrag = false; var useManualPan = options.pan.mode === 'manual', smartPanLock = options.pan.mode === 'smartLock', useSmartPan = smartPanLock || options.pan.mode === 'smart'; function onZoomClick(e, zoomOut, amount) { var page = browser.getPageXY(e); var c = plot.offset(); c.left = page.X - c.left; c.top = page.Y - c.top; var ec = plot.getPlaceholder().offset(); ec.left = page.X - ec.left; ec.top = page.Y - ec.top; var axes = plot.getXAxes().concat(plot.getYAxes()).filter(function (axis) { var box = axis.box; if (box !== undefined) { return (ec.left > box.left) && (ec.left < box.left + box.width) && (ec.top > box.top) && (ec.top < box.top + box.height); } }); if (axes.length === 0) { axes = undefined; } if (zoomOut) { plot.zoomOut({ center: c, axes: axes, amount: amount }); } else { plot.zoom({ center: c, axes: axes, amount: amount }); } } var prevCursor = 'default', panHint = null, panTimeout = null, plotState, prevDragPosition = { x: 0, y: 0 }, isPanAction = false; function onMouseWheel(e, delta) { var maxAbsoluteDeltaOnMac = 1, isMacScroll = Math.abs(e.originalEvent.deltaY) <= maxAbsoluteDeltaOnMac, defaultNonMacScrollAmount = null, macMagicRatio = 50, amount = isMacScroll ? 1 + Math.abs(e.originalEvent.deltaY) / macMagicRatio : defaultNonMacScrollAmount; if (isPanAction) { onDragEnd(e); } if (plot.getOptions().zoom.active) { e.preventDefault(); onZoomClick(e, delta < 0, amount); return false; } } plot.navigationState = function(startPageX, startPageY) { var axes = this.getAxes(); var result = {}; Object.keys(axes).forEach(function(axisName) { var axis = axes[axisName]; result[axisName] = { navigationOffset: { below: axis.options.offset.below || 0, above: axis.options.offset.above || 0}, axisMin: axis.min, axisMax: axis.max, diagMode: false } }); result.startPageX = startPageX || 0; result.startPageY = startPageY || 0; return result; } function onMouseDown(e) { canDrag = true; } function onMouseUp(e) { canDrag = false; } function isLeftMouseButtonPressed(e) { return e.button === 0; } function onDragStart(e) { if (!canDrag || !isLeftMouseButtonPressed(e)) { return false; } isPanAction = true; var page = browser.getPageXY(e); var ec = plot.getPlaceholder().offset(); ec.left = page.X - ec.left; ec.top = page.Y - ec.top; panAxes = plot.getXAxes().concat(plot.getYAxes()).filter(function (axis) { var box = axis.box; if (box !== undefined) { return (ec.left > box.left) && (ec.left < box.left + box.width) && (ec.top > box.top) && (ec.top < box.top + box.height); } }); if (panAxes.length === 0) { panAxes = undefined; } var c = plot.getPlaceholder().css('cursor'); if (c) { prevCursor = c; } plot.getPlaceholder().css('cursor', plot.getOptions().pan.cursor); if (useSmartPan) { plotState = plot.navigationState(page.X, page.Y); } else if (useManualPan) { prevDragPosition.x = page.X; prevDragPosition.y = page.Y; } } function onDrag(e) { if (!isPanAction) { return; } var page = browser.getPageXY(e); var frameRate = plot.getOptions().pan.frameRate; if (frameRate === -1) { if (useSmartPan) { plot.smartPan({ x: plotState.startPageX - page.X, y: plotState.startPageY - page.Y }, plotState, panAxes, false, smartPanLock); } else if (useManualPan) { plot.pan({ left: prevDragPosition.x - page.X, top: prevDragPosition.y - page.Y, axes: panAxes }); prevDragPosition.x = page.X; prevDragPosition.y = page.Y; } return; } if (panTimeout || !frameRate) return; panTimeout = setTimeout(function() { if (useSmartPan) { plot.smartPan({ x: plotState.startPageX - page.X, y: plotState.startPageY - page.Y }, plotState, panAxes, false, smartPanLock); } else if (useManualPan) { plot.pan({ left: prevDragPosition.x - page.X, top: prevDragPosition.y - page.Y, axes: panAxes }); prevDragPosition.x = page.X; prevDragPosition.y = page.Y; } panTimeout = null; }, 1 / frameRate * 1000); } function onDragEnd(e) { if (!isPanAction) { return; } if (panTimeout) { clearTimeout(panTimeout); panTimeout = null; } isPanAction = false; var page = browser.getPageXY(e); plot.getPlaceholder().css('cursor', prevCursor); if (useSmartPan) { plot.smartPan({ x: plotState.startPageX - page.X, y: plotState.startPageY - page.Y }, plotState, panAxes, false, smartPanLock); plot.smartPan.end(); } else if (useManualPan) { plot.pan({ left: prevDragPosition.x - page.X, top: prevDragPosition.y - page.Y, axes: panAxes }); prevDragPosition.x = 0; prevDragPosition.y = 0; } } function onDblClick(e) { plot.activate(); var o = plot.getOptions() if (!o.recenter.interactive) { return; } var axes = plot.getTouchedAxis(e.clientX, e.clientY), event; plot.recenter({ axes: axes[0] ? axes : null }); if (axes[0]) { event = new $.Event('re-center', { detail: { axisTouched: axes[0] }}); } else { event = new $.Event('re-center', { detail: e }); } plot.getPlaceholder().trigger(event); } function onClick(e) { plot.activate(); if (isPanAction) { onDragEnd(e); } return false; } plot.activate = function() { var o = plot.getOptions(); if (!o.pan.active || !o.zoom.active) { o.pan.active = true; o.zoom.active = true; plot.getPlaceholder().trigger("plotactivated", [plot]); } } function bindEvents(plot, eventHolder) { var o = plot.getOptions(); if (o.zoom.interactive) { eventHolder.mousewheel(onMouseWheel); } if (o.pan.interactive) { plot.addEventHandler("dragstart", onDragStart, eventHolder, 0); plot.addEventHandler("drag", onDrag, eventHolder, 0); plot.addEventHandler("dragend", onDragEnd, eventHolder, 0); eventHolder.bind("mousedown", onMouseDown); eventHolder.bind("mouseup", onMouseUp); } eventHolder.dblclick(onDblClick); eventHolder.click(onClick); } plot.zoomOut = function(args) { if (!args) { args = {}; } if (!args.amount) { args.amount = plot.getOptions().zoom.amount; } args.amount = 1 / args.amount; plot.zoom(args); }; plot.zoom = function(args) { if (!args) { args = {}; } var c = args.center, amount = args.amount || plot.getOptions().zoom.amount, w = plot.width(), h = plot.height(), axes = args.axes || plot.getAxes(); if (!c) { c = { left: w / 2, top: h / 2 }; } var xf = c.left / w, yf = c.top / h, minmax = { x: { min: c.left - xf * w / amount, max: c.left + (1 - xf) * w / amount }, y: { min: c.top - yf * h / amount, max: c.top + (1 - yf) * h / amount } }; for (var key in axes) { if (!axes.hasOwnProperty(key)) { continue; } var axis = axes[key], opts = axis.options, min = minmax[axis.direction].min, max = minmax[axis.direction].max, navigationOffset = axis.options.offset; //skip axis without axisZoom when zooming only on certain axis or axis without plotZoom for zoom on entire plot if ((!opts.axisZoom && args.axes) || (!args.axes && !opts.plotZoom)) { continue; } min = $.plot.saturated.saturate(axis.c2p(min)); max = $.plot.saturated.saturate(axis.c2p(max)); if (min > max) { // make sure min < max var tmp = min; min = max; max = tmp; } // test for zoom limits zoomRange: [min,max] if (opts.zoomRange) { // zoomed in too far if (max - min < opts.zoomRange[0]) { continue; } // zoomed out to far if (max - min > opts.zoomRange[1]) { continue; } } var offsetBelow = $.plot.saturated.saturate(navigationOffset.below - (axis.min - min)); var offsetAbove = $.plot.saturated.saturate(navigationOffset.above - (axis.max - max)); opts.offset = { below: offsetBelow, above: offsetAbove }; }; plot.setupGrid(true); plot.draw(); if (!args.preventEvent) { plot.getPlaceholder().trigger("plotzoom", [plot, args]); } }; plot.pan = function(args) { var delta = { x: +args.left, y: +args.top }; if (isNaN(delta.x)) delta.x = 0; if (isNaN(delta.y)) delta.y = 0; $.each(args.axes || plot.getAxes(), function(_, axis) { var opts = axis.options, d = delta[axis.direction]; //skip axis without axisPan when panning only on certain axis or axis without plotPan for pan the entire plot if ((!opts.axisPan && args.axes) || (!opts.plotPan && !args.axes)) { return; } // calc min delta (revealing left edge of plot) var minD = axis.p2c(opts.panRange[0]) - axis.p2c(axis.min); // calc max delta (revealing right edge of plot) var maxD = axis.p2c(opts.panRange[1]) - axis.p2c(axis.max); // limit delta to min or max if enabled if (opts.panRange[0] !== undefined && d >= maxD) d = maxD; if (opts.panRange[1] !== undefined && d <= minD) d = minD; if (d !== 0) { var navigationOffsetBelow = saturated.saturate(axis.c2p(axis.p2c(axis.min) + d) - axis.c2p(axis.p2c(axis.min))), navigationOffsetAbove = saturated.saturate(axis.c2p(axis.p2c(axis.max) + d) - axis.c2p(axis.p2c(axis.max))); if (!isFinite(navigationOffsetBelow)) { navigationOffsetBelow = 0; } if (!isFinite(navigationOffsetAbove)) { navigationOffsetAbove = 0; } opts.offset = { below: saturated.saturate(navigationOffsetBelow + (opts.offset.below || 0)), above: saturated.saturate(navigationOffsetAbove + (opts.offset.above || 0)) }; } }); plot.setupGrid(true); plot.draw(); if (!args.preventEvent) { plot.getPlaceholder().trigger("plotpan", [plot, args]); } }; plot.recenter = function(args) { $.each(args.axes || plot.getAxes(), function(_, axis) { if (args.axes) { if (this.direction === 'x') { axis.options.offset = { below: 0 }; } else if (this.direction === 'y') { axis.options.offset = { above: 0 }; } } else { axis.options.offset = { below: 0, above: 0 }; } }); plot.setupGrid(true); plot.draw(); }; var shouldSnap = function(delta) { return (Math.abs(delta.y) < SNAPPING_CONSTANT && Math.abs(delta.x) >= SNAPPING_CONSTANT) || (Math.abs(delta.x) < SNAPPING_CONSTANT && Math.abs(delta.y) >= SNAPPING_CONSTANT); } // adjust delta so the pan action is constrained on the vertical or horizontal direction // it the movements in the other direction are small var adjustDeltaToSnap = function(delta) { if (Math.abs(delta.x) < SNAPPING_CONSTANT && Math.abs(delta.y) >= SNAPPING_CONSTANT) { return {x: 0, y: delta.y}; } if (Math.abs(delta.y) < SNAPPING_CONSTANT && Math.abs(delta.x) >= SNAPPING_CONSTANT) { return {x: delta.x, y: 0}; } return delta; } var lockedDirection = null; var lockDeltaDirection = function(delta) { if (!lockedDirection && Math.max(Math.abs(delta.x), Math.abs(delta.y)) >= SNAPPING_CONSTANT) { lockedDirection = Math.abs(delta.x) < Math.abs(delta.y) ? 'y' : 'x'; } switch (lockedDirection) { case 'x': return { x: delta.x, y: 0 }; case 'y': return { x: 0, y: delta.y }; default: return { x: 0, y: 0 }; } } var isDiagonalMode = function(delta) { if (Math.abs(delta.x) > 0 && Math.abs(delta.y) > 0) { return true; } return false; } var restoreAxisOffset = function(axes, initialState, delta) { var axis; Object.keys(axes).forEach(function(axisName) { axis = axes[axisName]; if (delta[axis.direction] === 0) { axis.options.offset.below = initialState[axisName].navigationOffset.below; axis.options.offset.above = initialState[axisName].navigationOffset.above; } }); } var prevDelta = { x: 0, y: 0 }; plot.smartPan = function(delta, initialState, panAxes, preventEvent, smartLock) { var snap = smartLock ? true : shouldSnap(delta), axes = plot.getAxes(), opts; delta = smartLock ? lockDeltaDirection(delta) : adjustDeltaToSnap(delta); if (isDiagonalMode(delta)) { initialState.diagMode = true; } if (snap && initialState.diagMode === true) { initialState.diagMode = false; restoreAxisOffset(axes, initialState, delta); } if (snap) { panHint = { start: { x: initialState.startPageX - plot.offset().left + plot.getPlotOffset().left, y: initialState.startPageY - plot.offset().top + plot.getPlotOffset().top }, end: { x: initialState.startPageX - delta.x - plot.offset().left + plot.getPlotOffset().left, y: initialState.startPageY - delta.y - plot.offset().top + plot.getPlotOffset().top } } } else { panHint = { start: { x: initialState.startPageX - plot.offset().left + plot.getPlotOffset().left, y: initialState.startPageY - plot.offset().top + plot.getPlotOffset().top }, end: false } } if (isNaN(delta.x)) delta.x = 0; if (isNaN(delta.y)) delta.y = 0; if (panAxes) { axes = panAxes; } var axis, axisMin, axisMax, p, d; Object.keys(axes).forEach(function(axisName) { axis = axes[axisName]; axisMin = axis.min; axisMax = axis.max; opts = axis.options; d = delta[axis.direction]; p = prevDelta[axis.direction]; //skip axis without axisPan when panning only on certain axis or axis without plotPan for pan the entire plot if ((!opts.axisPan && panAxes) || (!panAxes && !opts.plotPan)) { return; } // calc min delta (revealing left edge of plot) var minD = p + axis.p2c(opts.panRange[0]) - axis.p2c(axisMin); // calc max delta (revealing right edge of plot) var maxD = p + axis.p2c(opts.panRange[1]) - axis.p2c(axisMax); // limit delta to min or max if enabled if (opts.panRange[0] !== undefined && d >= maxD) d = maxD; if (opts.panRange[1] !== undefined && d <= minD) d = minD; if (d !== 0) { var navigationOffsetBelow = saturated.saturate(axis.c2p(axis.p2c(axisMin) - (p - d)) - axis.c2p(axis.p2c(axisMin))), navigationOffsetAbove = saturated.saturate(axis.c2p(axis.p2c(axisMax) - (p - d)) - axis.c2p(axis.p2c(axisMax))); if (!isFinite(navigationOffsetBelow)) { navigationOffsetBelow = 0; } if (!isFinite(navigationOffsetAbove)) { navigationOffsetAbove = 0; } axis.options.offset.below = saturated.saturate(navigationOffsetBelow + (axis.options.offset.below || 0)); axis.options.offset.above = saturated.saturate(navigationOffsetAbove + (axis.options.offset.above || 0)); } }); prevDelta = delta; plot.setupGrid(true); plot.draw(); if (!preventEvent) { plot.getPlaceholder().trigger("plotpan", [plot, delta, panAxes, initialState]); } }; plot.smartPan.end = function() { panHint = null; lockedDirection = null; prevDelta = { x: 0, y: 0 }; plot.triggerRedrawOverlay(); } function shutdown(plot, eventHolder) { eventHolder.unbind("mousewheel", onMouseWheel); eventHolder.unbind("mousedown", onMouseDown); eventHolder.unbind("mouseup", onMouseUp); eventHolder.unbind("dragstart", onDragStart); eventHolder.unbind("drag", onDrag); eventHolder.unbind("dragend", onDragEnd); eventHolder.unbind("dblclick", onDblClick); eventHolder.unbind("click", onClick); if (panTimeout) clearTimeout(panTimeout); } function drawOverlay(plot, ctx) { if (panHint) { ctx.strokeStyle = 'rgba(96, 160, 208, 0.7)'; ctx.lineWidth = 2; ctx.lineJoin = "round"; var startx = Math.round(panHint.start.x), starty = Math.round(panHint.start.y), endx, endy; if (panAxes) { if (panAxes[0].direction === 'x') { endy = Math.round(panHint.start.y); endx = Math.round(panHint.end.x); } else if (panAxes[0].direction === 'y') { endx = Math.round(panHint.start.x); endy = Math.round(panHint.end.y); } } else { endx = Math.round(panHint.end.x); endy = Math.round(panHint.end.y); } ctx.beginPath(); if (panHint.end === false) { ctx.moveTo(startx, starty - PANHINT_LENGTH_CONSTANT); ctx.lineTo(startx, starty + PANHINT_LENGTH_CONSTANT); ctx.moveTo(startx + PANHINT_LENGTH_CONSTANT, starty); ctx.lineTo(startx - PANHINT_LENGTH_CONSTANT, starty); } else { var dirX = starty === endy; ctx.moveTo(startx - (dirX ? 0 : PANHINT_LENGTH_CONSTANT), starty - (dirX ? PANHINT_LENGTH_CONSTANT : 0)); ctx.lineTo(startx + (dirX ? 0 : PANHINT_LENGTH_CONSTANT), starty + (dirX ? PANHINT_LENGTH_CONSTANT : 0)); ctx.moveTo(startx, starty); ctx.lineTo(endx, endy); ctx.moveTo(endx - (dirX ? 0 : PANHINT_LENGTH_CONSTANT), endy - (dirX ? PANHINT_LENGTH_CONSTANT : 0)); ctx.lineTo(endx + (dirX ? 0 : PANHINT_LENGTH_CONSTANT), endy + (dirX ? PANHINT_LENGTH_CONSTANT : 0)); } ctx.stroke(); } } plot.getTouchedAxis = function(touchPointX, touchPointY) { var ec = plot.getPlaceholder().offset(); ec.left = touchPointX - ec.left; ec.top = touchPointY - ec.top; var axis = plot.getXAxes().concat(plot.getYAxes()).filter(function (axis) { var box = axis.box; if (box !== undefined) { return (ec.left > box.left) && (ec.left < box.left + box.width) && (ec.top > box.top) && (ec.top < box.top + box.height); } }); return axis; } plot.hooks.drawOverlay.push(drawOverlay); plot.hooks.bindEvents.push(bindEvents); plot.hooks.shutdown.push(shutdown); } $.plot.plugins.push({ init: init, options: options, name: 'navigate', version: '1.3' }); })(jQuery);
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/static/lib/admin-lte/plugins/flot/plugins/jquery.flot.navigate.js
0.724383
0.865053
jquery.flot.navigate.js
pypi
(function ($) { // we normalize the area of each symbol so it is approximately the // same as a circle of the given radius var square = function (ctx, x, y, radius, shadow) { // pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2 var size = radius * Math.sqrt(Math.PI) / 2; ctx.rect(x - size, y - size, size + size, size + size); }, rectangle = function (ctx, x, y, radius, shadow) { // pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2 var size = radius * Math.sqrt(Math.PI) / 2; ctx.rect(x - size, y - size, size + size, size + size); }, diamond = function (ctx, x, y, radius, shadow) { // pi * r^2 = 2s^2 => s = r * sqrt(pi/2) var size = radius * Math.sqrt(Math.PI / 2); ctx.moveTo(x - size, y); ctx.lineTo(x, y - size); ctx.lineTo(x + size, y); ctx.lineTo(x, y + size); ctx.lineTo(x - size, y); ctx.lineTo(x, y - size); }, triangle = function (ctx, x, y, radius, shadow) { // pi * r^2 = 1/2 * s^2 * sin (pi / 3) => s = r * sqrt(2 * pi / sin(pi / 3)) var size = radius * Math.sqrt(2 * Math.PI / Math.sin(Math.PI / 3)); var height = size * Math.sin(Math.PI / 3); ctx.moveTo(x - size / 2, y + height / 2); ctx.lineTo(x + size / 2, y + height / 2); if (!shadow) { ctx.lineTo(x, y - height / 2); ctx.lineTo(x - size / 2, y + height / 2); ctx.lineTo(x + size / 2, y + height / 2); } }, cross = function (ctx, x, y, radius, shadow) { // pi * r^2 = (2s)^2 => s = r * sqrt(pi)/2 var size = radius * Math.sqrt(Math.PI) / 2; ctx.moveTo(x - size, y - size); ctx.lineTo(x + size, y + size); ctx.moveTo(x - size, y + size); ctx.lineTo(x + size, y - size); }, ellipse = function(ctx, x, y, radius, shadow, fill) { if (!shadow) { ctx.moveTo(x + radius, y); ctx.arc(x, y, radius, 0, Math.PI * 2, false); } }, plus = function (ctx, x, y, radius, shadow) { var size = radius * Math.sqrt(Math.PI / 2); ctx.moveTo(x - size, y); ctx.lineTo(x + size, y); ctx.moveTo(x, y + size); ctx.lineTo(x, y - size); }, handlers = { square: square, rectangle: rectangle, diamond: diamond, triangle: triangle, cross: cross, ellipse: ellipse, plus: plus }; square.fill = true; rectangle.fill = true; diamond.fill = true; triangle.fill = true; ellipse.fill = true; function init(plot) { plot.drawSymbol = handlers; } $.plot.plugins.push({ init: init, name: 'symbols', version: '1.0' }); })(jQuery);
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/static/lib/admin-lte/plugins/flot/plugins/jquery.flot.symbol.js
0.504883
0.789356
jquery.flot.symbol.js
pypi
declare class uPlot { /** when passing a function for @targ, call init() after attaching self.root to the DOM */ constructor( opts: uPlot.Options, data?: uPlot.AlignedData, targ?: HTMLElement | ((self: uPlot, init: Function) => void) ); /** chart container */ readonly root: HTMLElement; /** status */ readonly status: 0 | 1; /** width of the plotting area + axes in CSS pixels */ readonly width: number; /** height of the plotting area + axes in CSS pixels (excludes title & legend height) */ readonly height: number; /** context of canvas used for plotting area + axes */ readonly ctx: CanvasRenderingContext2D; /** coords of plotting area in canvas pixels (relative to full canvas w/axes) */ readonly bbox: uPlot.BBox; /** coords of selected region in CSS pixels (relative to plotting area) */ readonly select: uPlot.BBox; /** cursor state & opts*/ readonly cursor: uPlot.Cursor; readonly legend: uPlot.Legend; // /** focus opts */ // readonly focus: uPlot.Focus; /** series state & opts */ readonly series: uPlot.Series[]; /** scales state & opts */ readonly scales: { [key: string]: uPlot.Scale; }; /** axes state & opts */ readonly axes: uPlot.Axis[]; /** hooks, including any added by plugins */ readonly hooks: uPlot.Hooks.Arrays; /** current data */ readonly data: uPlot.AlignedData; /** clears and redraws the canvas. if rebuildPaths = false, uses cached series' Path2D objects */ redraw(rebuildPaths?: boolean, recalcAxes?: boolean): void; /** defers recalc & redraw for multiple ops, e.g. setScale('x', ...) && setScale('y', ...) */ batch(txn: Function): void; /** destroys DOM, removes resize & scroll listeners, etc. */ destroy(): void; /** sets the chart data & redraws. (default resetScales = true) */ setData(data: uPlot.AlignedData, resetScales?: boolean): void; /** sets the limits of a scale & redraws (used for zooming) */ setScale(scaleKey: string, limits: { min: number; max: number }): void; /** sets the cursor position (relative to plotting area) */ setCursor(opts: {left: number, top: number}, fireHook?: boolean): void; /** sets the legend to the values of the specified idx */ setLegend(opts: {idx: number}, fireHook?: boolean): void; // TODO: include other series style opts which are dynamically pulled? /** toggles series visibility or focus */ setSeries(seriesIdx: number | null, opts: {show?: boolean, focus?: boolean}): void; /** adds a series */ addSeries(opts: uPlot.Series, seriesIdx?: number): void; /** deletes a series */ delSeries(seriesIdx: number): void; /** sets visually selected region without triggering setScale (zoom). (default fireHook = true) */ setSelect(opts: {left: number, top: number, width: number, height: number}, fireHook?: boolean): void; /** sets the width & height of the plotting area + axes (excludes title & legend height) */ setSize(opts: { width: number; height: number }): void; /** converts a CSS pixel position (relative to plotting area) to the closest data index */ posToIdx(left: number): number; /** converts a CSS pixel position (relative to plotting area) to a value along the given scale */ posToVal(leftTop: number, scaleKey: string): number; /** converts a value along the given scale to a CSS (default) or canvas pixel position. (default canvasPixels = false) */ valToPos(val: number, scaleKey: string, canvasPixels?: boolean): number; /** converts a value along x to the closest data index */ valToIdx(val: number): number; /** updates getBoundingClientRect() cache for cursor positioning. use when plot's position changes (excluding window scroll & resize) */ syncRect(defer?: boolean): void; /** uPlot's path-builder factories */ static paths: uPlot.Series.PathBuilderFactories; /** a deep merge util fn */ static assign(targ: object, ...srcs: object[]): object; /** re-ranges a given min/max by a multiple of the range's magnitude (used internally to expand/snap/pad numeric y scales) */ static rangeNum: ((min: number, max: number, mult: number, extra: boolean) => uPlot.Range.MinMax) | ((min: number, max: number, cfg: uPlot.Range.Config) => uPlot.Range.MinMax); /** re-ranges a given min/max outwards to nearest 10% of given min/max's magnitudes, unless fullMags = true */ static rangeLog(min: number, max: number, base: uPlot.Scale.LogBase, fullMags: boolean): uPlot.Range.MinMax; /** re-ranges a given min/max outwards to nearest 10% of given min/max's magnitudes, unless fullMags = true */ static rangeAsinh(min: number, max: number, base: uPlot.Scale.LogBase, fullMags: boolean): uPlot.Range.MinMax; /** default numeric formatter using browser's locale: new Intl.NumberFormat(navigator.language).format */ static fmtNum(val: number): string; /** creates an efficient formatter for Date objects from a template string, e.g. {YYYY}-{MM}-{DD} */ static fmtDate(tpl: string, names?: uPlot.DateNames): (date: Date) => string; /** converts a Date into new Date that's time-adjusted for the given IANA Time Zone Name */ static tzDate(date: Date, tzName: string): Date; /** outerJoins multiple data tables on table[0] values */ static join(tables: uPlot.AlignedData[], nullModes?: uPlot.JoinNullMode[][]): uPlot.AlignedData; static addGap: uPlot.Series.AddGap; static clipGaps: uPlot.Series.ClipPathBuilder; /** helper function for grabbing proper drawing orientation vars and fns for a plot instance (all dims in canvas pixels) */ static orient: (u: uPlot, seriesIdx: number, callback: uPlot.OrientCallback) => any; /** returns a pub/sub instance shared by all plots usng the provided key */ static sync: (key: string) => uPlot.SyncPubSub; } export = uPlot; declare namespace uPlot { type OrientCallback = ( series: Series, dataX: number[], dataY: (number | null)[], scaleX: Scale, scaleY: Scale, valToPosX: ValToPos, valToPosY: ValToPos, xOff: number, yOff: number, xDim: number, yDim: number, moveTo: MoveToH | MoveToV, lineTo: LineToH | LineToV, rect: RectH | RectV, arc: ArcH | ArcV, bezierCurveTo: BezierCurveToH | BezierCurveToV, ) => any; type ValToPos = (val: number, scale: Scale, fullDim: number, offset: number) => number; type Drawable = Path2D | CanvasRenderingContext2D; type MoveToH = (p: Drawable, x: number, y: number) => void; type MoveToV = (p: Drawable, y: number, x: number) => void; type LineToH = (p: Drawable, x: number, y: number) => void; type LineToV = (p: Drawable, y: number, x: number) => void; type RectH = (p: Drawable, x: number, y: number, w: number, h: number) => void; type RectV = (p: Drawable, y: number, x: number, h: number, w: number) => void; type ArcH = (p: Drawable, x: number, y: number, r: number, startAngle: number, endAngle: number) => void; type ArcV = (p: Drawable, y: number, x: number, r: number, startAngle: number, endAngle: number) => void; type BezierCurveToH = (p: Drawable, bp1x: number, bp1y: number, bp2x: number, bp2y: number, p2x: number, p2y: number) => void; type BezierCurveToV = (p: Drawable, bp1y: number, bp1x: number, bp2y: number, bp2x: number, p2y: number, p2x: number) => void; export const enum JoinNullMode { /** use for series with spanGaps: true */ Remove = 0, /** retain explicit nulls gaps (default) */ Retain = 1, /** expand explicit null gaps to include adjacent alignment artifacts (undefined values) */ Expand = 2, } export const enum Orientation { Horizontal = 0, Vertical = 1, } export type AlignedData = [ xValues: number[], ...yValues: (number | null)[][], ] export interface DateNames { /** long month names */ MMMM: string[]; /** short month names */ MMM: string[]; /** long weekday names (0: Sunday) */ WWWW: string[]; /** short weekday names (0: Sun) */ WWW: string[]; } export namespace Range { export type MinMax = [min: number, max: number]; export type Function = (self: uPlot, initMin: number, initMax: number, scaleKey: string) => MinMax; export type SoftMode = 0 | 1 | 2 | 3; export interface Limit { /** initial multiplier for dataMax-dataMin delta */ pad?: number; // 0.1 /** soft limit */ soft?: number; // 0 /** soft limit active if... 0: never, 1: data <= limit, 2: data + padding <= limit, 3: data <= limit <= data + padding */ mode?: SoftMode; // 3 /** hard limit */ hard?: number; } export interface Config { min: Range.Limit; max: Range.Limit; } } export interface Scales { [key: string]: Scale; } type SidesWithAxes = [top: boolean, right: boolean, bottom: boolean, left: boolean]; export type PaddingSide = number | null | ((self: uPlot, side: Axis.Side, sidesWithAxes: SidesWithAxes, cycleNum: number) => number); export type Padding = [top: PaddingSide, right: PaddingSide, bottom: PaddingSide, left: PaddingSide]; export interface Legend { show?: boolean; // true /** show series values at current cursor.idx */ live?: boolean; // true /** swiches primary interaction mode to toggle-one/toggle-all */ isolate?: boolean; // false /** series indicator line width */ width?: Legend.Width; /** series indicator stroke (CSS borderColor) */ stroke?: Legend.Stroke; /** series indicator stroke style (CSS borderStyle) */ dash?: Legend.Dash; /** series indicator fill */ fill?: Legend.Fill; /** current index (readback-only, not for init) */ idx?: number; /** current values (readback-only, not for init) */ values?: Legend.Values; } export namespace Legend { export type Width = number | ((self: uPlot, seriesIdx: number) => number); export type Stroke = CSSStyleDeclaration['borderColor'] | ((self: uPlot, seriesIdx: number) => CSSStyleDeclaration['borderColor']); export type Dash = CSSStyleDeclaration['borderStyle'] | ((self: uPlot, seriesIdx: number) => CSSStyleDeclaration['borderStyle']); export type Fill = CSSStyleDeclaration['background'] | ((self: uPlot, seriesIdx: number) => CSSStyleDeclaration['background']); export type Value = { [key: string]: string | number; }; export type Values = Value[]; } export type DateFormatterFactory = (tpl: string) => (date: Date) => string; export type LocalDateFromUnix = (ts: number) => Date; export const enum DrawOrderKey { Axes = 'axes', Series = 'series', } export interface Options { /** chart title */ title?: string; /** id to set on chart div */ id?: string; /** className to add to chart div */ class?: string; /** width of plotting area + axes in CSS pixels */ width: number; /** height of plotting area + axes in CSS pixels (excludes title & legend height) */ height: number; /** data for chart, if none is provided as argument to constructor */ data?: AlignedData; /** converts a unix timestamp to Date that's time-adjusted for the desired timezone */ tzDate?: LocalDateFromUnix; /** creates an efficient formatter for Date objects from a template string, e.g. {YYYY}-{MM}-{DD} */ fmtDate?: DateFormatterFactory; /** timestamp multiplier that yields 1 millisecond */ ms?: 1e-3 | 1; // 1e-3 /** drawing order for axes/grid & series (default: ["axes", "series"]) */ drawOrder?: DrawOrderKey[]; /** whether vt & hz lines of series/grid/ticks should be crisp/sharp or sub-px antialiased */ pxAlign?: boolean | number; // true series: Series[]; bands?: Band[]; scales?: Scales; axes?: Axis[]; /** padding per side, in CSS pixels (can prevent cross-axis labels at the plotting area limits from being chopped off) */ padding?: Padding; select?: Select; legend?: Legend; cursor?: Cursor; focus?: Focus; hooks?: Hooks.Arrays; plugins?: Plugin[]; } export interface Focus { /** alpha-transparancy of de-focused series */ alpha: number; } export interface BBox { show?: boolean; left: number; top: number; width: number; height: number; } export interface Select extends BBox { /** div into which .u-select will be placed: .u-over or .u-under */ over?: boolean; // true } export interface SyncPubSub { key: string; sub: (client: uPlot) => void; unsub: (client: uPlot) => void; pub: (type: string, client: uPlot, x: number, y: number, w: number, h: number, i: number) => void; plots: uPlot[]; } export namespace Cursor { export type LeftTop = [left: number, top: number]; export type MouseListener = (e: MouseEvent) => null; export type MouseListenerFactory = (self: uPlot, targ: HTMLElement, handler: MouseListener) => MouseListener | null; export type DataIdxRefiner = (self: uPlot, seriesIdx: number, closestIdx: number, xValue: number) => number; export type MousePosRefiner = (self: uPlot, mouseLeft: number, mouseTop: number) => LeftTop; export interface Bind { mousedown?: MouseListenerFactory; mouseup?: MouseListenerFactory; click?: MouseListenerFactory; dblclick?: MouseListenerFactory; mousemove?: MouseListenerFactory; mouseleave?: MouseListenerFactory; mouseenter?: MouseListenerFactory; } export namespace Points { export type Show = boolean | ((self: uPlot, seriesIdx: number) => HTMLElement); export type Size = number | ((self: uPlot, seriesIdx: number) => number); export type Width = number | ((self: uPlot, seriesIdx: number, size: number) => number); export type Stroke = CanvasRenderingContext2D['strokeStyle'] | ((self: uPlot, seriesIdx: number) => CanvasRenderingContext2D['strokeStyle']); export type Fill = CanvasRenderingContext2D['fillStyle'] | ((self: uPlot, seriesIdx: number) => CanvasRenderingContext2D['fillStyle']); } export interface Points { show?: Points.Show; /** hover point diameter in CSS pixels */ size?: Points.Size; /** hover point outline width in CSS pixels */ width?: Points.Width; /** hover point outline color, pattern or gradient */ stroke?: Points.Stroke; /** hover point fill color, pattern or gradient */ fill?: Points.Fill; } export interface Drag { setScale?: boolean; // true /** toggles dragging along x */ x?: boolean; // true /** toggles dragging along y */ y?: boolean; // false /** min drag distance threshold */ dist?: number; // 0 /** when x & y are true, sets an upper drag limit in CSS px for adaptive/unidirectional behavior */ uni?: number; // null } export namespace Sync { export type Scales = [xScaleKey: string, yScaleKey: string]; export type Filter = (type: string, client: uPlot, x: number, y: number, w: number, h: number, i: number) => boolean; export interface Filters { /** filters emitted events */ pub?: Filter; /** filters received events */ sub?: Filter; } export type ScaleKeyMatcher = (subScaleKey: string | null, pubScaleKey: string | null) => boolean; export type Match = [matchX: ScaleKeyMatcher, matchY: ScaleKeyMatcher]; export type Values = [xScaleValue: number, yScaleValue: number]; } export interface Sync { /** sync key must match between all charts in a synced group */ key: string; /** determines if series toggling and focus via cursor is synced across charts */ setSeries?: boolean; // true /** sets the x and y scales to sync by values. null will sync by relative (%) position */ scales?: Sync.Scales; // [xScaleKey, null] /** fns that match x and y scale keys between publisher and subscriber */ match?: Sync.Match; /** event filters */ filters?: Sync.Filters; /** sync scales' values at the cursor position (exposed for read-back by subscribers) */ values?: Sync.Values, } export interface Focus { /** minimum cursor proximity to datapoint in CSS pixels for focus activation */ prox: number; } } export interface Cursor { /** cursor on/off */ show?: boolean; /** vertical crosshair on/off */ x?: boolean; /** horizontal crosshair on/off */ y?: boolean; /** cursor position left offset in CSS pixels (relative to plotting area) */ left?: number; /** cursor position top offset in CSS pixels (relative to plotting area) */ top?: number; /** closest data index to cursor (closestIdx) */ idx?: number; /** returns data idx used for hover points & legend display (defaults to closestIdx) */ dataIdx?: Cursor.DataIdxRefiner; /** fires on debounced mousemove events; returns refined [left, top] tuple to snap cursor position */ move?: Cursor.MousePosRefiner; /** series hover points */ points?: Cursor.Points; /** event listener proxies (can be overridden to tweak interaction behavior) */ bind?: Cursor.Bind; /** determines vt/hz cursor dragging to set selection & setScale (zoom) */ drag?: Cursor.Drag; /** sync cursor between multiple charts */ sync?: Cursor.Sync; /** focus series closest to cursor */ focus?: Cursor.Focus; /** lock cursor on mouse click in plotting area */ lock?: boolean; // false } export namespace Scale { export type Auto = boolean | ((self: uPlot, resetScales: boolean) => boolean); export type Range = Range.MinMax | Range.Function | Range.Config; export const enum Distr { Linear = 1, Ordinal = 2, Logarithmic = 3, ArcSinh = 4, } export type LogBase = 10 | 2; export type Clamp = number | ((self: uPlot, val: number, scaleMin: number, scaleMax: number, scaleKey: string) => number); } export interface Scale { /** is this scale temporal, with series' data in UNIX timestamps? */ time?: boolean; /** determines whether all series' data on this scale will be scanned to find the full min/max range */ auto?: Scale.Auto; /** can define a static scale range or re-range an initially-determined range from series data */ range?: Scale.Range; /** scale key from which this scale is derived */ from?: string; /** scale distribution. 1: linear, 2: ordinal, 3: logarithmic, 4: arcsinh */ distr?: Scale.Distr; // 1 /** logarithmic base */ log?: Scale.LogBase; // 10; /** clamps log scale values <= 0 (default = scaleMin / 10) */ clamp?: Scale.Clamp; /** arcsinh linear threshold */ asinh?: number; // 1 /** current min scale value */ min?: number; /** current max scale value */ max?: number; /** scale direction */ dir?: 1 | -1; /** scale orientation - 0: hz, 1: vt */ ori?: 0 | 1; } export namespace Series { export interface Paths { /** path to stroke */ stroke?: Path2D | null; /** path to fill */ fill?: Path2D | null; /** path for clipping fill & stroke */ clip?: Path2D | null; } export interface SteppedPathBuilderOpts { align?: -1 | 1; // 1 // whether to draw ascenders/descenders at null/gap boundaries ascDesc?: boolean; // false } export interface BarsPathBuilderOpts { align?: -1 | 0 | 1, // 0 size?: [factor?: number, max?: number] } export type LinearPathBuilderFactory = () => Series.PathBuilder; export type SplinePathBuilderFactory = () => Series.PathBuilder; export type SteppedPathBuilderFactory = (opts?: SteppedPathBuilderOpts) => Series.PathBuilder; export type BarsPathBuilderFactory = (opts?: BarsPathBuilderOpts) => Series.PathBuilder; export interface PathBuilderFactories { linear?: LinearPathBuilderFactory; spline?: SplinePathBuilderFactory; stepped?: SteppedPathBuilderFactory; bars?: BarsPathBuilderFactory; } export type Stroke = CanvasRenderingContext2D['strokeStyle'] | ((self: uPlot, seriesIdx: number) => CanvasRenderingContext2D['strokeStyle']); export type Fill = CanvasRenderingContext2D['fillStyle'] | ((self: uPlot, seriesIdx: number) => CanvasRenderingContext2D['fillStyle']); export type Cap = CanvasRenderingContext2D['lineCap']; export namespace Points { export type Show = boolean | ((self: uPlot, seriesIdx: number, idx0: number, idx1: number) => boolean | undefined); } export interface Points { /** if boolean or returns boolean, round points are drawn with defined options, else fn should draw own custom points via self.ctx */ show?: Points.Show; /** diameter of point in CSS pixels */ size?: number; /** minimum avg space between point centers before they're shown (default: size * 2) */ space?: number; /** line width of circle outline in CSS pixels */ width?: number; /** line color of circle outline (defaults to series.stroke) */ stroke?: Stroke; /** line dash segment array */ dash?: number[]; /** line cap */ cap?: Series.Cap; /** fill color of circle (defaults to #fff) */ fill?: Fill; } export type Gap = [from: number, to: number]; export type Gaps = Gap[]; export type AddGap = (gaps: Gaps, from: number, to: number) => void; export type ClipPathBuilder = (gaps: Gaps, ori: Orientation, left: number, top: number, width: number, height: number) => Path2D | null; export type PathBuilder = (self: uPlot, seriesIdx: number, idx0: number, idx1: number) => Paths | null; export type MinMaxIdxs = [minIdx: number, maxIdx: number]; export type Value = string | ((self: uPlot, rawValue: number, seriesIdx: number, idx: number) => string | number); export type Values = (self: uPlot, seriesIdx: number, idx: number) => object; export type FillTo = number | ((self: uPlot, seriesIdx: number, dataMin: number, dataMax: number) => number); export const enum Sorted { Unsorted = 0, Ascending = 1, Descending = -1, } } export interface Series { /** series on/off. when off, it will not affect its scale */ show?: boolean; /** className to add to legend parts and cursor hover points */ class?: string; /** scale key */ scale?: string; /** whether this series' data is scanned during auto-ranging of its scale */ auto?: boolean; // true /** if & how the data is pre-sorted (scale.auto optimization) */ sorted?: Series.Sorted; /** when true, null data values will not cause line breaks */ spanGaps?: boolean; /** whether path and point drawing should offset canvas to try drawing crisp lines */ pxAlign?: number | boolean; // 1 /** legend label */ label?: string; /** inline-legend value formatter. can be an fmtDate formatting string when scale.time: true */ value?: Series.Value; /** table-legend multi-values formatter */ values?: Series.Values; paths?: Series.PathBuilder; /** rendered datapoints */ points?: Series.Points; /** line width in CSS pixels */ width?: number; /** line & legend color */ stroke?: Series.Stroke; /** area fill & legend color */ fill?: Series.Fill; /** area fill baseline (default: 0) */ fillTo?: Series.FillTo; /** line dash segment array */ dash?: number[]; /** line cap */ cap?: Series.Cap; /** alpha-transparancy */ alpha?: number; /** current min and max data indices rendered */ idxs?: Series.MinMaxIdxs; /** current min rendered value */ min?: number; /** current max rendered value */ max?: number; } export namespace Band { export type Fill = CanvasRenderingContext2D['fillStyle'] | ((self: uPlot, bandIdx: number, highSeriesFill: CanvasRenderingContext2D['fillStyle']) => CanvasRenderingContext2D['fillStyle']); export type Bounds = [highSeriesIdx: number, lowSeriesIdx: number]; } export interface Band { /** band on/off */ // show?: boolean; /** series indices of upper and lower band edges */ series: Band.Bounds; /** area fill style */ fill?: Band.Fill; } export namespace Axis { /** must return an array of same length as splits, e.g. via splits.map() */ export type Filter = (self: uPlot, splits: number[], axisIdx: number, foundSpace: number, foundIncr: number) => (number | null)[]; export type Size = number | ((self: uPlot, values: string[], axisIdx: number, cycleNum: number) => number); export type Space = number | ((self: uPlot, axisIdx: number, scaleMin: number, scaleMax: number, plotDim: number) => number); export type Incrs = number[] | ((self: uPlot, axisIdx: number, scaleMin: number, scaleMax: number, fullDim: number, minSpace: number) => number[]); export type Splits = number[] | ((self: uPlot, axisIdx: number, scaleMin: number, scaleMax: number, foundIncr: number, foundSpace: number) => number[]); export type StaticValues = (string | number | null)[]; export type DynamicValues = (self: uPlot, splits: number[], axisIdx: number, foundSpace: number, foundIncr: number) => StaticValues; export type TimeValuesConfig = (string | number | null)[][]; export type TimeValuesTpl = string; export type Values = StaticValues | DynamicValues | TimeValuesTpl | TimeValuesConfig; export type Stroke = CanvasRenderingContext2D['strokeStyle'] | ((self: uPlot, axisIdx: number) => CanvasRenderingContext2D['strokeStyle']); export const enum Side { Top = 0, Right = 1, Bottom = 2, Left = 3, } export const enum Align { Left = 1, Right = 2, } export type Rotate = number | ((self: uPlot, values: (string | number)[], axisIdx: number, foundSpace: number) => number); export interface Grid { /** on/off */ show?: boolean; // true /** can filter which splits render lines. e.g splits.map(v => v % 2 == 0 ? v : null) */ filter?: Filter; /** line color */ stroke?: Stroke; /** line width in CSS pixels */ width?: number; /** line dash segment array */ dash?: number[]; /** line cap */ cap?: Series.Cap; } export interface Ticks extends Grid { /** length of tick in CSS pixels */ size?: number; } } export interface Axis { /** axis on/off */ show?: boolean; /** scale key */ scale?: string; /** side of chart - 0: top, 1: rgt, 2: btm, 3: lft */ side?: Axis.Side; /** height of x axis or width of y axis in CSS pixels alloted for values, gap & ticks, but excluding axis label */ size?: Axis.Size; /** gap between axis values and axis baseline (or ticks, if enabled) in CSS pixels */ gap?: number; /** font used for axis values */ font?: CanvasRenderingContext2D['font']; /** color of axis label & values */ stroke?: Axis.Stroke; /** axis label text */ label?: string; /** height of x axis label or width of y axis label in CSS pixels */ labelSize?: number; /** font used for axis label */ labelFont?: CanvasRenderingContext2D['font']; /** minimum grid & tick spacing in CSS pixels */ space?: Axis.Space; /** available divisors for axis ticks, values, grid */ incrs?: Axis.Incrs; /** determines how and where the axis must be split for placing ticks, values, grid */ splits?: Axis.Splits; /** can filter which splits are passed to axis.values() for rendering. e.g splits.map(v => v % 2 == 0 ? v : null) */ filter?: Axis.Filter; /** formats values for rendering */ values?: Axis.Values; /** values rotation in degrees off horizontal (only bottom axes w/ side: 2) */ rotate?: Axis.Rotate; /** text alignment of axis values - 1: left, 2: right */ align?: Axis.Align; /** gridlines to draw from this axis' splits */ grid?: Axis.Grid; /** ticks to draw from this axis' splits */ ticks?: Axis.Ticks; } export namespace Hooks { export interface Defs { /** fires after opts are defaulted & merged but data has not been set and scales have not been ranged */ init?: (self: uPlot, opts: Options, data: AlignedData) => void; /** fires after any scale has changed */ setScale?: (self: uPlot, scaleKey: string) => void; /** fires after the cursor is moved */ setCursor?: (self: uPlot) => void; /** fires when cursor changes idx and legend updates (or should update) */ setLegend?: (self: uPlot) => void; /** fires after a selection is completed */ setSelect?: (self: uPlot) => void; /** fires after a series is toggled or focused */ setSeries?: (self: uPlot, seriesIdx: number | null, opts: Series) => void; /** fires after data is updated updated */ setData?: (self: uPlot) => void; /** fires after the chart is resized */ setSize?: (self: uPlot) => void; /** fires at start of every redraw */ drawClear?: (self: uPlot) => void; /** fires after all axes are drawn */ drawAxes?: (self: uPlot) => void; /** fires after each series is drawn */ drawSeries?: (self: uPlot, seriesIdx: number) => void; /** fires after everything is drawn */ draw?: (self: uPlot) => void; /** fires after the chart is fully initialized and in the DOM */ ready?: (self: uPlot) => void; /** fires after the chart is destroyed */ destroy?: (self: uPlot) => void; } export type Arrays = { [P in keyof Defs]: Defs[P][] } export type ArraysOrFuncs = { [P in keyof Defs]: Defs[P][] | Defs[P] } } export interface Plugin { /** can mutate provided opts as necessary */ opts?: (self: uPlot, opts: Options) => void | Options; hooks: Hooks.ArraysOrFuncs; } } export as namespace uPlot;
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/static/lib/admin-lte/plugins/uplot/uPlot.d.ts
0.566139
0.538316
uPlot.d.ts
pypi
<p align="center"> <a href="https://getbootstrap.com/"> <img src="https://getbootstrap.com/docs/4.6/assets/brand/bootstrap-solid.svg" alt="Bootstrap logo" width="72" height="72"> </a> </p> <h3 align="center">Bootstrap</h3> <p align="center"> Sleek, intuitive, and powerful front-end framework for faster and easier web development. <br> <a href="https://getbootstrap.com/docs/4.6/"><strong>Explore Bootstrap docs »</strong></a> <br> <br> <a href="https://github.com/twbs/bootstrap/issues/new?template=bug_report.md">Report bug</a> · <a href="https://github.com/twbs/bootstrap/issues/new?template=feature_request.md">Request feature</a> · <a href="https://themes.getbootstrap.com/">Themes</a> · <a href="https://blog.getbootstrap.com/">Blog</a> </p> ## Table of contents - [Quick start](#quick-start) - [Status](#status) - [What's included](#whats-included) - [Bugs and feature requests](#bugs-and-feature-requests) - [Documentation](#documentation) - [Contributing](#contributing) - [Community](#community) - [Versioning](#versioning) - [Creators](#creators) - [Thanks](#thanks) - [Copyright and license](#copyright-and-license) ## Quick start Several quick start options are available: - [Download the latest release.](https://github.com/twbs/bootstrap/archive/v4.6.2.zip) - Clone the repo: `git clone https://github.com/twbs/bootstrap.git` - Install with [npm](https://www.npmjs.com/): `npm install bootstrap` - Install with [yarn](https://yarnpkg.com/): `yarn add [email protected]` - Install with [Composer](https://getcomposer.org/): `composer require twbs/bootstrap:4.6.2` - Install with [NuGet](https://www.nuget.org/): CSS: `Install-Package bootstrap` Sass: `Install-Package bootstrap.sass` Read the [Getting started page](https://getbootstrap.com/docs/4.6/getting-started/introduction/) for information on the framework contents, templates and examples, and more. ## Status [![Slack](https://bootstrap-slack.herokuapp.com/badge.svg)](https://bootstrap-slack.herokuapp.com/) [![Build Status](https://img.shields.io/github/workflow/status/twbs/bootstrap/JS%20Tests/v4-dev?label=JS%20Tests&logo=github)](https://github.com/twbs/bootstrap/actions?query=workflow%3AJS+Tests+branch%3Av4-dev) [![npm version](https://img.shields.io/npm/v/bootstrap)](https://www.npmjs.com/package/bootstrap) [![Gem version](https://img.shields.io/gem/v/bootstrap)](https://rubygems.org/gems/bootstrap) [![Meteor Atmosphere](https://img.shields.io/badge/meteor-twbs%3Abootstrap-blue)](https://atmospherejs.com/twbs/bootstrap) [![Packagist Prerelease](https://img.shields.io/packagist/vpre/twbs/bootstrap)](https://packagist.org/packages/twbs/bootstrap) [![NuGet](https://img.shields.io/nuget/vpre/bootstrap)](https://www.nuget.org/packages/bootstrap/absoluteLatest) [![Coverage Status](https://img.shields.io/coveralls/github/twbs/bootstrap/v4-dev)](https://coveralls.io/github/twbs/bootstrap?branch=v4-dev) [![CSS gzip size](https://img.badgesize.io/twbs/bootstrap/v4-dev/dist/css/bootstrap.min.css?compression=gzip&label=CSS%20gzip%20size)](https://github.com/twbs/bootstrap/blob/v4-dev/dist/css/bootstrap.min.css) [![JS gzip size](https://img.badgesize.io/twbs/bootstrap/v4-dev/dist/js/bootstrap.min.js?compression=gzip&label=JS%20gzip%20size)](https://github.com/twbs/bootstrap/blob/v4-dev/dist/js/bootstrap.min.js) [![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=SkxZcStBeExEdVJqQ2hWYnlWckpkNmNEY213SFp6WHFETWk2bGFuY3pCbz0tLXhqbHJsVlZhQnRBdEpod3NLSDMzaHc9PQ==--3d0b75245708616eb93113221beece33e680b229)](https://www.browserstack.com/automate/public-build/SkxZcStBeExEdVJqQ2hWYnlWckpkNmNEY213SFp6WHFETWk2bGFuY3pCbz0tLXhqbHJsVlZhQnRBdEpod3NLSDMzaHc9PQ==--3d0b75245708616eb93113221beece33e680b229) [![Backers on Open Collective](https://img.shields.io/opencollective/backers/bootstrap)](#backers) [![Sponsors on Open Collective](https://img.shields.io/opencollective/sponsors/bootstrap)](#sponsors) ## What's included Within the download you'll find the following directories and files, logically grouping common assets and providing both compiled and minified variations. <details><summary>Download contents</summary> ```text bootstrap/ └── dist/ ├── css/ │ ├── bootstrap-grid.css │ ├── bootstrap-grid.css.map │ ├── bootstrap-grid.min.css │ ├── bootstrap-grid.min.css.map │ ├── bootstrap-reboot.css │ ├── bootstrap-reboot.css.map │ ├── bootstrap-reboot.min.css │ ├── bootstrap-reboot.min.css.map │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ └── bootstrap.min.css.map └── js/ ├── bootstrap.bundle.js ├── bootstrap.bundle.js.map ├── bootstrap.bundle.min.js ├── bootstrap.bundle.min.js.map ├── bootstrap.js ├── bootstrap.js.map ├── bootstrap.min.js └── bootstrap.min.js.map ``` </details> We provide compiled CSS and JS (`bootstrap.*`), as well as compiled and minified CSS and JS (`bootstrap.min.*`). [Source maps](https://developers.google.com/web/tools/chrome-devtools/javascript/source-maps) (`bootstrap.*.map`) are available for use with certain browsers' developer tools. Bundled JS files (`bootstrap.bundle.js` and minified `bootstrap.bundle.min.js`) include [Popper](https://popper.js.org/), but not [jQuery](https://jquery.com/). ## Bugs and feature requests Have a bug or a feature request? Please first read the [issue guidelines](https://github.com/twbs/bootstrap/blob/v4-dev/.github/CONTRIBUTING.md#using-the-issue-tracker) and search for existing and closed issues. If your problem or idea is not addressed yet, [please open a new issue](https://github.com/twbs/bootstrap/issues/new). ## Documentation Bootstrap's documentation, included in this repo in the root directory, is built with [Hugo](https://gohugo.io/) and publicly hosted on GitHub Pages at <https://getbootstrap.com/>. The docs may also be run locally. Documentation search is powered by [Algolia's DocSearch](https://community.algolia.com/docsearch/). Working on our search? Be sure to set `debug: true` in `site/assets/js/search.js`. ### Running documentation locally 1. Run `npm install` to install the Node.js dependencies, including Hugo (the site builder). 2. Run `npm run test` (or a specific npm script) to rebuild distributed CSS and JavaScript files, as well as our docs assets. 3. Run `npm start` to compile CSS and JavaScript files, generate our docs, and watch for changes. 4. Open `http://localhost:9001/` in your browser, and voilà. Learn more about using Hugo by reading its [documentation](https://gohugo.io/documentation/). ### Documentation for previous releases You can find all our previous releases docs on <https://getbootstrap.com/docs/versions/>. [Previous releases](https://github.com/twbs/bootstrap/releases) and their documentation are also available for download. ## Contributing Please read through our [contributing guidelines](https://github.com/twbs/bootstrap/blob/v4-dev/.github/CONTRIBUTING.md). Included are directions for opening issues, coding standards, and notes on development. Moreover, if your pull request contains JavaScript patches or features, you must include [relevant unit tests](https://github.com/twbs/bootstrap/tree/v4-dev/js/tests). All HTML and CSS should conform to the [Code Guide](https://github.com/mdo/code-guide), maintained by [Mark Otto](https://github.com/mdo). Editor preferences are available in the [editor config](https://github.com/twbs/bootstrap/blob/v4-dev/.editorconfig) for easy use in common text editors. Read more and download plugins at <https://editorconfig.org/>. ## Community Get updates on Bootstrap's development and chat with the project maintainers and community members. - Follow [@getbootstrap on Twitter](https://twitter.com/getbootstrap). - Read and subscribe to [The Official Bootstrap Blog](https://blog.getbootstrap.com/). - Join [the official Slack room](https://bootstrap-slack.herokuapp.com/). - Chat with fellow Bootstrappers in IRC. On the `irc.libera.chat` server, in the `#bootstrap` channel. - Implementation help may be found at Stack Overflow (tagged [`bootstrap-4`](https://stackoverflow.com/questions/tagged/bootstrap-4)). - Developers should use the keyword `bootstrap` on packages which modify or add to the functionality of Bootstrap when distributing through [npm](https://www.npmjs.com/browse/keyword/bootstrap) or similar delivery mechanisms for maximum discoverability. ## Versioning For transparency into our release cycle and in striving to maintain backward compatibility, Bootstrap is maintained under [the Semantic Versioning guidelines](https://semver.org/). Sometimes we screw up, but we adhere to those rules whenever possible. See [the Releases section of our GitHub project](https://github.com/twbs/bootstrap/releases) for changelogs for each release version of Bootstrap. Release announcement posts on [the official Bootstrap blog](https://blog.getbootstrap.com/) contain summaries of the most noteworthy changes made in each release. ## Creators **Mark Otto** - <https://twitter.com/mdo> - <https://github.com/mdo> **Jacob Thornton** - <https://twitter.com/fat> - <https://github.com/fat> ## Thanks <a href="https://www.browserstack.com/"> <img src="https://live.browserstack.com/images/opensource/browserstack-logo.svg" alt="BrowserStack Logo" width="192" height="42"> </a> Thanks to [BrowserStack](https://www.browserstack.com/) for providing the infrastructure that allows us to test in real browsers! ## Sponsors Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/bootstrap#sponsor)] [![](https://opencollective.com/bootstrap/sponsor/0/avatar.svg)](https://opencollective.com/bootstrap/sponsor/0/website) [![](https://opencollective.com/bootstrap/sponsor/1/avatar.svg)](https://opencollective.com/bootstrap/sponsor/1/website) [![](https://opencollective.com/bootstrap/sponsor/2/avatar.svg)](https://opencollective.com/bootstrap/sponsor/2/website) [![](https://opencollective.com/bootstrap/sponsor/3/avatar.svg)](https://opencollective.com/bootstrap/sponsor/3/website) [![](https://opencollective.com/bootstrap/sponsor/4/avatar.svg)](https://opencollective.com/bootstrap/sponsor/4/website) [![](https://opencollective.com/bootstrap/sponsor/5/avatar.svg)](https://opencollective.com/bootstrap/sponsor/5/website) [![](https://opencollective.com/bootstrap/sponsor/6/avatar.svg)](https://opencollective.com/bootstrap/sponsor/6/website) [![](https://opencollective.com/bootstrap/sponsor/7/avatar.svg)](https://opencollective.com/bootstrap/sponsor/7/website) [![](https://opencollective.com/bootstrap/sponsor/8/avatar.svg)](https://opencollective.com/bootstrap/sponsor/8/website) [![](https://opencollective.com/bootstrap/sponsor/9/avatar.svg)](https://opencollective.com/bootstrap/sponsor/9/website) ## Backers Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/bootstrap#backer)] [![Backers](https://opencollective.com/bootstrap/backers.svg?width=890)](https://opencollective.com/bootstrap#backers) ## Copyright and license Code and documentation copyright 2011-2022 the [Bootstrap Authors](https://github.com/twbs/bootstrap/graphs/contributors) and [Twitter, Inc.](https://twitter.com) Code released under the [MIT License](https://github.com/twbs/bootstrap/blob/main/LICENSE). Docs released under [Creative Commons](https://creativecommons.org/licenses/by/3.0/).
/satnogs-db-1.51.tar.gz/satnogs-db-1.51/db/static/lib/admin-lte/node_modules/bootstrap/README.md
0.645902
0.855429
README.md
pypi
def pop_count(inp): """ Function to determine the population count in the bit-stream "borrowed" in gnuradio """ pop_cnt = inp - ((inp >> 1) & 0o33333333333) - ((inp >> 2) & 0o11111111111) return ((pop_cnt + (pop_cnt >> 3)) & 0o30707070707) % 63 def additive_scramble(in_bytes, poly, seed, length): """ Function for implementing an additive scrambler (aka synchronous or linear-feedback shift register scrambler) and descrambler. """ in_bits = byte2bit(in_bytes) bit_len = len(in_bits) out_bits = [0] * bit_len lfsr = LFSR(poly, seed, length) reg_bit = 0 for j in range(bit_len): reg_bit = lfsr.next_bit() out_bits[j] = in_bits[j] ^ reg_bit return bit2byte(out_bits) def byte2bit(in_bytes): """ Function for converting a byte stream into the corresponding bit stream. Original Author: Filippo Valmori """ in_len = len(in_bytes) out_len = (in_len << 3) out_bits = [0] * out_len for j in range(out_len): byte_idx = (j >> 3) bit_idx = 7 - (j % 8) if (in_bytes[byte_idx] >> bit_idx) % 2: out_bits[j] = 1 return out_bits def bit2byte(in_bits): """ Function for converting a bit stream into the corresponding byte stream. Original Author: Filippo Valmori """ in_len = len(in_bits) out_len = (in_len >> 3) out_bytes = [0] * out_len for j in range(in_len): if in_bits[j]: byte_idx = (j >> 3) bit_idx = 7 - (j % 8) out_bytes[byte_idx] += (1 << bit_idx) return out_bytes class LFSR: """ Linear feedback shift register """ def __init__(self, mask, seed, length): """ Initialisation of the LFSR Obvious, isn't it!? ;-) :param mask: the polynomial mask :param seed: the initial state :param lenght: the legth of the register (length = 7 == 8 bits!) """ self.mask = mask self.reg = seed self.length = length def next_bit(self): """ Returns the next bit of the LFSR shift """ output = self.reg & 1 newbit = pop_count(self.reg & self.mask) % 2 self.reg = ((self.reg >> 1) | (newbit << self.length)) return output def next_byte(self): """ Returns the next whole byte """ output = self.reg & 0xFF for _ in range(8): self.next_bit() return output class Scrambler(object): # pylint: disable=too-few-public-methods """ Scrambler preprocessor class """ def __init__(self, poly, seed, length): """ Inititalize the scrambler :param poly: the polynom :param seed: the initial state of the LFSR """ self.poly = poly self.seed = seed self.length = length def decode(self, inp): # pylint: disable=no-self-use """ Scrambler method :param inp: the data to be processed :returns: the scrambled/descrambled data """ out = bytearray( additive_scramble(bytearray(inp), self.poly, self.seed, self.length)) return out
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/process/scrambler.py
0.790288
0.578329
scrambler.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Painani(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field dest_ssid: ax25_frame.ax25_header.dest_ssid_raw.ssid :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_frame.ax25_header.src_ssid_raw.ssid :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field short_internal_temperature: ax25_frame.payload.info.pld_id.short_internal_temperature :field short_pa_temperature: ax25_frame.payload.info.pld_id.short_pa_temperature :field short_current_3v3: ax25_frame.payload.info.pld_id.short_current_3v3 :field short_voltage_3v3: ax25_frame.payload.info.pld_id.short_voltage_3v3 :field short_current_5v: ax25_frame.payload.info.pld_id.short_current_5v :field short_voltage_5v: ax25_frame.payload.info.pld_id.short_voltage_5v :field id: ax25_frame.payload.info.pld_id.id :field length: ax25_frame.payload.info.pld_id.length :field antenna: ax25_frame.payload.info.pld_id.antenna :field temp_panel_1: ax25_frame.payload.info.pld_id.temp_panel_1 :field temp_panel_2: ax25_frame.payload.info.pld_id.temp_panel_2 :field temp_panel_3: ax25_frame.payload.info.pld_id.temp_panel_3 :field temp_bank_1: ax25_frame.payload.info.pld_id.temp_bank_1 :field temp_bank_2: ax25_frame.payload.info.pld_id.temp_bank_2 :field charge_bank_1: ax25_frame.payload.info.pld_id.charge_bank_1 :field charge_bank_2: ax25_frame.payload.info.pld_id.charge_bank_2 :field gyro_x: ax25_frame.payload.info.pld_id.gyro_x :field gyro_y: ax25_frame.payload.info.pld_id.gyro_y :field gyro_z: ax25_frame.payload.info.pld_id.gyro_z :field state: ax25_frame.payload.info.pld_id.state :field reboots: ax25_frame.payload.info.pld_id.reboots :field rtc: ax25_frame.payload.info.pld_id.rtc :field voltage_bank_1: ax25_frame.payload.info.pld_id.voltage_bank_1 :field voltage_bank_2: ax25_frame.payload.info.pld_id.voltage_bank_2 :field current_bank_1: ax25_frame.payload.info.pld_id.current_bank_1 :field current_bank_2: ax25_frame.payload.info.pld_id.current_bank_2 :field gps: ax25_frame.payload.info.pld_id.gps :field voltage_3v3: ax25_frame.payload.info.pld_id.voltage_3v3 :field battery_voltage: ax25_frame.payload.info.pld_id.byttery_voltage :field lna_voltage: ax25_frame.payload.info.pld_id.lna_voltage :field voltage_5v: ax25_frame.payload.info.pld_id.voltage_5v :field gps_voltage: ax25_frame.payload.info.pld_id.gps_voltage :field camera_voltage: ax25_frame.payload.info.pld_id.camera_voltage .. seealso:: Source - https://dep.cicese.mx/csa/painani/telemetry.pdf """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Painani.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Painani.Ax25Header(self._io, self, self._root) _on = (self.ax25_header.ctl & 19) if _on == 3: self.payload = Painani.UiFrame(self._io, self, self._root) elif _on == 19: self.payload = Painani.UiFrame(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Painani.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Painani.SsidMask(self._io, self, self._root) self.src_callsign_raw = Painani.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Painani.SsidMask(self._io, self, self._root) if (self.src_ssid_raw.ssid_mask & 1) == 0: self.repeater = Painani.Repeater(self._io, self, self._root) self.ctl = self._io.read_u1() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() _on = self._parent.ax25_header.src_callsign_raw.callsign_ror.callsign if _on == u"SPACE ": self.info = Painani.PainaniPayloadIdentify(self._io, self, self._root) class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") class PainaniBeaconShort(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.reserved = self._io.read_u4be() self.short_internal_temperature = self._io.read_s1() self.short_pa_temperature = self._io.read_s1() self.short_current_3v3 = self._io.read_s2be() self.short_voltage_3v3 = self._io.read_u2be() self.short_current_5v = self._io.read_s2be() self.short_voltage_5v = self._io.read_u2be() @property def cu33(self): if hasattr(self, '_m_cu33'): return self._m_cu33 if hasattr(self, '_m_cu33') else None self._m_cu33 = ((self.short_current_3v3 * 3) * 0.000001) return self._m_cu33 if hasattr(self, '_m_cu33') else None @property def v33(self): if hasattr(self, '_m_v33'): return self._m_v33 if hasattr(self, '_m_v33') else None self._m_v33 = ((self.short_voltage_3v3 * 4) * 0.001) return self._m_v33 if hasattr(self, '_m_v33') else None @property def cu5(self): if hasattr(self, '_m_cu5'): return self._m_cu5 if hasattr(self, '_m_cu5') else None self._m_cu5 = ((self.short_current_5v * 62) * 0.000001) return self._m_cu5 if hasattr(self, '_m_cu5') else None @property def v5(self): if hasattr(self, '_m_v5'): return self._m_v5 if hasattr(self, '_m_v5') else None self._m_v5 = ((self.short_voltage_5v * 4) * 0.001) return self._m_v5 if hasattr(self, '_m_v5') else None class PainaniBeaconLong(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.id_magic = self._io.read_bytes(2) if not self.id_magic == b"\x3C\xC3": raise kaitaistruct.ValidationNotEqualError(b"\x3C\xC3", self.id_magic, self._io, u"/types/painani_beacon_long/seq/0") self.length = self._io.read_u1() self.antenna = self._io.read_u1() self.temp_panel_1 = self._io.read_s2be() self.temp_panel_2 = self._io.read_s2be() self.temp_panel_3 = self._io.read_s2be() self.temp_bank_1 = self._io.read_s2be() self.temp_bank_2 = self._io.read_s2be() self.charge_bank_1 = self._io.read_s2be() self.charge_bank_2 = self._io.read_s2be() self.gyro_x = self._io.read_s2be() self.gyro_y = self._io.read_s2be() self.gyro_z = self._io.read_s2be() self.state = self._io.read_u1() self.reboots = self._io.read_u2be() self.rtc_raw = [None] * (6) for i in range(6): self.rtc_raw[i] = self._io.read_u1() self.voltage_bank_1 = self._io.read_u2be() self.voltage_bank_2 = self._io.read_u2be() self.current_bank_1 = self._io.read_s2be() self.current_bank_2 = self._io.read_s2be() self.gps = self._io.read_u1() self.voltage_3v3 = self._io.read_u2be() self.battery_voltage = self._io.read_u2be() self.lna_voltage = self._io.read_u2be() self.voltage_5v = self._io.read_u2be() self.gps_voltage = self._io.read_u2be() self.camera_voltage = self._io.read_u2be() self.unparsed = self._io.read_bytes_full() @property def rtc(self): if hasattr(self, '_m_rtc'): return self._m_rtc if hasattr(self, '_m_rtc') else None self._m_rtc = ((((((self.rtc_raw[0] << 40) | (self.rtc_raw[1] << 32)) | (self.rtc_raw[2] << 24)) | (self.rtc_raw[3] << 16)) | (self.rtc_raw[4] << 8)) | self.rtc_raw[5]) return self._m_rtc if hasattr(self, '_m_rtc') else None class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class PainaniPayloadIdentify(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): _on = self._root.framelength if _on == 30: self.pld_id = Painani.PainaniBeaconShort(self._io, self, self._root) elif _on == 72: self.pld_id = Painani.PainaniBeaconLong(self._io, self, self._root) class Repeaters(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_callsign_raw = Painani.CallsignRaw(self._io, self, self._root) self.rpt_ssid_raw = Painani.SsidMask(self._io, self, self._root) class Repeater(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_instance = [] i = 0 while True: _ = Painani.Repeaters(self._io, self, self._root) self.rpt_instance.append(_) if (_.rpt_ssid_raw.ssid_mask & 1) == 1: break i += 1 class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Painani.Callsign(_io__raw_callsign_ror, self, self._root) @property def framelength(self): if hasattr(self, '_m_framelength'): return self._m_framelength if hasattr(self, '_m_framelength') else None self._m_framelength = self._io.size() return self._m_framelength if hasattr(self, '_m_framelength') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/painani.py
0.421314
0.162912
painani.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Aausat4(KaitaiStruct): """:field data_plus_hmac_length: packet.data_length.data_plus_hmac_length :field frame_length: frame_length :field csp_hdr_crc: packet.csp_header.crc :field csp_hdr_rdp: packet.csp_header.rdp :field csp_hdr_xtea: packet.csp_header.xtea :field csp_hdr_hmac: packet.csp_header.hmac :field csp_hdr_src_port: packet.csp_header.src_port :field csp_hdr_dst_port: packet.csp_header.dst_port :field csp_hdr_destination: packet.csp_header.destination :field csp_hdr_source: packet.csp_header.source :field csp_hdr_priority: packet.csp_header.priority :field subsystems_valid: packet.data.beacon.valid :field eps_boot_count: packet.data.beacon.eps.boot_count :field eps_boot_cause: packet.data.beacon.eps.boot_cause :field eps_uptime: packet.data.beacon.eps.uptime :field eps_rt_clock: packet.data.beacon.eps.rt_clock :field eps_ping_status: packet.data.beacon.eps.ping_status :field eps_subsystem_selfstatus: packet.data.beacon.eps.subsystem_selfstatus :field eps_battery_voltage: packet.data.beacon.eps.battery_voltage :field eps_cell_diff: packet.data.beacon.eps.cell_diff :field eps_battery_current: packet.data.beacon.eps.battery_current :field eps_solar_power: packet.data.beacon.eps.solar_power :field eps_temp: packet.data.beacon.eps.temp :field eps_pa_temp: packet.data.beacon.eps.pa_temp :field eps_main_voltage: packet.data.beacon.eps.main_voltage :field com_boot_count: packet.data.beacon.com.boot_count :field com_boot_cause: packet.data.beacon.com.boot_cause .. seealso:: Source - https://github.com/aausat/aausat4_beacon_parser/blob/master/beacon.py """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.packet = Aausat4.Aausat4DataT(self._io, self, self._root) class ComT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.boot_count_raw = self._io.read_u2be() @property def boot_count(self): if hasattr(self, '_m_boot_count'): return self._m_boot_count if hasattr(self, '_m_boot_count') else None self._m_boot_count = (self.boot_count_raw & 8191) return self._m_boot_count if hasattr(self, '_m_boot_count') else None @property def boot_cause(self): if hasattr(self, '_m_boot_cause'): return self._m_boot_cause if hasattr(self, '_m_boot_cause') else None self._m_boot_cause = ((self.boot_count_raw & 57344) >> 13) return self._m_boot_cause if hasattr(self, '_m_boot_cause') else None class Aausat4HmacT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.hmac = self._io.read_u2be() class EpsT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.boot_count_raw = self._io.read_u2be() self.uptime = self._io.read_u4be() self.rt_clock = self._io.read_u4be() self.ping_status = self._io.read_u1() self.subsystem_selfstatus = self._io.read_u2be() self.battery_voltage = self._io.read_u1() self.cell_diff = self._io.read_s1() self.battery_current = self._io.read_s1() self.solar_power = self._io.read_u1() self.temp = self._io.read_s1() self.pa_temp = self._io.read_s1() self.main_voltage = self._io.read_s1() @property def boot_count(self): if hasattr(self, '_m_boot_count'): return self._m_boot_count if hasattr(self, '_m_boot_count') else None self._m_boot_count = (self.boot_count_raw & 8191) return self._m_boot_count if hasattr(self, '_m_boot_count') else None @property def boot_cause(self): if hasattr(self, '_m_boot_cause'): return self._m_boot_cause if hasattr(self, '_m_boot_cause') else None self._m_boot_cause = ((self.boot_count_raw & 57344) >> 13) return self._m_boot_cause if hasattr(self, '_m_boot_cause') else None class Aausat4DataT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): if self._root.frame_length == 92: self.data_length = Aausat4.Aausat4LenT(self._io, self, self._root) self.csp_header = Aausat4.CspHeaderT(self._io, self, self._root) self.data = Aausat4.CspDataT(self._io, self, self._root) if ((self._root.frame_length == 90) or (self._root.frame_length == 92)) : self.hmac = Aausat4.Aausat4HmacT(self._io, self, self._root) class Adcs1T(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.unparsed = self._io.read_bytes(7) class Aausat4LenT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.data_plus_hmac_length = self._io.read_u2be() class CspDataT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): if ((self._parent.csp_header.dst_port == 10) and (self._parent.csp_header.destination == 9)) : self.beacon = Aausat4.Aausat4BeaconT(self._io, self, self._root) class Ais2T(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.unparsed = self._io.read_bytes(20) class Aausat4BeaconT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.valid = self._io.read_u1() self._raw_eps = self._io.read_bytes(20) _io__raw_eps = KaitaiStream(BytesIO(self._raw_eps)) self.eps = Aausat4.EpsT(_io__raw_eps, self, self._root) self._raw_com = self._io.read_bytes(10) _io__raw_com = KaitaiStream(BytesIO(self._raw_com)) self.com = Aausat4.ComT(_io__raw_com, self, self._root) self.adcs1 = Aausat4.Adcs1T(self._io, self, self._root) self.adcs2 = Aausat4.Adcs2T(self._io, self, self._root) self.ais1 = Aausat4.Ais1T(self._io, self, self._root) self.ais2 = Aausat4.Ais2T(self._io, self, self._root) class CspHeaderT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.csp_flags = [None] * (4) for i in range(4): self.csp_flags[i] = self._io.read_u1() @property def source(self): if hasattr(self, '_m_source'): return self._m_source if hasattr(self, '_m_source') else None self._m_source = ((self.csp_flags[3] >> 1) & 31) return self._m_source if hasattr(self, '_m_source') else None @property def rdp(self): if hasattr(self, '_m_rdp'): return self._m_rdp if hasattr(self, '_m_rdp') else None self._m_rdp = ((self.csp_flags[0] >> 1) & 1) return self._m_rdp if hasattr(self, '_m_rdp') else None @property def src_port(self): if hasattr(self, '_m_src_port'): return self._m_src_port if hasattr(self, '_m_src_port') else None self._m_src_port = (self.csp_flags[1] & 63) return self._m_src_port if hasattr(self, '_m_src_port') else None @property def destination(self): if hasattr(self, '_m_destination'): return self._m_destination if hasattr(self, '_m_destination') else None self._m_destination = (((self.csp_flags[2] | (self.csp_flags[3] << 8)) >> 4) & 31) return self._m_destination if hasattr(self, '_m_destination') else None @property def dst_port(self): if hasattr(self, '_m_dst_port'): return self._m_dst_port if hasattr(self, '_m_dst_port') else None self._m_dst_port = (((self.csp_flags[1] | (self.csp_flags[2] << 8)) >> 6) & 63) return self._m_dst_port if hasattr(self, '_m_dst_port') else None @property def priority(self): if hasattr(self, '_m_priority'): return self._m_priority if hasattr(self, '_m_priority') else None self._m_priority = (self.csp_flags[3] >> 6) return self._m_priority if hasattr(self, '_m_priority') else None @property def reserved(self): if hasattr(self, '_m_reserved'): return self._m_reserved if hasattr(self, '_m_reserved') else None self._m_reserved = (self.csp_flags[0] >> 4) return self._m_reserved if hasattr(self, '_m_reserved') else None @property def xtea(self): if hasattr(self, '_m_xtea'): return self._m_xtea if hasattr(self, '_m_xtea') else None self._m_xtea = ((self.csp_flags[0] >> 2) & 1) return self._m_xtea if hasattr(self, '_m_xtea') else None @property def hmac(self): if hasattr(self, '_m_hmac'): return self._m_hmac if hasattr(self, '_m_hmac') else None self._m_hmac = ((self.csp_flags[0] >> 3) & 1) return self._m_hmac if hasattr(self, '_m_hmac') else None @property def crc(self): if hasattr(self, '_m_crc'): return self._m_crc if hasattr(self, '_m_crc') else None self._m_crc = (self.csp_flags[0] & 1) return self._m_crc if hasattr(self, '_m_crc') else None class Adcs2T(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.unparsed = self._io.read_bytes(6) class Ais1T(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.unparsed = self._io.read_bytes(20) @property def frame_length(self): if hasattr(self, '_m_frame_length'): return self._m_frame_length if hasattr(self, '_m_frame_length') else None self._m_frame_length = self._io.size() return self._m_frame_length if hasattr(self, '_m_frame_length') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/aausat4.py
0.588061
0.170232
aausat4.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO from enum import Enum if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Snet(KaitaiStruct): """:field fsync: pdu_header.fsync :field crc: pdu_header.crc :field fcid_major: pdu_header.fcid_major :field fcid_sub: pdu_header.fcid_sub :field urgent: pdu_header.control_1.urgent :field extended: pdu_header.control_1.extended :field crc_check: pdu_header.control_1.crc_check :field multi_frame: pdu_header.control_1.multi_frame :field time_tag_setting: pdu_header.control_1.time_tag_setting :field time_tagged: pdu_header.control_1.time_tagged :field data_length: pdu_header.data_length :field time_tag: pdu_header.time_tag :field versno: pdu_header_extension.extension.versno :field dfcid: pdu_header_extension.extension.dfcid :field rfu: pdu_header_extension.extension.rfu :field channel_info: pdu_header_extension.channel_info :field qos: pdu_header_extension.control_2.qos :field pdu_type_id: pdu_header_extension.control_2.pdu_type_id :field arq: pdu_header_extension.control_2.arq :field control_2_rfu: pdu_header_extension.control_2.rfu :field time_tag_sub: pdu_header_extension.time_tag_sub :field scid: pdu_header_extension.scid :field seqno: pdu_header_extension.seqno :field adcs_pget_imodechklistthisstepactive: payload.adcs_pget_imodechklistthisstepactive :field adcs_pget_iattdetfinalstate: payload.adcs_pget_iattdetfinalstate :field adcs_pget_isensorarrayavailstatusga: payload.adcs_pget_isensorarrayavailstatusga :field adcs_pget_isensorarrayavailstatusmfsa: payload.adcs_pget_isensorarrayavailstatusmfsa :field adcs_pget_isensorarrayavailstatussusea: payload.adcs_pget_isensorarrayavailstatussusea :field adcs_pget_iactarrayavailstatusrwa: payload.adcs_pget_iactarrayavailstatusrwa :field adcs_pget_iactarrayavailstatusmata: payload.adcs_pget_iactarrayavailstatusmata :field adcs_pget_attdetmfsdistcorrmode: payload.adcs_pget_attdetmfsdistcorrmode :field adcs_pget_attdetsusedistcorrmode: payload.adcs_pget_attdetsusedistcorrmode :field adcs_pget_attdettrackigrfdeltab: payload.adcs_pget_attdettrackigrfdeltab :field adcs_pget_attdetsusealbedotracking: payload.adcs_pget_attdetsusealbedotracking :field adcs_pget_suse1albedoflag: payload.adcs_pget_suse1albedoflag :field adcs_pget_suse2albedoflag: payload.adcs_pget_suse2albedoflag :field adcs_pget_suse3albedoflag: payload.adcs_pget_suse3albedoflag :field adcs_pget_suse4albedoflag: payload.adcs_pget_suse4albedoflag :field adcs_pget_suse5albedoflag: payload.adcs_pget_suse5albedoflag :field adcs_pget_suse6albedoflag: payload.adcs_pget_suse6albedoflag :field adcs_pget_attdetautovirtualizemfsa: payload.adcs_pget_attdetautovirtualizemfsa :field adcs_pget_attdetautovirtualizesusea: payload.adcs_pget_attdetautovirtualizesusea :field adcs_pget_attdetnarrowvectors: payload.adcs_pget_attdetnarrowvectors :field adcs_pget_attdetmismatchingvectors: payload.adcs_pget_attdetmismatchingvectors :field raw: payload.adcs_pget_omegaxoptimal_sat.raw :field value: payload.adcs_pget_omegaxoptimal_sat.value :field adcs_pget_omegayoptimal_sat_raw: payload.adcs_pget_omegayoptimal_sat.raw :field adcs_pget_omegayoptimal_sat_value: payload.adcs_pget_omegayoptimal_sat.value :field adcs_pget_omegazoptimal_sat_raw: payload.adcs_pget_omegazoptimal_sat.raw :field adcs_pget_omegazoptimal_sat_value: payload.adcs_pget_omegazoptimal_sat.value :field adcs_pget_magxoptimal_sat_raw: payload.adcs_pget_magxoptimal_sat.raw :field adcs_pget_magxoptimal_sat_value: payload.adcs_pget_magxoptimal_sat.value :field adcs_pget_magyoptimal_sat_raw: payload.adcs_pget_magyoptimal_sat.raw :field adcs_pget_magyoptimal_sat_value: payload.adcs_pget_magyoptimal_sat.value :field adcs_pget_magzoptimal_sat_raw: payload.adcs_pget_magzoptimal_sat.raw :field adcs_pget_magzoptimal_sat_value: payload.adcs_pget_magzoptimal_sat.value :field adcs_pget_sunxoptimal_sat_raw: payload.adcs_pget_sunxoptimal_sat.raw :field adcs_pget_sunxoptimal_sat_value: payload.adcs_pget_sunxoptimal_sat.value :field adcs_pget_sunyoptimal_sat_raw: payload.adcs_pget_sunyoptimal_sat.raw :field adcs_pget_sunyoptimal_sat_value: payload.adcs_pget_sunyoptimal_sat.value :field adcs_pget_sunzoptimal_sat_raw: payload.adcs_pget_sunzoptimal_sat.raw :field adcs_pget_sunzoptimal_sat_value: payload.adcs_pget_sunzoptimal_sat.value :field adcs_pget_dctrltorquerwax_sat_lr_raw: payload.adcs_pget_dctrltorquerwax_sat_lr.raw :field adcs_pget_dctrltorquerwax_sat_lr_value: payload.adcs_pget_dctrltorquerwax_sat_lr.value :field adcs_pget_dctrltorquerway_sat_lr_raw: payload.adcs_pget_dctrltorquerway_sat_lr.raw :field adcs_pget_dctrltorquerway_sat_lr_value: payload.adcs_pget_dctrltorquerway_sat_lr.value :field adcs_pget_dctrltorquerwaz_sat_lr_raw: payload.adcs_pget_dctrltorquerwaz_sat_lr.raw :field adcs_pget_dctrltorquerwaz_sat_lr_value: payload.adcs_pget_dctrltorquerwaz_sat_lr.value :field adcs_pget_dctrlmagmomentmatax_sat_lr_raw: payload.adcs_pget_dctrlmagmomentmatax_sat_lr.raw :field adcs_pget_dctrlmagmomentmatax_sat_lr_value: payload.adcs_pget_dctrlmagmomentmatax_sat_lr.value :field adcs_pget_dctrlmagmomentmatay_sat_lr_raw: payload.adcs_pget_dctrlmagmomentmatay_sat_lr.raw :field adcs_pget_dctrlmagmomentmatay_sat_lr_value: payload.adcs_pget_dctrlmagmomentmatay_sat_lr.value :field adcs_pget_dctrlmagmomentmataz_sat_lr_raw: payload.adcs_pget_dctrlmagmomentmataz_sat_lr.raw :field adcs_pget_dctrlmagmomentmataz_sat_lr_value: payload.adcs_pget_dctrlmagmomentmataz_sat_lr.value :field adcs_pget_ireadtorquerwx_mfr_raw: payload.adcs_pget_ireadtorquerwx_mfr.raw :field adcs_pget_ireadtorquerwx_mfr_value: payload.adcs_pget_ireadtorquerwx_mfr.value :field adcs_pget_ireadtorquerwy_mfr_raw: payload.adcs_pget_ireadtorquerwy_mfr.raw :field adcs_pget_ireadtorquerwy_mfr_value: payload.adcs_pget_ireadtorquerwy_mfr.value :field adcs_pget_ireadtorquerwz_mfr_raw: payload.adcs_pget_ireadtorquerwz_mfr.raw :field adcs_pget_ireadtorquerwz_mfr_value: payload.adcs_pget_ireadtorquerwz_mfr.value :field adcs_pget_ireadrotspeedrwx_mfr: payload.adcs_pget_ireadrotspeedrwx_mfr :field adcs_pget_ireadrotspeedrwy_mfr: payload.adcs_pget_ireadrotspeedrwy_mfr :field adcs_pget_ireadrotspeedrwz_mfr: payload.adcs_pget_ireadrotspeedrwz_mfr :field adcs_pget_sgp4latxpef_raw: payload.adcs_pget_sgp4latxpef.raw :field adcs_pget_sgp4latxpef_value: payload.adcs_pget_sgp4latxpef.value :field adcs_pget_sgp4longypef_raw: payload.adcs_pget_sgp4longypef.raw :field adcs_pget_sgp4longypef_value: payload.adcs_pget_sgp4longypef.value :field adcs_pget_sgp4altpef_raw: payload.adcs_pget_sgp4altpef.raw :field adcs_pget_sgp4altpef_value: payload.adcs_pget_sgp4altpef.value :field adcs_pget_attitudeerrorangle_raw: payload.adcs_pget_attitudeerrorangle.raw :field adcs_pget_attitudeerrorangle_value: payload.adcs_pget_attitudeerrorangle.value :field adcs_pget_targetdata_distance: payload.adcs_pget_targetdata_distance :field adcs_pget_targetdata_controlisactive: payload.adcs_pget_targetdata_controlisactive :field eps_pget_s00_cur_solx_pos_raw: payload.eps_pget_s00_cur_solx_pos.raw :field eps_pget_s00_cur_solx_pos_value: payload.eps_pget_s00_cur_solx_pos.value :field eps_pget_s01_cur_solx_neg_raw: payload.eps_pget_s01_cur_solx_neg.raw :field eps_pget_s01_cur_solx_neg_value: payload.eps_pget_s01_cur_solx_neg.value :field eps_pget_s02_cur_soly_pos_raw: payload.eps_pget_s02_cur_soly_pos.raw :field eps_pget_s02_cur_soly_pos_value: payload.eps_pget_s02_cur_soly_pos.value :field eps_pget_s03_cur_soly_neg_raw: payload.eps_pget_s03_cur_soly_neg.raw :field eps_pget_s03_cur_soly_neg_value: payload.eps_pget_s03_cur_soly_neg.value :field eps_pget_s04_cur_solz_pos_raw: payload.eps_pget_s04_cur_solz_pos.raw :field eps_pget_s04_cur_solz_pos_value: payload.eps_pget_s04_cur_solz_pos.value :field eps_pget_s05_cur_solz_neg_raw: payload.eps_pget_s05_cur_solz_neg.raw :field eps_pget_s05_cur_solz_neg_value: payload.eps_pget_s05_cur_solz_neg.value :field eps_pget_s06_v_sol: payload.eps_pget_s06_v_sol :field eps_pget_s24_v_bat0_raw: payload.eps_pget_s24_v_bat0.raw :field eps_pget_s24_v_bat0_value: payload.eps_pget_s24_v_bat0.value :field eps_pget_s26_a_in_charger0_raw: payload.eps_pget_s26_a_in_charger0.raw :field eps_pget_s26_a_in_charger0_value: payload.eps_pget_s26_a_in_charger0.value :field eps_pget_s25_a_out_charger0_raw: payload.eps_pget_s25_a_out_charger0.raw :field eps_pget_s25_a_out_charger0_value: payload.eps_pget_s25_a_out_charger0.value :field eps_pget_s13_v_bat1_raw: payload.eps_pget_s13_v_bat1.raw :field eps_pget_s13_v_bat1_value: payload.eps_pget_s13_v_bat1.value :field eps_pget_s23_a_in_charger1_raw: payload.eps_pget_s23_a_in_charger1.raw :field eps_pget_s23_a_in_charger1_value: payload.eps_pget_s23_a_in_charger1.value :field eps_pget_s14_a_out_charger1_raw: payload.eps_pget_s14_a_out_charger1.raw :field eps_pget_s14_a_out_charger1_value: payload.eps_pget_s14_a_out_charger1.value :field eps_pget_s22_v_sum_raw: payload.eps_pget_s22_v_sum.raw :field eps_pget_s22_v_sum_value: payload.eps_pget_s22_v_sum.value :field eps_pget_s44_v_3v3_raw: payload.eps_pget_s44_v_3v3.raw :field eps_pget_s44_v_3v3_value: payload.eps_pget_s44_v_3v3.value :field eps_pget_s45_v_5v_raw: payload.eps_pget_s45_v_5v.raw :field eps_pget_s45_v_5v_value: payload.eps_pget_s45_v_5v.value :field thm_pget_s31_th_bat0_raw: payload.thm_pget_s31_th_bat0.raw :field thm_pget_s31_th_bat0_value: payload.thm_pget_s31_th_bat0.value :field thm_pget_s15_th_bat1_raw: payload.thm_pget_s15_th_bat1.raw :field thm_pget_s15_th_bat1_value: payload.thm_pget_s15_th_bat1.value :field thm_pget_th_obc: payload.thm_pget_th_obc :field eps_pget_a_obc: payload.eps_pget_a_obc :field eps_pget_v_obc: payload.eps_pget_v_obc :field eps_pget_s30_a_in_bat0_raw: payload.eps_pget_s30_a_in_bat0.raw :field eps_pget_s30_a_in_bat0_value: payload.eps_pget_s30_a_in_bat0.value :field eps_pget_s29_a_out_bat0_raw: payload.eps_pget_s29_a_out_bat0.raw :field eps_pget_s29_a_out_bat0_value: payload.eps_pget_s29_a_out_bat0.value :field eps_pget_s12_a_in_bat1_raw: payload.eps_pget_s12_a_in_bat1.raw :field eps_pget_s12_a_in_bat1_value: payload.eps_pget_s12_a_in_bat1.value :field eps_pget_s20_a_out_bat1_raw: payload.eps_pget_s20_a_out_bat1.raw :field eps_pget_s20_a_out_bat1_value: payload.eps_pget_s20_a_out_bat1.value :field com0_pget_systime: payload.contents.com0_pget_systime :field com0_pget_memdatatype: payload.contents.com0_pget_memdatatype :field com0_pget_memdata32: payload.contents.com0_pget_memdata32 :field com1_pget_systime: payload.contents.com1_pget_systime :field com1_pget_memdatatype: payload.contents.com1_pget_memdatatype :field com1_pget_memdata32: payload.contents.com1_pget_memdata32 """ class Versno(Enum): salsat = 0 class Scid(Enum): snet_a = 0 snet_b = 1 snet_c = 2 snet_d = 3 salsat = 4 def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pdu_header = Snet.PduHeader(self._io, self, self._root) if self.pdu_header.control_1.extended: self.pdu_header_extension = Snet.PduHeaderExtension(self._io, self, self._root) _on = self.pdu_header.fcid_major if _on == 0: self.payload = Snet.AdcsStandardTelemetry(self._io, self, self._root) elif _on == 9: self.payload = Snet.EpsStandardTelemetry(self._io, self, self._root) elif _on == 54: self.payload = Snet.Fcid54(self._io, self, self._root) class EpsStandardTelemetry(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.eps_pget_s00_cur_solx_pos = Snet.Solarcurrent(self._io, self, self._root) self.eps_pget_s01_cur_solx_neg = Snet.Solarcurrent(self._io, self, self._root) self.eps_pget_s02_cur_soly_pos = Snet.Solarcurrent(self._io, self, self._root) self.eps_pget_s03_cur_soly_neg = Snet.Solarcurrent(self._io, self, self._root) self.eps_pget_s04_cur_solz_pos = Snet.Solarcurrent(self._io, self, self._root) self.eps_pget_s05_cur_solz_neg = Snet.Solarcurrent(self._io, self, self._root) self.eps_pget_s06_v_sol = self._io.read_s2le() self.eps_pget_s24_v_bat0 = Snet.Batvoltage(self._io, self, self._root) self.eps_pget_s26_a_in_charger0 = Snet.Chargecurr(self._io, self, self._root) self.eps_pget_s25_a_out_charger0 = Snet.Outcurr(self._io, self, self._root) self.eps_pget_s13_v_bat1 = Snet.Batvoltage(self._io, self, self._root) self.eps_pget_s23_a_in_charger1 = Snet.Chargecurr(self._io, self, self._root) self.eps_pget_s14_a_out_charger1 = Snet.Outcurr(self._io, self, self._root) self.eps_pget_s22_v_sum = Snet.Batvoltage(self._io, self, self._root) self.eps_pget_s44_v_3v3 = Snet.V3voltage(self._io, self, self._root) self.eps_pget_s45_v_5v = Snet.V5voltage(self._io, self, self._root) self.thm_pget_s31_th_bat0 = Snet.Battemp(self._io, self, self._root) self.thm_pget_s15_th_bat1 = Snet.Battemp(self._io, self, self._root) self.thm_pget_th_obc = self._io.read_s2le() self.eps_pget_a_obc = self._io.read_u2le() self.eps_pget_v_obc = self._io.read_u2le() self.eps_pget_s30_a_in_bat0 = Snet.Chargecurr(self._io, self, self._root) self.eps_pget_s29_a_out_bat0 = Snet.Chargecurr(self._io, self, self._root) self.eps_pget_s12_a_in_bat1 = Snet.Chargecurr(self._io, self, self._root) self.eps_pget_s20_a_out_bat1 = Snet.Chargecurr(self._io, self, self._root) class Torquemag(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s1() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 127) return self._m_value if hasattr(self, '_m_value') else None class Mailbox0(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.com0_pget_systime = self._io.read_u4le() self.com0_pget_memdatatype = self._io.read_u1() self.com0_pget_memdata32 = self._io.read_bytes(32) class Battemp(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 256) return self._m_value if hasattr(self, '_m_value') else None class Torquerw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s1() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = ((1000000 * self.raw) / 38484) return self._m_value if hasattr(self, '_m_value') else None class Fcid54(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): _on = self._parent.pdu_header.fcid_major if _on == 17: self.contents = Snet.Mailbox0(self._io, self, self._root) elif _on == 117: self.contents = Snet.Mailbox1(self._io, self, self._root) class Control1(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.urgent = self._io.read_bits_int_be(1) != 0 self.extended = self._io.read_bits_int_be(1) != 0 self.crc_check = self._io.read_bits_int_be(1) != 0 self.multi_frame = self._io.read_bits_int_be(1) != 0 self.time_tag_setting = self._io.read_bits_int_be(1) != 0 self.time_tagged = self._io.read_bits_int_be(1) != 0 class PduHeaderExtension(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.extension = Snet.Extension(self._io, self, self._root) self.channel_info = self._io.read_bits_int_be(8) self._io.align_to_byte() self.control_2 = Snet.Control2(self._io, self, self._root) self.time_tag_sub = self._io.read_bits_int_be(16) self.scid = KaitaiStream.resolve_enum(Snet.Scid, self._io.read_bits_int_be(10)) self.seqno = self._io.read_bits_int_be(14) class Sunvect(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 32000) return self._m_value if hasattr(self, '_m_value') else None class V3voltage(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 8) return self._m_value if hasattr(self, '_m_value') else None class Chargecurr(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 12) return self._m_value if hasattr(self, '_m_value') else None class Angularrate(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 260) return self._m_value if hasattr(self, '_m_value') else None class Batvoltage(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 2) return self._m_value if hasattr(self, '_m_value') else None class Control2(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.qos = self._io.read_bits_int_be(1) != 0 self.pdu_type_id = self._io.read_bits_int_be(1) != 0 self.arq = self._io.read_bits_int_be(1) != 0 self.rfu = self._io.read_bits_int_be(5) class Attitude(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_u2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 177) return self._m_value if hasattr(self, '_m_value') else None class PduHeader(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.fsync = self._io.read_bits_int_be(18) if not self.fsync == 249152: raise kaitaistruct.ValidationNotEqualError(249152, self.fsync, self._io, u"/types/pdu_header/seq/0") self.crc = self._io.read_bits_int_be(14) self.fcid_major = self._io.read_bits_int_be(6) self.fcid_sub = self._io.read_bits_int_be(10) self._io.align_to_byte() self.control_1 = Snet.Control1(self._io, self, self._root) self.data_length = self._io.read_bits_int_be(10) self._io.align_to_byte() if self.control_1.time_tagged == True: self.time_tag = self._io.read_u4le() class Solarcurrent(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 50) return self._m_value if hasattr(self, '_m_value') else None class Alt(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_u1() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 0.25) return self._m_value if hasattr(self, '_m_value') else None class V5voltage(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 5) return self._m_value if hasattr(self, '_m_value') else None class Outcurr(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 6) return self._m_value if hasattr(self, '_m_value') else None class Measuredtorque(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = ((1000000 * self.raw) / 9696969) return self._m_value if hasattr(self, '_m_value') else None class Lon(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 177) return self._m_value if hasattr(self, '_m_value') else None class Mailbox1(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.com1_pget_systime = self._io.read_u4le() self.com1_pget_memdatatype = self._io.read_u1() self.com1_pget_memdata32 = self._io.read_bytes(32) class Magfield(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 0.1) return self._m_value if hasattr(self, '_m_value') else None class Lat(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2le() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (self.raw / 355) return self._m_value if hasattr(self, '_m_value') else None class Extension(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.versno = KaitaiStream.resolve_enum(Snet.Versno, self._io.read_bits_int_be(2)) self.dfcid = self._io.read_bits_int_be(2) self.rfu = self._io.read_bits_int_be(4) class AdcsStandardTelemetry(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.adcs_pget_imodechklistthisstepactive = self._io.read_s1() self.adcs_pget_iattdetfinalstate = self._io.read_u1() self.adcs_pget_isensorarrayavailstatusga = self._io.read_u1() self.adcs_pget_isensorarrayavailstatusmfsa = self._io.read_u1() self.adcs_pget_isensorarrayavailstatussusea = self._io.read_u1() self.adcs_pget_iactarrayavailstatusrwa = self._io.read_u1() self.adcs_pget_iactarrayavailstatusmata = self._io.read_u1() self.adcs_pget_attdetmfsdistcorrmode = self._io.read_u1() self.adcs_pget_attdetsusedistcorrmode = self._io.read_u1() self.adcs_pget_attdettrackigrfdeltab = self._io.read_bits_int_be(1) != 0 self.adcs_pget_attdetsusealbedotracking = self._io.read_bits_int_be(1) != 0 self.adcs_pget_suse1albedoflag = self._io.read_bits_int_be(1) != 0 self.adcs_pget_suse2albedoflag = self._io.read_bits_int_be(1) != 0 self.adcs_pget_suse3albedoflag = self._io.read_bits_int_be(1) != 0 self.adcs_pget_suse4albedoflag = self._io.read_bits_int_be(1) != 0 self.adcs_pget_suse5albedoflag = self._io.read_bits_int_be(1) != 0 self.adcs_pget_suse6albedoflag = self._io.read_bits_int_be(1) != 0 self.adcs_pget_attdetautovirtualizemfsa = self._io.read_bits_int_be(1) != 0 self.adcs_pget_attdetautovirtualizesusea = self._io.read_bits_int_be(1) != 0 self.adcs_pget_attdetnarrowvectors = self._io.read_bits_int_be(1) != 0 self.adcs_pget_attdetmismatchingvectors = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.adcs_pget_omegaxoptimal_sat = Snet.Angularrate(self._io, self, self._root) self.adcs_pget_omegayoptimal_sat = Snet.Angularrate(self._io, self, self._root) self.adcs_pget_omegazoptimal_sat = Snet.Angularrate(self._io, self, self._root) self.adcs_pget_magxoptimal_sat = Snet.Magfield(self._io, self, self._root) self.adcs_pget_magyoptimal_sat = Snet.Magfield(self._io, self, self._root) self.adcs_pget_magzoptimal_sat = Snet.Magfield(self._io, self, self._root) self.adcs_pget_sunxoptimal_sat = Snet.Sunvect(self._io, self, self._root) self.adcs_pget_sunyoptimal_sat = Snet.Sunvect(self._io, self, self._root) self.adcs_pget_sunzoptimal_sat = Snet.Sunvect(self._io, self, self._root) self.adcs_pget_dctrltorquerwax_sat_lr = Snet.Torquerw(self._io, self, self._root) self.adcs_pget_dctrltorquerway_sat_lr = Snet.Torquerw(self._io, self, self._root) self.adcs_pget_dctrltorquerwaz_sat_lr = Snet.Torquerw(self._io, self, self._root) self.adcs_pget_dctrlmagmomentmatax_sat_lr = Snet.Torquemag(self._io, self, self._root) self.adcs_pget_dctrlmagmomentmatay_sat_lr = Snet.Torquemag(self._io, self, self._root) self.adcs_pget_dctrlmagmomentmataz_sat_lr = Snet.Torquemag(self._io, self, self._root) self.adcs_pget_ireadtorquerwx_mfr = Snet.Measuredtorque(self._io, self, self._root) self.adcs_pget_ireadtorquerwy_mfr = Snet.Measuredtorque(self._io, self, self._root) self.adcs_pget_ireadtorquerwz_mfr = Snet.Measuredtorque(self._io, self, self._root) self.adcs_pget_ireadrotspeedrwx_mfr = self._io.read_s2le() self.adcs_pget_ireadrotspeedrwy_mfr = self._io.read_s2le() self.adcs_pget_ireadrotspeedrwz_mfr = self._io.read_s2le() self.adcs_pget_sgp4latxpef = Snet.Lat(self._io, self, self._root) self.adcs_pget_sgp4longypef = Snet.Lon(self._io, self, self._root) self.adcs_pget_sgp4altpef = Snet.Alt(self._io, self, self._root) self.adcs_pget_attitudeerrorangle = Snet.Attitude(self._io, self, self._root) self.adcs_pget_targetdata_distance = self._io.read_u2le() self.adcs_pget_targetdata_controlisactive = self._io.read_bits_int_be(1) != 0
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/snet.py
0.540924
0.158565
snet.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Selfiesat(KaitaiStruct): """:field crc: csp_header.crc :field rdp: csp_header.rdp :field xtea: csp_header.xtea :field hmac: csp_header.hmac :field reserved: csp_header.reserved :field src_port: csp_header.src_port :field dst_port: csp_header.dst_port :field destination: csp_header.destination :field source: csp_header.source :field priority: csp_header.priority :field packet_length: csp_data.packet_length :field alarm_mask: csp_data.csp_payload.alarm_mask :field eps_counter_boot: csp_data.csp_payload.eps_counter_boot :field eps_vbatt: csp_data.csp_payload.eps_vbatt :field eps_outputmask: csp_data.csp_payload.eps_outputmask :field id: csp_data.csp_payload.id :field fsm_states: csp_data.csp_payload.fsm_states :field callsign: csp_data.csp_payload.callsign """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.csp_header = Selfiesat.CspHeaderT(self._io, self, self._root) self.csp_data = Selfiesat.CspDataT(self._io, self, self._root) class CspHeaderT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.csp_flags = [None] * (4) for i in range(4): self.csp_flags[i] = self._io.read_u1() @property def source(self): if hasattr(self, '_m_source'): return self._m_source if hasattr(self, '_m_source') else None self._m_source = ((self.csp_flags[3] >> 1) & 31) return self._m_source if hasattr(self, '_m_source') else None @property def rdp(self): if hasattr(self, '_m_rdp'): return self._m_rdp if hasattr(self, '_m_rdp') else None self._m_rdp = ((self.csp_flags[0] >> 1) & 1) return self._m_rdp if hasattr(self, '_m_rdp') else None @property def src_port(self): if hasattr(self, '_m_src_port'): return self._m_src_port if hasattr(self, '_m_src_port') else None self._m_src_port = (self.csp_flags[1] & 63) return self._m_src_port if hasattr(self, '_m_src_port') else None @property def destination(self): if hasattr(self, '_m_destination'): return self._m_destination if hasattr(self, '_m_destination') else None self._m_destination = (((self.csp_flags[2] | (self.csp_flags[3] << 8)) >> 4) & 31) return self._m_destination if hasattr(self, '_m_destination') else None @property def dst_port(self): if hasattr(self, '_m_dst_port'): return self._m_dst_port if hasattr(self, '_m_dst_port') else None self._m_dst_port = (((self.csp_flags[1] | (self.csp_flags[2] << 8)) >> 6) & 63) return self._m_dst_port if hasattr(self, '_m_dst_port') else None @property def priority(self): if hasattr(self, '_m_priority'): return self._m_priority if hasattr(self, '_m_priority') else None self._m_priority = (self.csp_flags[3] >> 6) return self._m_priority if hasattr(self, '_m_priority') else None @property def reserved(self): if hasattr(self, '_m_reserved'): return self._m_reserved if hasattr(self, '_m_reserved') else None self._m_reserved = (self.csp_flags[0] >> 4) return self._m_reserved if hasattr(self, '_m_reserved') else None @property def xtea(self): if hasattr(self, '_m_xtea'): return self._m_xtea if hasattr(self, '_m_xtea') else None self._m_xtea = ((self.csp_flags[0] >> 2) & 1) return self._m_xtea if hasattr(self, '_m_xtea') else None @property def hmac(self): if hasattr(self, '_m_hmac'): return self._m_hmac if hasattr(self, '_m_hmac') else None self._m_hmac = ((self.csp_flags[0] >> 3) & 1) return self._m_hmac if hasattr(self, '_m_hmac') else None @property def crc(self): if hasattr(self, '_m_crc'): return self._m_crc if hasattr(self, '_m_crc') else None self._m_crc = (self.csp_flags[0] & 1) return self._m_crc if hasattr(self, '_m_crc') else None class CspDataT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.packet_length = self._io.read_u2be() if not ((self.packet_length == 224)) : raise kaitaistruct.ValidationNotAnyOfError(self.packet_length, self._io, u"/types/csp_data_t/seq/0") self.pad_0 = self._io.read_bytes(8) self._raw_csp_payload = self._io.read_bytes_full() _io__raw_csp_payload = KaitaiStream(BytesIO(self._raw_csp_payload)) self.csp_payload = Selfiesat.SelfiesatTelemetryT(_io__raw_csp_payload, self, self._root) class SelfiesatTelemetryT(KaitaiStruct): """struct bcn_normal { unsigned int alarm_mask; // Alarms from housekeeping unsigned short eps_counter_boot; // EPS boot count unsigned short eps_vbatt; // Voltage of EPS battery unsigned char eps_outputmask; // Whether channels are on or off unsigned char id; // Identifier for beacons unsigned char fsm_states; // obc_main's internal fsm states }; """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.alarm_mask = self._io.read_u4be() self.eps_counter_boot = self._io.read_u2be() self.eps_vbatt = self._io.read_u2be() self.eps_outputmask = self._io.read_u1() self.id = self._io.read_u1() self.fsm_states = self._io.read_u1() self.pad_1 = self._io.read_bytes(1) self.callsign = (KaitaiStream.bytes_terminate(self._io.read_bytes(9), 0, False)).decode(u"ASCII") if not ((self.callsign == u"SelfieSat")) : raise kaitaistruct.ValidationNotAnyOfError(self.callsign, self._io, u"/types/selfiesat_telemetry_t/seq/7")
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/selfiesat.py
0.525369
0.181989
selfiesat.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Meznsat(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_frame.ax25_header.src_ssid_raw.ssid :field dest_ssid: ax25_frame.ax25_header.dest_ssid_raw.ssid :field rpt_callsign: ax25_frame.ax25_header.repeater.rpt_instance[0].rpt_callsign_raw.callsign_ror.callsign :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field frame_length: frame_length :field callsign: ax25_frame.payload.ax25_info.beacon_type.callsign :field satellite_mode: ax25_frame.payload.ax25_info.beacon_type.satellite_mode :field day_of_month: ax25_frame.payload.ax25_info.beacon_type.day_of_month :field day_of_week: ax25_frame.payload.ax25_info.beacon_type.day_of_week :field hour: ax25_frame.payload.ax25_info.beacon_type.hour :field minute: ax25_frame.payload.ax25_info.beacon_type.minute :field sec: ax25_frame.payload.ax25_info.beacon_type.sec :field obc_reset_count: ax25_frame.payload.ax25_info.beacon_type.obc_reset_count :field obc_temp: ax25_frame.payload.ax25_info.beacon_type.obc_temp :field vbatt: ax25_frame.payload.ax25_info.beacon_type.vbatt :field sys_current: ax25_frame.payload.ax25_info.beacon_type.sys_current :field batt_temp: ax25_frame.payload.ax25_info.beacon_type.batt_temp :field ext_batt1_temp: ax25_frame.payload.ax25_info.beacon_type.ext_batt1_temp :field ext_batt2_temp: ax25_frame.payload.ax25_info.beacon_type.ext_batt2_temp :field eps_reboots: ax25_frame.payload.ax25_info.beacon_type.eps_reboots :field receiver_current: ax25_frame.payload.ax25_info.beacon_type.receiver_current :field transmitter_current: ax25_frame.payload.ax25_info.beacon_type.transmitter_current :field pa_temp: ax25_frame.payload.ax25_info.beacon_type.pa_temp :field pa_current: ax25_frame.payload.ax25_info.beacon_type.pa_current :field adcs_run_mode: ax25_frame.payload.ax25_info.beacon_type.adcs_run_mode :field estimated_x_angular_rate: ax25_frame.payload.ax25_info.beacon_type.estimated_x_angular_rate :field estimated_y_angular_rate: ax25_frame.payload.ax25_info.beacon_type.estimated_y_angular_rate :field estimated_z_angular_rate: ax25_frame.payload.ax25_info.beacon_type.estimated_z_angular_rate :field estimated_q1: ax25_frame.payload.ax25_info.beacon_type.estimated_q1 :field estimated_q2: ax25_frame.payload.ax25_info.beacon_type.estimated_q2 :field estimated_q3: ax25_frame.payload.ax25_info.beacon_type.estimated_q3 :field ant_temp: ax25_frame.payload.ax25_info.beacon_type.ant_temp :field minus_z_temp: ax25_frame.payload.ax25_info.beacon_type.minus_z_temp :field plus_z_temp: ax25_frame.payload.ax25_info.beacon_type.plus_z_temp :field minus_y_temp: ax25_frame.payload.ax25_info.beacon_type.minus_y_temp :field plus_y_temp: ax25_frame.payload.ax25_info.beacon_type.plus_y_temp :field minus_x_temp: ax25_frame.payload.ax25_info.beacon_type.minus_x_temp :field plus_x_temp: ax25_frame.payload.ax25_info.beacon_type.plus_x_temp :field message: ax25_frame.payload.ax25_info.beacon_type.message Attention: `rpt_callsign` cannot be accessed because `rpt_instance` is an array of unknown size at the beginning of the parsing process! Left an example in here. .. seealso:: """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Meznsat.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Meznsat.Ax25Header(self._io, self, self._root) _on = (self.ax25_header.ctl & 19) if _on == 0: self.payload = Meznsat.IFrame(self._io, self, self._root) elif _on == 3: self.payload = Meznsat.UiFrame(self._io, self, self._root) elif _on == 19: self.payload = Meznsat.UiFrame(self._io, self, self._root) elif _on == 16: self.payload = Meznsat.IFrame(self._io, self, self._root) elif _on == 18: self.payload = Meznsat.IFrame(self._io, self, self._root) elif _on == 2: self.payload = Meznsat.IFrame(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Meznsat.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Meznsat.SsidMask(self._io, self, self._root) self.src_callsign_raw = Meznsat.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Meznsat.SsidMask(self._io, self, self._root) if (self.src_ssid_raw.ssid_mask & 1) == 0: self.repeater = Meznsat.Repeater(self._io, self, self._root) self.ctl = self._io.read_u1() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() _on = self._parent.ax25_header.src_callsign_raw.callsign_ror.callsign if _on == u"A68MZ ": self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Meznsat.MeznsatPayload(_io__raw_ax25_info, self, self._root) else: self.ax25_info = self._io.read_bytes_full() class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") class IFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.ax25_info = self._io.read_bytes_full() class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class Repeaters(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_callsign_raw = Meznsat.CallsignRaw(self._io, self, self._root) self.rpt_ssid_raw = Meznsat.SsidMask(self._io, self, self._root) class Repeater(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_instance = [] i = 0 while True: _ = Meznsat.Repeaters(self._io, self, self._root) self.rpt_instance.append(_) if (_.rpt_ssid_raw.ssid_mask & 1) == 1: break i += 1 class MeznsatTlm(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(7)).decode(u"utf-8") self.satellite_mode = self._io.read_u1() self.day_of_month = self._io.read_u1() self.day_of_week = self._io.read_u1() self.hour = self._io.read_u1() self.minute = self._io.read_u1() self.sec = self._io.read_u1() self.obc_reset_count = self._io.read_u4le() self.obc_temp = self._io.read_s2le() self.vbatt = self._io.read_u2le() self.sys_current = self._io.read_u2le() self.batt_temp = self._io.read_s2le() self.ext_batt1_temp = self._io.read_s2le() self.ext_batt2_temp = self._io.read_s2le() self.eps_reboots = self._io.read_u2le() self.receiver_current = self._io.read_u2le() self.transmitter_current = self._io.read_u2le() self.pa_temp = self._io.read_s2le() self.pa_current = self._io.read_u2le() self.adcs_run_mode = self._io.read_u1() self.estimated_x_angular_rate = self._io.read_s2le() self.estimated_y_angular_rate = self._io.read_s2le() self.estimated_z_angular_rate = self._io.read_s2le() self.estimated_q1 = self._io.read_u2le() self.estimated_q2 = self._io.read_u2le() self.estimated_q3 = self._io.read_u2le() self.ant_temp = self._io.read_s2le() self.minus_z_temp = self._io.read_s4le() self.plus_z_temp = self._io.read_s4le() self.minus_y_temp = self._io.read_s4le() self.plus_y_temp = self._io.read_s4le() self.minus_x_temp = self._io.read_s4le() self.plus_x_temp = self._io.read_s4le() class MeznsatPayload(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): _on = self._io.size() if _on == 78: self.beacon_type = Meznsat.MeznsatTlm(self._io, self, self._root) else: self.beacon_type = Meznsat.MeznsatGenericPacket(self._io, self, self._root) class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Meznsat.Callsign(_io__raw_callsign_ror, self, self._root) class MeznsatGenericPacket(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.message = (self._io.read_bytes_full()).decode(u"utf-8") @property def frame_length(self): if hasattr(self, '_m_frame_length'): return self._m_frame_length if hasattr(self, '_m_frame_length') else None self._m_frame_length = self._io.size() return self._m_frame_length if hasattr(self, '_m_frame_length') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/meznsat.py
0.532911
0.196286
meznsat.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO from enum import Enum if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Celesta(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.dest_callsign_ror.dest_callsign :field dest_ssid_raw: ax25_frame.ax25_header.dest_ssid_raw :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.src_callsign_ror.src_callsign :field src_ssid_raw: ax25_frame.ax25_header.src_ssid_raw :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.ax25_data.pid :field size: ax25_frame.ax25_data.size :field frame_type: ax25_frame.ax25_data.frame_type :field ts: ax25_frame.ax25_data.ts :field timestamp: ax25_frame.ax25_data.obdh.timestamp :field temperature: ax25_frame.ax25_data.obdh.temperature :field satellite_mode: ax25_frame.ax25_data.obdh.satellite_mode :field obdh_mode: ax25_frame.ax25_data.obdh.obdh_mode :field bytes_to_transmit: ax25_frame.ax25_data.obdh.bytes_to_transmit :field number_of_resets: ax25_frame.ax25_data.obdh.number_of_resets :field number_of_errors: ax25_frame.ax25_data.obdh.number_of_errors :field eps_mode: ax25_frame.ax25_data.eps.eps_mode :field battery_voltage_raw: ax25_frame.ax25_data.eps.battery_voltage_raw :field battery_temperature: ax25_frame.ax25_data.eps.battery_temperature :field min_battery_voltage_raw: ax25_frame.ax25_data.eps.min_battery_voltage_raw :field max_battery_voltage_raw: ax25_frame.ax25_data.eps.max_battery_voltage_raw :field avg_battery_voltage_raw: ax25_frame.ax25_data.eps.avg_battery_voltage_raw :field avg_charge_current_raw: ax25_frame.ax25_data.eps.avg_charge_current_raw :field max_charge_current_raw: ax25_frame.ax25_data.eps.max_charge_current_raw :field z_minu_face_temperature: ax25_frame.ax25_data.eps.z_minu_face_temperature :field o_b_d_h_current: ax25_frame.ax25_data.eps.o_b_d_h_current :field e_p_s_current: ax25_frame.ax25_data.eps.e_p_s_current :field t_t_c_micro_c_current: ax25_frame.ax25_data.eps.t_t_c_micro_c_current :field t_t_c_p_a_current_raw: ax25_frame.ax25_data.eps.t_t_c_p_a_current_raw :field d_o_s_i_current: ax25_frame.ax25_data.eps.d_o_s_i_current :field charge_current_raw: ax25_frame.ax25_data.eps.charge_current_raw :field spare: ax25_frame.ax25_data.eps.spare :field last_battery_voltage: ax25_frame.ax25_data.eps.last_battery_voltage :field minimum_battery_voltage_measured_since_reboot: ax25_frame.ax25_data.eps.minimum_battery_voltage_measured_since_reboot :field maximum_battery_voltage_measured_since_reboot: ax25_frame.ax25_data.eps.maximum_battery_voltage_measured_since_reboot :field average_battery_voltage_measured_since_reboot: ax25_frame.ax25_data.eps.average_battery_voltage_measured_since_reboot :field average_charge_current_measured_since_reboot: ax25_frame.ax25_data.eps.average_charge_current_measured_since_reboot :field maximum_charge_current_measured_since_reboot: ax25_frame.ax25_data.eps.maximum_charge_current_measured_since_reboot :field current_consumption_of_the_power_amplifier_of_the_ttc: ax25_frame.ax25_data.eps.current_consumption_of_the_power_amplifier_of_the_ttc :field total_charge_current_of_the_battery: ax25_frame.ax25_data.eps.total_charge_current_of_the_battery :field mode: ax25_frame.ax25_data.ttc.mode :field number_of_ttc_resets: ax25_frame.ax25_data.ttc.number_of_ttc_resets :field last_reset_cause: ax25_frame.ax25_data.ttc.last_reset_cause :field number_of_received_valid_packets: ax25_frame.ax25_data.ttc.number_of_received_valid_packets :field number_of_transmitted_packets: ax25_frame.ax25_data.ttc.number_of_transmitted_packets :field measured_transmission_power: ax25_frame.ax25_data.ttc.measured_transmission_power :field last_error_code: ax25_frame.ax25_data.ttc.last_error_code :field power_configuration: ax25_frame.ax25_data.ttc.power_configuration :field power_amplifier_temperature: ax25_frame.ax25_data.ttc.power_amplifier_temperature :field rssi_of_last_received_packet_raw: ax25_frame.ax25_data.ttc.rssi_of_last_received_packet_raw :field frequency_deviation_of_last_received_packet_raw: ax25_frame.ax25_data.ttc.frequency_deviation_of_last_received_packet_raw :field beacon_period: ax25_frame.ax25_data.ttc.beacon_period :field rssi_of_last_received_packet: ax25_frame.ax25_data.ttc.rssi_of_last_received_packet :field frequency_deviation_of_last_received_packet_with_valid_crc: ax25_frame.ax25_data.ttc.frequency_deviation_of_last_received_packet_with_valid_crc :field last_message_rssi_raw: ax25_frame.ax25_data.ham_message.last_message_rssi_raw :field radio_message: ax25_frame.ax25_data.ham_message.radio_message :field last_msg_rssi_dbm: ax25_frame.ax25_data.ham_message.last_msg_rssi_dbm """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Celesta.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Celesta.Ax25Header(self._io, self, self._root) self.ax25_data = Celesta.Ax25Data(self._io, self, self._root) class DestCallsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign = (self._io.read_bytes(6)).decode(u"ASCII") class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Celesta.DestCallsignRaw(self._io, self, self._root) self.dest_ssid_raw = self._io.read_u1() self.src_callsign_raw = Celesta.SrcCallsignRaw(self._io, self, self._root) self.src_ssid_raw = self._io.read_u1() self.ctl = self._io.read_u1() class HamMessage(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.last_message_rssi_raw = self._io.read_u1() self.radio_message = (self._io.read_bytes(133)).decode(u"ASCII") @property def last_msg_rssi_dbm(self): if hasattr(self, '_m_last_msg_rssi_dbm'): return self._m_last_msg_rssi_dbm if hasattr(self, '_m_last_msg_rssi_dbm') else None self._m_last_msg_rssi_dbm = (-1 * self.last_message_rssi_raw) return self._m_last_msg_rssi_dbm if hasattr(self, '_m_last_msg_rssi_dbm') else None class SrcCallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_src_callsign_ror = self._io.read_bytes(6) self._raw_src_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_src_callsign_ror, 8 - (1), 1) _io__raw_src_callsign_ror = KaitaiStream(BytesIO(self._raw_src_callsign_ror)) self.src_callsign_ror = Celesta.SrcCallsign(_io__raw_src_callsign_ror, self, self._root) class Ttc(KaitaiStruct): class EMode(Enum): idle = 1 beacon = 17 commissionning = 34 silent = 68 class ELastResetCause(Enum): power_supply_reset = 17 watchdog = 34 oscillator_error = 51 reset_pin = 68 debugger_reset = 85 software_reset = 119 class ELastErrorCode(Enum): nothing = 0 obdh_status_req = 1 obdh_bdr_req = 2 radio_hw_error = 17 tx_queue_full = 34 rx_queue_full = 51 tx_bus_queue_full = 68 rx_bus_queue_full = 85 obc_temp_hw_error = 102 obc_temp_h_limit_error = 119 obc_temp_l_limit_error = 136 pa_temp_hw_error = 153 fram_id_error = 161 fram_hw_error = 162 fram_read_error = 163 fram_write_error = 164 event_queue_read_error = 165 pa_temp_h_limit_error = 170 pa_temp_l_limit_error = 187 obdh_nack = 204 ttc_reset_req = 209 pf_reset_req = 221 radio_task_timeout = 238 radio_unqueue = 255 def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.mode = KaitaiStream.resolve_enum(Celesta.Ttc.EMode, self._io.read_u1()) self.number_of_ttc_resets = self._io.read_u2le() self.last_reset_cause = KaitaiStream.resolve_enum(Celesta.Ttc.ELastResetCause, self._io.read_u1()) self.number_of_received_valid_packets = self._io.read_u2le() self.number_of_transmitted_packets = self._io.read_u2le() self.measured_transmission_power = self._io.read_u2le() self.last_error_code = KaitaiStream.resolve_enum(Celesta.Ttc.ELastErrorCode, self._io.read_u1()) self.power_configuration = self._io.read_u1() self.power_amplifier_temperature = self._io.read_s1() self.rssi_of_last_received_packet_raw = self._io.read_u1() self.frequency_deviation_of_last_received_packet_raw = self._io.read_u1() self.beacon_period = self._io.read_u1() @property def rssi_of_last_received_packet(self): if hasattr(self, '_m_rssi_of_last_received_packet'): return self._m_rssi_of_last_received_packet if hasattr(self, '_m_rssi_of_last_received_packet') else None self._m_rssi_of_last_received_packet = (-1 * self.rssi_of_last_received_packet_raw) return self._m_rssi_of_last_received_packet if hasattr(self, '_m_rssi_of_last_received_packet') else None @property def frequency_deviation_of_last_received_packet_with_valid_crc(self): if hasattr(self, '_m_frequency_deviation_of_last_received_packet_with_valid_crc'): return self._m_frequency_deviation_of_last_received_packet_with_valid_crc if hasattr(self, '_m_frequency_deviation_of_last_received_packet_with_valid_crc') else None self._m_frequency_deviation_of_last_received_packet_with_valid_crc = (self.frequency_deviation_of_last_received_packet_raw * 17) return self._m_frequency_deviation_of_last_received_packet_with_valid_crc if hasattr(self, '_m_frequency_deviation_of_last_received_packet_with_valid_crc') else None class Obdh(KaitaiStruct): class ESatelliteMode(Enum): standby = 0 deploy = 1 commissionning = 2 comm_pl = 3 mission = 4 low_p_mission = 5 transmit = 6 survival = 7 silent = 8 class EObdhMode(Enum): standby = 17 deploy = 34 commissionning = 51 comm_pl = 68 mission = 85 low_power_mission = 102 silent = 119 por = 255 def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = self._io.read_u4be() self.temperature = self._io.read_u2le() self.satellite_mode = KaitaiStream.resolve_enum(Celesta.Obdh.ESatelliteMode, self._io.read_u1()) self.obdh_mode = KaitaiStream.resolve_enum(Celesta.Obdh.EObdhMode, self._io.read_u1()) self.bytes_to_transmit = self._io.read_u4le() self.number_of_resets = self._io.read_u2le() self.number_of_errors = self._io.read_u2le() class Eps(KaitaiStruct): class EEpsMode(Enum): idle = 0 survival = 17 stnadby = 34 deploy = 51 commissionnong = 68 mission = 85 low_power_mission = 102 silent = 119 def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.eps_mode = KaitaiStream.resolve_enum(Celesta.Eps.EEpsMode, self._io.read_u1()) self.battery_voltage_raw = self._io.read_u1() self.battery_temperature = self._io.read_s1() self.min_battery_voltage_raw = self._io.read_u1() self.max_battery_voltage_raw = self._io.read_u1() self.avg_battery_voltage_raw = self._io.read_u1() self.avg_charge_current_raw = self._io.read_u1() self.max_charge_current_raw = self._io.read_u1() self.z_minu_face_temperature = self._io.read_s1() self.o_b_d_h_current = self._io.read_u1() self.e_p_s_current = self._io.read_u1() self.t_t_c_micro_c_current = self._io.read_u1() self.t_t_c_p_a_current_raw = self._io.read_u1() self.d_o_s_i_current = self._io.read_u1() self.charge_current_raw = self._io.read_u1() self.spare = self._io.read_u1() @property def total_charge_current_of_the_battery(self): if hasattr(self, '_m_total_charge_current_of_the_battery'): return self._m_total_charge_current_of_the_battery if hasattr(self, '_m_total_charge_current_of_the_battery') else None self._m_total_charge_current_of_the_battery = (self.charge_current_raw * 12) return self._m_total_charge_current_of_the_battery if hasattr(self, '_m_total_charge_current_of_the_battery') else None @property def current_consumption_of_the_power_amplifier_of_the_ttc(self): if hasattr(self, '_m_current_consumption_of_the_power_amplifier_of_the_ttc'): return self._m_current_consumption_of_the_power_amplifier_of_the_ttc if hasattr(self, '_m_current_consumption_of_the_power_amplifier_of_the_ttc') else None self._m_current_consumption_of_the_power_amplifier_of_the_ttc = (self.t_t_c_p_a_current_raw * 5) return self._m_current_consumption_of_the_power_amplifier_of_the_ttc if hasattr(self, '_m_current_consumption_of_the_power_amplifier_of_the_ttc') else None @property def average_charge_current_measured_since_reboot(self): if hasattr(self, '_m_average_charge_current_measured_since_reboot'): return self._m_average_charge_current_measured_since_reboot if hasattr(self, '_m_average_charge_current_measured_since_reboot') else None self._m_average_charge_current_measured_since_reboot = (self.avg_charge_current_raw * 12) return self._m_average_charge_current_measured_since_reboot if hasattr(self, '_m_average_charge_current_measured_since_reboot') else None @property def maximum_charge_current_measured_since_reboot(self): if hasattr(self, '_m_maximum_charge_current_measured_since_reboot'): return self._m_maximum_charge_current_measured_since_reboot if hasattr(self, '_m_maximum_charge_current_measured_since_reboot') else None self._m_maximum_charge_current_measured_since_reboot = (self.max_charge_current_raw * 12) return self._m_maximum_charge_current_measured_since_reboot if hasattr(self, '_m_maximum_charge_current_measured_since_reboot') else None @property def maximum_battery_voltage_measured_since_reboot(self): if hasattr(self, '_m_maximum_battery_voltage_measured_since_reboot'): return self._m_maximum_battery_voltage_measured_since_reboot if hasattr(self, '_m_maximum_battery_voltage_measured_since_reboot') else None self._m_maximum_battery_voltage_measured_since_reboot = (self.max_battery_voltage_raw * 20) return self._m_maximum_battery_voltage_measured_since_reboot if hasattr(self, '_m_maximum_battery_voltage_measured_since_reboot') else None @property def last_battery_voltage(self): if hasattr(self, '_m_last_battery_voltage'): return self._m_last_battery_voltage if hasattr(self, '_m_last_battery_voltage') else None self._m_last_battery_voltage = (self.battery_voltage_raw * 20) return self._m_last_battery_voltage if hasattr(self, '_m_last_battery_voltage') else None @property def minimum_battery_voltage_measured_since_reboot(self): if hasattr(self, '_m_minimum_battery_voltage_measured_since_reboot'): return self._m_minimum_battery_voltage_measured_since_reboot if hasattr(self, '_m_minimum_battery_voltage_measured_since_reboot') else None self._m_minimum_battery_voltage_measured_since_reboot = (self.min_battery_voltage_raw * 20) return self._m_minimum_battery_voltage_measured_since_reboot if hasattr(self, '_m_minimum_battery_voltage_measured_since_reboot') else None @property def average_battery_voltage_measured_since_reboot(self): if hasattr(self, '_m_average_battery_voltage_measured_since_reboot'): return self._m_average_battery_voltage_measured_since_reboot if hasattr(self, '_m_average_battery_voltage_measured_since_reboot') else None self._m_average_battery_voltage_measured_since_reboot = (self.avg_battery_voltage_raw * 20) return self._m_average_battery_voltage_measured_since_reboot if hasattr(self, '_m_average_battery_voltage_measured_since_reboot') else None class DestCallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_dest_callsign_ror = self._io.read_bytes(6) self._raw_dest_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_dest_callsign_ror, 8 - (1), 1) _io__raw_dest_callsign_ror = KaitaiStream(BytesIO(self._raw_dest_callsign_ror)) self.dest_callsign_ror = Celesta.DestCallsign(_io__raw_dest_callsign_ror, self, self._root) class Ax25Data(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.size = self._io.read_u1() self.frame_type = self._io.read_u1() self.ts = self._io.read_u4be() self.obdh = Celesta.Obdh(self._io, self, self._root) self.eps = Celesta.Eps(self._io, self, self._root) self.ttc = Celesta.Ttc(self._io, self, self._root) self.payload = self._io.read_bytes(48) self.ham_message = Celesta.HamMessage(self._io, self, self._root) class SrcCallsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.src_callsign = (self._io.read_bytes(6)).decode(u"ASCII")
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/celesta.py
0.717309
0.232571
celesta.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Dhabisat(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_frame.ax25_header.src_ssid_raw.ssid :field dest_ssid: ax25_frame.ax25_header.dest_ssid_raw.ssid :field rpt_callsign: ax25_frame.ax25_header.repeater.rpt_instance[0].rpt_callsign_raw.callsign_ror.callsign :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field data_type: ax25_frame.payload.ax25_info.dhabisat_header.data_type :field time_stamp: ax25_frame.payload.ax25_info.dhabisat_header.time_stamp :field file_index: ax25_frame.payload.ax25_info.dhabisat_header.file_index :field interval: ax25_frame.payload.ax25_info.dhabisat_header.interval :field total_packets: ax25_frame.payload.ax25_info.dhabisat_header.total_packets :field current_packet: ax25_frame.payload.ax25_info.dhabisat_header.current_packet :field payload_ax25_info_beacon_type_callsign: ax25_frame.payload.ax25_info.beacon_type.callsign :field obc_mode: ax25_frame.payload.ax25_info.beacon_type.obc_mode :field obc_reset_count: ax25_frame.payload.ax25_info.beacon_type.obc_reset_count :field obc_timestamp: ax25_frame.payload.ax25_info.beacon_type.obc_timestamp :field obc_uptime: ax25_frame.payload.ax25_info.beacon_type.obc_uptime :field subsystem_safety_criteria: ax25_frame.payload.ax25_info.beacon_type.subsystem_safety_criteria :field telemetry_distribution_counter: ax25_frame.payload.ax25_info.beacon_type.telemetry_distribution_counter :field obc_temperature: ax25_frame.payload.ax25_info.beacon_type.obc_temperature :field camera_voltage: ax25_frame.payload.ax25_info.beacon_type.camera_voltage :field camera_current: ax25_frame.payload.ax25_info.beacon_type.camera_current :field battery_temperature: ax25_frame.payload.ax25_info.beacon_type.battery_temperature :field battery_voltage: ax25_frame.payload.ax25_info.beacon_type.battery_voltage :field adcs_5v_voltage: ax25_frame.payload.ax25_info.beacon_type.adcs_5v_voltage :field adcs_5v_current: ax25_frame.payload.ax25_info.beacon_type.adcs_5v_current :field adcs_5v_power: ax25_frame.payload.ax25_info.beacon_type.adcs_5v_power :field adcs_3v3_voltage: ax25_frame.payload.ax25_info.beacon_type.adcs_3v3_voltage :field adcs_3v3_current: ax25_frame.payload.ax25_info.beacon_type.adcs_3v3_current :field adcs_3v3_power: ax25_frame.payload.ax25_info.beacon_type.adcs_3v3_power :field eps_mode: ax25_frame.payload.ax25_info.beacon_type.eps_mode :field eps_reset_cause: ax25_frame.payload.ax25_info.beacon_type.eps_reset_cause :field eps_uptime: ax25_frame.payload.ax25_info.beacon_type.eps_uptime :field eps_error: ax25_frame.payload.ax25_info.beacon_type.eps_error :field eps_system_reset_counter_power_on: ax25_frame.payload.ax25_info.beacon_type.eps_system_reset_counter_power_on :field eps_system_reset_counter_watchdog: ax25_frame.payload.ax25_info.beacon_type.eps_system_reset_counter_watchdog :field eps_system_reset_counter_commanded: ax25_frame.payload.ax25_info.beacon_type.eps_system_reset_counter_commanded :field eps_system_reset_counter_controller: ax25_frame.payload.ax25_info.beacon_type.eps_system_reset_counter_controller :field eps_system_reset_counter_low_power: ax25_frame.payload.ax25_info.beacon_type.eps_system_reset_counter_low_power :field panel_xp_temperature: ax25_frame.payload.ax25_info.beacon_type.panel_xp_temperature :field panel_xn_temperature: ax25_frame.payload.ax25_info.beacon_type.panel_xn_temperature :field panel_yp_temperature: ax25_frame.payload.ax25_info.beacon_type.panel_yp_temperature :field panel_yn_temperature: ax25_frame.payload.ax25_info.beacon_type.panel_yn_temperature :field panel_zp_temperature: ax25_frame.payload.ax25_info.beacon_type.panel_zp_temperature :field panel_zn_temperature: ax25_frame.payload.ax25_info.beacon_type.panel_zn_temperature :field tx_pa_temp: ax25_frame.payload.ax25_info.beacon_type.tx_pa_temp :field attitude_estimation_mode: ax25_frame.payload.ax25_info.beacon_type.attitude_estimation_mode :field attitude_control_mode: ax25_frame.payload.ax25_info.beacon_type.attitude_control_mode :field adcs_run_mode: ax25_frame.payload.ax25_info.beacon_type.adcs_run_mode :field asgp4_mode: ax25_frame.payload.ax25_info.beacon_type.asgp4_mode :field cubecontrol_signal_enabled: ax25_frame.payload.ax25_info.beacon_type.cubecontrol_signal_enabled :field cubecontrol_motor_enabled: ax25_frame.payload.ax25_info.beacon_type.cubecontrol_motor_enabled :field cubesense1_enabled: ax25_frame.payload.ax25_info.beacon_type.cubesense1_enabled :field cubesense2_enabled: ax25_frame.payload.ax25_info.beacon_type.cubesense2_enabled :field cubewheel1_enabled: ax25_frame.payload.ax25_info.beacon_type.cubewheel1_enabled :field cubewheel2_enabled: ax25_frame.payload.ax25_info.beacon_type.cubewheel2_enabled :field cubewheel3_enabled: ax25_frame.payload.ax25_info.beacon_type.cubewheel3_enabled :field cubestar_enabled: ax25_frame.payload.ax25_info.beacon_type.cubestar_enabled :field gps_receiver_enabled: ax25_frame.payload.ax25_info.beacon_type.gps_receiver_enabled :field gps_lna_power_enabled: ax25_frame.payload.ax25_info.beacon_type.gps_lna_power_enabled :field motor_driver_enabled: ax25_frame.payload.ax25_info.beacon_type.motor_driver_enabled :field sun_is_above_local_horizon: ax25_frame.payload.ax25_info.beacon_type.sun_is_above_local_horizon :field cubesense1_communications_error: ax25_frame.payload.ax25_info.beacon_type.cubesense1_communications_error :field cubesense2_communications_error: ax25_frame.payload.ax25_info.beacon_type.cubesense2_communications_error :field cubecontrol_signal_communications_error: ax25_frame.payload.ax25_info.beacon_type.cubecontrol_signal_communications_error :field cubecontrol_motor_communications_error: ax25_frame.payload.ax25_info.beacon_type.cubecontrol_motor_communications_error :field cubewheel1_communications_error: ax25_frame.payload.ax25_info.beacon_type.cubewheel1_communications_error :field cubewheel2_communications_error: ax25_frame.payload.ax25_info.beacon_type.cubewheel2_communications_error :field cubewheel3_communications_error: ax25_frame.payload.ax25_info.beacon_type.cubewheel3_communications_error :field cubestar_communications_error: ax25_frame.payload.ax25_info.beacon_type.cubestar_communications_error :field magnetometer_range_error: ax25_frame.payload.ax25_info.beacon_type.magnetometer_range_error :field cam1_sram_overcurrent_detected: ax25_frame.payload.ax25_info.beacon_type.cam1_sram_overcurrent_detected :field cam1_3v3_overcurrent_detected: ax25_frame.payload.ax25_info.beacon_type.cam1_3v3_overcurrent_detected :field cam1_sensor_busy_error: ax25_frame.payload.ax25_info.beacon_type.cam1_sensor_busy_error :field cam1_sensor_detection_error: ax25_frame.payload.ax25_info.beacon_type.cam1_sensor_detection_error :field sun_sensor_range_error: ax25_frame.payload.ax25_info.beacon_type.sun_sensor_range_error :field cam2_sram_overcurrent_detected: ax25_frame.payload.ax25_info.beacon_type.cam2_sram_overcurrent_detected :field cam2_3v3_overcurrent_detected: ax25_frame.payload.ax25_info.beacon_type.cam2_3v3_overcurrent_detected :field cam2_sensor_busy_error: ax25_frame.payload.ax25_info.beacon_type.cam2_sensor_busy_error :field cam2_sensor_detection_error: ax25_frame.payload.ax25_info.beacon_type.cam2_sensor_detection_error :field nadir_sensor_range_error: ax25_frame.payload.ax25_info.beacon_type.nadir_sensor_range_error :field rate_sensor_range_error: ax25_frame.payload.ax25_info.beacon_type.rate_sensor_range_error :field wheel_speed_range_error: ax25_frame.payload.ax25_info.beacon_type.wheel_speed_range_error :field coarse_sun_sensor_error: ax25_frame.payload.ax25_info.beacon_type.coarse_sun_sensor_error :field startracker_match_error: ax25_frame.payload.ax25_info.beacon_type.startracker_match_error :field startracker_overcurrent_detected: ax25_frame.payload.ax25_info.beacon_type.startracker_overcurrent_detected :field orbit_parameters_are_invalid: ax25_frame.payload.ax25_info.beacon_type.orbit_parameters_are_invalid :field configuration_is_invalid: ax25_frame.payload.ax25_info.beacon_type.configuration_is_invalid :field control_mode_change_is_not_allowed: ax25_frame.payload.ax25_info.beacon_type.control_mode_change_is_not_allowed :field estimator_change_is_not_allowed: ax25_frame.payload.ax25_info.beacon_type.estimator_change_is_not_allowed :field current_magnetometer_sampling_mode: ax25_frame.payload.ax25_info.beacon_type.current_magnetometer_sampling_mode :field modelled_and_measured_magnetic_field_differs_in_size: ax25_frame.payload.ax25_info.beacon_type.modelled_and_measured_magnetic_field_differs_in_size :field node_recovery_error: ax25_frame.payload.ax25_info.beacon_type.node_recovery_error :field cubesense1_runtime_error: ax25_frame.payload.ax25_info.beacon_type.cubesense1_runtime_error :field cubesense2_runtime_error: ax25_frame.payload.ax25_info.beacon_type.cubesense2_runtime_error :field cubecontrol_signal_runtime_error: ax25_frame.payload.ax25_info.beacon_type.cubecontrol_signal_runtime_error :field cubecontrol_motor_runtime_error: ax25_frame.payload.ax25_info.beacon_type.cubecontrol_motor_runtime_error :field cubewheel1_runtime_error: ax25_frame.payload.ax25_info.beacon_type.cubewheel1_runtime_error :field cubewheel2_runtime_error: ax25_frame.payload.ax25_info.beacon_type.cubewheel2_runtime_error :field cubewheel3_runtime_error: ax25_frame.payload.ax25_info.beacon_type.cubewheel3_runtime_error :field cubestar_runtime_error: ax25_frame.payload.ax25_info.beacon_type.cubestar_runtime_error :field magnetometer_error: ax25_frame.payload.ax25_info.beacon_type.magnetometer_error :field rate_sensor_failure: ax25_frame.payload.ax25_info.beacon_type.rate_sensor_failure :field padding_1: ax25_frame.payload.ax25_info.beacon_type.padding_1 :field padding_2: ax25_frame.payload.ax25_info.beacon_type.padding_2 :field padding_3: ax25_frame.payload.ax25_info.beacon_type.padding_3 :field estimated_roll_angle: ax25_frame.payload.ax25_info.beacon_type.estimated_roll_angle :field estimated_pitch_angle: ax25_frame.payload.ax25_info.beacon_type.estimated_pitch_angle :field estimated_yaw_angle: ax25_frame.payload.ax25_info.beacon_type.estimated_yaw_angle :field estimated_q1: ax25_frame.payload.ax25_info.beacon_type.estimated_q1 :field estimated_q2: ax25_frame.payload.ax25_info.beacon_type.estimated_q2 :field estimated_q3: ax25_frame.payload.ax25_info.beacon_type.estimated_q3 :field estimated_x_angular_rate: ax25_frame.payload.ax25_info.beacon_type.estimated_x_angular_rate :field estimated_y_angular_rate: ax25_frame.payload.ax25_info.beacon_type.estimated_y_angular_rate :field estimated_z_angular_rate: ax25_frame.payload.ax25_info.beacon_type.estimated_z_angular_rate :field x_position: ax25_frame.payload.ax25_info.beacon_type.x_position :field y_position: ax25_frame.payload.ax25_info.beacon_type.y_position :field z_position: ax25_frame.payload.ax25_info.beacon_type.z_position :field x_velocity: ax25_frame.payload.ax25_info.beacon_type.x_velocity :field y_velocity: ax25_frame.payload.ax25_info.beacon_type.y_velocity :field z_velocity: ax25_frame.payload.ax25_info.beacon_type.z_velocity :field latitude: ax25_frame.payload.ax25_info.beacon_type.latitude :field longitude: ax25_frame.payload.ax25_info.beacon_type.longitude :field altitude: ax25_frame.payload.ax25_info.beacon_type.altitude :field ecef_position_x: ax25_frame.payload.ax25_info.beacon_type.ecef_position_x :field ecef_position_y: ax25_frame.payload.ax25_info.beacon_type.ecef_position_y :field ecef_position_z: ax25_frame.payload.ax25_info.beacon_type.ecef_position_z :field cubesense1_3v3_current: ax25_frame.payload.ax25_info.beacon_type.cubesense1_3v3_current :field cubesense1_cam_sram_current: ax25_frame.payload.ax25_info.beacon_type.cubesense1_cam_sram_current :field cubesense2_3v3_current: ax25_frame.payload.ax25_info.beacon_type.cubesense2_3v3_current :field cubesense2_cam_sram_current: ax25_frame.payload.ax25_info.beacon_type.cubesense2_cam_sram_current :field cubecontrol_3v3_current: ax25_frame.payload.ax25_info.beacon_type.cubecontrol_3v3_current :field cubecontrol_5v_current: ax25_frame.payload.ax25_info.beacon_type.cubecontrol_5v_current :field cubecontrol_vbat_current: ax25_frame.payload.ax25_info.beacon_type.cubecontrol_vbat_current :field wheel1current: ax25_frame.payload.ax25_info.beacon_type.wheel1current :field wheel2current: ax25_frame.payload.ax25_info.beacon_type.wheel2current :field wheel3current: ax25_frame.payload.ax25_info.beacon_type.wheel3current :field cubestarcurrent: ax25_frame.payload.ax25_info.beacon_type.cubestarcurrent :field magnetorquercurrent: ax25_frame.payload.ax25_info.beacon_type.magnetorquercurrent :field cubestar_mcu_temperature: ax25_frame.payload.ax25_info.beacon_type.cubestar_mcu_temperature :field adcs_mcu_temperature: ax25_frame.payload.ax25_info.beacon_type.adcs_mcu_temperature :field magnetometer_temperature: ax25_frame.payload.ax25_info.beacon_type.magnetometer_temperature :field redundant_magnetometer_temperature: ax25_frame.payload.ax25_info.beacon_type.redundant_magnetometer_temperature :field xrate_sensor_temperature: ax25_frame.payload.ax25_info.beacon_type.xrate_sensor_temperature :field yrate_sensor_temperature: ax25_frame.payload.ax25_info.beacon_type.yrate_sensor_temperature :field zrate_sensor_temperature: ax25_frame.payload.ax25_info.beacon_type.zrate_sensor_temperature :field x_angular_rate: ax25_frame.payload.ax25_info.beacon_type.x_angular_rate :field y_angular_rate: ax25_frame.payload.ax25_info.beacon_type.y_angular_rate :field z_angular_rate: ax25_frame.payload.ax25_info.beacon_type.z_angular_rate :field x_wheelspeed: ax25_frame.payload.ax25_info.beacon_type.x_wheelspeed :field y_wheelspeed: ax25_frame.payload.ax25_info.beacon_type.y_wheelspeed :field z_wheelspeed: ax25_frame.payload.ax25_info.beacon_type.z_wheelspeed :field message: ax25_frame.payload.ax25_info.beacon_type.message Attention: `rpt_callsign` cannot be accessed because `rpt_instance` is an array of unknown size at the beginning of the parsing process! Left an example in here. .. seealso:: Source - https://gitlab.com/librespacefoundation/satnogs/satnogs-decoders/-/issues/57 """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Dhabisat.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Dhabisat.Ax25Header(self._io, self, self._root) _on = (self.ax25_header.ctl & 19) if _on == 0: self.payload = Dhabisat.IFrame(self._io, self, self._root) elif _on == 3: self.payload = Dhabisat.UiFrame(self._io, self, self._root) elif _on == 19: self.payload = Dhabisat.UiFrame(self._io, self, self._root) elif _on == 16: self.payload = Dhabisat.IFrame(self._io, self, self._root) elif _on == 18: self.payload = Dhabisat.IFrame(self._io, self, self._root) elif _on == 2: self.payload = Dhabisat.IFrame(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Dhabisat.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Dhabisat.SsidMask(self._io, self, self._root) self.src_callsign_raw = Dhabisat.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Dhabisat.SsidMask(self._io, self, self._root) if (self.src_ssid_raw.ssid_mask & 1) == 0: self.repeater = Dhabisat.Repeater(self._io, self, self._root) self.ctl = self._io.read_u1() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Dhabisat.DhabisatPayload(_io__raw_ax25_info, self, self._root) class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") if not ((self.callsign == u"A68MY ") or (self.callsign == u"A68MX ") or (self.callsign == u"A68KU ") or (self.callsign == u"NOCALL")) : raise kaitaistruct.ValidationNotAnyOfError(self.callsign, self._io, u"/types/callsign/seq/0") class DhabisatPayload(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dhabisat_header = Dhabisat.DhabisatHeaderT(self._io, self, self._root) _on = self._io.size() if _on == 187: self.beacon_type = Dhabisat.DhabisatBeacon(self._io, self, self._root) else: self.beacon_type = Dhabisat.DhabisatGenericPacket(self._io, self, self._root) class IFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.ax25_info = self._io.read_bytes_full() class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class DhabisatGenericPacket(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.message = (self._io.read_bytes_full()).decode(u"utf-8") class Repeaters(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_callsign_raw = Dhabisat.CallsignRaw(self._io, self, self._root) self.rpt_ssid_raw = Dhabisat.SsidMask(self._io, self, self._root) class Repeater(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_instance = [] i = 0 while True: _ = Dhabisat.Repeaters(self._io, self, self._root) self.rpt_instance.append(_) if (_.rpt_ssid_raw.ssid_mask & 1) == 1: break i += 1 class DhabisatBeacon(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(5)).decode(u"utf-8") self.obc_mode = self._io.read_u1() self.obc_reset_count = self._io.read_u4le() self.obc_timestamp = self._io.read_u4le() self.obc_uptime = self._io.read_u4le() self.subsystem_safety_criteria = self._io.read_u1() self.telemetry_distribution_counter = self._io.read_u4le() self.obc_temperature = self._io.read_u1() self.camera_voltage = self._io.read_u1() self.camera_current = self._io.read_u2le() self.battery_temperature = self._io.read_s2le() self.battery_voltage = self._io.read_s2le() self.adcs_5v_voltage = self._io.read_u2le() self.adcs_5v_current = self._io.read_u2le() self.adcs_5v_power = self._io.read_u2le() self.adcs_3v3_voltage = self._io.read_u2le() self.adcs_3v3_current = self._io.read_u2le() self.adcs_3v3_power = self._io.read_u2le() self.eps_mode = self._io.read_u1() self.eps_reset_cause = self._io.read_u1() self.eps_uptime = self._io.read_u4le() self.eps_error = self._io.read_u2le() self.eps_system_reset_counter_power_on = self._io.read_u2le() self.eps_system_reset_counter_watchdog = self._io.read_u2le() self.eps_system_reset_counter_commanded = self._io.read_u2le() self.eps_system_reset_counter_controller = self._io.read_u2le() self.eps_system_reset_counter_low_power = self._io.read_u2le() self.panel_xp_temperature = self._io.read_u1() self.panel_xn_temperature = self._io.read_u1() self.panel_yp_temperature = self._io.read_u1() self.panel_yn_temperature = self._io.read_u1() self.panel_zp_temperature = self._io.read_u1() self.panel_zn_temperature = self._io.read_u1() self.tx_pa_temp = self._io.read_s2le() self.attitude_estimation_mode = self._io.read_bits_int_le(4) self.attitude_control_mode = self._io.read_bits_int_le(4) self.adcs_run_mode = self._io.read_bits_int_le(2) self.asgp4_mode = self._io.read_bits_int_le(2) self.cubecontrol_signal_enabled = self._io.read_bits_int_le(1) != 0 self.cubecontrol_motor_enabled = self._io.read_bits_int_le(1) != 0 self.cubesense1_enabled = self._io.read_bits_int_le(1) != 0 self.cubesense2_enabled = self._io.read_bits_int_le(1) != 0 self.cubewheel1_enabled = self._io.read_bits_int_le(1) != 0 self.cubewheel2_enabled = self._io.read_bits_int_le(1) != 0 self.cubewheel3_enabled = self._io.read_bits_int_le(1) != 0 self.cubestar_enabled = self._io.read_bits_int_le(1) != 0 self.gps_receiver_enabled = self._io.read_bits_int_le(1) != 0 self.gps_lna_power_enabled = self._io.read_bits_int_le(1) != 0 self.motor_driver_enabled = self._io.read_bits_int_le(1) != 0 self.sun_is_above_local_horizon = self._io.read_bits_int_le(1) != 0 self.cubesense1_communications_error = self._io.read_bits_int_le(1) != 0 self.cubesense2_communications_error = self._io.read_bits_int_le(1) != 0 self.cubecontrol_signal_communications_error = self._io.read_bits_int_le(1) != 0 self.cubecontrol_motor_communications_error = self._io.read_bits_int_le(1) != 0 self.cubewheel1_communications_error = self._io.read_bits_int_le(1) != 0 self.cubewheel2_communications_error = self._io.read_bits_int_le(1) != 0 self.cubewheel3_communications_error = self._io.read_bits_int_le(1) != 0 self.cubestar_communications_error = self._io.read_bits_int_le(1) != 0 self.magnetometer_range_error = self._io.read_bits_int_le(1) != 0 self.cam1_sram_overcurrent_detected = self._io.read_bits_int_le(1) != 0 self.cam1_3v3_overcurrent_detected = self._io.read_bits_int_le(1) != 0 self.cam1_sensor_busy_error = self._io.read_bits_int_le(1) != 0 self.cam1_sensor_detection_error = self._io.read_bits_int_le(1) != 0 self.sun_sensor_range_error = self._io.read_bits_int_le(1) != 0 self.cam2_sram_overcurrent_detected = self._io.read_bits_int_le(1) != 0 self.cam2_3v3_overcurrent_detected = self._io.read_bits_int_le(1) != 0 self.cam2_sensor_busy_error = self._io.read_bits_int_le(1) != 0 self.cam2_sensor_detection_error = self._io.read_bits_int_le(1) != 0 self.nadir_sensor_range_error = self._io.read_bits_int_le(1) != 0 self.rate_sensor_range_error = self._io.read_bits_int_le(1) != 0 self.wheel_speed_range_error = self._io.read_bits_int_le(1) != 0 self.coarse_sun_sensor_error = self._io.read_bits_int_le(1) != 0 self.startracker_match_error = self._io.read_bits_int_le(1) != 0 self.startracker_overcurrent_detected = self._io.read_bits_int_le(1) != 0 self.orbit_parameters_are_invalid = self._io.read_bits_int_le(1) != 0 self.configuration_is_invalid = self._io.read_bits_int_le(1) != 0 self.control_mode_change_is_not_allowed = self._io.read_bits_int_le(1) != 0 self.estimator_change_is_not_allowed = self._io.read_bits_int_le(1) != 0 self.current_magnetometer_sampling_mode = self._io.read_bits_int_le(2) self.modelled_and_measured_magnetic_field_differs_in_size = self._io.read_bits_int_le(1) != 0 self.node_recovery_error = self._io.read_bits_int_le(1) != 0 self.cubesense1_runtime_error = self._io.read_bits_int_le(1) != 0 self.cubesense2_runtime_error = self._io.read_bits_int_le(1) != 0 self.cubecontrol_signal_runtime_error = self._io.read_bits_int_le(1) != 0 self.cubecontrol_motor_runtime_error = self._io.read_bits_int_le(1) != 0 self.cubewheel1_runtime_error = self._io.read_bits_int_le(1) != 0 self.cubewheel2_runtime_error = self._io.read_bits_int_le(1) != 0 self.cubewheel3_runtime_error = self._io.read_bits_int_le(1) != 0 self.cubestar_runtime_error = self._io.read_bits_int_le(1) != 0 self.magnetometer_error = self._io.read_bits_int_le(1) != 0 self.rate_sensor_failure = self._io.read_bits_int_le(1) != 0 self.padding_1 = self._io.read_bits_int_le(6) self._io.align_to_byte() self.padding_2 = self._io.read_u2le() self.padding_3 = self._io.read_u1() self.estimated_roll_angle = self._io.read_s2le() self.estimated_pitch_angle = self._io.read_s2le() self.estimated_yaw_angle = self._io.read_s2le() self.estimated_q1 = self._io.read_s2le() self.estimated_q2 = self._io.read_s2le() self.estimated_q3 = self._io.read_s2le() self.estimated_x_angular_rate = self._io.read_s2le() self.estimated_y_angular_rate = self._io.read_s2le() self.estimated_z_angular_rate = self._io.read_s2le() self.x_position = self._io.read_s2le() self.y_position = self._io.read_s2le() self.z_position = self._io.read_s2le() self.x_velocity = self._io.read_s2le() self.y_velocity = self._io.read_s2le() self.z_velocity = self._io.read_s2le() self.latitude = self._io.read_s2le() self.longitude = self._io.read_s2le() self.altitude = self._io.read_s2le() self.ecef_position_x = self._io.read_s2le() self.ecef_position_y = self._io.read_s2le() self.ecef_position_z = self._io.read_s2le() self.cubesense1_3v3_current = self._io.read_u2le() self.cubesense1_cam_sram_current = self._io.read_u2le() self.cubesense2_3v3_current = self._io.read_u2le() self.cubesense2_cam_sram_current = self._io.read_u2le() self.cubecontrol_3v3_current = self._io.read_u2le() self.cubecontrol_5v_current = self._io.read_u2le() self.cubecontrol_vbat_current = self._io.read_u2le() self.wheel1current = self._io.read_u2le() self.wheel2current = self._io.read_u2le() self.wheel3current = self._io.read_u2le() self.cubestarcurrent = self._io.read_u2le() self.magnetorquercurrent = self._io.read_u2le() self.cubestar_mcu_temperature = self._io.read_s2le() self.adcs_mcu_temperature = self._io.read_s2le() self.magnetometer_temperature = self._io.read_s2le() self.redundant_magnetometer_temperature = self._io.read_s2le() self.xrate_sensor_temperature = self._io.read_s2le() self.yrate_sensor_temperature = self._io.read_s2le() self.zrate_sensor_temperature = self._io.read_s2le() self.x_angular_rate = self._io.read_s2le() self.y_angular_rate = self._io.read_s2le() self.z_angular_rate = self._io.read_s2le() self.x_wheelspeed = self._io.read_s2le() self.y_wheelspeed = self._io.read_s2le() self.z_wheelspeed = self._io.read_s2le() class DhabisatHeaderT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.data_type = self._io.read_u1() self.time_stamp = self._io.read_u4le() self.file_index = self._io.read_u2le() self.interval = self._io.read_u2le() self.total_packets = self._io.read_u2le() self.current_packet = self._io.read_u2le() class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Dhabisat.Callsign(_io__raw_callsign_ror, self, self._root) @property def frame_length(self): if hasattr(self, '_m_frame_length'): return self._m_frame_length if hasattr(self, '_m_frame_length') else None self._m_frame_length = self._io.size() return self._m_frame_length if hasattr(self, '_m_frame_length') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/dhabisat.py
0.594434
0.203015
dhabisat.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Beesat(KaitaiStruct): """:field sync: master_frame.sync :field contrl0: master_frame.contrl0 :field contrl1: master_frame.contrl1 :field calsgn: master_frame.calsgn :field crcsgn: master_frame.crcsgn :field asm: master_frame.packet_type.transfer_frame0.asm :field tfvn: master_frame.packet_type.transfer_frame0.tfvn :field scid: master_frame.packet_type.transfer_frame0.scid :field vcid: master_frame.packet_type.transfer_frame0.vcid :field ocff: master_frame.packet_type.transfer_frame0.ocff :field mcfc: master_frame.packet_type.transfer_frame0.mcfc :field vcfc: master_frame.packet_type.transfer_frame0.vcfc :field tf_shf: master_frame.packet_type.transfer_frame0.tf_shf :field sync_flag: master_frame.packet_type.transfer_frame0.sync_flag :field pof: master_frame.packet_type.transfer_frame0.pof :field slid: master_frame.packet_type.transfer_frame0.slid :field fhp: master_frame.packet_type.transfer_frame0.fhp :field pvn: master_frame.packet_type.transfer_frame0.source_packet.pvn :field pt: master_frame.packet_type.transfer_frame0.source_packet.pt :field shf: master_frame.packet_type.transfer_frame0.source_packet.shf :field apid: master_frame.packet_type.transfer_frame0.source_packet.apid :field sequence_flag: master_frame.packet_type.transfer_frame0.source_packet.sequence_flag :field psc: master_frame.packet_type.transfer_frame0.source_packet.psc :field pdl: master_frame.packet_type.transfer_frame0.source_packet.pdl :field value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused00.value :field unused01_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused01.value :field unused02_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused02.value :field unused03_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused03.value :field unused04_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused04.value :field unused05_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused05.value :field unused06_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused06.value :field unused07_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused07.value :field unused08_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused08.value :field unused09_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused09.value :field unused10_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused10.value :field unused11_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused11.value :field unused12_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused12.value :field unused13_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused13.value :field unused14_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused14.value :field unused15_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused15.value :field unused16_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.unused16.value :field analog_value_01_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_01.value :field psant0: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psant0 :field psant1: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psant1 :field pscom0: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pscom0 :field pscom1: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pscom1 :field analog_value_02_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_02.value :field psuhf0: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psuhf0 :field psuhf1: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psuhf1 :field pstnc0: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pstnc0 :field pstnc1: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pstnc1 :field analog_value_03_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_03.value :field psgyro: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psgyro :field psmcsx: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psmcsx :field psmcsy: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psmcsy :field psmcsz: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psmcsz :field analog_value_04_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_04.value :field pswhee: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pswhee :field psobc0: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psobc0 :field psobc1: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psobc1 :field pspdh0: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pspdh0 :field analog_value_05_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_05.value :field pscam0: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pscam0 :field pssuns: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pssuns :field psmfs0: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psmfs0 :field psmfs1: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psmfs1 :field analog_value_06_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_06.value :field pstemp: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pstemp :field pscan0: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pscan0 :field pscan1: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pscan1 :field psccw0: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psccw0 :field analog_value_07_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_07.value :field psccw1: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.psccw1 :field ps5vcn: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.ps5vcn :field reserved00: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved00 :field pcbobc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcbobc :field analog_value_08_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_08.value :field pcbext: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcbext :field pcch00: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch00 :field pcch01: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch01 :field pcch02: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch02 :field analog_value_09_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_09.value :field pcch03: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch03 :field pcch04: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch04 :field pcch05: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch05 :field pcch06: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch06 :field analog_value_10: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_10 :field pcch07: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch07 :field pcch08: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch08 :field pcch09: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch09 :field pcch10: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch10 :field analog_value_11: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_11 :field pcch11: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch11 :field pcch12: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch12 :field pcch13: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch13 :field pcch14: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch14 :field analog_value_12_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_12.value :field pcch15: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch15 :field pcch16: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch16 :field pcch17: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch17 :field pcch18: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch18 :field analog_value_13_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_13.value :field pcch19: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch19 :field pcch20: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch20 :field pcch21: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch21 :field pcch22: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch22 :field analog_value_14_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_14.value :field pcch23: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch23 :field pcch24: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch24 :field pcch25: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch25 :field pcch26: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch26 :field analog_value_15_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_15.value :field tcrxid: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.tcrxid :field obcaid: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.obcaid :field tmtxrt: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.tmtxrt :field pcch27: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch27 :field analog_value_16_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_16.value :field pcch28: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch28 :field pcch29: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch29 :field pcch30: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch30 :field pcch31: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch31 :field ccticc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.ccticc :field cctctt: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.cctctt :field ccetcs: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.ccetcs :field cceimc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.cceimc :field ccettc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.ccettc :field ccettg: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.ccettg :field ccetcc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.ccetcc :field tcrxqu_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.tcrxqu.value :field tcfrcp: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.tcfrcp :field tmhkur: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.tmhkur :field cstutc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.cstutc :field cstsys: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.cstsys :field obcbad: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.obcbad :field ceswmc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.ceswmc :field reserved01: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved01 :field beacon: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.beacon :field obcabc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.obcabc :field modobc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.modobc :field ccecan: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.ccecan :field obccan: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.obccan :field pcsyst: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcsyst :field pcbcnt: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcbcnt :field pctxec: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pctxec :field pcrxec: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcrxec :field pcoffc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcoffc :field pcackc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcackc :field pcch32: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch32 :field pcch33: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch33 :field pcch34: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch34 :field pcch35: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch35 :field pcch36: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch36 :field pcch37: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch37 :field pcch38: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch38 :field pcch39: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch39 :field pcch40: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch40 :field pcch41: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.pcch41 :field reserved02: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved02 :field analog_value_17_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_17.value :field reserved03: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved03 :field analog_value_18_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_18.value :field reserved04: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved04 :field analog_value_19_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_19.value :field reserved05: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved05 :field acswhx: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acswhx :field acswhy: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acswhy :field acswhz: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acswhz :field acsq00_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsq00.value :field acsq01_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsq01.value :field acsq02_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsq02.value :field acsq03_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsq03.value :field acssux_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acssux.value :field acssuy_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acssuy.value :field acssuz_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acssuz.value :field acsm0x_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsm0x.value :field acsm0y_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsm0y.value :field acsm0z_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsm0z.value :field acsm1x_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsm1x.value :field acsm1y_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsm1y.value :field acsm1z_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsm1z.value :field acsmod: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsmod :field acsgsc: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsgsc :field acsshd: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsshd :field reserved06: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved06 :field acserr: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acserr :field acsgyx_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsgyx.value :field acsgyy_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsgyy.value :field acsgyz_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.acsgyz.value :field analog_value_20_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_20.value :field reserved07: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved07 :field analog_value_21_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_21.value :field reserved08: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved08 :field analog_value_22_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_22.value :field reserved09: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved09 :field analog_value_23_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_23.value :field reserved10: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved10 :field analog_value_24_value: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.analog_value_24.value :field reserved11: master_frame.packet_type.transfer_frame0.source_packet.telemetry_values.reserved11 :field fecf: master_frame.packet_type.transfer_frame0.fecf :field two_byte_combined: master_frame.packet_type.transfer_frame0.two_byte_combined :field transfer_frame1_asm: master_frame.packet_type.transfer_frame1.asm :field transfer_frame1_tfvn: master_frame.packet_type.transfer_frame1.tfvn :field transfer_frame1_scid: master_frame.packet_type.transfer_frame1.scid :field transfer_frame1_vcid: master_frame.packet_type.transfer_frame1.vcid :field transfer_frame1_ocff: master_frame.packet_type.transfer_frame1.ocff :field transfer_frame1_mcfc: master_frame.packet_type.transfer_frame1.mcfc :field transfer_frame1_vcfc: master_frame.packet_type.transfer_frame1.vcfc :field transfer_frame1_tf_shf: master_frame.packet_type.transfer_frame1.tf_shf :field transfer_frame1_sync_flag: master_frame.packet_type.transfer_frame1.sync_flag :field transfer_frame1_pof: master_frame.packet_type.transfer_frame1.pof :field transfer_frame1_slid: master_frame.packet_type.transfer_frame1.slid :field transfer_frame1_fhp: master_frame.packet_type.transfer_frame1.fhp :field transfer_frame1_pvn: master_frame.packet_type.transfer_frame1.source_packet.pvn :field transfer_frame1_pt: master_frame.packet_type.transfer_frame1.source_packet.pt :field transfer_frame1_shf: master_frame.packet_type.transfer_frame1.source_packet.shf :field transfer_frame1_apid: master_frame.packet_type.transfer_frame1.source_packet.apid :field transfer_frame1_sequence_flag: master_frame.packet_type.transfer_frame1.source_packet.sequence_flag :field transfer_frame1_psc: master_frame.packet_type.transfer_frame1.source_packet.psc :field transfer_frame1_pdl: master_frame.packet_type.transfer_frame1.source_packet.pdl :field transfer_frame1_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused00.value :field transfer_frame1_unused01_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused01.value :field transfer_frame1_unused02_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused02.value :field transfer_frame1_unused03_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused03.value :field transfer_frame1_unused04_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused04.value :field transfer_frame1_unused05_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused05.value :field transfer_frame1_unused06_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused06.value :field transfer_frame1_unused07_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused07.value :field transfer_frame1_unused08_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused08.value :field transfer_frame1_unused09_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused09.value :field transfer_frame1_unused10_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused10.value :field transfer_frame1_unused11_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused11.value :field transfer_frame1_unused12_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused12.value :field transfer_frame1_unused13_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused13.value :field transfer_frame1_unused14_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused14.value :field transfer_frame1_unused15_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused15.value :field transfer_frame1_unused16_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.unused16.value :field transfer_frame1_analog_value_01_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_01.value :field transfer_frame1_psant0: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psant0 :field transfer_frame1_psant1: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psant1 :field transfer_frame1_pscom0: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pscom0 :field transfer_frame1_pscom1: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pscom1 :field transfer_frame1_analog_value_02_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_02.value :field transfer_frame1_psuhf0: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psuhf0 :field transfer_frame1_psuhf1: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psuhf1 :field transfer_frame1_pstnc0: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pstnc0 :field transfer_frame1_pstnc1: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pstnc1 :field transfer_frame1_analog_value_03_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_03.value :field transfer_frame1_psgyro: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psgyro :field transfer_frame1_psmcsx: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psmcsx :field transfer_frame1_psmcsy: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psmcsy :field transfer_frame1_psmcsz: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psmcsz :field transfer_frame1_analog_value_04_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_04.value :field transfer_frame1_pswhee: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pswhee :field transfer_frame1_psobc0: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psobc0 :field transfer_frame1_psobc1: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psobc1 :field transfer_frame1_pspdh0: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pspdh0 :field transfer_frame1_analog_value_05_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_05.value :field transfer_frame1_pscam0: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pscam0 :field transfer_frame1_pssuns: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pssuns :field transfer_frame1_psmfs0: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psmfs0 :field transfer_frame1_psmfs1: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psmfs1 :field transfer_frame1_analog_value_06_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_06.value :field transfer_frame1_pstemp: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pstemp :field transfer_frame1_pscan0: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pscan0 :field transfer_frame1_pscan1: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pscan1 :field transfer_frame1_psccw0: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psccw0 :field transfer_frame1_analog_value_07_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_07.value :field transfer_frame1_psccw1: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.psccw1 :field transfer_frame1_ps5vcn: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.ps5vcn :field transfer_frame1_reserved00: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved00 :field transfer_frame1_pcbobc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcbobc :field transfer_frame1_analog_value_08_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_08.value :field transfer_frame1_pcbext: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcbext :field transfer_frame1_pcch00: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch00 :field transfer_frame1_pcch01: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch01 :field transfer_frame1_pcch02: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch02 :field transfer_frame1_analog_value_09_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_09.value :field transfer_frame1_pcch03: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch03 :field transfer_frame1_pcch04: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch04 :field transfer_frame1_pcch05: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch05 :field transfer_frame1_pcch06: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch06 :field transfer_frame1_analog_value_10: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_10 :field transfer_frame1_pcch07: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch07 :field transfer_frame1_pcch08: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch08 :field transfer_frame1_pcch09: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch09 :field transfer_frame1_pcch10: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch10 :field transfer_frame1_analog_value_11: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_11 :field transfer_frame1_pcch11: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch11 :field transfer_frame1_pcch12: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch12 :field transfer_frame1_pcch13: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch13 :field transfer_frame1_pcch14: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch14 :field transfer_frame1_analog_value_12_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_12.value :field transfer_frame1_pcch15: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch15 :field transfer_frame1_pcch16: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch16 :field transfer_frame1_pcch17: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch17 :field transfer_frame1_pcch18: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch18 :field transfer_frame1_analog_value_13_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_13.value :field transfer_frame1_pcch19: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch19 :field transfer_frame1_pcch20: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch20 :field transfer_frame1_pcch21: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch21 :field transfer_frame1_pcch22: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch22 :field transfer_frame1_analog_value_14_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_14.value :field transfer_frame1_pcch23: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch23 :field transfer_frame1_pcch24: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch24 :field transfer_frame1_pcch25: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch25 :field transfer_frame1_pcch26: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch26 :field transfer_frame1_analog_value_15_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_15.value :field transfer_frame1_tcrxid: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.tcrxid :field transfer_frame1_obcaid: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.obcaid :field transfer_frame1_tmtxrt: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.tmtxrt :field transfer_frame1_pcch27: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch27 :field transfer_frame1_analog_value_16_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_16.value :field transfer_frame1_pcch28: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch28 :field transfer_frame1_pcch29: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch29 :field transfer_frame1_pcch30: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch30 :field transfer_frame1_pcch31: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch31 :field transfer_frame1_ccticc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.ccticc :field transfer_frame1_cctctt: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.cctctt :field transfer_frame1_ccetcs: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.ccetcs :field transfer_frame1_cceimc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.cceimc :field transfer_frame1_ccettc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.ccettc :field transfer_frame1_ccettg: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.ccettg :field transfer_frame1_ccetcc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.ccetcc :field transfer_frame1_tcrxqu_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.tcrxqu.value :field transfer_frame1_tcfrcp: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.tcfrcp :field transfer_frame1_tmhkur: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.tmhkur :field transfer_frame1_cstutc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.cstutc :field transfer_frame1_cstsys: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.cstsys :field transfer_frame1_obcbad: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.obcbad :field transfer_frame1_ceswmc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.ceswmc :field transfer_frame1_reserved01: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved01 :field transfer_frame1_beacon: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.beacon :field transfer_frame1_obcabc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.obcabc :field transfer_frame1_modobc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.modobc :field transfer_frame1_ccecan: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.ccecan :field transfer_frame1_obccan: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.obccan :field transfer_frame1_pcsyst: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcsyst :field transfer_frame1_pcbcnt: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcbcnt :field transfer_frame1_pctxec: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pctxec :field transfer_frame1_pcrxec: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcrxec :field transfer_frame1_pcoffc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcoffc :field transfer_frame1_pcackc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcackc :field transfer_frame1_pcch32: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch32 :field transfer_frame1_pcch33: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch33 :field transfer_frame1_pcch34: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch34 :field transfer_frame1_pcch35: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch35 :field transfer_frame1_pcch36: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch36 :field transfer_frame1_pcch37: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch37 :field transfer_frame1_pcch38: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch38 :field transfer_frame1_pcch39: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch39 :field transfer_frame1_pcch40: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch40 :field transfer_frame1_pcch41: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.pcch41 :field transfer_frame1_reserved02: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved02 :field transfer_frame1_analog_value_17_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_17.value :field transfer_frame1_reserved03: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved03 :field transfer_frame1_analog_value_18_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_18.value :field transfer_frame1_reserved04: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved04 :field transfer_frame1_analog_value_19_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_19.value :field transfer_frame1_reserved05: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved05 :field transfer_frame1_acswhx: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acswhx :field transfer_frame1_acswhy: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acswhy :field transfer_frame1_acswhz: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acswhz :field transfer_frame1_acsq00_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsq00.value :field transfer_frame1_acsq01_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsq01.value :field transfer_frame1_acsq02_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsq02.value :field transfer_frame1_acsq03_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsq03.value :field transfer_frame1_acssux_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acssux.value :field transfer_frame1_acssuy_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acssuy.value :field transfer_frame1_acssuz_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acssuz.value :field transfer_frame1_acsm0x_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsm0x.value :field transfer_frame1_acsm0y_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsm0y.value :field transfer_frame1_acsm0z_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsm0z.value :field transfer_frame1_acsm1x_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsm1x.value :field transfer_frame1_acsm1y_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsm1y.value :field transfer_frame1_acsm1z_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsm1z.value :field transfer_frame1_acsmod: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsmod :field transfer_frame1_acsgsc: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsgsc :field transfer_frame1_acsshd: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsshd :field transfer_frame1_reserved06: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved06 :field transfer_frame1_acserr: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acserr :field transfer_frame1_acsgyx_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsgyx.value :field transfer_frame1_acsgyy_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsgyy.value :field transfer_frame1_acsgyz_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.acsgyz.value :field transfer_frame1_analog_value_20_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_20.value :field transfer_frame1_reserved07: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved07 :field transfer_frame1_analog_value_21_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_21.value :field transfer_frame1_reserved08: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved08 :field transfer_frame1_analog_value_22_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_22.value :field transfer_frame1_reserved09: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved09 :field transfer_frame1_analog_value_23_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_23.value :field transfer_frame1_reserved10: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved10 :field transfer_frame1_analog_value_24_value: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.analog_value_24.value :field transfer_frame1_reserved11: master_frame.packet_type.transfer_frame1.source_packet.telemetry_values.reserved11 :field transfer_frame1_fecf: master_frame.packet_type.transfer_frame1.fecf :field transfer_frame1_two_byte_combined: master_frame.packet_type.transfer_frame1.two_byte_combined :field transfer_frame2_asm: master_frame.packet_type.transfer_frame2.asm :field transfer_frame2_tfvn: master_frame.packet_type.transfer_frame2.tfvn :field transfer_frame2_scid: master_frame.packet_type.transfer_frame2.scid :field transfer_frame2_vcid: master_frame.packet_type.transfer_frame2.vcid :field transfer_frame2_ocff: master_frame.packet_type.transfer_frame2.ocff :field transfer_frame2_mcfc: master_frame.packet_type.transfer_frame2.mcfc :field transfer_frame2_vcfc: master_frame.packet_type.transfer_frame2.vcfc :field transfer_frame2_tf_shf: master_frame.packet_type.transfer_frame2.tf_shf :field transfer_frame2_sync_flag: master_frame.packet_type.transfer_frame2.sync_flag :field transfer_frame2_pof: master_frame.packet_type.transfer_frame2.pof :field transfer_frame2_slid: master_frame.packet_type.transfer_frame2.slid :field transfer_frame2_fhp: master_frame.packet_type.transfer_frame2.fhp :field transfer_frame2_pvn: master_frame.packet_type.transfer_frame2.source_packet.pvn :field transfer_frame2_pt: master_frame.packet_type.transfer_frame2.source_packet.pt :field transfer_frame2_shf: master_frame.packet_type.transfer_frame2.source_packet.shf :field transfer_frame2_apid: master_frame.packet_type.transfer_frame2.source_packet.apid :field transfer_frame2_sequence_flag: master_frame.packet_type.transfer_frame2.source_packet.sequence_flag :field transfer_frame2_psc: master_frame.packet_type.transfer_frame2.source_packet.psc :field transfer_frame2_pdl: master_frame.packet_type.transfer_frame2.source_packet.pdl :field transfer_frame2_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused00.value :field transfer_frame2_unused01_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused01.value :field transfer_frame2_unused02_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused02.value :field transfer_frame2_unused03_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused03.value :field transfer_frame2_unused04_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused04.value :field transfer_frame2_unused05_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused05.value :field transfer_frame2_unused06_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused06.value :field transfer_frame2_unused07_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused07.value :field transfer_frame2_unused08_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused08.value :field transfer_frame2_unused09_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused09.value :field transfer_frame2_unused10_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused10.value :field transfer_frame2_unused11_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused11.value :field transfer_frame2_unused12_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused12.value :field transfer_frame2_unused13_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused13.value :field transfer_frame2_unused14_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused14.value :field transfer_frame2_unused15_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused15.value :field transfer_frame2_unused16_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.unused16.value :field transfer_frame2_analog_value_01_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_01.value :field transfer_frame2_psant0: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psant0 :field transfer_frame2_psant1: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psant1 :field transfer_frame2_pscom0: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pscom0 :field transfer_frame2_pscom1: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pscom1 :field transfer_frame2_analog_value_02_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_02.value :field transfer_frame2_psuhf0: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psuhf0 :field transfer_frame2_psuhf1: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psuhf1 :field transfer_frame2_pstnc0: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pstnc0 :field transfer_frame2_pstnc1: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pstnc1 :field transfer_frame2_analog_value_03_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_03.value :field transfer_frame2_psgyro: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psgyro :field transfer_frame2_psmcsx: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psmcsx :field transfer_frame2_psmcsy: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psmcsy :field transfer_frame2_psmcsz: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psmcsz :field transfer_frame2_analog_value_04_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_04.value :field transfer_frame2_pswhee: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pswhee :field transfer_frame2_psobc0: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psobc0 :field transfer_frame2_psobc1: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psobc1 :field transfer_frame2_pspdh0: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pspdh0 :field transfer_frame2_analog_value_05_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_05.value :field transfer_frame2_pscam0: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pscam0 :field transfer_frame2_pssuns: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pssuns :field transfer_frame2_psmfs0: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psmfs0 :field transfer_frame2_psmfs1: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psmfs1 :field transfer_frame2_analog_value_06_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_06.value :field transfer_frame2_pstemp: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pstemp :field transfer_frame2_pscan0: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pscan0 :field transfer_frame2_pscan1: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pscan1 :field transfer_frame2_psccw0: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psccw0 :field transfer_frame2_analog_value_07_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_07.value :field transfer_frame2_psccw1: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.psccw1 :field transfer_frame2_ps5vcn: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.ps5vcn :field transfer_frame2_reserved00: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved00 :field transfer_frame2_pcbobc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcbobc :field transfer_frame2_analog_value_08_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_08.value :field transfer_frame2_pcbext: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcbext :field transfer_frame2_pcch00: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch00 :field transfer_frame2_pcch01: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch01 :field transfer_frame2_pcch02: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch02 :field transfer_frame2_analog_value_09_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_09.value :field transfer_frame2_pcch03: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch03 :field transfer_frame2_pcch04: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch04 :field transfer_frame2_pcch05: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch05 :field transfer_frame2_pcch06: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch06 :field transfer_frame2_analog_value_10: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_10 :field transfer_frame2_pcch07: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch07 :field transfer_frame2_pcch08: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch08 :field transfer_frame2_pcch09: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch09 :field transfer_frame2_pcch10: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch10 :field transfer_frame2_analog_value_11: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_11 :field transfer_frame2_pcch11: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch11 :field transfer_frame2_pcch12: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch12 :field transfer_frame2_pcch13: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch13 :field transfer_frame2_pcch14: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch14 :field transfer_frame2_analog_value_12_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_12.value :field transfer_frame2_pcch15: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch15 :field transfer_frame2_pcch16: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch16 :field transfer_frame2_pcch17: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch17 :field transfer_frame2_pcch18: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch18 :field transfer_frame2_analog_value_13_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_13.value :field transfer_frame2_pcch19: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch19 :field transfer_frame2_pcch20: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch20 :field transfer_frame2_pcch21: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch21 :field transfer_frame2_pcch22: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch22 :field transfer_frame2_analog_value_14_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_14.value :field transfer_frame2_pcch23: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch23 :field transfer_frame2_pcch24: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch24 :field transfer_frame2_pcch25: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch25 :field transfer_frame2_pcch26: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch26 :field transfer_frame2_analog_value_15_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_15.value :field transfer_frame2_tcrxid: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.tcrxid :field transfer_frame2_obcaid: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.obcaid :field transfer_frame2_tmtxrt: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.tmtxrt :field transfer_frame2_pcch27: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch27 :field transfer_frame2_analog_value_16_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_16.value :field transfer_frame2_pcch28: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch28 :field transfer_frame2_pcch29: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch29 :field transfer_frame2_pcch30: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch30 :field transfer_frame2_pcch31: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch31 :field transfer_frame2_ccticc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.ccticc :field transfer_frame2_cctctt: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.cctctt :field transfer_frame2_ccetcs: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.ccetcs :field transfer_frame2_cceimc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.cceimc :field transfer_frame2_ccettc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.ccettc :field transfer_frame2_ccettg: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.ccettg :field transfer_frame2_ccetcc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.ccetcc :field transfer_frame2_tcrxqu_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.tcrxqu.value :field transfer_frame2_tcfrcp: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.tcfrcp :field transfer_frame2_tmhkur: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.tmhkur :field transfer_frame2_cstutc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.cstutc :field transfer_frame2_cstsys: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.cstsys :field transfer_frame2_obcbad: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.obcbad :field transfer_frame2_ceswmc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.ceswmc :field transfer_frame2_reserved01: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved01 :field transfer_frame2_beacon: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.beacon :field transfer_frame2_obcabc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.obcabc :field transfer_frame2_modobc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.modobc :field transfer_frame2_ccecan: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.ccecan :field transfer_frame2_obccan: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.obccan :field transfer_frame2_pcsyst: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcsyst :field transfer_frame2_pcbcnt: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcbcnt :field transfer_frame2_pctxec: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pctxec :field transfer_frame2_pcrxec: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcrxec :field transfer_frame2_pcoffc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcoffc :field transfer_frame2_pcackc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcackc :field transfer_frame2_pcch32: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch32 :field transfer_frame2_pcch33: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch33 :field transfer_frame2_pcch34: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch34 :field transfer_frame2_pcch35: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch35 :field transfer_frame2_pcch36: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch36 :field transfer_frame2_pcch37: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch37 :field transfer_frame2_pcch38: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch38 :field transfer_frame2_pcch39: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch39 :field transfer_frame2_pcch40: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch40 :field transfer_frame2_pcch41: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.pcch41 :field transfer_frame2_reserved02: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved02 :field transfer_frame2_analog_value_17_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_17.value :field transfer_frame2_reserved03: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved03 :field transfer_frame2_analog_value_18_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_18.value :field transfer_frame2_reserved04: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved04 :field transfer_frame2_analog_value_19_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_19.value :field transfer_frame2_reserved05: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved05 :field transfer_frame2_acswhx: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acswhx :field transfer_frame2_acswhy: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acswhy :field transfer_frame2_acswhz: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acswhz :field transfer_frame2_acsq00_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsq00.value :field transfer_frame2_acsq01_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsq01.value :field transfer_frame2_acsq02_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsq02.value :field transfer_frame2_acsq03_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsq03.value :field transfer_frame2_acssux_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acssux.value :field transfer_frame2_acssuy_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acssuy.value :field transfer_frame2_acssuz_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acssuz.value :field transfer_frame2_acsm0x_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsm0x.value :field transfer_frame2_acsm0y_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsm0y.value :field transfer_frame2_acsm0z_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsm0z.value :field transfer_frame2_acsm1x_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsm1x.value :field transfer_frame2_acsm1y_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsm1y.value :field transfer_frame2_acsm1z_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsm1z.value :field transfer_frame2_acsmod: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsmod :field transfer_frame2_acsgsc: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsgsc :field transfer_frame2_acsshd: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsshd :field transfer_frame2_reserved06: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved06 :field transfer_frame2_acserr: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acserr :field transfer_frame2_acsgyx_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsgyx.value :field transfer_frame2_acsgyy_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsgyy.value :field transfer_frame2_acsgyz_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.acsgyz.value :field transfer_frame2_analog_value_20_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_20.value :field transfer_frame2_reserved07: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved07 :field transfer_frame2_analog_value_21_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_21.value :field transfer_frame2_reserved08: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved08 :field transfer_frame2_analog_value_22_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_22.value :field transfer_frame2_reserved09: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved09 :field transfer_frame2_analog_value_23_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_23.value :field transfer_frame2_reserved10: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved10 :field transfer_frame2_analog_value_24_value: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.analog_value_24.value :field transfer_frame2_reserved11: master_frame.packet_type.transfer_frame2.source_packet.telemetry_values.reserved11 :field transfer_frame2_fecf: master_frame.packet_type.transfer_frame2.fecf :field transfer_frame2_two_byte_combined: master_frame.packet_type.transfer_frame2.two_byte_combined :field transfer_frame3_asm: master_frame.packet_type.transfer_frame3.asm :field transfer_frame3_tfvn: master_frame.packet_type.transfer_frame3.tfvn :field transfer_frame3_scid: master_frame.packet_type.transfer_frame3.scid :field transfer_frame3_vcid: master_frame.packet_type.transfer_frame3.vcid :field transfer_frame3_ocff: master_frame.packet_type.transfer_frame3.ocff :field transfer_frame3_mcfc: master_frame.packet_type.transfer_frame3.mcfc :field transfer_frame3_vcfc: master_frame.packet_type.transfer_frame3.vcfc :field transfer_frame3_tf_shf: master_frame.packet_type.transfer_frame3.tf_shf :field transfer_frame3_sync_flag: master_frame.packet_type.transfer_frame3.sync_flag :field transfer_frame3_pof: master_frame.packet_type.transfer_frame3.pof :field transfer_frame3_slid: master_frame.packet_type.transfer_frame3.slid :field transfer_frame3_fhp: master_frame.packet_type.transfer_frame3.fhp :field transfer_frame3_pvn: master_frame.packet_type.transfer_frame3.source_packet.pvn :field transfer_frame3_pt: master_frame.packet_type.transfer_frame3.source_packet.pt :field transfer_frame3_shf: master_frame.packet_type.transfer_frame3.source_packet.shf :field transfer_frame3_apid: master_frame.packet_type.transfer_frame3.source_packet.apid :field transfer_frame3_sequence_flag: master_frame.packet_type.transfer_frame3.source_packet.sequence_flag :field transfer_frame3_psc: master_frame.packet_type.transfer_frame3.source_packet.psc :field transfer_frame3_pdl: master_frame.packet_type.transfer_frame3.source_packet.pdl :field transfer_frame3_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused00.value :field transfer_frame3_unused01_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused01.value :field transfer_frame3_unused02_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused02.value :field transfer_frame3_unused03_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused03.value :field transfer_frame3_unused04_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused04.value :field transfer_frame3_unused05_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused05.value :field transfer_frame3_unused06_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused06.value :field transfer_frame3_unused07_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused07.value :field transfer_frame3_unused08_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused08.value :field transfer_frame3_unused09_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused09.value :field transfer_frame3_unused10_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused10.value :field transfer_frame3_unused11_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused11.value :field transfer_frame3_unused12_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused12.value :field transfer_frame3_unused13_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused13.value :field transfer_frame3_unused14_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused14.value :field transfer_frame3_unused15_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused15.value :field transfer_frame3_unused16_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.unused16.value :field transfer_frame3_analog_value_01_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_01.value :field transfer_frame3_psant0: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psant0 :field transfer_frame3_psant1: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psant1 :field transfer_frame3_pscom0: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pscom0 :field transfer_frame3_pscom1: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pscom1 :field transfer_frame3_analog_value_02_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_02.value :field transfer_frame3_psuhf0: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psuhf0 :field transfer_frame3_psuhf1: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psuhf1 :field transfer_frame3_pstnc0: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pstnc0 :field transfer_frame3_pstnc1: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pstnc1 :field transfer_frame3_analog_value_03_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_03.value :field transfer_frame3_psgyro: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psgyro :field transfer_frame3_psmcsx: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psmcsx :field transfer_frame3_psmcsy: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psmcsy :field transfer_frame3_psmcsz: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psmcsz :field transfer_frame3_analog_value_04_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_04.value :field transfer_frame3_pswhee: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pswhee :field transfer_frame3_psobc0: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psobc0 :field transfer_frame3_psobc1: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psobc1 :field transfer_frame3_pspdh0: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pspdh0 :field transfer_frame3_analog_value_05_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_05.value :field transfer_frame3_pscam0: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pscam0 :field transfer_frame3_pssuns: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pssuns :field transfer_frame3_psmfs0: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psmfs0 :field transfer_frame3_psmfs1: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psmfs1 :field transfer_frame3_analog_value_06_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_06.value :field transfer_frame3_pstemp: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pstemp :field transfer_frame3_pscan0: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pscan0 :field transfer_frame3_pscan1: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pscan1 :field transfer_frame3_psccw0: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psccw0 :field transfer_frame3_analog_value_07_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_07.value :field transfer_frame3_psccw1: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.psccw1 :field transfer_frame3_ps5vcn: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.ps5vcn :field transfer_frame3_reserved00: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved00 :field transfer_frame3_pcbobc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcbobc :field transfer_frame3_analog_value_08_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_08.value :field transfer_frame3_pcbext: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcbext :field transfer_frame3_pcch00: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch00 :field transfer_frame3_pcch01: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch01 :field transfer_frame3_pcch02: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch02 :field transfer_frame3_analog_value_09_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_09.value :field transfer_frame3_pcch03: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch03 :field transfer_frame3_pcch04: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch04 :field transfer_frame3_pcch05: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch05 :field transfer_frame3_pcch06: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch06 :field transfer_frame3_analog_value_10: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_10 :field transfer_frame3_pcch07: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch07 :field transfer_frame3_pcch08: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch08 :field transfer_frame3_pcch09: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch09 :field transfer_frame3_pcch10: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch10 :field transfer_frame3_analog_value_11: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_11 :field transfer_frame3_pcch11: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch11 :field transfer_frame3_pcch12: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch12 :field transfer_frame3_pcch13: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch13 :field transfer_frame3_pcch14: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch14 :field transfer_frame3_analog_value_12_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_12.value :field transfer_frame3_pcch15: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch15 :field transfer_frame3_pcch16: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch16 :field transfer_frame3_pcch17: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch17 :field transfer_frame3_pcch18: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch18 :field transfer_frame3_analog_value_13_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_13.value :field transfer_frame3_pcch19: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch19 :field transfer_frame3_pcch20: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch20 :field transfer_frame3_pcch21: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch21 :field transfer_frame3_pcch22: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch22 :field transfer_frame3_analog_value_14_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_14.value :field transfer_frame3_pcch23: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch23 :field transfer_frame3_pcch24: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch24 :field transfer_frame3_pcch25: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch25 :field transfer_frame3_pcch26: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch26 :field transfer_frame3_analog_value_15_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_15.value :field transfer_frame3_tcrxid: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.tcrxid :field transfer_frame3_obcaid: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.obcaid :field transfer_frame3_tmtxrt: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.tmtxrt :field transfer_frame3_pcch27: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch27 :field transfer_frame3_analog_value_16_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_16.value :field transfer_frame3_pcch28: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch28 :field transfer_frame3_pcch29: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch29 :field transfer_frame3_pcch30: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch30 :field transfer_frame3_pcch31: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch31 :field transfer_frame3_ccticc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.ccticc :field transfer_frame3_cctctt: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.cctctt :field transfer_frame3_ccetcs: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.ccetcs :field transfer_frame3_cceimc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.cceimc :field transfer_frame3_ccettc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.ccettc :field transfer_frame3_ccettg: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.ccettg :field transfer_frame3_ccetcc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.ccetcc :field transfer_frame3_tcrxqu_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.tcrxqu.value :field transfer_frame3_tcfrcp: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.tcfrcp :field transfer_frame3_tmhkur: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.tmhkur :field transfer_frame3_cstutc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.cstutc :field transfer_frame3_cstsys: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.cstsys :field transfer_frame3_obcbad: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.obcbad :field transfer_frame3_ceswmc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.ceswmc :field transfer_frame3_reserved01: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved01 :field transfer_frame3_beacon: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.beacon :field transfer_frame3_obcabc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.obcabc :field transfer_frame3_modobc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.modobc :field transfer_frame3_ccecan: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.ccecan :field transfer_frame3_obccan: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.obccan :field transfer_frame3_pcsyst: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcsyst :field transfer_frame3_pcbcnt: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcbcnt :field transfer_frame3_pctxec: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pctxec :field transfer_frame3_pcrxec: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcrxec :field transfer_frame3_pcoffc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcoffc :field transfer_frame3_pcackc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcackc :field transfer_frame3_pcch32: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch32 :field transfer_frame3_pcch33: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch33 :field transfer_frame3_pcch34: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch34 :field transfer_frame3_pcch35: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch35 :field transfer_frame3_pcch36: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch36 :field transfer_frame3_pcch37: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch37 :field transfer_frame3_pcch38: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch38 :field transfer_frame3_pcch39: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch39 :field transfer_frame3_pcch40: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch40 :field transfer_frame3_pcch41: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.pcch41 :field transfer_frame3_reserved02: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved02 :field transfer_frame3_analog_value_17_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_17.value :field transfer_frame3_reserved03: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved03 :field transfer_frame3_analog_value_18_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_18.value :field transfer_frame3_reserved04: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved04 :field transfer_frame3_analog_value_19_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_19.value :field transfer_frame3_reserved05: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved05 :field transfer_frame3_acswhx: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acswhx :field transfer_frame3_acswhy: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acswhy :field transfer_frame3_acswhz: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acswhz :field transfer_frame3_acsq00_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsq00.value :field transfer_frame3_acsq01_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsq01.value :field transfer_frame3_acsq02_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsq02.value :field transfer_frame3_acsq03_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsq03.value :field transfer_frame3_acssux_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acssux.value :field transfer_frame3_acssuy_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acssuy.value :field transfer_frame3_acssuz_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acssuz.value :field transfer_frame3_acsm0x_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsm0x.value :field transfer_frame3_acsm0y_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsm0y.value :field transfer_frame3_acsm0z_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsm0z.value :field transfer_frame3_acsm1x_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsm1x.value :field transfer_frame3_acsm1y_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsm1y.value :field transfer_frame3_acsm1z_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsm1z.value :field transfer_frame3_acsmod: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsmod :field transfer_frame3_acsgsc: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsgsc :field transfer_frame3_acsshd: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsshd :field transfer_frame3_reserved06: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved06 :field transfer_frame3_acserr: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acserr :field transfer_frame3_acsgyx_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsgyx.value :field transfer_frame3_acsgyy_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsgyy.value :field transfer_frame3_acsgyz_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.acsgyz.value :field transfer_frame3_analog_value_20_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_20.value :field transfer_frame3_reserved07: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved07 :field transfer_frame3_analog_value_21_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_21.value :field transfer_frame3_reserved08: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved08 :field transfer_frame3_analog_value_22_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_22.value :field transfer_frame3_reserved09: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved09 :field transfer_frame3_analog_value_23_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_23.value :field transfer_frame3_reserved10: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved10 :field transfer_frame3_analog_value_24_value: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.analog_value_24.value :field transfer_frame3_reserved11: master_frame.packet_type.transfer_frame3.source_packet.telemetry_values.reserved11 :field transfer_frame3_fecf: master_frame.packet_type.transfer_frame3.fecf :field transfer_frame3_two_byte_combined: master_frame.packet_type.transfer_frame3.two_byte_combined :field count: master_frame.packet_type.digipeater_info_block.count :field byte_count: master_frame.packet_type.digipeater_info_block.byte_count :field local_time: master_frame.packet_type.digipeater_info_block.local_time :field calsgn_snd: master_frame.packet_type.digipeater_info_block.calsgn_snd :field long_qth_field: master_frame.packet_type.digipeater_info_block.long_qth_field :field lat_qth_field: master_frame.packet_type.digipeater_info_block.lat_qth_field :field long_qth_square: master_frame.packet_type.digipeater_info_block.long_qth_square :field lat_qth_square: master_frame.packet_type.digipeater_info_block.lat_qth_square :field long_qth_subsquare: master_frame.packet_type.digipeater_info_block.long_qth_subsquare :field lat_qth_subsquare: master_frame.packet_type.digipeater_info_block.lat_qth_subsquare :field message: master_frame.packet_type.digipeater_message.message .. seealso:: 'https://www.tu.berlin/en/raumfahrttechnik/institute/amateur-radio' 'https://www.static.tu.berlin/fileadmin/www/10002275/Amateur_Radio/BEESAT-1_Digipeater-Format.ods' 'https://www.static.tu.berlin/fileadmin/www/10002275/Amateur_Radio/BEESAT-1_telemetry_format.pdf' """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.master_frame = Beesat.MasterFrame(self._io, self, self._root) class SourcePacket(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pvn = self._io.read_bits_int_be(3) if not self.pvn == 0: raise kaitaistruct.ValidationNotEqualError(0, self.pvn, self._io, u"/types/source_packet/seq/0") self.pt = self._io.read_bits_int_be(1) != 0 if not self.pt == False: raise kaitaistruct.ValidationNotEqualError(False, self.pt, self._io, u"/types/source_packet/seq/1") self.shf = self._io.read_bits_int_be(1) != 0 if not self.shf == False: raise kaitaistruct.ValidationNotEqualError(False, self.shf, self._io, u"/types/source_packet/seq/2") self.apid = self._io.read_bits_int_le(11) self.sequence_flag = self._io.read_bits_int_be(2) self.psc = self._io.read_bits_int_be(14) self.pdl = self._io.read_bits_int_be(16) self._io.align_to_byte() _on = self._parent.two_byte_combined if _on == 65535: self.telemetry_values = Beesat.TelemetryValuesUnused(self._io, self, self._root) else: self.telemetry_values = Beesat.TelemetryValues(self._io, self, self._root) class Voltage1(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_bits_int_be(12) @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (0.0033725265168795620437956204379562 * self.raw) return self._m_value if hasattr(self, '_m_value') else None class Ampere0(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_bits_int_be(12) @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (0.6103515625 * self.raw) return self._m_value if hasattr(self, '_m_value') else None class Unused2(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_u2be() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (0 * self.raw) return self._m_value if hasattr(self, '_m_value') else None class Acs4(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2be() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = ((-0.0573 * self.raw) + 2.5210) return self._m_value if hasattr(self, '_m_value') else None class Celsius0(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_bits_int_be(12) @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = ((0.244140625 * self.raw) - 50) return self._m_value if hasattr(self, '_m_value') else None class DigipeaterFrame(KaitaiStruct): """ .. seealso:: Source - https://www.static.tu.berlin/fileadmin/www/10002275/Amateur_Radio/BEESAT-1_Digipeater-Format.ods """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.digipeater_info_block = Beesat.DigipeaterInfoBlock(self._io, self, self._root) self.digipeater_message = Beesat.DigipeaterMessage(self._io, self, self._root) class TelemetryTransferFrames(KaitaiStruct): """ .. seealso:: Source - https://www.static.tu.berlin/fileadmin/www/10002275/Amateur_Radio/BEESAT-1_telemetry_format.pdf """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.transfer_frame0 = Beesat.TransferFrame(self._io, self, self._root) self.transfer_frame1 = Beesat.TransferFrame(self._io, self, self._root) self.transfer_frame2 = Beesat.TransferFrame(self._io, self, self._root) self.transfer_frame3 = Beesat.TransferFrame(self._io, self, self._root) class Unused8(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_u8be() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (0 * self.raw) return self._m_value if hasattr(self, '_m_value') else None class Unused4(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_u4be() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (0 * self.raw) return self._m_value if hasattr(self, '_m_value') else None class Celsius3(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_bits_int_be(12) @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = ((0.48577 * self.raw) - 270.595) return self._m_value if hasattr(self, '_m_value') else None class TelemetryValuesUnused(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.unused00 = Beesat.Unused8(self._io, self, self._root) self.unused01 = Beesat.Unused8(self._io, self, self._root) self.unused02 = Beesat.Unused8(self._io, self, self._root) self.unused03 = Beesat.Unused8(self._io, self, self._root) self.unused04 = Beesat.Unused8(self._io, self, self._root) self.unused05 = Beesat.Unused8(self._io, self, self._root) self.unused06 = Beesat.Unused8(self._io, self, self._root) self.unused07 = Beesat.Unused8(self._io, self, self._root) self.unused08 = Beesat.Unused8(self._io, self, self._root) self.unused09 = Beesat.Unused8(self._io, self, self._root) self.unused10 = Beesat.Unused8(self._io, self, self._root) self.unused11 = Beesat.Unused8(self._io, self, self._root) self.unused12 = Beesat.Unused8(self._io, self, self._root) self.unused13 = Beesat.Unused8(self._io, self, self._root) self.unused14 = Beesat.Unused8(self._io, self, self._root) self.unused15 = Beesat.Unused4(self._io, self, self._root) self.unused16 = Beesat.Unused2(self._io, self, self._root) class Db0(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_u1() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = ((0.0548780487 * self.raw) + 1.573172) return self._m_value if hasattr(self, '_m_value') else None class Acs1(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2be() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (10 * self.raw) return self._m_value if hasattr(self, '_m_value') else None class TelemetryValues(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.analog_value_01 = Beesat.Voltage0(self._io, self, self._root) self.psant0 = self._io.read_bits_int_be(1) != 0 self.psant1 = self._io.read_bits_int_be(1) != 0 self.pscom0 = self._io.read_bits_int_be(1) != 0 self.pscom1 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_02 = Beesat.Voltage1(self._io, self, self._root) self.psuhf0 = self._io.read_bits_int_be(1) != 0 self.psuhf1 = self._io.read_bits_int_be(1) != 0 self.pstnc0 = self._io.read_bits_int_be(1) != 0 self.pstnc1 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_03 = Beesat.Voltage1(self._io, self, self._root) self.psgyro = self._io.read_bits_int_be(1) != 0 self.psmcsx = self._io.read_bits_int_be(1) != 0 self.psmcsy = self._io.read_bits_int_be(1) != 0 self.psmcsz = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_04 = Beesat.Voltage0(self._io, self, self._root) self.pswhee = self._io.read_bits_int_be(1) != 0 self.psobc0 = self._io.read_bits_int_be(1) != 0 self.psobc1 = self._io.read_bits_int_be(1) != 0 self.pspdh0 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_05 = Beesat.Voltage2(self._io, self, self._root) self.pscam0 = self._io.read_bits_int_be(1) != 0 self.pssuns = self._io.read_bits_int_be(1) != 0 self.psmfs0 = self._io.read_bits_int_be(1) != 0 self.psmfs1 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_06 = Beesat.Ampere0(self._io, self, self._root) self.pstemp = self._io.read_bits_int_be(1) != 0 self.pscan0 = self._io.read_bits_int_be(1) != 0 self.pscan1 = self._io.read_bits_int_be(1) != 0 self.psccw0 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_07 = Beesat.Ampere0(self._io, self, self._root) self.psccw1 = self._io.read_bits_int_be(1) != 0 self.ps5vcn = self._io.read_bits_int_be(1) != 0 self.reserved00 = self._io.read_bits_int_be(1) != 0 self.pcbobc = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_08 = Beesat.Celsius0(self._io, self, self._root) self.pcbext = self._io.read_bits_int_be(1) != 0 self.pcch00 = self._io.read_bits_int_be(1) != 0 self.pcch01 = self._io.read_bits_int_be(1) != 0 self.pcch02 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_09 = Beesat.Celsius0(self._io, self, self._root) self.pcch03 = self._io.read_bits_int_be(1) != 0 self.pcch04 = self._io.read_bits_int_be(1) != 0 self.pcch05 = self._io.read_bits_int_be(1) != 0 self.pcch06 = self._io.read_bits_int_be(1) != 0 self.analog_value_10 = self._io.read_bits_int_be(12) self.pcch07 = self._io.read_bits_int_be(1) != 0 self.pcch08 = self._io.read_bits_int_be(1) != 0 self.pcch09 = self._io.read_bits_int_be(1) != 0 self.pcch10 = self._io.read_bits_int_be(1) != 0 self.analog_value_11 = self._io.read_bits_int_be(12) self.pcch11 = self._io.read_bits_int_be(1) != 0 self.pcch12 = self._io.read_bits_int_be(1) != 0 self.pcch13 = self._io.read_bits_int_be(1) != 0 self.pcch14 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_12 = Beesat.Ampere1(self._io, self, self._root) self.pcch15 = self._io.read_bits_int_be(1) != 0 self.pcch16 = self._io.read_bits_int_be(1) != 0 self.pcch17 = self._io.read_bits_int_be(1) != 0 self.pcch18 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_13 = Beesat.Celsius1(self._io, self, self._root) self.pcch19 = self._io.read_bits_int_be(1) != 0 self.pcch20 = self._io.read_bits_int_be(1) != 0 self.pcch21 = self._io.read_bits_int_be(1) != 0 self.pcch22 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_14 = Beesat.Celsius1(self._io, self, self._root) self.pcch23 = self._io.read_bits_int_be(1) != 0 self.pcch24 = self._io.read_bits_int_be(1) != 0 self.pcch25 = self._io.read_bits_int_be(1) != 0 self.pcch26 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_15 = Beesat.Celsius1(self._io, self, self._root) self.tcrxid = self._io.read_bits_int_be(1) != 0 self.obcaid = self._io.read_bits_int_be(1) != 0 self.tmtxrt = self._io.read_bits_int_be(1) != 0 self.pcch27 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.analog_value_16 = Beesat.Ampere1(self._io, self, self._root) self.pcch28 = self._io.read_bits_int_be(1) != 0 self.pcch29 = self._io.read_bits_int_be(1) != 0 self.pcch30 = self._io.read_bits_int_be(1) != 0 self.pcch31 = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.ccticc = self._io.read_u1() self.cctctt = self._io.read_u1() self.ccetcs = self._io.read_u1() self.cceimc = self._io.read_u1() self.ccettc = self._io.read_u1() self.ccettg = self._io.read_u1() self.ccetcc = self._io.read_u1() self.tcrxqu = Beesat.Db0(self._io, self, self._root) self.tcfrcp = self._io.read_u2be() self.tmhkur = self._io.read_u2be() self.cstutc = self._io.read_u4be() self.cstsys = self._io.read_u4be() self.obcbad = self._io.read_u1() self.ceswmc = self._io.read_u1() self.reserved01 = self._io.read_u1() self.beacon = self._io.read_u1() self.obcabc = self._io.read_u1() self.modobc = self._io.read_u1() self.ccecan = self._io.read_u1() self.obccan = self._io.read_u1() self.pcsyst = self._io.read_u2be() self.pcbcnt = self._io.read_u1() self.pctxec = self._io.read_u1() self.pcrxec = self._io.read_u1() self.pcoffc = self._io.read_u1() self.pcackc = self._io.read_u1() self.pcch32 = self._io.read_bits_int_be(1) != 0 self.pcch33 = self._io.read_bits_int_be(1) != 0 self.pcch34 = self._io.read_bits_int_be(1) != 0 self.pcch35 = self._io.read_bits_int_be(1) != 0 self.pcch36 = self._io.read_bits_int_be(1) != 0 self.pcch37 = self._io.read_bits_int_be(1) != 0 self.pcch38 = self._io.read_bits_int_be(1) != 0 self.pcch39 = self._io.read_bits_int_be(1) != 0 self.pcch40 = self._io.read_bits_int_be(1) != 0 self.pcch41 = self._io.read_bits_int_be(1) != 0 self.reserved02 = self._io.read_bits_int_be(14) self._io.align_to_byte() self.analog_value_17 = Beesat.Ampere1(self._io, self, self._root) self.reserved03 = self._io.read_bits_int_be(4) self._io.align_to_byte() self.analog_value_18 = Beesat.Celsius2(self._io, self, self._root) self.reserved04 = self._io.read_bits_int_be(4) self._io.align_to_byte() self.analog_value_19 = Beesat.Celsius1(self._io, self, self._root) self.reserved05 = self._io.read_bits_int_be(4) self._io.align_to_byte() self.acswhx = self._io.read_s2be() self.acswhy = self._io.read_s2be() self.acswhz = self._io.read_s2be() self.acsq00 = Beesat.Acs0(self._io, self, self._root) self.acsq01 = Beesat.Acs0(self._io, self, self._root) self.acsq02 = Beesat.Acs0(self._io, self, self._root) self.acsq03 = Beesat.Acs0(self._io, self, self._root) self.acssux = Beesat.Acs0(self._io, self, self._root) self.acssuy = Beesat.Acs0(self._io, self, self._root) self.acssuz = Beesat.Acs0(self._io, self, self._root) self.acsm0x = Beesat.Acs1(self._io, self, self._root) self.acsm0y = Beesat.Acs1(self._io, self, self._root) self.acsm0z = Beesat.Acs1(self._io, self, self._root) self.acsm1x = Beesat.Acs1(self._io, self, self._root) self.acsm1y = Beesat.Acs1(self._io, self, self._root) self.acsm1z = Beesat.Acs1(self._io, self, self._root) self.acsmod = self._io.read_bits_int_be(4) self.acsgsc = self._io.read_bits_int_be(1) != 0 self.acsshd = self._io.read_bits_int_be(1) != 0 self.reserved06 = self._io.read_bits_int_be(2) self._io.align_to_byte() self.acserr = self._io.read_u1() self.acsgyx = Beesat.Acs2(self._io, self, self._root) self.acsgyy = Beesat.Acs3(self._io, self, self._root) self.acsgyz = Beesat.Acs4(self._io, self, self._root) self.analog_value_20 = Beesat.Celsius2(self._io, self, self._root) self.reserved07 = self._io.read_bits_int_be(4) self._io.align_to_byte() self.analog_value_21 = Beesat.Ampere2(self._io, self, self._root) self.reserved08 = self._io.read_bits_int_be(4) self._io.align_to_byte() self.analog_value_22 = Beesat.Ampere2(self._io, self, self._root) self.reserved09 = self._io.read_bits_int_be(4) self._io.align_to_byte() self.analog_value_23 = Beesat.Ampere2(self._io, self, self._root) self.reserved10 = self._io.read_bits_int_be(4) self._io.align_to_byte() self.analog_value_24 = Beesat.Celsius3(self._io, self, self._root) self.reserved11 = self._io.read_bits_int_be(4) class Ampere2(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_bits_int_be(12) @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (0.152587891 * self.raw) return self._m_value if hasattr(self, '_m_value') else None class Acs0(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2be() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (0.0001 * self.raw) return self._m_value if hasattr(self, '_m_value') else None class Acs2(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2be() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = ((0.0573 * self.raw) + 19.7097) return self._m_value if hasattr(self, '_m_value') else None class DigipeaterInfoBlock(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.count = self._io.read_u2be() self.byte_count = self._io.read_u2be() self.local_time = self._io.read_u4be() self.calsgn_snd = (KaitaiStream.bytes_terminate(self._io.read_bytes(6), 0, False)).decode(u"ascii") self.long_qth_field = self._io.read_bits_int_be(6) self.lat_qth_field = self._io.read_bits_int_be(6) self.long_qth_square = self._io.read_bits_int_be(4) self.lat_qth_square = self._io.read_bits_int_be(4) self.long_qth_subsquare = self._io.read_bits_int_be(6) self.lat_qth_subsquare = self._io.read_bits_int_be(6) class Voltage2(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_bits_int_be(12) @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (0.001220703125 * self.raw) return self._m_value if hasattr(self, '_m_value') else None class MasterFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.sync = self._io.read_u2be() self.contrl0 = self._io.read_u1() self.contrl1 = self._io.read_u1() self.calsgn = (KaitaiStream.bytes_terminate(self._io.read_bytes(6), 0, False)).decode(u"ascii") if not self.calsgn == u"DP0BEE": raise kaitaistruct.ValidationNotEqualError(u"DP0BEE", self.calsgn, self._io, u"/types/master_frame/seq/3") self.crcsgn = self._io.read_u2be() _on = self.contrl0 if _on == 20: self.packet_type = Beesat.TelemetryTransferFrames(self._io, self, self._root) elif _on == 150: self.packet_type = Beesat.DigipeaterFrame(self._io, self, self._root) class DigipeaterMessage(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.message = self._io.read_bits_int_be(1296) class Ampere1(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_bits_int_be(12) @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (0.30517578125 * self.raw) return self._m_value if hasattr(self, '_m_value') else None class TransferFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.asm = self._io.read_bits_int_be(32) if not self.asm == 449838109: raise kaitaistruct.ValidationNotEqualError(449838109, self.asm, self._io, u"/types/transfer_frame/seq/0") self.tfvn = self._io.read_bits_int_be(2) self.scid = self._io.read_bits_int_be(10) self.vcid = self._io.read_bits_int_be(3) self.ocff = self._io.read_bits_int_be(1) != 0 self._io.align_to_byte() self.mcfc = self._io.read_u1() self.vcfc = self._io.read_u1() self.tf_shf = self._io.read_bits_int_be(1) != 0 if not self.tf_shf == False: raise kaitaistruct.ValidationNotEqualError(False, self.tf_shf, self._io, u"/types/transfer_frame/seq/7") self.sync_flag = self._io.read_bits_int_be(1) != 0 if not self.sync_flag == False: raise kaitaistruct.ValidationNotEqualError(False, self.sync_flag, self._io, u"/types/transfer_frame/seq/8") self.pof = self._io.read_bits_int_be(1) != 0 if not self.pof == False: raise kaitaistruct.ValidationNotEqualError(False, self.pof, self._io, u"/types/transfer_frame/seq/9") self.slid = self._io.read_bits_int_be(2) if not self.slid == 3: raise kaitaistruct.ValidationNotEqualError(3, self.slid, self._io, u"/types/transfer_frame/seq/10") self.fhp = self._io.read_bits_int_be(11) if not self.fhp == 0: raise kaitaistruct.ValidationNotEqualError(0, self.fhp, self._io, u"/types/transfer_frame/seq/11") self._io.align_to_byte() self.source_packet = Beesat.SourcePacket(self._io, self, self._root) self.fecf = self._io.read_u2be() @property def two_byte_combined(self): """combine tfvn, scid, vcid and ocff to two bytes in order to check whether offline transfer frame contains any valid data, does not contain any if these bytes are FFFF.""" if hasattr(self, '_m_two_byte_combined'): return self._m_two_byte_combined if hasattr(self, '_m_two_byte_combined') else None self._m_two_byte_combined = ((((self.tfvn << 14) | (self.scid << 4)) | (self.vcid << 1)) | int(self.ocff)) return self._m_two_byte_combined if hasattr(self, '_m_two_byte_combined') else None class Celsius2(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_bits_int_be(12) @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (0.125 * self.raw) return self._m_value if hasattr(self, '_m_value') else None class Acs3(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_s2be() @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = ((-0.0573 * self.raw) + 21.9443) return self._m_value if hasattr(self, '_m_value') else None class Celsius1(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_bits_int_be(12) @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = ((0.06103515625 * self.raw) - 50) return self._m_value if hasattr(self, '_m_value') else None class Voltage0(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw = self._io.read_bits_int_be(12) @property def value(self): if hasattr(self, '_m_value'): return self._m_value if hasattr(self, '_m_value') else None self._m_value = (0.001619779146 * self.raw) return self._m_value if hasattr(self, '_m_value') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/beesat.py
0.441432
0.171859
beesat.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Cape1(KaitaiStruct): """:field callsign: callsign :field pkt_type: pkt_type :field mpb_voltage: payload.mpb_voltage.as_int :field hpb_voltage: payload.hpb_voltage.as_int :field battery_1_voltage: payload.battery_1_voltage.as_int :field battery_2_voltage: payload.battery_2_voltage.as_int :field battery_1_current_generated: payload.battery_1_current_generated.as_int :field battery_1_current_absorbed: payload.battery_1_current_absorbed.as_int :field battery_2_current_generated: payload.battery_2_current_generated.as_int :field battery_2_current_absorbed: payload.battery_2_current_absorbed.as_int :field temp_battery_1: payload.temp_battery_1.as_int :field temp_px_face: payload.temp_px_face.as_int :field temp_nx_face: payload.temp_nx_face.as_int :field temp_py_face: payload.temp_py_face.as_int :field temp_ny_face: payload.temp_ny_face.as_int :field temp_pz_face: payload.temp_pz_face.as_int :field temp_nz_face: payload.temp_nz_face.as_int :field temp_rf_amp: payload.temp_rf_amp.as_int :field temp_battery_2: payload.temp_battery_2.as_int :field panel_px_face: payload.panel_px_face.as_int :field panel_nx_face: payload.panel_nx_face.as_int :field panel_py_face: payload.panel_py_face.as_int :field panel_ny_face: payload.panel_ny_face.as_int :field panel_pz_face: payload.panel_pz_face.as_int :field panel_nz_face: payload.panel_nz_face.as_int .. seealso:: Source - http://www.dk3wn.info/sat/afu/sat_cape.shtml https://www.pe0sat.vgnet.nl/download/CAPE/cape-1_02-07-2020_1940UTC.PNG https://www.pe0sat.vgnet.nl/download/CAPE/cape-1_02-07-2020_1940UTC.txt https://www.pe0sat.vgnet.nl/download/CAPE/tlm_info.txt """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.check_callsign = self._io.read_bytes(5) if not self.check_callsign == b"\x4B\x35\x55\x53\x4C": raise kaitaistruct.ValidationNotEqualError(b"\x4B\x35\x55\x53\x4C", self.check_callsign, self._io, u"/seq/0") self.pkt_type = (self._io.read_bytes(1)).decode(u"ascii") _on = self.pkt_type if _on == u"1": self.payload = Cape1.PktType1(self._io, self, self._root) elif _on == u"2": self.payload = Cape1.PktType2(self._io, self, self._root) elif _on == u"3": self.payload = Cape1.PktType3(self._io, self, self._root) class HexInt(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.as_str = (self._io.read_bytes(2)).decode(u"ASCII") @property def as_int(self): if hasattr(self, '_m_as_int'): return self._m_as_int if hasattr(self, '_m_as_int') else None self._m_as_int = (int(self.as_str, 16) if int(self.as_str, 16) < 128 else -(((int(self.as_str, 16) - 1) ^ 255))) return self._m_as_int if hasattr(self, '_m_as_int') else None class PktType3(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.panel_px_face = Cape1.SolarCurrent(self._io, self, self._root) self.panel_nx_face = Cape1.SolarCurrent(self._io, self, self._root) self.panel_py_face = Cape1.SolarCurrent(self._io, self, self._root) self.panel_ny_face = Cape1.SolarCurrent(self._io, self, self._root) self.panel_pz_face = Cape1.SolarCurrent(self._io, self, self._root) self.panel_nz_face = Cape1.SolarCurrent(self._io, self, self._root) class HexUint(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.as_str = (self._io.read_bytes(2)).decode(u"ASCII") @property def as_int(self): if hasattr(self, '_m_as_int'): return self._m_as_int if hasattr(self, '_m_as_int') else None self._m_as_int = int(self.as_str, 16) return self._m_as_int if hasattr(self, '_m_as_int') else None class PktType1(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.mpb_voltage = Cape1.Voltage(self._io, self, self._root) self.hpb_voltage = Cape1.Voltage(self._io, self, self._root) self.battery_1_voltage = Cape1.Voltage(self._io, self, self._root) self.battery_2_voltage = Cape1.Voltage(self._io, self, self._root) self.battery_1_current_generated = Cape1.HexUint(self._io, self, self._root) self.battery_1_current_absorbed = Cape1.HexUint(self._io, self, self._root) self.battery_2_current_generated = Cape1.HexUint(self._io, self, self._root) self.battery_2_current_absorbed = Cape1.HexUint(self._io, self, self._root) class SolarCurrent(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.as_str = (self._io.read_bytes(2)).decode(u"ASCII") @property def as_int(self): """(I * 10) [mA].""" if hasattr(self, '_m_as_int'): return self._m_as_int if hasattr(self, '_m_as_int') else None self._m_as_int = int(self.as_str, 16) return self._m_as_int if hasattr(self, '_m_as_int') else None class PktType2(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.temp_battery_1 = Cape1.HexInt(self._io, self, self._root) self.temp_px_face = Cape1.HexInt(self._io, self, self._root) self.temp_nx_face = Cape1.HexInt(self._io, self, self._root) self.temp_py_face = Cape1.HexInt(self._io, self, self._root) self.temp_ny_face = Cape1.HexInt(self._io, self, self._root) self.temp_pz_face = Cape1.HexInt(self._io, self, self._root) self.temp_nz_face = Cape1.HexInt(self._io, self, self._root) self.temp_rf_amp = Cape1.HexInt(self._io, self, self._root) self.temp_battery_2 = Cape1.HexInt(self._io, self, self._root) class Voltage(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.as_str = (self._io.read_bytes(2)).decode(u"ASCII") @property def as_int(self): """ (V * 0.02) [V] despite documentation indicating (V * 0.2).""" if hasattr(self, '_m_as_int'): return self._m_as_int if hasattr(self, '_m_as_int') else None self._m_as_int = int(self.as_str, 16) return self._m_as_int if hasattr(self, '_m_as_int') else None @property def callsign(self): if hasattr(self, '_m_callsign'): return self._m_callsign if hasattr(self, '_m_callsign') else None _pos = self._io.pos() self._io.seek(0) self._m_callsign = (self._io.read_bytes(5)).decode(u"ascii") self._io.seek(_pos) return self._m_callsign if hasattr(self, '_m_callsign') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/cape1.py
0.550124
0.192236
cape1.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Polyitan1(KaitaiStruct): """:field dst_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field data_type: ax25_frame.payload.ax25_info.header.data_type :field beacon0: ax25_frame.payload.ax25_info.data.body :field device_err1_raw: ax25_frame.payload.ax25_info.data.device_err1_raw :field device_err2_raw: ax25_frame.payload.ax25_info.data.device_err2_raw :field device_err3_raw: ax25_frame.payload.ax25_info.data.device_err3_raw :field ss256: ax25_frame.payload.ax25_info.data.ss256 :field rtc_s: ax25_frame.payload.ax25_info.data.rtc_s :field sat_mode: ax25_frame.payload.ax25_info.data.sat_mode :field submode: ax25_frame.payload.ax25_info.data.submode :field mux_i3_3: ax25_frame.payload.ax25_info.data.mux_i3_3 :field arege: ax25_frame.payload.ax25_info.data.arege :field eab1: ax25_frame.payload.ax25_info.data.eab1 :field eab2: ax25_frame.payload.ax25_info.data.eab2 :field eab3: ax25_frame.payload.ax25_info.data.eab3 :field v_acb: ax25_frame.payload.ax25_info.data.v_acb :field cab1: ax25_frame.payload.ax25_info.data.cab1 :field cab2: ax25_frame.payload.ax25_info.data.cab2 :field cab3: ax25_frame.payload.ax25_info.data.cab3 :field c_from_sb_all: ax25_frame.payload.ax25_info.data.c_from_sb_all :field curr_sp_main: ax25_frame.payload.ax25_info.data.curr_sp_main :field c_load_all: ax25_frame.payload.ax25_info.data.c_load_all :field p_sbx: ax25_frame.payload.ax25_info.data.p_sbx :field p_sby: ax25_frame.payload.ax25_info.data.p_sby :field p_sbz: ax25_frame.payload.ax25_info.data.p_sbz :field device_errors: ax25_frame.payload.ax25_info.data.device_errors :field magtl_x: ax25_frame.payload.ax25_info.data.magtl_x :field magtl_y: ax25_frame.payload.ax25_info.data.magtl_y :field magtl_z: ax25_frame.payload.ax25_info.data.magtl_z :field gyro_x_mdps: ax25_frame.payload.ax25_info.data.gyro_x_mdps :field gyro_y_mdps: ax25_frame.payload.ax25_info.data.gyro_y_mdps :field gyro_z_mdps: ax25_frame.payload.ax25_info.data.gyro_z_mdps :field mux_i5_0: ax25_frame.payload.ax25_info.data.mux_i5_0 :field ads1248_tmp_c: ax25_frame.payload.ax25_info.data.ads1248_tmp_c :field charge: ax25_frame.payload.ax25_info.data.charge :field antennas_status: ax25_frame.payload.ax25_info.data.antennas_status :field t_ab1: ax25_frame.payload.ax25_info.data.t_ab1 :field t_ab2: ax25_frame.payload.ax25_info.data.t_ab2 :field t_ab3: ax25_frame.payload.ax25_info.data.t_ab3 :field mode: ax25_frame.payload.ax25_info.data.mode :field device_status: ax25_frame.payload.ax25_info.info.data.device_status :field rtc_ss: ax25_frame.payload.ax25_info.data.rtc_ss :field u_3_3v_digi: ax25_frame.payload.ax25_info.data.u_3_3v_digi :field u_3_3v_rf: ax25_frame.payload.ax25_info.data.u_3_3v_rf :field u_3_3v_rf_amp: ax25_frame.payload.ax25_info.data.u_3_3v_rf_amp :field temp2: ax25_frame.payload.ax25_info.data.temp2 :field temp1: ax25_frame.payload.ax25_info.data.temp1 .. seealso:: Source - https://amsat.vhfdx.in.ua/documents/polyitan.ksy """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Polyitan1.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Polyitan1.Ax25Header(self._io, self, self._root) _on = (self.ax25_header.ctl & 19) if _on == 0: self.payload = Polyitan1.IFrame(self._io, self, self._root) elif _on == 3: self.payload = Polyitan1.UiFrame(self._io, self, self._root) elif _on == 19: self.payload = Polyitan1.UiFrame(self._io, self, self._root) elif _on == 16: self.payload = Polyitan1.IFrame(self._io, self, self._root) elif _on == 18: self.payload = Polyitan1.IFrame(self._io, self, self._root) elif _on == 2: self.payload = Polyitan1.IFrame(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Polyitan1.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Polyitan1.SsidMask(self._io, self, self._root) self.src_callsign_raw = Polyitan1.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Polyitan1.SsidMask(self._io, self, self._root) self.ctl = self._io.read_u1() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() _on = self._parent.ax25_header.src_callsign_raw.callsign_ror.callsign if _on == u"EM0UKP": self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Polyitan1.Ax25Info(_io__raw_ax25_info, self, self._root) else: self.ax25_info = self._io.read_bytes_full() class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") class Beacon1(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.device_err1_raw = self._io.read_u1() self.device_err2_raw = self._io.read_u1() self.device_err3_raw = self._io.read_u1() self.ss256 = self._io.read_u1() self.rtc_s = self._io.read_s4le() self.sat_mode = self._io.read_u1() self.submode = self._io.read_u1() self.magtl_x1_raw = self._io.read_u1() self.magtl_x2_raw = self._io.read_u1() self.magtl_x3_raw = self._io.read_u1() self.magtl_y1_raw = self._io.read_u1() self.magtl_y2_raw = self._io.read_u1() self.magtl_y3_raw = self._io.read_u1() self.magtl_z1_raw = self._io.read_u1() self.magtl_z2_raw = self._io.read_u1() self.magtl_z3_raw = self._io.read_u1() self.gyro_x1_mdps_raw = self._io.read_u1() self.gyro_x2_mdps_raw = self._io.read_u1() self.gyro_x3_mdps_raw = self._io.read_u1() self.gyro_y1_mdps_raw = self._io.read_u1() self.gyro_y2_mdps_raw = self._io.read_u1() self.gyro_y3_mdps_raw = self._io.read_u1() self.gyro_z1_mdps_raw = self._io.read_u1() self.gyro_z2_mdps_raw = self._io.read_u1() self.gyro_z3_mdps_raw = self._io.read_u1() self.mux_i3_3 = self._io.read_u2le() self.mux_i5_0_raw = self._io.read_u2le() self.ads1248_tmp_c_raw = self._io.read_s2le() self.arege = self._io.read_u2le() self.antennas_status_raw = self._io.read_u2le() self.charge_raw = self._io.read_u2be() self.eab1 = self._io.read_u2le() self.eab2 = self._io.read_u2le() self.eab3 = self._io.read_u2le() self.v_acb = self._io.read_s2le() self.cab1 = self._io.read_s2le() self.cab2 = self._io.read_s2le() self.cab3 = self._io.read_s2le() self.c_from_sb_all = self._io.read_s2le() self.curr_sp_main = self._io.read_u2le() self.c_load_all = self._io.read_s2le() self.t_ab2_raw = self._io.read_s2le() self.t_ab3_raw = self._io.read_s2le() self.p_sbx = self._io.read_s2le() self.p_sby = self._io.read_s2le() self.p_sbz = self._io.read_s2le() @property def device_errors(self): """non zero if orientation enabled.""" if hasattr(self, '_m_device_errors'): return self._m_device_errors if hasattr(self, '_m_device_errors') else None self._m_device_errors = (((self.device_err3_raw << 16) | (self.device_err2_raw << 8)) | self.device_err1_raw) return self._m_device_errors if hasattr(self, '_m_device_errors') else None @property def charge(self): if hasattr(self, '_m_charge'): return self._m_charge if hasattr(self, '_m_charge') else None self._m_charge = (self.charge_raw * 0.1) return self._m_charge if hasattr(self, '_m_charge') else None @property def magtl_y(self): """non zero if orientation enabled.""" if hasattr(self, '_m_magtl_y'): return self._m_magtl_y if hasattr(self, '_m_magtl_y') else None self._m_magtl_y = (((self.magtl_y3_raw << 16) | (self.magtl_y2_raw << 8)) | self.magtl_y1_raw) return self._m_magtl_y if hasattr(self, '_m_magtl_y') else None @property def t_ab3(self): if hasattr(self, '_m_t_ab3'): return self._m_t_ab3 if hasattr(self, '_m_t_ab3') else None self._m_t_ab3 = (self.t_ab3_raw * 0.1) return self._m_t_ab3 if hasattr(self, '_m_t_ab3') else None @property def ads1248_tmp_c(self): if hasattr(self, '_m_ads1248_tmp_c'): return self._m_ads1248_tmp_c if hasattr(self, '_m_ads1248_tmp_c') else None self._m_ads1248_tmp_c = (self.ads1248_tmp_c_raw * 0.1) return self._m_ads1248_tmp_c if hasattr(self, '_m_ads1248_tmp_c') else None @property def magtl_z(self): """non zero if orientation enabled.""" if hasattr(self, '_m_magtl_z'): return self._m_magtl_z if hasattr(self, '_m_magtl_z') else None self._m_magtl_z = (((self.magtl_z3_raw << 16) | (self.magtl_z2_raw << 8)) | self.magtl_z1_raw) return self._m_magtl_z if hasattr(self, '_m_magtl_z') else None @property def antennas_status(self): """not set.""" if hasattr(self, '_m_antennas_status'): return self._m_antennas_status if hasattr(self, '_m_antennas_status') else None self._m_antennas_status = (self.antennas_status_raw & 15) return self._m_antennas_status if hasattr(self, '_m_antennas_status') else None @property def gyro_x_mdps(self): """non zero if orientation enabled.""" if hasattr(self, '_m_gyro_x_mdps'): return self._m_gyro_x_mdps if hasattr(self, '_m_gyro_x_mdps') else None self._m_gyro_x_mdps = (((self.gyro_x3_mdps_raw << 16) | (self.gyro_x2_mdps_raw << 8)) | self.gyro_x1_mdps_raw) return self._m_gyro_x_mdps if hasattr(self, '_m_gyro_x_mdps') else None @property def t_ab1(self): """not set.""" if hasattr(self, '_m_t_ab1'): return self._m_t_ab1 if hasattr(self, '_m_t_ab1') else None self._m_t_ab1 = 0.0 return self._m_t_ab1 if hasattr(self, '_m_t_ab1') else None @property def magtl_x(self): """non zero if orientation enabled.""" if hasattr(self, '_m_magtl_x'): return self._m_magtl_x if hasattr(self, '_m_magtl_x') else None self._m_magtl_x = (((self.magtl_x3_raw << 16) | (self.magtl_x2_raw << 8)) | self.magtl_x1_raw) return self._m_magtl_x if hasattr(self, '_m_magtl_x') else None @property def gyro_y_mdps(self): """non zero if orientation enabled.""" if hasattr(self, '_m_gyro_y_mdps'): return self._m_gyro_y_mdps if hasattr(self, '_m_gyro_y_mdps') else None self._m_gyro_y_mdps = (((self.gyro_y3_mdps_raw << 16) | (self.gyro_y2_mdps_raw << 8)) | self.gyro_y1_mdps_raw) return self._m_gyro_y_mdps if hasattr(self, '_m_gyro_y_mdps') else None @property def mode(self): if hasattr(self, '_m_mode'): return self._m_mode if hasattr(self, '_m_mode') else None self._m_mode = (u"Beacon" if self.sat_mode == 2 else (u"PostLauncheDepl" if self.sat_mode == 1 else (u"Recharge" if self.sat_mode == 3 else (u"Telecom" if self.sat_mode == 4 else (u"Failsafe" if self.sat_mode == 5 else (u"Off" if self.sat_mode == 6 else (u"Sun" if self.sat_mode == 7 else u"PostLaunche"))))))) return self._m_mode if hasattr(self, '_m_mode') else None @property def gyro_z_mdps(self): if hasattr(self, '_m_gyro_z_mdps'): return self._m_gyro_z_mdps if hasattr(self, '_m_gyro_z_mdps') else None self._m_gyro_z_mdps = (((self.gyro_z3_mdps_raw << 16) | (self.gyro_z2_mdps_raw << 8)) | self.gyro_z1_mdps_raw) return self._m_gyro_z_mdps if hasattr(self, '_m_gyro_z_mdps') else None @property def t_ab2(self): """not set.""" if hasattr(self, '_m_t_ab2'): return self._m_t_ab2 if hasattr(self, '_m_t_ab2') else None self._m_t_ab2 = (self.t_ab2_raw * 0.1) return self._m_t_ab2 if hasattr(self, '_m_t_ab2') else None @property def mux_i5_0(self): if hasattr(self, '_m_mux_i5_0'): return self._m_mux_i5_0 if hasattr(self, '_m_mux_i5_0') else None self._m_mux_i5_0 = (self.mux_i5_0_raw * 0.1) return self._m_mux_i5_0 if hasattr(self, '_m_mux_i5_0') else None class IFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.ax25_info = self._io.read_bytes_full() class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class Beacon2(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.device_status = self._io.read_u2le() self.rtc_ss = self._io.read_s4le() self.temp2_raw = self._io.read_s2le() self.temp1_raw = self._io.read_s2le() self.u_3_3v_digi = self._io.read_s2le() self.u_3_3v_rf = self._io.read_s2le() self.u_3_3v_rf_amp = self._io.read_s2le() @property def temp2(self): """value [В°C].""" if hasattr(self, '_m_temp2'): return self._m_temp2 if hasattr(self, '_m_temp2') else None self._m_temp2 = (self.temp2_raw * 0.1) return self._m_temp2 if hasattr(self, '_m_temp2') else None @property def temp1(self): """value [В°C].""" if hasattr(self, '_m_temp1'): return self._m_temp1 if hasattr(self, '_m_temp1') else None self._m_temp1 = (self.temp1_raw * 0.1) return self._m_temp1 if hasattr(self, '_m_temp1') else None class Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.data_type = self._io.read_u1() class Beacon0(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.body = (self._io.read_bytes_full()).decode(u"ASCII") class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Polyitan1.Callsign(_io__raw_callsign_ror, self, self._root) class Ax25Info(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.header = Polyitan1.Header(self._io, self, self._root) _on = self.header.data_type if _on == 0: self.data = Polyitan1.Beacon0(self._io, self, self._root) elif _on == 1: self.data = Polyitan1.Beacon1(self._io, self, self._root) elif _on == 2: self.data = Polyitan1.Beacon2(self._io, self, self._root)
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/polyitan1.py
0.439988
0.180811
polyitan1.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Foresail1(KaitaiStruct): """:field timestamp: pus.obc_housekeeping.timestamp.timestamp :field obc_side: pus.obc_housekeeping.side :field obc_fdir: pus.obc_housekeeping.fdir :field obc_scheduler: pus.obc_housekeeping.scheduler :field obc_sw_revision: pus.obc_housekeeping.software_revision :field obc_uptime: pus.obc_housekeeping.uptime :field obc_heap_free: pus.obc_housekeeping.heap_free :field obc_cpu_load: pus.obc_housekeeping.cpu_load :field obc_fs_free_space: pus.obc_housekeeping.fs_free_space :field arbiter_uptime: pus.obc_housekeeping.arbiter_uptime :field arbiter_age: pus.obc_housekeeping.arbiter_age :field arbiter_bootcount: pus.obc_housekeeping.arbiter_bootcount :field arbiter_temperature: pus.obc_housekeeping.arbiter_temperature :field side_a_bootcount: pus.obc_housekeeping.side_a_bootcount :field side_a_heartbeat: pus.obc_housekeeping.side_a_heartbeat :field side_a_fail_counter: pus.obc_housekeeping.side_a_fail_counter :field side_a_fail_reason: pus.obc_housekeeping.side_a_fail_reason :field side_b_bootcount: pus.obc_housekeeping.side_b_bootcount :field side_b_heartbeat: pus.obc_housekeeping.side_b_heartbeat :field side_b_fail_counter: pus.obc_housekeeping.side_b_fail_counter :field side_b_fail_reason: pus.obc_housekeeping.side_b_fail_reason :field timestamp: pus.eps_housekeeping.timestamp.timestamp :field pcdu_uptime: pus.eps_housekeeping.pcdu_uptime :field pcdu_boot_count: pus.eps_housekeeping.pcdu_boot_count :field pdm_expected: pus.eps_housekeeping.pdm_expected :field pdm_faulted: pus.eps_housekeeping.pdm_faulted :field pcdu_peak_detect_index: pus.eps_housekeeping.pcdu_peak_detect_index :field panel_x_minus_voltage: pus.eps_housekeeping.v_in_x_minus :field panel_x_plus_voltage: pus.eps_housekeeping.v_in_x_plus :field panel_y_minus_voltage: pus.eps_housekeeping.v_in_y_minus :field panel_y_plus_voltage: pus.eps_housekeeping.v_in_y_plus :field panel_x_minus_max_voltage: pus.eps_housekeeping.v_in_max_x_minus :field panel_x_plus_max_voltage: pus.eps_housekeeping.v_in_max_x_plus :field panel_y_minus_max_voltage: pus.eps_housekeeping.v_in_max_y_minus :field panel_y_plus_max_voltage: pus.eps_housekeeping.v_in_max_y_plus :field panel_x_minus_current: pus.eps_housekeeping.i_in_x_minus :field panel_x_plus_current: pus.eps_housekeeping.i_in_x_plus :field panel_y_minus_current: pus.eps_housekeeping.i_in_y_minus :field panel_y_plus_current: pus.eps_housekeeping.i_in_y_plus :field panel_x_minus_max_current: pus.eps_housekeeping.i_in_max_x_minus :field panel_x_plus_max_current: pus.eps_housekeeping.i_in_max_x_plus :field panel_y_minus_max_current: pus.eps_housekeeping.i_in_max_y_minus :field panel_y_plus_max_current: pus.eps_housekeeping.i_in_max_y_plus :field v_batt_bus: pus.eps_housekeeping.v_batt_bus :field temp_x_minus: pus.eps_housekeeping.temp_x_minus :field temp_x_plus: pus.eps_housekeeping.temp_x_plus :field temp_y_minus: pus.eps_housekeeping.temp_y_minus :field temp_y_plus: pus.eps_housekeeping.temp_y_plus :field temp_pcdu: pus.eps_housekeeping.temp_pcdu :field v_3v6_uhd_adcs: pus.eps_housekeeping.v_3v6_uhd_adcs :field v_3v6_mag_obc: pus.eps_housekeeping.v_3v6_mag_obc :field v_3v6_epb_cam: pus.eps_housekeeping.v_3v6_epb_cam :field i_pate_batt: pus.eps_housekeeping.i_pate_batt :field pb_batt_current: pus.eps_housekeeping.i_pb_batt :field pb_3v6_current: pus.eps_housekeeping.i_pb_3v6 :field cam_3v6_current: pus.eps_housekeeping.i_cam_3v6 :field mag_3v6_current: pus.eps_housekeeping.i_mag_3v6 :field obc_3v6_current: pus.eps_housekeeping.i_obc_3v6 :field uhf_3v6_current: pus.eps_housekeeping.i_uhf_3v6 :field adcs_3v6_current: pus.eps_housekeeping.i_adcs_3v6 :field pate_batt_current_max: pus.eps_housekeeping.i_pate_batt_max :field pb_batt_current_max: pus.eps_housekeeping.i_pb_batt_max :field pb_3v6_current_max: pus.eps_housekeeping.i_pb_3v6_max :field cam_3v6_current_max: pus.eps_housekeeping.i_cam_3v6_max :field mag_3v6_current_max: pus.eps_housekeeping.i_mag_3v6_max :field obc_3v6_current_max: pus.eps_housekeeping.i_obc_3v6_max :field uhf_3v6_current_max: pus.eps_housekeeping.i_uhf_3v6_max :field adcs_3v6_current_max: pus.eps_housekeeping.i_adcs_3v6_max :field pate_batt_current_min: pus.eps_housekeeping.i_pate_batt_min :field pb_batt_current_min: pus.eps_housekeeping.i_pb_batt_min :field pb_3v6_current_min: pus.eps_housekeeping.i_pb_3v6_min :field cam_3v6_current_min: pus.eps_housekeeping.i_cam_3v6_min :field mag_3v6_current_min: pus.eps_housekeeping.i_mag_3v6_min :field obc_3v6_current_min: pus.eps_housekeeping.i_obc_3v6_min :field uhf_3v6_current_min: pus.eps_housekeeping.i_uhf_3v6_min :field adcs_3v6_current_min: pus.eps_housekeeping.i_adcs_3v6_min :field batt_status: pus.eps_housekeeping.batt_status :field batt_boot_count: pus.eps_housekeeping.batt_boot_count :field batt_wdt_reset_count: pus.eps_housekeeping.batt_wdt_reset_count :field batt_bus_timeout_count: pus.eps_housekeeping.batt_bus_timeout_count :field batt_bpc_fail_count: pus.eps_housekeeping.batt_bpc_fail_count :field batt_pack_voltage: pus.eps_housekeeping.batt_pack_voltage :field batt_pack_lower_voltage: pus.eps_housekeeping.batt_pack_lower_voltage :field batt_pack_current: pus.eps_housekeeping.batt_pack_current :field batt_pack_min_current: pus.eps_housekeeping.batt_pack_min_current :field batt_pack_max_current: pus.eps_housekeeping.batt_pack_max_current :field batt_pack_temp: pus.eps_housekeeping.batt_pack_temp :field batt_board_temp: pus.eps_housekeeping.batt_board_temp :field batt_heater_pwm_on_time: pus.eps_housekeeping.heater_pwm_on_time :field timestamp: pus.uhf_housekeeping.timestamp.timestamp :field uhf_uptime: pus.uhf_housekeeping.uptime :field uhf_bootcount: pus.uhf_housekeeping.bootcount :field uhf_wdt_resets: pus.uhf_housekeeping.wdt_reset_count :field uhf_sbe_count: pus.uhf_housekeeping.sbe_count :field uhf_mbe_count: pus.uhf_housekeeping.mbe_count :field uhf_total_tx_frames: pus.uhf_housekeeping.total_tx_frames :field uhf_total_rx_frames: pus.uhf_housekeeping.total_rx_frames :field uhf_total_ham_tx_frames: pus.uhf_housekeeping.total_ham_tx_frames :field uhf_total_ham_rx_frames: pus.uhf_housekeeping.total_ham_rx_frames :field uhf_side: pus.uhf_housekeeping.side :field uhf_rx_mode: pus.uhf_housekeeping.rx_mode :field uhf_tx_mode: pus.uhf_housekeeping.tx_mode :field uhf_mcu_temperature: pus.uhf_housekeeping.mcu_temperature :field uhf_pa_temperature: pus.uhf_housekeeping.pa_temperature :field uhf_background_rssi: pus.uhf_housekeeping.backogrund_rssi :field uhf_last_rssi: pus.uhf_housekeeping.last_rssi :field uhf_last_freq_offset: pus.uhf_housekeeping.last_freq_offset :field timestamp: pus.adcs_housekeeping.timestamp.timestamp :field determination_mode: pus.adcs_housekeeping.determination_mode :field control_mode: pus.adcs_housekeeping.control_mode :field mjd: pus.adcs_housekeeping.mjd :field position_x: pus.adcs_housekeeping.position_x :field position_y: pus.adcs_housekeeping.position_y :field position_z: pus.adcs_housekeeping.position_z :field velocity_x: pus.adcs_housekeeping.velocity_x :field velocity_y: pus.adcs_housekeeping.velocity_y :field velocity_z: pus.adcs_housekeeping.velocity_z :field quaternion_x: pus.adcs_housekeeping.quaternion_x :field quaternion_y: pus.adcs_housekeeping.quaternion_y :field quaternion_z: pus.adcs_housekeeping.quaternion_z :field quaternion_w: pus.adcs_housekeeping.quaternion_w :field angular_rate_x: pus.adcs_housekeeping.angular_rate_x :field angular_rate_y: pus.adcs_housekeeping.angular_rate_y :field angular_rate_z: pus.adcs_housekeeping.angular_rate_z :field timestamp: pus.event.timestamp.timestamp :field event_severity: pus.event.severity :field event_rid: pus.event.rid :field event_info: pus.event.info :field repeater_dest_callsign: repeater.ax25_header.dest_callsign_raw.callsign_ror.callsign :field repeater_dest_ssid: repeater.ax25_header.dest_ssid_raw.ssid :field repeater_src_callsign: repeater.ax25_header.src_callsign_raw.callsign_ror.callsign :field repeater_src_ssid: repeater.ax25_header.src_ssid_raw.ssid :field repeater_payload: repeater.payload .. seealso:: Source - https://foresail.github.io/docs/FS1_Space_Ground_Interface_Control_Sheet.pdf """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.skylink = Foresail1.SkylinkFrame(self._io, self, self._root) if ((self.skylink.vc == 0) or (self.skylink.vc == 1)) : self._raw_pus = self._io.read_bytes(((self._io.size() - self._io.pos()) - (8 * self.skylink.is_authenticated))) _io__raw_pus = KaitaiStream(BytesIO(self._raw_pus)) self.pus = Foresail1.ForesailPusFrame(_io__raw_pus, self, self._root) if self.skylink.vc == 3: self._raw_repeater = self._io.read_bytes(((self._io.size() - self._io.pos()) - (8 * self.skylink.is_authenticated))) _io__raw_repeater = KaitaiStream(BytesIO(self._raw_repeater)) self.repeater = Foresail1.Ax25Frame(_io__raw_repeater, self, self._root) if self.skylink.is_authenticated == 1: self.auth = self._io.read_bytes(8) class Ax25Frame(KaitaiStruct): """ .. seealso:: Source - https://www.tapr.org/pdf/AX25.2.2.pdf """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.start_flag = self._io.read_bytes(1) if not self.start_flag == b"\x7E": raise kaitaistruct.ValidationNotEqualError(b"\x7E", self.start_flag, self._io, u"/types/ax25_frame/seq/0") self.ax25_header = Foresail1.Ax25Header(self._io, self, self._root) self.payload = (KaitaiStream.bytes_terminate(self._io.read_bytes((((self._io.size() - self._io.pos()) - 3) - (8 * self._root.skylink.is_authenticated))), 0, False)).decode(u"ascii") self.fcs = self._io.read_u2be() self.end_flag = self._io.read_bytes(1) if not self.end_flag == b"\x7E": raise kaitaistruct.ValidationNotEqualError(b"\x7E", self.end_flag, self._io, u"/types/ax25_frame/seq/4") class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Foresail1.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Foresail1.SsidMask(self._io, self, self._root) self.src_callsign_raw = Foresail1.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Foresail1.SsidMask(self._io, self, self._root) self.ctl = self._io.read_u1() self.pid = self._io.read_u1() class PusHeader(KaitaiStruct): """CCSDS PUS header.""" def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.packet_id = self._io.read_u2be() self.sequence = self._io.read_u2be() self.length = self._io.read_u2be() self.secondary_header = self._io.read_u1() self.service_type = self._io.read_u1() self.service_subtype = self._io.read_u1() class AdcsHousekeeping(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = Foresail1.UnixTimestamp(self._io, self, self._root) self.determination_mode = self._io.read_u1() self.control_mode = self._io.read_u1() self.mjd = self._io.read_f4le() self.position_x = self._io.read_f4le() self.position_y = self._io.read_f4le() self.position_z = self._io.read_f4le() self.velocity_x = self._io.read_f4le() self.velocity_y = self._io.read_f4le() self.velocity_z = self._io.read_f4le() self.angular_rate_x = self._io.read_f4le() self.angular_rate_y = self._io.read_f4le() self.angular_rate_z = self._io.read_f4le() self.quaternion_x = self._io.read_f4le() self.quaternion_y = self._io.read_f4le() self.quaternion_z = self._io.read_f4le() self.quaternion_w = self._io.read_f4le() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.ax25_info = self._io.read_bytes_full() class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") class UhfHousekeeping(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = Foresail1.UnixTimestamp(self._io, self, self._root) self.uptime = self._io.read_u4le() self.bootcount = self._io.read_u2le() self.wdt_reset_count = self._io.read_u1() self.sbe_count = self._io.read_u1() self.mbe_count = self._io.read_u1() self.bus_sync_errors = self._io.read_u1() self.bus_len_errors = self._io.read_u1() self.bus_crc_errors = self._io.read_u1() self.bus_bug_errors = self._io.read_u1() self.total_tx_frames = self._io.read_u4le() self.total_rx_frames = self._io.read_u4le() self.total_ham_tx_frames = self._io.read_u4le() self.total_ham_rx_frames = self._io.read_u4le() self.side = self._io.read_u1() self.rx_mode = self._io.read_u1() self.tx_mode = self._io.read_u1() self.mcu_temperature = self._io.read_s2le() self.pa_temperature = self._io.read_s2le() self.background_rssi = self._io.read_s1() self.last_rssi = self._io.read_s1() self.last_freq_offset = self._io.read_s2le() class UnixTimestamp(KaitaiStruct): """Unix timestamp.""" def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = self._io.read_u4be() class Event(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = Foresail1.UnixTimestamp(self._io, self, self._root) self.rid = self._io.read_u2be() self.info = self._io.read_bytes_full() class EpsHousekeeping(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = Foresail1.UnixTimestamp(self._io, self, self._root) self.pcdu_uptime = self._io.read_u4le() self.pcdu_boot_count = self._io.read_u1() self.pdm_expected = self._io.read_u1() self.pdm_faulted = self._io.read_u1() self.pcdu_peak_detect_index = self._io.read_u1() self.v_in_x_minus = self._io.read_u2le() self.v_in_x_plus = self._io.read_u2le() self.v_in_y_minus = self._io.read_u2le() self.v_in_y_plus = self._io.read_u2le() self.v_in_max_x_minus = self._io.read_u2le() self.v_in_max_x_plus = self._io.read_u2le() self.v_in_max_y_minus = self._io.read_u2le() self.v_in_max_y_plus = self._io.read_u2le() self.i_in_x_minus = self._io.read_u2le() self.i_in_x_plus = self._io.read_u2le() self.i_in_y_minus = self._io.read_u2le() self.i_in_y_plus = self._io.read_u2le() self.i_in_max_x_minus = self._io.read_u2le() self.i_in_max_x_plus = self._io.read_u2le() self.i_in_max_y_minus = self._io.read_u2le() self.i_in_max_y_plus = self._io.read_u2le() self.v_batt_bus = self._io.read_u2le() self.temp_x_minus = self._io.read_s2le() self.temp_x_plus = self._io.read_s2le() self.temp_y_minus = self._io.read_s2le() self.temp_y_plus = self._io.read_s2le() self.temp_pcdu = self._io.read_s2le() self.v_3v6_uhd_adcs = self._io.read_u2le() self.v_3v6_mag_obc = self._io.read_u2le() self.v_3v6_epb_cam = self._io.read_u2le() self.i_pate_batt = self._io.read_u2le() self.i_pb_batt = self._io.read_u2le() self.i_pb_3v6 = self._io.read_u2le() self.i_cam_3v6 = self._io.read_u2le() self.i_mag_3v6 = self._io.read_u2le() self.i_obc_3v6 = self._io.read_u2le() self.i_uhf_3v6 = self._io.read_u2le() self.i_adcs_3v6 = self._io.read_u2le() self.i_pate_batt_max = self._io.read_u2le() self.i_pb_batt_max = self._io.read_u2le() self.i_pb_3v6_max = self._io.read_u2le() self.i_cam_3v6_max = self._io.read_u2le() self.i_mag_3v6_max = self._io.read_u2le() self.i_obc_3v6_max = self._io.read_u2le() self.i_uhf_3v6_max = self._io.read_u2le() self.i_adcs_3v6_max = self._io.read_u2le() self.i_pate_batt_min = self._io.read_u2le() self.i_pb_batt_min = self._io.read_u2le() self.i_pb_3v6_min = self._io.read_u2le() self.i_cam_3v6_min = self._io.read_u2le() self.i_mag_3v6_min = self._io.read_u2le() self.i_obc_3v6_min = self._io.read_u2le() self.i_uhf_3v6_min = self._io.read_u2le() self.i_adcs_3v6_min = self._io.read_u2le() self.batt_status = self._io.read_u2le() self.batt_boot_count = self._io.read_u1() self.batt_wdt_reset_count = self._io.read_u1() self.batt_bus_timeout_count = self._io.read_u1() self.batt_bpc_fail_count = self._io.read_u1() self.batt_pack_voltage = self._io.read_u2le() self.batt_pack_lower_voltage = self._io.read_u2le() self.batt_pack_current = self._io.read_s2le() self.batt_pack_min_current = self._io.read_s2le() self.batt_pack_max_current = self._io.read_s2le() self.batt_pack_temp = self._io.read_s2le() self.batt_board_temp = self._io.read_s2le() self.heater_pwm_on_time = self._io.read_u2le() class ForesailPusFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.header = Foresail1.PusHeader(self._io, self, self._root) if ((self.header.service_type == 3) and (self.header.service_subtype == 2)) : self.obc_housekeeping = Foresail1.ObcHousekeeping(self._io, self, self._root) if ((self.header.service_type == 3) and (self.header.service_subtype == 3)) : self.eps_housekeeping = Foresail1.EpsHousekeeping(self._io, self, self._root) if ((self.header.service_type == 3) and (self.header.service_subtype == 4)) : self.uhf_housekeeping = Foresail1.UhfHousekeeping(self._io, self, self._root) if ((self.header.service_type == 3) and (self.header.service_subtype == 5)) : self.adcs_housekeeping = Foresail1.AdcsHousekeeping(self._io, self, self._root) if ((self.header.service_type == 4) and ( ((self.header.service_subtype == 1) or (self.header.service_subtype == 2) or (self.header.service_subtype == 3) or (self.header.service_subtype == 4)) )) : self.event = Foresail1.Event(self._io, self, self._root) class Pdms(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.val = self._io.read_u1() @property def mag_3v6(self): if hasattr(self, '_m_mag_3v6'): return self._m_mag_3v6 if hasattr(self, '_m_mag_3v6') else None self._m_mag_3v6 = ((self.val & 16) >> 4) return self._m_mag_3v6 if hasattr(self, '_m_mag_3v6') else None @property def uhf_3v6(self): if hasattr(self, '_m_uhf_3v6'): return self._m_uhf_3v6 if hasattr(self, '_m_uhf_3v6') else None self._m_uhf_3v6 = ((self.val & 64) >> 6) return self._m_uhf_3v6 if hasattr(self, '_m_uhf_3v6') else None @property def pate_batt(self): if hasattr(self, '_m_pate_batt'): return self._m_pate_batt if hasattr(self, '_m_pate_batt') else None self._m_pate_batt = ((self.val & 1) >> 0) return self._m_pate_batt if hasattr(self, '_m_pate_batt') else None @property def obc_3v6(self): if hasattr(self, '_m_obc_3v6'): return self._m_obc_3v6 if hasattr(self, '_m_obc_3v6') else None self._m_obc_3v6 = ((self.val & 32) >> 5) return self._m_obc_3v6 if hasattr(self, '_m_obc_3v6') else None @property def cam_3v6(self): if hasattr(self, '_m_cam_3v6'): return self._m_cam_3v6 if hasattr(self, '_m_cam_3v6') else None self._m_cam_3v6 = ((self.val & 8) >> 3) return self._m_cam_3v6 if hasattr(self, '_m_cam_3v6') else None @property def pb_3v6(self): if hasattr(self, '_m_pb_3v6'): return self._m_pb_3v6 if hasattr(self, '_m_pb_3v6') else None self._m_pb_3v6 = ((self.val & 4) >> 2) return self._m_pb_3v6 if hasattr(self, '_m_pb_3v6') else None @property def adcs_3v6(self): if hasattr(self, '_m_adcs_3v6'): return self._m_adcs_3v6 if hasattr(self, '_m_adcs_3v6') else None self._m_adcs_3v6 = ((self.val & 128) >> 7) return self._m_adcs_3v6 if hasattr(self, '_m_adcs_3v6') else None @property def pb_batt(self): if hasattr(self, '_m_pb_batt'): return self._m_pb_batt if hasattr(self, '_m_pb_batt') else None self._m_pb_batt = ((self.val & 2) >> 1) return self._m_pb_batt if hasattr(self, '_m_pb_batt') else None class SkylinkFrame(KaitaiStruct): """ .. seealso:: Skylink Protocol Specification.pdf """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.start_byte = self._io.read_bytes(1) if not self.start_byte == b"\x66": raise kaitaistruct.ValidationNotEqualError(b"\x66", self.start_byte, self._io, u"/types/skylink_frame/seq/0") self.identity = self._io.read_bytes(6) if not self.identity == b"\x4F\x48\x32\x46\x31\x53": raise kaitaistruct.ValidationNotEqualError(b"\x4F\x48\x32\x46\x31\x53", self.identity, self._io, u"/types/skylink_frame/seq/1") self.control = self._io.read_u1() self.extension_length = self._io.read_u1() self.sequence_number = self._io.read_u2be() self.extensions = self._io.read_bytes(self.extension_length) @property def has_payload(self): if hasattr(self, '_m_has_payload'): return self._m_has_payload if hasattr(self, '_m_has_payload') else None self._m_has_payload = ((self.control & 32) >> 5) return self._m_has_payload if hasattr(self, '_m_has_payload') else None @property def arq_on(self): if hasattr(self, '_m_arq_on'): return self._m_arq_on if hasattr(self, '_m_arq_on') else None self._m_arq_on = ((self.control & 16) >> 4) return self._m_arq_on if hasattr(self, '_m_arq_on') else None @property def is_authenticated(self): if hasattr(self, '_m_is_authenticated'): return self._m_is_authenticated if hasattr(self, '_m_is_authenticated') else None self._m_is_authenticated = ((self.control & 8) >> 3) return self._m_is_authenticated if hasattr(self, '_m_is_authenticated') else None @property def vc(self): if hasattr(self, '_m_vc'): return self._m_vc if hasattr(self, '_m_vc') else None self._m_vc = ((self.control & 7) >> 0) return self._m_vc if hasattr(self, '_m_vc') else None class IFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.ax25_info = self._io.read_bytes_full() class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Foresail1.Callsign(_io__raw_callsign_ror, self, self._root) class ObcHousekeeping(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = Foresail1.UnixTimestamp(self._io, self, self._root) self.side = self._io.read_u1() self.fdir = self._io.read_u1() self.scheduler = self._io.read_u1() self.software_revision = self._io.read_u1() self.uptime = self._io.read_u4le() self.heap_free = self._io.read_u1() self.cpu_load = self._io.read_u1() self.fs_free_space = self._io.read_u2le() self.arbiter_uptime = self._io.read_u2le() self.arbiter_age = self._io.read_u2le() self.arbiter_bootcount = self._io.read_u2le() self.arbiter_temperature = self._io.read_s2le() self.side_a_bootcount = self._io.read_u1() self.side_a_heartbeat = self._io.read_u1() self.side_a_fail_counter = self._io.read_u1() self.side_a_fail_reason = self._io.read_u1() self.side_b_bootcount = self._io.read_u1() self.side_b_heartbeat = self._io.read_u1() self.side_b_fail_counter = self._io.read_u1() self.side_b_fail_reason = self._io.read_u1() self.arbiter_log_1 = self._io.read_u1() self.arbiter_log_2 = self._io.read_u1() self.arbiter_log_3 = self._io.read_u1() self.arbiter_log_4 = self._io.read_u1()
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/foresail1.py
0.53607
0.25503
foresail1.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO import satnogsdecoders.process if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Chomptt(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_frame.ax25_header.src_ssid_raw.ssid :field dest_ssid: ax25_frame.ax25_header.dest_ssid_raw.ssid :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field identifier: ax25_frame.payload.ax25_info.identifier :field msg_num: ax25_frame.payload.ax25_info.chomptb85.msg_num :field time: ax25_frame.payload.ax25_info.chomptb85.time :field mode: ax25_frame.payload.ax25_info.chomptb85.mode :field idle_timer: ax25_frame.payload.ax25_info.chomptb85.idle_timer :field vbat: ax25_frame.payload.ax25_info.chomptb85.vbat :field spc_xp: ax25_frame.payload.ax25_info.chomptb85.spc_xp :field spc_xn: ax25_frame.payload.ax25_info.chomptb85.spc_xn :field spc_yp: ax25_frame.payload.ax25_info.chomptb85.spc_yp :field spc_zp: ax25_frame.payload.ax25_info.chomptb85.spc_zp :field spc_zn: ax25_frame.payload.ax25_info.chomptb85.spc_zn :field temp_b1: ax25_frame.payload.ax25_info.chomptb85.temp_b1 :field temp_b3: ax25_frame.payload.ax25_info.chomptb85.temp_b3 :field temp_b4: ax25_frame.payload.ax25_info.chomptb85.temp_b4 :field temp_b5: ax25_frame.payload.ax25_info.chomptb85.temp_b5 :field temp_b6: ax25_frame.payload.ax25_info.chomptb85.temp_b6 :field temp_b9: ax25_frame.payload.ax25_info.chomptb85.temp_b9 :field temp_xn: ax25_frame.payload.ax25_info.chomptb85.temp_xn :field temp_xp: ax25_frame.payload.ax25_info.chomptb85.temp_xp :field temp_yp: ax25_frame.payload.ax25_info.chomptb85.temp_yp :field temp_zn: ax25_frame.payload.ax25_info.chomptb85.temp_zn :field temp_zp: ax25_frame.payload.ax25_info.chomptb85.temp_zp :field v_bat: ax25_frame.payload.ax25_info.chomptb85.v_bat :field i_dog: ax25_frame.payload.ax25_info.chomptb85.i_dog :field i_sat: ax25_frame.payload.ax25_info.chomptb85.i_sat :field i_temp: ax25_frame.payload.ax25_info.chomptb85.i_temp :field i_gps_arduino: ax25_frame.payload.ax25_info.chomptb85.i_gps_arduino :field i_gps_novatel: ax25_frame.payload.ax25_info.chomptb85.i_gps_novatel :field i_sten: ax25_frame.payload.ax25_info.chomptb85.i_sten :field i_acs: ax25_frame.payload.ax25_info.chomptb85.i_acs :field i_rout: ax25_frame.payload.ax25_info.chomptb85.i_rout :field i_lit: ax25_frame.payload.ax25_info.chomptb85.i_lit :field mag_x: ax25_frame.payload.ax25_info.chomptb85.mag_x :field mag_y: ax25_frame.payload.ax25_info.chomptb85.mag_y :field mag_z: ax25_frame.payload.ax25_info.chomptb85.mag_z :field identifier: ax25_frame.payload.ax25_info.identifier :field flags: ax25_frame.payload.ax25_info.optib85.flags :field sup_t1: ax25_frame.payload.ax25_info.optib85.sup_t1 :field sup_t2: ax25_frame.payload.ax25_info.optib85.sup_t2 :field sup_vbat: ax25_frame.payload.ax25_info.optib85.sup_vbat :field ch1_flags: ax25_frame.payload.ax25_info.optib85.ch1_flags :field ch1_temp: ax25_frame.payload.ax25_info.optib85.ch1_temp :field csac1_temp: ax25_frame.payload.ax25_info.optib85.csac1_temp :field ch1_current: ax25_frame.payload.ax25_info.optib85.ch1_current :field ch2_flags: ax25_frame.payload.ax25_info.optib85.ch2_flags :field ch2_temp: ax25_frame.payload.ax25_info.optib85.ch2_temp :field csac2_temp: ax25_frame.payload.ax25_info.optib85.csac2_temp :field ch2_current: ax25_frame.payload.ax25_info.optib85.ch2_current :field count: ax25_frame.payload.ax25_info.optib85.count :field overflow: ax25_frame.payload.ax25_info.optib85.overflow .. seealso:: Source - https://pssl.mae.ufl.edu/#chomptt/page/beacondecode """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Chomptt.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Chomptt.Ax25Header(self._io, self, self._root) _on = (self.ax25_header.ctl & 19) if _on == 0: self.payload = Chomptt.IFrame(self._io, self, self._root) elif _on == 3: self.payload = Chomptt.UiFrame(self._io, self, self._root) elif _on == 19: self.payload = Chomptt.UiFrame(self._io, self, self._root) elif _on == 16: self.payload = Chomptt.IFrame(self._io, self, self._root) elif _on == 18: self.payload = Chomptt.IFrame(self._io, self, self._root) elif _on == 2: self.payload = Chomptt.IFrame(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Chomptt.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Chomptt.SsidMask(self._io, self, self._root) self.src_callsign_raw = Chomptt.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Chomptt.SsidMask(self._io, self, self._root) if (self.src_ssid_raw.ssid_mask & 1) == 0: self.repeater = Chomptt.Repeater(self._io, self, self._root) self.ctl = self._io.read_u1() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() _on = self._root.framelength if _on == 69: self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Chomptt.Optib85T(_io__raw_ax25_info, self, self._root) elif _on == 128: self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Chomptt.Chomptb85T(_io__raw_ax25_info, self, self._root) else: self.ax25_info = self._io.read_bytes_full() class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") class IFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.ax25_info = self._io.read_bytes_full() class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class Repeaters(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_callsign_raw = Chomptt.CallsignRaw(self._io, self, self._root) self.rpt_ssid_raw = Chomptt.SsidMask(self._io, self, self._root) class Repeater(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_instance = [] i = 0 while True: _ = Chomptt.Repeaters(self._io, self, self._root) self.rpt_instance.append(_) if (_.rpt_ssid_raw.ssid_mask & 1) == 1: break i += 1 class Optib85T(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.identifier = (self._io.read_bytes(4)).decode(u"ASCII") self.sod = self._io.read_bytes(2) self._raw__raw_optib85 = self._io.read_bytes(38) _process = satnogsdecoders.process.B85decode() self._raw_optib85 = _process.decode(self._raw__raw_optib85) _io__raw_optib85 = KaitaiStream(BytesIO(self._raw_optib85)) self.optib85 = Chomptt.OptiT(_io__raw_optib85, self, self._root) self.eod = self._io.read_bytes(2) class OptiT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.flags = self._io.read_u2le() self.sup_t1 = self._io.read_s2le() self.sup_t2 = self._io.read_s2le() self.sup_vbat = self._io.read_s2le() self.ch1_flags = self._io.read_u2le() self.ch1_temp = self._io.read_s2le() self.csac1_temp = self._io.read_s2le() self.ch1_current = self._io.read_s2le() self.ch2_flags = self._io.read_u2le() self.ch2_temp = self._io.read_s2le() self.csac2_temp = self._io.read_s2le() self.ch2_current = self._io.read_s2le() self.count = self._io.read_u2le() self.overflow = self._io.read_u4le() class ChomptT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.msg_num = self._io.read_u2le() self.time = self._io.read_u4le() self.mode = self._io.read_u1() self.idle_timer = self._io.read_u2le() self.vbat = self._io.read_u2le() self.spc_xp = self._io.read_s2le() self.spc_xn = self._io.read_s2le() self.spc_yp = self._io.read_s2le() self.spc_zp = self._io.read_s2le() self.spc_zn = self._io.read_s2le() self.temp_b1 = self._io.read_u2le() self.temp_b3 = self._io.read_u2le() self.temp_b4 = self._io.read_u2le() self.temp_b5 = self._io.read_u2le() self.temp_b6 = self._io.read_u2le() self.temp_b9 = self._io.read_u2le() self.temp_xn = self._io.read_s2le() self.temp_xp = self._io.read_s2le() self.temp_yp = self._io.read_s2le() self.temp_zn = self._io.read_s2le() self.temp_zp = self._io.read_s2le() self.v_bat = self._io.read_s2le() self.i_dog = self._io.read_s2le() self.i_sat = self._io.read_s2le() self.i_temp = self._io.read_s2le() self.i_gps_arduino = self._io.read_s2le() self.i_gps_novatel = self._io.read_s2le() self.i_sten = self._io.read_s2le() self.i_acs = self._io.read_s2le() self.i_rout = self._io.read_s2le() self.i_lit = self._io.read_s2le() self.mag_x = self._io.read_f4le() self.mag_y = self._io.read_f4le() self.mag_z = self._io.read_f4le() class Chomptb85T(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.identifier = (self._io.read_bytes_term(92, False, True, True)).decode(u"ASCII") self.sod = self._io.read_bytes(2) self._raw__raw_chomptb85 = self._io.read_bytes(94) _process = satnogsdecoders.process.B85decode() self._raw_chomptb85 = _process.decode(self._raw__raw_chomptb85) _io__raw_chomptb85 = KaitaiStream(BytesIO(self._raw_chomptb85)) self.chomptb85 = Chomptt.ChomptT(_io__raw_chomptb85, self, self._root) self.eod = self._io.read_bytes(2) class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Chomptt.Callsign(_io__raw_callsign_ror, self, self._root) @property def rpt1_callsign(self): if hasattr(self, '_m_rpt1_callsign'): return self._m_rpt1_callsign if hasattr(self, '_m_rpt1_callsign') else None self._m_rpt1_callsign = self.ax25_frame.ax25_header.repeater.rpt_instance[0].rpt_callsign_raw.callsign_ror.callsign return self._m_rpt1_callsign if hasattr(self, '_m_rpt1_callsign') else None @property def framelength(self): if hasattr(self, '_m_framelength'): return self._m_framelength if hasattr(self, '_m_framelength') else None self._m_framelength = self._io.size() return self._m_framelength if hasattr(self, '_m_framelength') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/chomptt.py
0.510985
0.200832
chomptt.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Us6(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_frame.ax25_header.src_ssid_raw.ssid :field dest_ssid: ax25_frame.ax25_header.dest_ssid_raw.ssid :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field packetindex: ax25_frame.payload.ax25_info.packetindex :field groundindexack: ax25_frame.payload.ax25_info.groundindexack :field payloadsize: ax25_frame.payload.ax25_info.payloadsize :field rebootcounter: ax25_frame.payload.ax25_info.rebootcounter :field uptime: ax25_frame.payload.ax25_info.uptime :field unixtime: ax25_frame.payload.ax25_info.unixtime :field tempmcu: ax25_frame.payload.ax25_info.tempmcu :field tempfpga: ax25_frame.payload.ax25_info.tempfpga :field magnetometerx: ax25_frame.payload.ax25_info.magnetometerx :field magnetometery: ax25_frame.payload.ax25_info.magnetometery :field magnetometerz: ax25_frame.payload.ax25_info.magnetometerz :field gyroscopex: ax25_frame.payload.ax25_info.gyroscopex :field gyroscopey: ax25_frame.payload.ax25_info.gyroscopey :field gyroscopez: ax25_frame.payload.ax25_info.gyroscopez :field cpucurrent: ax25_frame.payload.ax25_info.cpucurrent :field tempradio: ax25_frame.payload.ax25_info.tempradio :field payloadreserved1: ax25_frame.payload.ax25_info.payloadreserved1 :field payloadreserved2: ax25_frame.payload.ax25_info.payloadreserved2 :field tempbottom: ax25_frame.payload.ax25_info.tempbottom :field tempupper: ax25_frame.payload.ax25_info.tempupper :field payloadreserved3: ax25_frame.payload.ax25_info.payloadreserved3 :field epsvbat: ax25_frame.payload.ax25_info.epsvbat :field epscurrent_sun: ax25_frame.payload.ax25_info.epscurrent_sun :field epscurrent_out: ax25_frame.payload.ax25_info.epscurrent_out :field epsvpanel01: ax25_frame.payload.ax25_info.epsvpanel01 :field epsvpanel02: ax25_frame.payload.ax25_info.epsvpanel02 :field epsvpanel03: ax25_frame.payload.ax25_info.epsvpanel03 :field epscurrent01: ax25_frame.payload.ax25_info.epscurrent01 :field epscurrent02: ax25_frame.payload.ax25_info.epscurrent02 :field epscurrent03: ax25_frame.payload.ax25_info.epscurrent03 :field epsbatttemp: ax25_frame.payload.ax25_info.epsbatttemp :field payloadreserved4: ax25_frame.payload.ax25_info.payloadreserved4 :field saterrorflags: ax25_frame.payload.ax25_info.saterrorflags :field satoperationstatus: ax25_frame.payload.ax25_info.satoperationstatus :field crc: ax25_frame.payload.ax25_info.crc .. seealso:: Source - https://www.gaussteam.com/radio-amateur-information-for-unisat-6/ """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Us6.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Us6.Ax25Header(self._io, self, self._root) self.payload = Us6.Us6Frame(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Us6.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Us6.SsidMask(self._io, self, self._root) self.src_callsign_raw = Us6.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Us6.SsidMask(self._io, self, self._root) self.ctl = self._io.read_u1() class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") class Us6Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.ax25_info = Us6.Frame(self._io, self, self._root) class Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.syncpacket = self._io.read_bytes(3) if not self.syncpacket == b"\x55\x53\x36": raise kaitaistruct.ValidationNotEqualError(b"\x55\x53\x36", self.syncpacket, self._io, u"/types/frame/seq/0") self.packetindex = self._io.read_u2le() self.groundindexack = self._io.read_u2le() self.packettype = self._io.read_bytes(1) if not self.packettype == b"\x01": raise kaitaistruct.ValidationNotEqualError(b"\x01", self.packettype, self._io, u"/types/frame/seq/3") self.payloadsize = self._io.read_u1() self.rebootcounter = self._io.read_u2le() self.uptime = self._io.read_u4le() self.unixtime = self._io.read_u4le() self.tempmcu = self._io.read_s1() self.tempfpga = self._io.read_s1() self.magnetometerx = self._io.read_s2le() self.magnetometery = self._io.read_s2le() self.magnetometerz = self._io.read_s2le() self.gyroscopex = self._io.read_s2le() self.gyroscopey = self._io.read_s2le() self.gyroscopez = self._io.read_s2le() self.cpucurrent = self._io.read_u2le() self.tempradio = self._io.read_s1() self.payloadreserved1 = self._io.read_u1() self.payloadreserved2 = self._io.read_u1() self.tempbottom = self._io.read_u1() self.tempupper = self._io.read_u1() self.payloadreserved3 = self._io.read_u1() self.epsvbat = self._io.read_u2le() self.epscurrent_sun = self._io.read_u2le() self.epscurrent_out = self._io.read_u2le() self.epsvpanel01 = self._io.read_u2le() self.epsvpanel02 = self._io.read_u2le() self.epsvpanel03 = self._io.read_u2le() self.epscurrent01 = self._io.read_u2le() self.epscurrent02 = self._io.read_u2le() self.epscurrent03 = self._io.read_u2le() self.epsbatttemp = self._io.read_u2le() self.payloadreserved4 = self._io.read_u1() self.saterrorflags = self._io.read_u2le() self.satoperationstatus = self._io.read_u1() self.crc = self._io.read_u1() class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Us6.Callsign(_io__raw_callsign_ror, self, self._root)
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/us6.py
0.407923
0.155174
us6.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Ramsat(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_frame.ax25_header.src_ssid_raw.ssid :field dest_ssid: ax25_frame.ax25_header.dest_ssid_raw.ssid :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field prefix: ax25_frame.payload.payload.prefix :field beacon_timestamp: ax25_frame.payload.payload.beacon_timestamp :field battery_voltage: ax25_frame.payload.payload.battery_voltage :field battery_current_magnitude: ax25_frame.payload.payload.battery_current_magnitude :field battery_is_charging: ax25_frame.payload.payload.battery_is_charging :field voltage_feeding_bcr1_x: ax25_frame.payload.payload.voltage_feeding_bcr1_x :field current_bcr1_neg_x: ax25_frame.payload.payload.current_bcr1_neg_x :field current_bcr1_pos_x: ax25_frame.payload.payload.current_bcr1_pos_x :field voltage_feeding_bcr2_y: ax25_frame.payload.payload.voltage_feeding_bcr2_y :field current_bcr1_neg_y: ax25_frame.payload.payload.current_bcr1_neg_y :field current_bcr1_pos_y: ax25_frame.payload.payload.current_bcr1_pos_y :field voltage_feeding_bcr3_z: ax25_frame.payload.payload.voltage_feeding_bcr3_z :field current_bcr1_neg_z: ax25_frame.payload.payload.current_bcr1_neg_z :field bcr_output_voltage: ax25_frame.payload.payload.bcr_output_voltage :field bcr_output_current: ax25_frame.payload.payload.bcr_output_current :field battery_bus_voltage: ax25_frame.payload.payload.battery_bus_voltage :field battery_bus_current: ax25_frame.payload.payload.battery_bus_current :field low_v_bus_voltage: ax25_frame.payload.payload.low_v_bus_voltage :field low_v_bus_current: ax25_frame.payload.payload.low_v_bus_current :field high_v_bus_voltage: ax25_frame.payload.payload.high_v_bus_voltage :field high_v_bus_current: ax25_frame.payload.payload.high_v_bus_current :field temperature_eps: ax25_frame.payload.payload.temperature_eps :field temperature_battery_motherboard: ax25_frame.payload.payload.temperature_battery_motherboard :field temperature_battery_daughterboard: ax25_frame.payload.payload.temperature_battery_daughterboard :field temperature_pos_x_array: ax25_frame.payload.payload.temperature_pos_x_array :field temperature_neg_x_array: ax25_frame.payload.payload.temperature_neg_x_array :field temperature_pos_y_array: ax25_frame.payload.payload.temperature_pos_y_array :field temperature_neg_y_array: ax25_frame.payload.payload.temperature_neg_y_array :field sunsensor_pos_xa: ax25_frame.payload.payload.sunsensor_pos_xa :field sunsensor_pos_xb: ax25_frame.payload.payload.sunsensor_pos_xb :field sunsensor_neg_xa: ax25_frame.payload.payload.sunsensor_neg_xa :field sunsensor_neg_xb: ax25_frame.payload.payload.sunsensor_neg_xb :field sunsensor_pos_ya: ax25_frame.payload.payload.sunsensor_pos_ya :field sunsensor_pos_yb: ax25_frame.payload.payload.sunsensor_pos_yb :field sunsensor_neg_ya: ax25_frame.payload.payload.sunsensor_neg_ya :field sunsensor_net_yb: ax25_frame.payload.payload.sunsensor_net_yb :field imtq_cal_mag_x: ax25_frame.payload.payload.imtq_cal_mag_x :field imtq_cal_mag_y: ax25_frame.payload.payload.imtq_cal_mag_y :field imtq_cal_mag_z: ax25_frame.payload.payload.imtq_cal_mag_z :field antenna_deployment_status: ax25_frame.payload.payload.antenna_deployment_status :field longitude: ax25_frame.payload.payload.longitude :field latitude: ax25_frame.payload.payload.latitude :field elevation: ax25_frame.payload.payload.elevation """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Ramsat.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Ramsat.Ax25Header(self._io, self, self._root) _on = (self.ax25_header.ctl & 19) if _on == 0: self.payload = Ramsat.IFrame(self._io, self, self._root) elif _on == 3: self.payload = Ramsat.UiFrame(self._io, self, self._root) elif _on == 19: self.payload = Ramsat.UiFrame(self._io, self, self._root) elif _on == 16: self.payload = Ramsat.IFrame(self._io, self, self._root) elif _on == 18: self.payload = Ramsat.IFrame(self._io, self, self._root) elif _on == 2: self.payload = Ramsat.IFrame(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Ramsat.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Ramsat.SsidMask(self._io, self, self._root) self.src_callsign_raw = Ramsat.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Ramsat.SsidMask(self._io, self, self._root) self.ctl = self._io.read_u1() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.payload = Ramsat.RsPacket(self._io, self, self._root) class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") if not ((self.callsign == u"CQ ") or (self.callsign == u"W4SKH ")) : raise kaitaistruct.ValidationNotAnyOfError(self.callsign, self._io, u"/types/callsign/seq/0") class RsPacket(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.prefix = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") if not self.prefix == u"RSBeac:": raise kaitaistruct.ValidationNotEqualError(u"RSBeac:", self.prefix, self._io, u"/types/rs_packet/seq/0") self.beacon_timestamp = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.battery_voltage_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.battery_current_magnitude_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.battery_is_charging_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.voltage_feeding_bcr1_x_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.current_bcr1_neg_x_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.current_bcr1_pos_x_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.voltage_feeding_bcr2_y_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.current_bcr1_neg_y_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.current_bcr1_pos_y_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.voltage_feeding_bcr3_z_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.current_bcr1_neg_z_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.bcr_output_voltage_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.bcr_output_current_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.battery_bus_voltage_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.battery_bus_current_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.low_v_bus_voltage_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.low_v_bus_current_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.high_v_bus_voltage_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.high_v_bus_current_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.temperature_eps_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.temperature_battery_motherboard_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.temperature_battery_daughterboard_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.temperature_pos_x_array_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.temperature_neg_x_array_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.temperature_pos_y_array_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.temperature_neg_y_array_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.sunsensor_pos_xa_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.sunsensor_pos_xb_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.sunsensor_neg_xa_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.sunsensor_neg_xb_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.sunsensor_pos_ya_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.sunsensor_pos_yb_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.sunsensor_neg_ya_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.sunsensor_net_yb_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.imtq_cal_mag_x_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.imtq_cal_mag_y_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.imtq_cal_mag_z_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.antenna_deployment_status_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.longitude_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.latitude_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.elevation_str = (self._io.read_bytes(4)).decode(u"ASCII") @property def bcr_output_current(self): if hasattr(self, '_m_bcr_output_current'): return self._m_bcr_output_current if hasattr(self, '_m_bcr_output_current') else None self._m_bcr_output_current = int(self.bcr_output_current_str) return self._m_bcr_output_current if hasattr(self, '_m_bcr_output_current') else None @property def bcr_output_voltage(self): if hasattr(self, '_m_bcr_output_voltage'): return self._m_bcr_output_voltage if hasattr(self, '_m_bcr_output_voltage') else None self._m_bcr_output_voltage = int(self.bcr_output_voltage_str) return self._m_bcr_output_voltage if hasattr(self, '_m_bcr_output_voltage') else None @property def sunsensor_neg_ya(self): if hasattr(self, '_m_sunsensor_neg_ya'): return self._m_sunsensor_neg_ya if hasattr(self, '_m_sunsensor_neg_ya') else None self._m_sunsensor_neg_ya = int(self.sunsensor_neg_ya_str) return self._m_sunsensor_neg_ya if hasattr(self, '_m_sunsensor_neg_ya') else None @property def temperature_neg_y_array(self): if hasattr(self, '_m_temperature_neg_y_array'): return self._m_temperature_neg_y_array if hasattr(self, '_m_temperature_neg_y_array') else None self._m_temperature_neg_y_array = int(self.temperature_neg_y_array_str) return self._m_temperature_neg_y_array if hasattr(self, '_m_temperature_neg_y_array') else None @property def current_bcr1_neg_x(self): if hasattr(self, '_m_current_bcr1_neg_x'): return self._m_current_bcr1_neg_x if hasattr(self, '_m_current_bcr1_neg_x') else None self._m_current_bcr1_neg_x = int(self.current_bcr1_neg_x_str) return self._m_current_bcr1_neg_x if hasattr(self, '_m_current_bcr1_neg_x') else None @property def imtq_cal_mag_x(self): if hasattr(self, '_m_imtq_cal_mag_x'): return self._m_imtq_cal_mag_x if hasattr(self, '_m_imtq_cal_mag_x') else None self._m_imtq_cal_mag_x = int(self.imtq_cal_mag_x_str) return self._m_imtq_cal_mag_x if hasattr(self, '_m_imtq_cal_mag_x') else None @property def current_bcr1_pos_x(self): if hasattr(self, '_m_current_bcr1_pos_x'): return self._m_current_bcr1_pos_x if hasattr(self, '_m_current_bcr1_pos_x') else None self._m_current_bcr1_pos_x = int(self.current_bcr1_pos_x_str) return self._m_current_bcr1_pos_x if hasattr(self, '_m_current_bcr1_pos_x') else None @property def sunsensor_net_yb(self): if hasattr(self, '_m_sunsensor_net_yb'): return self._m_sunsensor_net_yb if hasattr(self, '_m_sunsensor_net_yb') else None self._m_sunsensor_net_yb = int(self.sunsensor_net_yb_str) return self._m_sunsensor_net_yb if hasattr(self, '_m_sunsensor_net_yb') else None @property def temperature_pos_x_array(self): if hasattr(self, '_m_temperature_pos_x_array'): return self._m_temperature_pos_x_array if hasattr(self, '_m_temperature_pos_x_array') else None self._m_temperature_pos_x_array = int(self.temperature_pos_x_array_str) return self._m_temperature_pos_x_array if hasattr(self, '_m_temperature_pos_x_array') else None @property def battery_bus_voltage(self): if hasattr(self, '_m_battery_bus_voltage'): return self._m_battery_bus_voltage if hasattr(self, '_m_battery_bus_voltage') else None self._m_battery_bus_voltage = int(self.battery_bus_voltage_str) return self._m_battery_bus_voltage if hasattr(self, '_m_battery_bus_voltage') else None @property def battery_current_magnitude(self): if hasattr(self, '_m_battery_current_magnitude'): return self._m_battery_current_magnitude if hasattr(self, '_m_battery_current_magnitude') else None self._m_battery_current_magnitude = int(self.battery_current_magnitude_str) return self._m_battery_current_magnitude if hasattr(self, '_m_battery_current_magnitude') else None @property def sunsensor_pos_xa(self): if hasattr(self, '_m_sunsensor_pos_xa'): return self._m_sunsensor_pos_xa if hasattr(self, '_m_sunsensor_pos_xa') else None self._m_sunsensor_pos_xa = int(self.sunsensor_pos_xa_str) return self._m_sunsensor_pos_xa if hasattr(self, '_m_sunsensor_pos_xa') else None @property def battery_voltage(self): if hasattr(self, '_m_battery_voltage'): return self._m_battery_voltage if hasattr(self, '_m_battery_voltage') else None self._m_battery_voltage = int(self.battery_voltage_str) return self._m_battery_voltage if hasattr(self, '_m_battery_voltage') else None @property def low_v_bus_voltage(self): if hasattr(self, '_m_low_v_bus_voltage'): return self._m_low_v_bus_voltage if hasattr(self, '_m_low_v_bus_voltage') else None self._m_low_v_bus_voltage = int(self.low_v_bus_voltage_str) return self._m_low_v_bus_voltage if hasattr(self, '_m_low_v_bus_voltage') else None @property def sunsensor_neg_xa(self): if hasattr(self, '_m_sunsensor_neg_xa'): return self._m_sunsensor_neg_xa if hasattr(self, '_m_sunsensor_neg_xa') else None self._m_sunsensor_neg_xa = int(self.sunsensor_neg_xa_str) return self._m_sunsensor_neg_xa if hasattr(self, '_m_sunsensor_neg_xa') else None @property def temperature_eps(self): if hasattr(self, '_m_temperature_eps'): return self._m_temperature_eps if hasattr(self, '_m_temperature_eps') else None self._m_temperature_eps = int(self.temperature_eps_str) return self._m_temperature_eps if hasattr(self, '_m_temperature_eps') else None @property def latitude(self): if hasattr(self, '_m_latitude'): return self._m_latitude if hasattr(self, '_m_latitude') else None self._m_latitude = int(self.latitude_str) return self._m_latitude if hasattr(self, '_m_latitude') else None @property def sunsensor_pos_xb(self): if hasattr(self, '_m_sunsensor_pos_xb'): return self._m_sunsensor_pos_xb if hasattr(self, '_m_sunsensor_pos_xb') else None self._m_sunsensor_pos_xb = int(self.sunsensor_pos_xb_str) return self._m_sunsensor_pos_xb if hasattr(self, '_m_sunsensor_pos_xb') else None @property def longitude(self): if hasattr(self, '_m_longitude'): return self._m_longitude if hasattr(self, '_m_longitude') else None self._m_longitude = int(self.longitude_str) return self._m_longitude if hasattr(self, '_m_longitude') else None @property def elevation(self): if hasattr(self, '_m_elevation'): return self._m_elevation if hasattr(self, '_m_elevation') else None self._m_elevation = int(self.elevation_str) return self._m_elevation if hasattr(self, '_m_elevation') else None @property def voltage_feeding_bcr1_x(self): if hasattr(self, '_m_voltage_feeding_bcr1_x'): return self._m_voltage_feeding_bcr1_x if hasattr(self, '_m_voltage_feeding_bcr1_x') else None self._m_voltage_feeding_bcr1_x = int(self.voltage_feeding_bcr1_x_str) return self._m_voltage_feeding_bcr1_x if hasattr(self, '_m_voltage_feeding_bcr1_x') else None @property def voltage_feeding_bcr2_y(self): if hasattr(self, '_m_voltage_feeding_bcr2_y'): return self._m_voltage_feeding_bcr2_y if hasattr(self, '_m_voltage_feeding_bcr2_y') else None self._m_voltage_feeding_bcr2_y = int(self.voltage_feeding_bcr2_y_str) return self._m_voltage_feeding_bcr2_y if hasattr(self, '_m_voltage_feeding_bcr2_y') else None @property def temperature_battery_daughterboard(self): if hasattr(self, '_m_temperature_battery_daughterboard'): return self._m_temperature_battery_daughterboard if hasattr(self, '_m_temperature_battery_daughterboard') else None self._m_temperature_battery_daughterboard = int(self.temperature_battery_daughterboard_str) return self._m_temperature_battery_daughterboard if hasattr(self, '_m_temperature_battery_daughterboard') else None @property def current_bcr1_pos_y(self): if hasattr(self, '_m_current_bcr1_pos_y'): return self._m_current_bcr1_pos_y if hasattr(self, '_m_current_bcr1_pos_y') else None self._m_current_bcr1_pos_y = int(self.current_bcr1_pos_y_str) return self._m_current_bcr1_pos_y if hasattr(self, '_m_current_bcr1_pos_y') else None @property def antenna_deployment_status(self): if hasattr(self, '_m_antenna_deployment_status'): return self._m_antenna_deployment_status if hasattr(self, '_m_antenna_deployment_status') else None self._m_antenna_deployment_status = int(self.antenna_deployment_status_str) return self._m_antenna_deployment_status if hasattr(self, '_m_antenna_deployment_status') else None @property def battery_is_charging(self): if hasattr(self, '_m_battery_is_charging'): return self._m_battery_is_charging if hasattr(self, '_m_battery_is_charging') else None self._m_battery_is_charging = int(self.battery_is_charging_str) return self._m_battery_is_charging if hasattr(self, '_m_battery_is_charging') else None @property def battery_bus_current(self): if hasattr(self, '_m_battery_bus_current'): return self._m_battery_bus_current if hasattr(self, '_m_battery_bus_current') else None self._m_battery_bus_current = int(self.battery_bus_current_str) return self._m_battery_bus_current if hasattr(self, '_m_battery_bus_current') else None @property def sunsensor_pos_ya(self): if hasattr(self, '_m_sunsensor_pos_ya'): return self._m_sunsensor_pos_ya if hasattr(self, '_m_sunsensor_pos_ya') else None self._m_sunsensor_pos_ya = int(self.sunsensor_pos_ya_str) return self._m_sunsensor_pos_ya if hasattr(self, '_m_sunsensor_pos_ya') else None @property def low_v_bus_current(self): if hasattr(self, '_m_low_v_bus_current'): return self._m_low_v_bus_current if hasattr(self, '_m_low_v_bus_current') else None self._m_low_v_bus_current = int(self.low_v_bus_current_str) return self._m_low_v_bus_current if hasattr(self, '_m_low_v_bus_current') else None @property def voltage_feeding_bcr3_z(self): if hasattr(self, '_m_voltage_feeding_bcr3_z'): return self._m_voltage_feeding_bcr3_z if hasattr(self, '_m_voltage_feeding_bcr3_z') else None self._m_voltage_feeding_bcr3_z = int(self.voltage_feeding_bcr3_z_str) return self._m_voltage_feeding_bcr3_z if hasattr(self, '_m_voltage_feeding_bcr3_z') else None @property def current_bcr1_neg_y(self): if hasattr(self, '_m_current_bcr1_neg_y'): return self._m_current_bcr1_neg_y if hasattr(self, '_m_current_bcr1_neg_y') else None self._m_current_bcr1_neg_y = int(self.current_bcr1_neg_y_str) return self._m_current_bcr1_neg_y if hasattr(self, '_m_current_bcr1_neg_y') else None @property def current_bcr1_neg_z(self): if hasattr(self, '_m_current_bcr1_neg_z'): return self._m_current_bcr1_neg_z if hasattr(self, '_m_current_bcr1_neg_z') else None self._m_current_bcr1_neg_z = int(self.current_bcr1_neg_z_str) return self._m_current_bcr1_neg_z if hasattr(self, '_m_current_bcr1_neg_z') else None @property def high_v_bus_current(self): if hasattr(self, '_m_high_v_bus_current'): return self._m_high_v_bus_current if hasattr(self, '_m_high_v_bus_current') else None self._m_high_v_bus_current = int(self.high_v_bus_current_str) return self._m_high_v_bus_current if hasattr(self, '_m_high_v_bus_current') else None @property def imtq_cal_mag_z(self): if hasattr(self, '_m_imtq_cal_mag_z'): return self._m_imtq_cal_mag_z if hasattr(self, '_m_imtq_cal_mag_z') else None self._m_imtq_cal_mag_z = int(self.imtq_cal_mag_z_str) return self._m_imtq_cal_mag_z if hasattr(self, '_m_imtq_cal_mag_z') else None @property def high_v_bus_voltage(self): if hasattr(self, '_m_high_v_bus_voltage'): return self._m_high_v_bus_voltage if hasattr(self, '_m_high_v_bus_voltage') else None self._m_high_v_bus_voltage = int(self.high_v_bus_voltage_str) return self._m_high_v_bus_voltage if hasattr(self, '_m_high_v_bus_voltage') else None @property def sunsensor_pos_yb(self): if hasattr(self, '_m_sunsensor_pos_yb'): return self._m_sunsensor_pos_yb if hasattr(self, '_m_sunsensor_pos_yb') else None self._m_sunsensor_pos_yb = int(self.sunsensor_pos_yb_str) return self._m_sunsensor_pos_yb if hasattr(self, '_m_sunsensor_pos_yb') else None @property def imtq_cal_mag_y(self): if hasattr(self, '_m_imtq_cal_mag_y'): return self._m_imtq_cal_mag_y if hasattr(self, '_m_imtq_cal_mag_y') else None self._m_imtq_cal_mag_y = int(self.imtq_cal_mag_y_str) return self._m_imtq_cal_mag_y if hasattr(self, '_m_imtq_cal_mag_y') else None @property def sunsensor_neg_xb(self): if hasattr(self, '_m_sunsensor_neg_xb'): return self._m_sunsensor_neg_xb if hasattr(self, '_m_sunsensor_neg_xb') else None self._m_sunsensor_neg_xb = int(self.sunsensor_neg_xb_str) return self._m_sunsensor_neg_xb if hasattr(self, '_m_sunsensor_neg_xb') else None @property def temperature_pos_y_array(self): if hasattr(self, '_m_temperature_pos_y_array'): return self._m_temperature_pos_y_array if hasattr(self, '_m_temperature_pos_y_array') else None self._m_temperature_pos_y_array = int(self.temperature_pos_y_array_str) return self._m_temperature_pos_y_array if hasattr(self, '_m_temperature_pos_y_array') else None @property def temperature_battery_motherboard(self): if hasattr(self, '_m_temperature_battery_motherboard'): return self._m_temperature_battery_motherboard if hasattr(self, '_m_temperature_battery_motherboard') else None self._m_temperature_battery_motherboard = int(self.temperature_battery_motherboard_str) return self._m_temperature_battery_motherboard if hasattr(self, '_m_temperature_battery_motherboard') else None @property def temperature_neg_x_array(self): if hasattr(self, '_m_temperature_neg_x_array'): return self._m_temperature_neg_x_array if hasattr(self, '_m_temperature_neg_x_array') else None self._m_temperature_neg_x_array = int(self.temperature_neg_x_array_str) return self._m_temperature_neg_x_array if hasattr(self, '_m_temperature_neg_x_array') else None class IFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.ax25_info = self._io.read_bytes_full() class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Ramsat.Callsign(_io__raw_callsign_ror, self, self._root)
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/ramsat.py
0.560132
0.283211
ramsat.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO import satnogsdecoders.process if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Geoscanedelveis(KaitaiStruct): """:field dest_callsign: data.ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: data.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: data.ax25_header.src_ssid_raw.ssid :field dest_ssid: data.ax25_header.dest_ssid_raw.ssid :field ctl: data.ax25_header.ctl :field pid: data.ax25_header.pid :field obc_timestamp: data.payload.obc_timestamp :field eps_cell_current: data.payload.eps_cell_current :field eps_system_current: data.payload.eps_system_current :field eps_cell_voltage_half: data.payload.eps_cell_voltage_half :field eps_cell_voltage_full: data.payload.eps_cell_voltage_full :field adc_temperature_pos_x: data.payload.adc_temperature_pos_x :field adc_temperature_neg_x: data.payload.adc_temperature_neg_x :field adc_temperature_pos_y: data.payload.adc_temperature_pos_y :field adc_temperature_neg_y: data.payload.adc_temperature_neg_y :field adc_temperature_pos_z: data.payload.adc_temperature_pos_z :field adc_temperature_neg_z: data.payload.adc_temperature_neg_z :field adc_temperature_cell1: data.payload.adc_temperature_cell1 :field adc_temperature_cell2: data.payload.adc_temperature_cell2 :field obc_cpu_load: data.payload.obc_cpu_load :field obc_boot_count: data.payload.obc_boot_count :field comm_boot_count: data.payload.comm_boot_count :field comm_rssi: data.payload.comm_rssi :field sat_id: data.geoscan_header.sat_id :field info: data.geoscan_header.info :field offset: data.geoscan_header.offset :field cmd: data.geoscan_data.cmd :field adc_timestamp: data.geoscan_data.payload.adc_timestamp :field sun_sensor_pos_x: data.geoscan_data.payload.sun_sensor_pos_x :field sun_sensor_neg_x: data.geoscan_data.payload.sun_sensor_neg_x :field sun_sensor_pos_y: data.geoscan_data.payload.sun_sensor_pos_y :field sun_sensor_neg_y: data.geoscan_data.payload.sun_sensor_neg_y :field sun_sensor_neg_z: data.geoscan_data.payload.sun_sensor_neg_z :field mag_sensor_pos_x: data.geoscan_data.payload.mag_sensor_pos_x :field mag_sensor_neg_x: data.geoscan_data.payload.mag_sensor_neg_x :field mag_sensor_pos_y: data.geoscan_data.payload.mag_sensor_pos_y :field mag_sensor_neg_y: data.geoscan_data.payload.mag_sensor_neg_y :field mag_sensor_pos_z: data.geoscan_data.payload.mag_sensor_pos_z :field mag_sensor_neg_z: data.geoscan_data.payload.mag_sensor_neg_z :field temperature_pos_x: data.geoscan_data.payload.temperature_pos_x :field temperature_neg_x: data.geoscan_data.payload.temperature_neg_x :field temperature_pos_y: data.geoscan_data.payload.temperature_pos_y :field temperature_neg_y: data.geoscan_data.payload.temperature_neg_y :field temperature_pos_z: data.geoscan_data.payload.temperature_pos_z :field temperature_neg_z: data.geoscan_data.payload.temperature_neg_z :field temperature_cell1: data.geoscan_data.payload.temperature_cell1 :field temperature_cell2: data.geoscan_data.payload.temperature_cell2 :field status: data.geoscan_data.payload.status :field eps_timestamp: data.geoscan_data.payload.eps_timestamp :field geoscan_data_eps_cell_current: data.geoscan_data.payload.eps_cell_current :field geoscan_data_eps_system_current: data.geoscan_data.payload.eps_system_current :field reserved0: data.geoscan_data.payload.reserved0 :field reserved1: data.geoscan_data.payload.reserved1 :field reserved2: data.geoscan_data.payload.reserved2 :field reserved3: data.geoscan_data.payload.reserved3 :field geoscan_data_eps_cell_voltage_half: data.geoscan_data.payload.eps_cell_voltage_half :field geoscan_data_eps_cell_voltage_full: data.geoscan_data.payload.eps_cell_voltage_full :field reserved4: data.geoscan_data.payload.reserved4 :field reserved5: data.geoscan_data.payload.reserved5 :field reserved6: data.geoscan_data.payload.reserved6 :field gnss_timestamp: data.geoscan_data.payload.gnss_timestamp :field valid: data.geoscan_data.payload.valid :field year: data.geoscan_data.payload.year :field month: data.geoscan_data.payload.month :field day: data.geoscan_data.payload.day :field hour: data.geoscan_data.payload.hour :field minute: data.geoscan_data.payload.minute :field second: data.geoscan_data.payload.second :field dutc: data.geoscan_data.payload.dutc :field offset_gnss: data.geoscan_data.payload.offset_gnss :field x: data.geoscan_data.payload.x :field y: data.geoscan_data.payload.y :field z: data.geoscan_data.payload.z :field v_x: data.geoscan_data.payload.v_x :field v_y: data.geoscan_data.payload.v_y :field v_z: data.geoscan_data.payload.v_z :field vdop: data.geoscan_data.payload.vdop :field hdop: data.geoscan_data.payload.hdop :field pdop: data.geoscan_data.payload.pdop :field tdop: data.geoscan_data.payload.tdop :field fakel_timestamp: data.geoscan_data.payload.fakel_timestamp :field bitfield0: data.geoscan_data.payload.bitfield0 :field bitfield1: data.geoscan_data.payload.bitfield1 :field voltage_80v: data.geoscan_data.payload.voltage_80v :field voltage_13v: data.geoscan_data.payload.voltage_13v :field current_valve: data.geoscan_data.payload.current_valve :field voltage_valve: data.geoscan_data.payload.voltage_valve :field current_control_valve: data.geoscan_data.payload.current_control_valve :field voltage_control_valve: data.geoscan_data.payload.voltage_control_valve :field current_ek1: data.geoscan_data.payload.current_ek1 :field voltage_ek1: data.geoscan_data.payload.voltage_ek1 :field current_ek2: data.geoscan_data.payload.current_ek2 :field voltage_ek2: data.geoscan_data.payload.voltage_ek2 :field current_ek: data.geoscan_data.payload.current_ek :field voltage_ek: data.geoscan_data.payload.voltage_ek :field temperature_td1: data.geoscan_data.payload.temperature_td1 :field reserved7: data.geoscan_data.payload.reserved7 :field temperature_tp: data.geoscan_data.payload.temperature_tp :field pressure_cylinder: data.geoscan_data.payload.pressure_cylinder :field pressure_receiver: data.geoscan_data.payload.pressure_receiver :field switch_on_counter: data.geoscan_data.payload.switch_on_counter :field time_switched_on_counter: data.geoscan_data.payload.time_switched_on_counter :field bitfield3: data.geoscan_data.payload.bitfield3 :field state: data.geoscan_data.payload.state :field reserved8: data.geoscan_data.payload.reserved8 :field reserved9: data.geoscan_data.payload.reserved9 :field pump_time: data.geoscan_data.payload.pump_time :field time_of_last_pump: data.geoscan_data.payload.time_of_last_pump :field reserved10: data.geoscan_data.payload.reserved10 :field data_str: data.geoscan_data.payload.photo_data.data.data_str """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): _on = self.type if _on == 2223669894: self.data = Geoscanedelveis.Ax25Frame(self._io, self, self._root) elif _on == 16793089: self.data = Geoscanedelveis.GeoscanFrame(self._io, self, self._root) elif _on == 16793093: self.data = Geoscanedelveis.GeoscanFrame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Geoscanedelveis.Ax25Header(self._io, self, self._root) self.payload = Geoscanedelveis.GeoscanBeaconTlm(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Geoscanedelveis.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Geoscanedelveis.SsidMask(self._io, self, self._root) self.src_callsign_raw = Geoscanedelveis.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Geoscanedelveis.SsidMask(self._io, self, self._root) self.ctl = self._io.read_u1() self.pid = self._io.read_u1() class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") if not ((self.callsign == u"BEACON") or (self.callsign == u"RS20S ")) : raise kaitaistruct.ValidationNotAnyOfError(self.callsign, self._io, u"/types/callsign/seq/0") class GeoscanFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.geoscan_header = Geoscanedelveis.GeoscanHeader(self._io, self, self._root) self.geoscan_data = Geoscanedelveis.GeoscanTlm(self._io, self, self._root) class StrB64T(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.data_str = (self._io.read_bytes_full()).decode(u"ASCII") class GeoscanPhoto(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw_photo_data = self._io.read_bytes_full() _io__raw_photo_data = KaitaiStream(BytesIO(self._raw_photo_data)) self.photo_data = Geoscanedelveis.DataB64T(_io__raw_photo_data, self, self._root) class GeoscanHeader(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.sat_id = self._io.read_u1() self.info = self._io.read_u4le() self.offset = self._io.read_u2le() class DataB64T(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_data = self._io.read_bytes_full() _process = satnogsdecoders.process.B64encode() self._raw_data = _process.decode(self._raw__raw_data) _io__raw_data = KaitaiStream(BytesIO(self._raw_data)) self.data = Geoscanedelveis.StrB64T(_io__raw_data, self, self._root) class GeoscanGnss(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.gnss_timestamp = self._io.read_u4le() self.valid = self._io.read_u1() if not ((self.valid == 1)) : raise kaitaistruct.ValidationNotAnyOfError(self.valid, self._io, u"/types/geoscan_gnss/seq/1") self.year = self._io.read_u2le() self.month = self._io.read_u1() self.day = self._io.read_u1() self.hour = self._io.read_u1() self.minute = self._io.read_u1() self.second = self._io.read_u2le() self.dutc = self._io.read_u1() self.offset_gnss = self._io.read_u2le() self.x = self._io.read_s4le() self.y = self._io.read_s4le() self.z = self._io.read_s4le() self.v_x = self._io.read_s4le() self.v_y = self._io.read_s4le() self.v_z = self._io.read_s4le() self.vdop = self._io.read_u2le() self.hdop = self._io.read_u2le() self.pdop = self._io.read_u2le() self.tdop = self._io.read_u2le() class GeoscanEps(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.eps_timestamp = self._io.read_u4le() self.eps_cell_current = self._io.read_u4le() self.eps_system_current = self._io.read_u4le() self.reserved0 = self._io.read_u4le() self.reserved1 = self._io.read_u4le() self.reserved2 = self._io.read_s2le() self.reserved3 = self._io.read_u2le() self.eps_cell_voltage_half = self._io.read_u1() self.eps_cell_voltage_full = self._io.read_u1() self.reserved4 = self._io.read_s2le() self.reserved5 = self._io.read_s1() self.reserved6 = self._io.read_u4le() class GeoscanTlm(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cmd = self._io.read_u1() _on = self.cmd if _on == 10: self.payload = Geoscanedelveis.GeoscanGnss(self._io, self, self._root) elif _on == 6: self.payload = Geoscanedelveis.GeoscanFakel(self._io, self, self._root) elif _on == 7: self.payload = Geoscanedelveis.GeoscanGnss(self._io, self, self._root) elif _on == 1: self.payload = Geoscanedelveis.GeoscanAdc(self._io, self, self._root) elif _on == 11: self.payload = Geoscanedelveis.GeoscanPhoto(self._io, self, self._root) elif _on == 5: self.payload = Geoscanedelveis.GeoscanFakel(self._io, self, self._root) elif _on == 8: self.payload = Geoscanedelveis.GeoscanGnss(self._io, self, self._root) elif _on == 9: self.payload = Geoscanedelveis.GeoscanGnss(self._io, self, self._root) elif _on == 2: self.payload = Geoscanedelveis.GeoscanEps(self._io, self, self._root) class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class GeoscanBeaconTlm(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.obc_timestamp = self._io.read_u4le() self.eps_cell_current = self._io.read_u2le() self.eps_system_current = self._io.read_u2le() self.eps_cell_voltage_half = self._io.read_u2le() self.eps_cell_voltage_full = self._io.read_u2le() self.adc_temperature_pos_x = self._io.read_s1() self.adc_temperature_neg_x = self._io.read_s1() self.adc_temperature_pos_y = self._io.read_s1() self.adc_temperature_neg_y = self._io.read_s1() self.adc_temperature_pos_z = self._io.read_s1() self.adc_temperature_neg_z = self._io.read_s1() self.adc_temperature_cell1 = self._io.read_s1() self.adc_temperature_cell2 = self._io.read_s1() self.obc_cpu_load = self._io.read_u1() self.obc_boot_count = self._io.read_u2le() self.comm_boot_count = self._io.read_u2le() self.comm_rssi = self._io.read_s1() class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Geoscanedelveis.Callsign(_io__raw_callsign_ror, self, self._root) class GeoscanAdc(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.adc_timestamp = self._io.read_u4le() self.sun_sensor_pos_x = self._io.read_u4le() self.sun_sensor_neg_x = self._io.read_u4le() self.sun_sensor_pos_y = self._io.read_u4le() self.sun_sensor_neg_y = self._io.read_u4le() self.sun_sensor_neg_z = self._io.read_u4le() self.mag_sensor_pos_x = self._io.read_s1() self.mag_sensor_neg_x = self._io.read_s1() self.mag_sensor_pos_y = self._io.read_s1() self.mag_sensor_neg_y = self._io.read_s1() self.mag_sensor_pos_z = self._io.read_s1() self.mag_sensor_neg_z = self._io.read_s1() self.temperature_pos_x = self._io.read_s1() self.temperature_neg_x = self._io.read_s1() self.temperature_pos_y = self._io.read_s1() self.temperature_neg_y = self._io.read_s1() self.temperature_pos_z = self._io.read_s1() self.temperature_neg_z = self._io.read_s1() self.temperature_cell1 = self._io.read_s1() self.temperature_cell2 = self._io.read_s1() self.status = self._io.read_u4le() class GeoscanFakel(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.fakel_timestamp = self._io.read_u4le() self.bitfield0 = self._io.read_u1() self.bitfield1 = self._io.read_u1() self.voltage_80v = self._io.read_u2le() self.voltage_13v = self._io.read_u2le() self.current_valve = self._io.read_u2le() self.voltage_valve = self._io.read_u2le() self.current_control_valve = self._io.read_u2le() self.voltage_control_valve = self._io.read_u2le() self.current_ek1 = self._io.read_u2le() self.voltage_ek1 = self._io.read_u2le() self.current_ek2 = self._io.read_u2le() self.voltage_ek2 = self._io.read_u2le() self.current_ek = self._io.read_u2le() self.voltage_ek = self._io.read_u2le() self.temperature_td1 = self._io.read_u2le() self.reserved7 = self._io.read_u2le() self.temperature_tp = self._io.read_u2le() self.pressure_cylinder = self._io.read_u2le() self.pressure_receiver = self._io.read_u2le() self.switch_on_counter = self._io.read_u2le() self.time_switched_on_counter = self._io.read_u2le() self.bitfield3 = self._io.read_u1() self.state = self._io.read_u1() self.reserved8 = self._io.read_u1() self.reserved9 = self._io.read_u1() self.pump_time = self._io.read_u2le() self.time_of_last_pump = self._io.read_u2le() self.reserved10 = self._io.read_u1() @property def len(self): if hasattr(self, '_m_len'): return self._m_len if hasattr(self, '_m_len') else None self._m_len = self._io.size() return self._m_len if hasattr(self, '_m_len') else None @property def type(self): if hasattr(self, '_m_type'): return self._m_type if hasattr(self, '_m_type') else None _pos = self._io.pos() self._io.seek(0) self._m_type = self._io.read_u4be() self._io.seek(_pos) return self._m_type if hasattr(self, '_m_type') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/geoscanedelveis.py
0.57678
0.506958
geoscanedelveis.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Amicalsat(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field dest_ssid: ax25_frame.ax25_header.dest_ssid_raw.ssid :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_frame.ax25_header.src_ssid_raw.ssid :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field start: ax25_frame.payload.ax25_info.start :field tlm_area: ax25_frame.payload.ax25_info.tlm_area :field tlm_type: ax25_frame.payload.ax25_info.tlm_area_switch.tlm_type :field m1_cpu_voltage_volt: ax25_frame.payload.ax25_info.tlm_area_switch.m1.cpu_voltage_volt :field m1_boot_number_int: ax25_frame.payload.ax25_info.tlm_area_switch.m1.boot_number_int :field m1_cpu_temperature_degree: ax25_frame.payload.ax25_info.tlm_area_switch.m1.cpu_temperature_degree :field m1_up_time_int: ax25_frame.payload.ax25_info.tlm_area_switch.m1.up_time_int :field timestamp_int: ax25_frame.payload.ax25_info.tlm_area_switch.m1.timestamp_int :field m1_imc_aocs_ok: ax25_frame.payload.ax25_info.tlm_area_switch.m1.imc_aocs_ok :field m1_imc_cu_l_ok: ax25_frame.payload.ax25_info.tlm_area_switch.m1.imc_cu_l_ok :field m1_imc_cu_r_ok: ax25_frame.payload.ax25_info.tlm_area_switch.m1.imc_cu_r_ok :field m1_imc_vhf1_ok: ax25_frame.payload.ax25_info.tlm_area_switch.m1.imc_vhf1_ok :field m1_imc_uhf2_ok: ax25_frame.payload.ax25_info.tlm_area_switch.m1.imc_uhf2_ok :field m1_vhf1_downlink: ax25_frame.payload.ax25_info.tlm_area_switch.m1.vhf1_downlink :field m1_uhf2_downlink: ax25_frame.payload.ax25_info.tlm_area_switch.m1.uhf2_downlink :field m1_imc_check: ax25_frame.payload.ax25_info.tlm_area_switch.m1.imc_check :field m1_beacon_mode: ax25_frame.payload.ax25_info.tlm_area_switch.m1.beacon_mode :field m1_cyclic_reset_on: ax25_frame.payload.ax25_info.tlm_area_switch.m1.cyclic_reset_on :field m1_survival_mode: ax25_frame.payload.ax25_info.tlm_area_switch.m1.survival_mode :field m1_payload_off: ax25_frame.payload.ax25_info.tlm_area_switch.m1.payload_off :field m1_cu_auto_off: ax25_frame.payload.ax25_info.tlm_area_switch.m1.cu_auto_off :field m1_tm_log: ax25_frame.payload.ax25_info.tlm_area_switch.m1.tm_log :field m1_cul_on: ax25_frame.payload.ax25_info.tlm_area_switch.m1.cul_on :field m1_cul_faut: ax25_frame.payload.ax25_info.tlm_area_switch.m1.cul_faut :field m1_cur_on: ax25_frame.payload.ax25_info.tlm_area_switch.m1.cur_on :field m1_cur_fault: ax25_frame.payload.ax25_info.tlm_area_switch.m1.cur_fault :field m1_cu_on: ax25_frame.payload.ax25_info.tlm_area_switch.m1.cu_on :field m1_cul_dead: ax25_frame.payload.ax25_info.tlm_area_switch.m1.cul_dead :field m1_cur_dead: ax25_frame.payload.ax25_info.tlm_area_switch.m1.cur_dead :field m1_fault_3v_r: ax25_frame.payload.ax25_info.tlm_area_switch.m1.fault_3v_r :field m1_fault_3v_m: ax25_frame.payload.ax25_info.tlm_area_switch.m1.fault_3v_m :field m1_charge_r: ax25_frame.payload.ax25_info.tlm_area_switch.m1.charge_r :field m1_charge_m: ax25_frame.payload.ax25_info.tlm_area_switch.m1.charge_m :field m1_long_log: ax25_frame.payload.ax25_info.tlm_area_switch.m1.long_log :field m1_log_to_flash: ax25_frame.payload.ax25_info.tlm_area_switch.m1.log_to_flash :field m1_plan: ax25_frame.payload.ax25_info.tlm_area_switch.m1.plan :field m1_stream: ax25_frame.payload.ax25_info.tlm_area_switch.m1.stream :field m1_vhf1_packet_ready: ax25_frame.payload.ax25_info.tlm_area_switch.m1.vhf1_packet_ready :field m1_uhf2_packet_ready: ax25_frame.payload.ax25_info.tlm_area_switch.m1.uhf2_packet_ready :field m1_survival_start: ax25_frame.payload.ax25_info.tlm_area_switch.m1.survival_start :field m1_survival_end: ax25_frame.payload.ax25_info.tlm_area_switch.m1.survival_end :field a1_adcs_mode: ax25_frame.payload.ax25_info.tlm_area_switch.a1.adcs_mode :field a1_faults: ax25_frame.payload.ax25_info.tlm_area_switch.a1.faults :field a1_detumbling: ax25_frame.payload.ax25_info.tlm_area_switch.a1.detumbling :field a1_adcs_on_off: ax25_frame.payload.ax25_info.tlm_area_switch.a1.adcs_on_off :field a1_detumbling_status: ax25_frame.payload.ax25_info.tlm_area_switch.a1.detumbling_status :field a1_manual: ax25_frame.payload.ax25_info.tlm_area_switch.a1.manual :field a1_act_on_off: ax25_frame.payload.ax25_info.tlm_area_switch.a1.act_on_off :field a1_sun_contr: ax25_frame.payload.ax25_info.tlm_area_switch.a1.sun_contr :field a1_sens_on_off: ax25_frame.payload.ax25_info.tlm_area_switch.a1.sens_on_off :field a1_act_man_contr: ax25_frame.payload.ax25_info.tlm_area_switch.a1.act_man_contr :field a1_act_limited_contr: ax25_frame.payload.ax25_info.tlm_area_switch.a1.act_limited_contr :field a1_gyro_acc_fault: ax25_frame.payload.ax25_info.tlm_area_switch.a1.gyro_acc_fault :field a1_mag_fault: ax25_frame.payload.ax25_info.tlm_area_switch.a1.mag_fault :field a1_sun_fault: ax25_frame.payload.ax25_info.tlm_area_switch.a1.sun_fault :field a1_l1_fault: ax25_frame.payload.ax25_info.tlm_area_switch.a1.l1_fault :field a1_l2_fault: ax25_frame.payload.ax25_info.tlm_area_switch.a1.l2_fault :field a1_l3_fault: ax25_frame.payload.ax25_info.tlm_area_switch.a1.l3_fault :field timestamp_int: ax25_frame.payload.ax25_info.tlm_area_switch.a1.timestamp_int :field a1_mag_x: ax25_frame.payload.ax25_info.tlm_area_switch.a1.mag_x :field a1_mag_y: ax25_frame.payload.ax25_info.tlm_area_switch.a1.mag_y :field a1_mag_z: ax25_frame.payload.ax25_info.tlm_area_switch.a1.mag_z :field a1_mag_x_int: ax25_frame.payload.ax25_info.tlm_area_switch.a1.mag_x_int :field a1_mag_y_int: ax25_frame.payload.ax25_info.tlm_area_switch.a1.mag_y_int :field a1_mag_z_int: ax25_frame.payload.ax25_info.tlm_area_switch.a1.mag_z_int :field a1_gyro_x_int: ax25_frame.payload.ax25_info.tlm_area_switch.a1.gyro_x_int :field a1_gyro_y_int: ax25_frame.payload.ax25_info.tlm_area_switch.a1.gyro_y_int :field a1_gyro_z_int: ax25_frame.payload.ax25_info.tlm_area_switch.a1.gyro_z_int :field a1_latitude_int: ax25_frame.payload.ax25_info.tlm_area_switch.a1.latitude_int :field a1_longitude_int: ax25_frame.payload.ax25_info.tlm_area_switch.a1.longitude_int :field em_boot_number_int: ax25_frame.payload.ax25_info.tlm_area_switch.em.boot_number_int :field em_input_voltage_volt: ax25_frame.payload.ax25_info.tlm_area_switch.em.input_voltage_volt :field em_input_current_ma: ax25_frame.payload.ax25_info.tlm_area_switch.em.input_current_ma :field em_input_power_mw: ax25_frame.payload.ax25_info.tlm_area_switch.em.input_power_mw :field em_peak_power_mw: ax25_frame.payload.ax25_info.tlm_area_switch.em.peak_power_mw :field em_solar_panel_voltage_volt: ax25_frame.payload.ax25_info.tlm_area_switch.em.solar_panel_voltage_volt :field timestamp_int: ax25_frame.payload.ax25_info.tlm_area_switch.em.timestamp_int :field em_v_in_volt: ax25_frame.payload.ax25_info.tlm_area_switch.em.v_in_volt :field em_v_solar_volt: ax25_frame.payload.ax25_info.tlm_area_switch.em.v_solar_volt :field em_i_in_ma: ax25_frame.payload.ax25_info.tlm_area_switch.em.i_in_ma :field em_p_in_mw: ax25_frame.payload.ax25_info.tlm_area_switch.em.p_in_mw :field em_p_peak_mw: ax25_frame.payload.ax25_info.tlm_area_switch.em.p_peak_mw :field em_t_cpu_degree: ax25_frame.payload.ax25_info.tlm_area_switch.em.t_cpu_degree :field em_v_cpu_volt: ax25_frame.payload.ax25_info.tlm_area_switch.em.v_cpu_volt :field timestamp: ax25_frame.payload.ax25_info.tlm_area_switch.er.timestamp :field boot_number: ax25_frame.payload.ax25_info.tlm_area_switch.er.boot_number :field er_input_voltage_volt: ax25_frame.payload.ax25_info.tlm_area_switch.er.input_voltage_volt :field er_input_current_ma: ax25_frame.payload.ax25_info.tlm_area_switch.er.input_current_ma :field er_input_power_mw: ax25_frame.payload.ax25_info.tlm_area_switch.er.input_power_mw :field er_peak_power_mw: ax25_frame.payload.ax25_info.tlm_area_switch.er.peak_power_mw :field er_solar_panel_voltage_volt: ax25_frame.payload.ax25_info.tlm_area_switch.er.solar_panel_voltage_volt :field timestamp_int: ax25_frame.payload.ax25_info.tlm_area_switch.er.timestamp_int :field er_v_in_volt: ax25_frame.payload.ax25_info.tlm_area_switch.er.v_in_volt :field er_v_solar_volt: ax25_frame.payload.ax25_info.tlm_area_switch.er.v_solar_volt :field er_i_in_ma: ax25_frame.payload.ax25_info.tlm_area_switch.er.i_in_ma :field er_p_in_mw: ax25_frame.payload.ax25_info.tlm_area_switch.er.p_in_mw :field er_p_peak_mw: ax25_frame.payload.ax25_info.tlm_area_switch.er.p_peak_mw :field er_t_cpu_degree: ax25_frame.payload.ax25_info.tlm_area_switch.er.t_cpu_degree :field er_v_cpu_volt: ax25_frame.payload.ax25_info.tlm_area_switch.er.v_cpu_volt :field timestamp: ax25_frame.payload.ax25_info.tlm_area_switch.v1.timestamp :field v1_cpu_voltage_volt: ax25_frame.payload.ax25_info.tlm_area_switch.v1.cpu_voltage_volt :field v1_battery_voltage_volt: ax25_frame.payload.ax25_info.tlm_area_switch.v1.battery_voltage_volt :field v1_cpu_temperature_degree: ax25_frame.payload.ax25_info.tlm_area_switch.v1.cpu_temperature_degree :field v1_amplifier_temperature_degree: ax25_frame.payload.ax25_info.tlm_area_switch.v1.amplifier_temperature_degree :field v1_fec: ax25_frame.payload.ax25_info.tlm_area_switch.v1.fec :field v1_downlink: ax25_frame.payload.ax25_info.tlm_area_switch.v1.downlink :field v1_band_lock: ax25_frame.payload.ax25_info.tlm_area_switch.v1.band_lock :field v1_xor: ax25_frame.payload.ax25_info.tlm_area_switch.v1.xor :field v1_aes_128: ax25_frame.payload.ax25_info.tlm_area_switch.v1.aes_128 :field v1_amp_ovt: ax25_frame.payload.ax25_info.tlm_area_switch.v1.amp_ovt :field timestamp_int: ax25_frame.payload.ax25_info.tlm_area_switch.v1.timestamp_int :field v1_current_rssi_int: ax25_frame.payload.ax25_info.tlm_area_switch.v1.current_rssi_int :field v1_latch_rssi_int: ax25_frame.payload.ax25_info.tlm_area_switch.v1.latch_rssi_int :field v1_a_f_c_offset_int: ax25_frame.payload.ax25_info.tlm_area_switch.v1.a_f_c_offset_int :field timestamp_int: ax25_frame.payload.ax25_info.tlm_area_switch.u2.timestamp_int :field u2_cpu_voltage_volt: ax25_frame.payload.ax25_info.tlm_area_switch.u2.cpu_voltage_volt :field u2_battery_voltage_volt: ax25_frame.payload.ax25_info.tlm_area_switch.u2.battery_voltage_volt :field u2_cpu_temperature_degree: ax25_frame.payload.ax25_info.tlm_area_switch.u2.cpu_temperature_degree :field u2_amplifier_temperature_degree: ax25_frame.payload.ax25_info.tlm_area_switch.u2.amplifier_temperature_degree :field u2_fec: ax25_frame.payload.ax25_info.tlm_area_switch.u2.fec :field u2_downlink: ax25_frame.payload.ax25_info.tlm_area_switch.u2.downlink :field u2_band_lock: ax25_frame.payload.ax25_info.tlm_area_switch.u2.band_lock :field u2_xor: ax25_frame.payload.ax25_info.tlm_area_switch.u2.xor :field u2_aes_128: ax25_frame.payload.ax25_info.tlm_area_switch.u2.aes_128 :field u2_amp_ovt: ax25_frame.payload.ax25_info.tlm_area_switch.u2.amp_ovt :field timestamp_int: ax25_frame.payload.ax25_info.tlm_area_switch.u2.timestamp_int :field u2_current_rssi_int: ax25_frame.payload.ax25_info.tlm_area_switch.u2.current_rssi_int :field u2_latch_rssi_int: ax25_frame.payload.ax25_info.tlm_area_switch.u2.latch_rssi_int :field u2_a_f_c_offset_int: ax25_frame.payload.ax25_info.tlm_area_switch.u2.a_f_c_offset_int :field cu_r_return_value_int: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.return_value_int :field timestamp_int: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.timestamp_int :field cu_r_cpu_voltage_volt: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.cpu_voltage_volt :field cu_r_cpu_temperature_degree: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.cpu_temperature_degree :field cu_r_onyx_on: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.onyx_on :field cu_r_llc_onyx_fault: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.llc_onyx_fault :field cu_r_llc_sram_fault: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.llc_sram_fault :field cu_r_fault_1v8_r: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.fault_1v8_r :field cu_r_fault_1v8_m: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.fault_1v8_m :field cu_r_fault_3v3_12v: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.fault_3v3_12v :field cu_r_pic_ready_raw: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.pic_ready_raw :field cu_r_pic_ready_conv: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.pic_ready_conv :field cu_r_pic_ready_compressed: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.pic_ready_compressed :field cu_r_pic_ready_compressed_8: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.pic_ready_compressed_8 :field cu_r_sd_pic_write_ok: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.sd_pic_write_ok :field cu_r_sd_pic_read_ok: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.sd_pic_read_ok :field cu_r_sd_get_info_ok: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.sd_get_info_ok :field cu_r_sd_erase_ok: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.sd_erase_ok :field cu_r_sd_full: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.sd_full :field cu_r_adc_ready: ax25_frame.payload.ax25_info.tlm_area_switch.cu_r.adc_ready :field timestamp_int: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.timestamp_int :field cu_l_cpu_voltage_volt: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.cpu_voltage_volt :field cu_l_cpu_temperature_degree: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.cpu_temperature_degree :field cu_l_onyx_on: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.onyx_on :field cu_l_llc_onyx_fault: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.llc_onyx_fault :field cu_l_llc_sram_fault: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.llc_sram_fault :field cu_l_fault_1v8_r: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.fault_1v8_r :field cu_l_fault_1v8_m: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.fault_1v8_m :field cu_l_fault_3v3_12v: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.fault_3v3_12v :field cu_l_pic_ready_raw: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.pic_ready_raw :field cu_l_pic_ready_conv: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.pic_ready_conv :field cu_l_pic_ready_compressed: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.pic_ready_compressed :field cu_l_pic_ready_compressed_8: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.pic_ready_compressed_8 :field cu_l_sd_pic_write_ok: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.sd_pic_write_ok :field cu_l_sd_pic_read_ok: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.sd_pic_read_ok :field cu_l_sd_get_info_ok: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.sd_get_info_ok :field cu_l_sd_erase_ok: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.sd_erase_ok :field cu_l_sd_full: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.sd_full :field cu_l_adc_ready: ax25_frame.payload.ax25_info.tlm_area_switch.cu_l.adc_ready :field aprs_message: ax25_frame.payload.ax25_info.aprs_message .. seealso:: Source - https://gitlab.com/librespacefoundation/satnogs-ops/uploads/f6fde8b864f8cdf37d65433bd958e138/AmicalSat_downlinks_v0.3.pdf """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Amicalsat.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Amicalsat.Ax25Header(self._io, self, self._root) _on = (self.ax25_header.ctl & 19) if _on == 0: self.payload = Amicalsat.IFrame(self._io, self, self._root) elif _on == 3: self.payload = Amicalsat.UiFrame(self._io, self, self._root) elif _on == 19: self.payload = Amicalsat.UiFrame(self._io, self, self._root) elif _on == 16: self.payload = Amicalsat.IFrame(self._io, self, self._root) elif _on == 18: self.payload = Amicalsat.IFrame(self._io, self, self._root) elif _on == 2: self.payload = Amicalsat.IFrame(self._io, self, self._root) class CuRLogType(KaitaiStruct): """CU_R;LOG;[Timestamp];[CPU voltage];[CPU temperature];[flags] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.cpu_voltage = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.cpu_temperature = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.flagsmagic = self._io.read_bytes(2) if not self.flagsmagic == b"\x30\x78": raise kaitaistruct.ValidationNotEqualError(b"\x30\x78", self.flagsmagic, self._io, u"/types/cu_r_log_type/seq/3") self.cu_flags = (self._io.read_bytes_full()).decode(u"ASCII") @property def cpu_temperature_degree(self): if hasattr(self, '_m_cpu_temperature_degree'): return self._m_cpu_temperature_degree if hasattr(self, '_m_cpu_temperature_degree') else None self._m_cpu_temperature_degree = int(self.cpu_temperature) return self._m_cpu_temperature_degree if hasattr(self, '_m_cpu_temperature_degree') else None @property def sd_pic_write_ok(self): if hasattr(self, '_m_sd_pic_write_ok'): return self._m_sd_pic_write_ok if hasattr(self, '_m_sd_pic_write_ok') else None self._m_sd_pic_write_ok = ((int(self.cu_flags, 16) & 1024) >> 10) return self._m_sd_pic_write_ok if hasattr(self, '_m_sd_pic_write_ok') else None @property def sd_pic_read_ok(self): if hasattr(self, '_m_sd_pic_read_ok'): return self._m_sd_pic_read_ok if hasattr(self, '_m_sd_pic_read_ok') else None self._m_sd_pic_read_ok = ((int(self.cu_flags, 16) & 2048) >> 11) return self._m_sd_pic_read_ok if hasattr(self, '_m_sd_pic_read_ok') else None @property def pic_ready_conv(self): if hasattr(self, '_m_pic_ready_conv'): return self._m_pic_ready_conv if hasattr(self, '_m_pic_ready_conv') else None self._m_pic_ready_conv = ((int(self.cu_flags, 16) & 128) >> 7) return self._m_pic_ready_conv if hasattr(self, '_m_pic_ready_conv') else None @property def fault_1v8_r(self): if hasattr(self, '_m_fault_1v8_r'): return self._m_fault_1v8_r if hasattr(self, '_m_fault_1v8_r') else None self._m_fault_1v8_r = ((int(self.cu_flags, 16) & 8) >> 3) return self._m_fault_1v8_r if hasattr(self, '_m_fault_1v8_r') else None @property def fault_1v8_m(self): if hasattr(self, '_m_fault_1v8_m'): return self._m_fault_1v8_m if hasattr(self, '_m_fault_1v8_m') else None self._m_fault_1v8_m = ((int(self.cu_flags, 16) & 16) >> 4) return self._m_fault_1v8_m if hasattr(self, '_m_fault_1v8_m') else None @property def llc_sram_fault(self): if hasattr(self, '_m_llc_sram_fault'): return self._m_llc_sram_fault if hasattr(self, '_m_llc_sram_fault') else None self._m_llc_sram_fault = ((int(self.cu_flags, 16) & 4) >> 2) return self._m_llc_sram_fault if hasattr(self, '_m_llc_sram_fault') else None @property def fault_3v3_12v(self): if hasattr(self, '_m_fault_3v3_12v'): return self._m_fault_3v3_12v if hasattr(self, '_m_fault_3v3_12v') else None self._m_fault_3v3_12v = ((int(self.cu_flags, 16) & 32) >> 5) return self._m_fault_3v3_12v if hasattr(self, '_m_fault_3v3_12v') else None @property def llc_onyx_fault(self): if hasattr(self, '_m_llc_onyx_fault'): return self._m_llc_onyx_fault if hasattr(self, '_m_llc_onyx_fault') else None self._m_llc_onyx_fault = ((int(self.cu_flags, 16) & 2) >> 1) return self._m_llc_onyx_fault if hasattr(self, '_m_llc_onyx_fault') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None @property def sd_erase_ok(self): if hasattr(self, '_m_sd_erase_ok'): return self._m_sd_erase_ok if hasattr(self, '_m_sd_erase_ok') else None self._m_sd_erase_ok = ((int(self.cu_flags, 16) & 8192) >> 13) return self._m_sd_erase_ok if hasattr(self, '_m_sd_erase_ok') else None @property def sd_get_info_ok(self): if hasattr(self, '_m_sd_get_info_ok'): return self._m_sd_get_info_ok if hasattr(self, '_m_sd_get_info_ok') else None self._m_sd_get_info_ok = ((int(self.cu_flags, 16) & 4096) >> 12) return self._m_sd_get_info_ok if hasattr(self, '_m_sd_get_info_ok') else None @property def onyx_on(self): if hasattr(self, '_m_onyx_on'): return self._m_onyx_on if hasattr(self, '_m_onyx_on') else None self._m_onyx_on = (int(self.cu_flags, 16) & 1) return self._m_onyx_on if hasattr(self, '_m_onyx_on') else None @property def pic_ready_raw(self): if hasattr(self, '_m_pic_ready_raw'): return self._m_pic_ready_raw if hasattr(self, '_m_pic_ready_raw') else None self._m_pic_ready_raw = ((int(self.cu_flags, 16) & 64) >> 6) return self._m_pic_ready_raw if hasattr(self, '_m_pic_ready_raw') else None @property def cpu_voltage_volt(self): if hasattr(self, '_m_cpu_voltage_volt'): return self._m_cpu_voltage_volt if hasattr(self, '_m_cpu_voltage_volt') else None self._m_cpu_voltage_volt = (int(self.cpu_voltage) / 1000.0) return self._m_cpu_voltage_volt if hasattr(self, '_m_cpu_voltage_volt') else None @property def sd_full(self): if hasattr(self, '_m_sd_full'): return self._m_sd_full if hasattr(self, '_m_sd_full') else None self._m_sd_full = ((int(self.cu_flags, 16) & 16384) >> 14) return self._m_sd_full if hasattr(self, '_m_sd_full') else None @property def pic_ready_compressed_8(self): if hasattr(self, '_m_pic_ready_compressed_8'): return self._m_pic_ready_compressed_8 if hasattr(self, '_m_pic_ready_compressed_8') else None self._m_pic_ready_compressed_8 = ((int(self.cu_flags, 16) & 512) >> 9) return self._m_pic_ready_compressed_8 if hasattr(self, '_m_pic_ready_compressed_8') else None @property def adc_ready(self): if hasattr(self, '_m_adc_ready'): return self._m_adc_ready if hasattr(self, '_m_adc_ready') else None self._m_adc_ready = ((int(self.cu_flags, 16) & 32768) >> 15) return self._m_adc_ready if hasattr(self, '_m_adc_ready') else None @property def pic_ready_compressed(self): if hasattr(self, '_m_pic_ready_compressed'): return self._m_pic_ready_compressed if hasattr(self, '_m_pic_ready_compressed') else None self._m_pic_ready_compressed = ((int(self.cu_flags, 16) & 256) >> 8) return self._m_pic_ready_compressed if hasattr(self, '_m_pic_ready_compressed') else None class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Amicalsat.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Amicalsat.SsidMask(self._io, self, self._root) self.src_callsign_raw = Amicalsat.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Amicalsat.SsidMask(self._io, self, self._root) if (self.src_ssid_raw.ssid_mask & 1) == 0: self.repeater = Amicalsat.Repeater(self._io, self, self._root) self.ctl = self._io.read_u1() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Amicalsat.Ax25InfoData(_io__raw_ax25_info, self, self._root) class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") class A1PositionType(KaitaiStruct): """A1;POSITION;[Current timestamp];[Latitude];[Longitude] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.latitude = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.longitude = (self._io.read_bytes_full()).decode(u"ASCII") @property def latitude_int(self): if hasattr(self, '_m_latitude_int'): return self._m_latitude_int if hasattr(self, '_m_latitude_int') else None self._m_latitude_int = int(self.latitude) return self._m_latitude_int if hasattr(self, '_m_latitude_int') else None @property def longitude_int(self): if hasattr(self, '_m_longitude_int'): return self._m_longitude_int if hasattr(self, '_m_longitude_int') else None self._m_longitude_int = int(self.longitude) return self._m_longitude_int if hasattr(self, '_m_longitude_int') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None class M1Type(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.tlm_type = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") _on = self.tlm_type if _on == u"LOG": self.m1 = Amicalsat.M1LogType(self._io, self, self._root) elif _on == u"FLAGS": self.m1 = Amicalsat.M1FlagsType(self._io, self, self._root) class CuLOnyxType(KaitaiStruct): """CU_L;ONYX SENSOR T;[Timestamp];[Return value] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.return_value = (self._io.read_bytes_full()).decode(u"ASCII") @property def return_value_int(self): if hasattr(self, '_m_return_value_int'): return self._m_return_value_int if hasattr(self, '_m_return_value_int') else None self._m_return_value_int = int(self.return_value) return self._m_return_value_int if hasattr(self, '_m_return_value_int') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None class CuLType(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.tlm_type = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") _on = self.tlm_type if _on == u"ONYX SENSOR T": self.cu_l = Amicalsat.CuLOnyxType(self._io, self, self._root) elif _on == u"LOG": self.cu_l = Amicalsat.CuLLogType(self._io, self, self._root) class V1MsType(KaitaiStruct): """V1;MS;[Timestamp];[Current rssi];[Latch rssi];[AFC offset] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.current_rssi = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.latch_rssi = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.a_f_c_offset = (self._io.read_bytes_full()).decode(u"ASCII") @property def current_rssi_int(self): if hasattr(self, '_m_current_rssi_int'): return self._m_current_rssi_int if hasattr(self, '_m_current_rssi_int') else None self._m_current_rssi_int = int(self.current_rssi) return self._m_current_rssi_int if hasattr(self, '_m_current_rssi_int') else None @property def latch_rssi_int(self): if hasattr(self, '_m_latch_rssi_int'): return self._m_latch_rssi_int if hasattr(self, '_m_latch_rssi_int') else None self._m_latch_rssi_int = int(self.latch_rssi) return self._m_latch_rssi_int if hasattr(self, '_m_latch_rssi_int') else None @property def a_f_c_offset_int(self): if hasattr(self, '_m_a_f_c_offset_int'): return self._m_a_f_c_offset_int if hasattr(self, '_m_a_f_c_offset_int') else None self._m_a_f_c_offset_int = int(self.a_f_c_offset) return self._m_a_f_c_offset_int if hasattr(self, '_m_a_f_c_offset_int') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None class EmLogType(KaitaiStruct): """EM;LOG;[Timestamp];[Boot number];[Input voltage];[Input current];[Input power];[Peak Power];[Solar panel voltage] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.boot_number = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.input_voltage = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.input_current = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.input_power = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.peak_power = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.solar_panel_voltage = (self._io.read_bytes_full()).decode(u"ASCII") @property def input_current_ma(self): if hasattr(self, '_m_input_current_ma'): return self._m_input_current_ma if hasattr(self, '_m_input_current_ma') else None self._m_input_current_ma = int(self.input_current) return self._m_input_current_ma if hasattr(self, '_m_input_current_ma') else None @property def peak_power_mw(self): if hasattr(self, '_m_peak_power_mw'): return self._m_peak_power_mw if hasattr(self, '_m_peak_power_mw') else None self._m_peak_power_mw = int(self.peak_power) return self._m_peak_power_mw if hasattr(self, '_m_peak_power_mw') else None @property def input_power_mw(self): if hasattr(self, '_m_input_power_mw'): return self._m_input_power_mw if hasattr(self, '_m_input_power_mw') else None self._m_input_power_mw = int(self.input_power) return self._m_input_power_mw if hasattr(self, '_m_input_power_mw') else None @property def boot_number_int(self): if hasattr(self, '_m_boot_number_int'): return self._m_boot_number_int if hasattr(self, '_m_boot_number_int') else None self._m_boot_number_int = int(self.boot_number) return self._m_boot_number_int if hasattr(self, '_m_boot_number_int') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None @property def input_voltage_volt(self): if hasattr(self, '_m_input_voltage_volt'): return self._m_input_voltage_volt if hasattr(self, '_m_input_voltage_volt') else None self._m_input_voltage_volt = (int(self.input_voltage) / 1000.0) return self._m_input_voltage_volt if hasattr(self, '_m_input_voltage_volt') else None @property def solar_panel_voltage_volt(self): if hasattr(self, '_m_solar_panel_voltage_volt'): return self._m_solar_panel_voltage_volt if hasattr(self, '_m_solar_panel_voltage_volt') else None self._m_solar_panel_voltage_volt = (int(self.solar_panel_voltage) / 1000.0) return self._m_solar_panel_voltage_volt if hasattr(self, '_m_solar_panel_voltage_volt') else None class ErMnType(KaitaiStruct): """ER;MN;[Timestamp];[V in];[V solar];[I in];[P in];[P peak];[T cpu];[V cpu] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.v_in = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.v_solar = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.i_in = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.p_in = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.p_peak = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.t_cpu = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.v_cpu = (self._io.read_bytes_full()).decode(u"ASCII") @property def p_peak_mw(self): if hasattr(self, '_m_p_peak_mw'): return self._m_p_peak_mw if hasattr(self, '_m_p_peak_mw') else None self._m_p_peak_mw = int(self.p_peak) return self._m_p_peak_mw if hasattr(self, '_m_p_peak_mw') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None @property def t_cpu_degree(self): if hasattr(self, '_m_t_cpu_degree'): return self._m_t_cpu_degree if hasattr(self, '_m_t_cpu_degree') else None self._m_t_cpu_degree = int(self.t_cpu) return self._m_t_cpu_degree if hasattr(self, '_m_t_cpu_degree') else None @property def v_solar_volt(self): if hasattr(self, '_m_v_solar_volt'): return self._m_v_solar_volt if hasattr(self, '_m_v_solar_volt') else None self._m_v_solar_volt = (int(self.v_solar) / 1000.0) return self._m_v_solar_volt if hasattr(self, '_m_v_solar_volt') else None @property def v_in_volt(self): if hasattr(self, '_m_v_in_volt'): return self._m_v_in_volt if hasattr(self, '_m_v_in_volt') else None self._m_v_in_volt = (int(self.v_in) / 1000.0) return self._m_v_in_volt if hasattr(self, '_m_v_in_volt') else None @property def p_in_mw(self): if hasattr(self, '_m_p_in_mw'): return self._m_p_in_mw if hasattr(self, '_m_p_in_mw') else None self._m_p_in_mw = int(self.p_in) return self._m_p_in_mw if hasattr(self, '_m_p_in_mw') else None @property def i_in_ma(self): if hasattr(self, '_m_i_in_ma'): return self._m_i_in_ma if hasattr(self, '_m_i_in_ma') else None self._m_i_in_ma = int(self.i_in) return self._m_i_in_ma if hasattr(self, '_m_i_in_ma') else None @property def v_cpu_volt(self): if hasattr(self, '_m_v_cpu_volt'): return self._m_v_cpu_volt if hasattr(self, '_m_v_cpu_volt') else None self._m_v_cpu_volt = (int(self.v_cpu) / 1000.0) return self._m_v_cpu_volt if hasattr(self, '_m_v_cpu_volt') else None class CuRType(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.tlm_type = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") _on = self.tlm_type if _on == u"ONYX SENSOR T": self.cu_r = Amicalsat.CuROnyxType(self._io, self, self._root) elif _on == u"LOG": self.cu_r = Amicalsat.CuRLogType(self._io, self, self._root) class IFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Amicalsat.Ax25InfoData(_io__raw_ax25_info, self, self._root) class U2RlType(KaitaiStruct): """U2;RL;[Timestamp],[CPU voltage];[Battery voltage];[CPU temperature];[Amplifier temperature];[Flags] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.cpu_voltage = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.battery_voltage = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.cpu_temperature = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.amplifier_temperature = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.flagsmagic = self._io.read_bytes(2) if not self.flagsmagic == b"\x30\x78": raise kaitaistruct.ValidationNotEqualError(b"\x30\x78", self.flagsmagic, self._io, u"/types/u2_rl_type/seq/5") self.flags = (self._io.read_bytes(1)).decode(u"ASCII") @property def cpu_temperature_degree(self): if hasattr(self, '_m_cpu_temperature_degree'): return self._m_cpu_temperature_degree if hasattr(self, '_m_cpu_temperature_degree') else None self._m_cpu_temperature_degree = int(self.cpu_temperature) return self._m_cpu_temperature_degree if hasattr(self, '_m_cpu_temperature_degree') else None @property def fec(self): if hasattr(self, '_m_fec'): return self._m_fec if hasattr(self, '_m_fec') else None self._m_fec = (int(self.flags, 16) & 1) return self._m_fec if hasattr(self, '_m_fec') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None @property def band_lock(self): if hasattr(self, '_m_band_lock'): return self._m_band_lock if hasattr(self, '_m_band_lock') else None self._m_band_lock = ((int(self.flags, 16) & 4) >> 2) return self._m_band_lock if hasattr(self, '_m_band_lock') else None @property def cpu_voltage_volt(self): if hasattr(self, '_m_cpu_voltage_volt'): return self._m_cpu_voltage_volt if hasattr(self, '_m_cpu_voltage_volt') else None self._m_cpu_voltage_volt = (int(self.cpu_voltage) / 1000.0) return self._m_cpu_voltage_volt if hasattr(self, '_m_cpu_voltage_volt') else None @property def aes_128(self): if hasattr(self, '_m_aes_128'): return self._m_aes_128 if hasattr(self, '_m_aes_128') else None self._m_aes_128 = ((int(self.flags, 16) & 16) >> 4) return self._m_aes_128 if hasattr(self, '_m_aes_128') else None @property def amplifier_temperature_degree(self): if hasattr(self, '_m_amplifier_temperature_degree'): return self._m_amplifier_temperature_degree if hasattr(self, '_m_amplifier_temperature_degree') else None self._m_amplifier_temperature_degree = int(self.amplifier_temperature) return self._m_amplifier_temperature_degree if hasattr(self, '_m_amplifier_temperature_degree') else None @property def amp_ovt(self): if hasattr(self, '_m_amp_ovt'): return self._m_amp_ovt if hasattr(self, '_m_amp_ovt') else None self._m_amp_ovt = ((int(self.flags, 16) & 32) >> 5) return self._m_amp_ovt if hasattr(self, '_m_amp_ovt') else None @property def xor(self): if hasattr(self, '_m_xor'): return self._m_xor if hasattr(self, '_m_xor') else None self._m_xor = ((int(self.flags, 16) & 8) >> 3) return self._m_xor if hasattr(self, '_m_xor') else None @property def downlink(self): if hasattr(self, '_m_downlink'): return self._m_downlink if hasattr(self, '_m_downlink') else None self._m_downlink = ((int(self.flags, 16) & 2) >> 1) return self._m_downlink if hasattr(self, '_m_downlink') else None @property def battery_voltage_volt(self): if hasattr(self, '_m_battery_voltage_volt'): return self._m_battery_voltage_volt if hasattr(self, '_m_battery_voltage_volt') else None self._m_battery_voltage_volt = (int(self.battery_voltage) / 1000.0) return self._m_battery_voltage_volt if hasattr(self, '_m_battery_voltage_volt') else None class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class V1RlType(KaitaiStruct): """V1;RL;[Timestamp],[CPU voltage];[Battery voltage];[CPU temperature];[Amplifier temperature];[Flags] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.cpu_voltage = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.battery_voltage = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.cpu_temperature = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.amplifier_temperature = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.flagsmagic = self._io.read_bytes(2) if not self.flagsmagic == b"\x30\x78": raise kaitaistruct.ValidationNotEqualError(b"\x30\x78", self.flagsmagic, self._io, u"/types/v1_rl_type/seq/5") self.flags = (self._io.read_bytes(1)).decode(u"ASCII") @property def cpu_temperature_degree(self): if hasattr(self, '_m_cpu_temperature_degree'): return self._m_cpu_temperature_degree if hasattr(self, '_m_cpu_temperature_degree') else None self._m_cpu_temperature_degree = int(self.cpu_temperature) return self._m_cpu_temperature_degree if hasattr(self, '_m_cpu_temperature_degree') else None @property def fec(self): if hasattr(self, '_m_fec'): return self._m_fec if hasattr(self, '_m_fec') else None self._m_fec = (int(self.flags, 16) & 1) return self._m_fec if hasattr(self, '_m_fec') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None @property def band_lock(self): if hasattr(self, '_m_band_lock'): return self._m_band_lock if hasattr(self, '_m_band_lock') else None self._m_band_lock = ((int(self.flags, 16) & 4) >> 2) return self._m_band_lock if hasattr(self, '_m_band_lock') else None @property def cpu_voltage_volt(self): if hasattr(self, '_m_cpu_voltage_volt'): return self._m_cpu_voltage_volt if hasattr(self, '_m_cpu_voltage_volt') else None self._m_cpu_voltage_volt = (int(self.cpu_voltage) / 1000.0) return self._m_cpu_voltage_volt if hasattr(self, '_m_cpu_voltage_volt') else None @property def aes_128(self): if hasattr(self, '_m_aes_128'): return self._m_aes_128 if hasattr(self, '_m_aes_128') else None self._m_aes_128 = ((int(self.flags, 16) & 16) >> 4) return self._m_aes_128 if hasattr(self, '_m_aes_128') else None @property def amplifier_temperature_degree(self): if hasattr(self, '_m_amplifier_temperature_degree'): return self._m_amplifier_temperature_degree if hasattr(self, '_m_amplifier_temperature_degree') else None self._m_amplifier_temperature_degree = int(self.amplifier_temperature) return self._m_amplifier_temperature_degree if hasattr(self, '_m_amplifier_temperature_degree') else None @property def amp_ovt(self): if hasattr(self, '_m_amp_ovt'): return self._m_amp_ovt if hasattr(self, '_m_amp_ovt') else None self._m_amp_ovt = ((int(self.flags, 16) & 32) >> 5) return self._m_amp_ovt if hasattr(self, '_m_amp_ovt') else None @property def xor(self): if hasattr(self, '_m_xor'): return self._m_xor if hasattr(self, '_m_xor') else None self._m_xor = ((int(self.flags, 16) & 8) >> 3) return self._m_xor if hasattr(self, '_m_xor') else None @property def downlink(self): if hasattr(self, '_m_downlink'): return self._m_downlink if hasattr(self, '_m_downlink') else None self._m_downlink = ((int(self.flags, 16) & 2) >> 1) return self._m_downlink if hasattr(self, '_m_downlink') else None @property def battery_voltage_volt(self): if hasattr(self, '_m_battery_voltage_volt'): return self._m_battery_voltage_volt if hasattr(self, '_m_battery_voltage_volt') else None self._m_battery_voltage_volt = (int(self.battery_voltage) / 1000.0) return self._m_battery_voltage_volt if hasattr(self, '_m_battery_voltage_volt') else None class EmMnType(KaitaiStruct): """EM;MN;[Timestamp];[V in];[V solar];[I in];[P in];[P peak];[T cpu];[V cpu] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.v_in = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.v_solar = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.i_in = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.p_in = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.p_peak = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.t_cpu = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.v_cpu = (self._io.read_bytes_full()).decode(u"ASCII") @property def p_peak_mw(self): if hasattr(self, '_m_p_peak_mw'): return self._m_p_peak_mw if hasattr(self, '_m_p_peak_mw') else None self._m_p_peak_mw = int(self.p_peak) return self._m_p_peak_mw if hasattr(self, '_m_p_peak_mw') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None @property def t_cpu_degree(self): if hasattr(self, '_m_t_cpu_degree'): return self._m_t_cpu_degree if hasattr(self, '_m_t_cpu_degree') else None self._m_t_cpu_degree = int(self.t_cpu) return self._m_t_cpu_degree if hasattr(self, '_m_t_cpu_degree') else None @property def v_solar_volt(self): if hasattr(self, '_m_v_solar_volt'): return self._m_v_solar_volt if hasattr(self, '_m_v_solar_volt') else None self._m_v_solar_volt = (int(self.v_solar) / 1000.0) return self._m_v_solar_volt if hasattr(self, '_m_v_solar_volt') else None @property def v_in_volt(self): if hasattr(self, '_m_v_in_volt'): return self._m_v_in_volt if hasattr(self, '_m_v_in_volt') else None self._m_v_in_volt = (int(self.v_in) / 1000.0) return self._m_v_in_volt if hasattr(self, '_m_v_in_volt') else None @property def p_in_mw(self): if hasattr(self, '_m_p_in_mw'): return self._m_p_in_mw if hasattr(self, '_m_p_in_mw') else None self._m_p_in_mw = int(self.p_in) return self._m_p_in_mw if hasattr(self, '_m_p_in_mw') else None @property def i_in_ma(self): if hasattr(self, '_m_i_in_ma'): return self._m_i_in_ma if hasattr(self, '_m_i_in_ma') else None self._m_i_in_ma = int(self.i_in) return self._m_i_in_ma if hasattr(self, '_m_i_in_ma') else None @property def v_cpu_volt(self): if hasattr(self, '_m_v_cpu_volt'): return self._m_v_cpu_volt if hasattr(self, '_m_v_cpu_volt') else None self._m_v_cpu_volt = (int(self.v_cpu) / 1000.0) return self._m_v_cpu_volt if hasattr(self, '_m_v_cpu_volt') else None class Repeaters(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_callsign_raw = Amicalsat.CallsignRaw(self._io, self, self._root) self.rpt_ssid_raw = Amicalsat.SsidMask(self._io, self, self._root) class Repeater(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_instance = [] i = 0 while True: _ = Amicalsat.Repeaters(self._io, self, self._root) self.rpt_instance.append(_) if (_.rpt_ssid_raw.ssid_mask & 1) == 1: break i += 1 class U2MsType(KaitaiStruct): """U2;MS;[Timestamp];[Current rssi];[Latch rssi];[AFC offset] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.current_rssi = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.latch_rssi = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.a_f_c_offset = (self._io.read_bytes_full()).decode(u"ASCII") @property def current_rssi_int(self): if hasattr(self, '_m_current_rssi_int'): return self._m_current_rssi_int if hasattr(self, '_m_current_rssi_int') else None self._m_current_rssi_int = int(self.current_rssi) return self._m_current_rssi_int if hasattr(self, '_m_current_rssi_int') else None @property def latch_rssi_int(self): if hasattr(self, '_m_latch_rssi_int'): return self._m_latch_rssi_int if hasattr(self, '_m_latch_rssi_int') else None self._m_latch_rssi_int = int(self.latch_rssi) return self._m_latch_rssi_int if hasattr(self, '_m_latch_rssi_int') else None @property def a_f_c_offset_int(self): if hasattr(self, '_m_a_f_c_offset_int'): return self._m_a_f_c_offset_int if hasattr(self, '_m_a_f_c_offset_int') else None self._m_a_f_c_offset_int = int(self.a_f_c_offset) return self._m_a_f_c_offset_int if hasattr(self, '_m_a_f_c_offset_int') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None class CuLLogType(KaitaiStruct): """CU_L;LOG;[Timestamp];[CPU voltage];[CPU temperature];[flags] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.cpu_voltage = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.cpu_temperature = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.flagsmagic = self._io.read_bytes(2) if not self.flagsmagic == b"\x30\x78": raise kaitaistruct.ValidationNotEqualError(b"\x30\x78", self.flagsmagic, self._io, u"/types/cu_l_log_type/seq/3") self.cu_flags = (self._io.read_bytes_full()).decode(u"ASCII") @property def cpu_temperature_degree(self): if hasattr(self, '_m_cpu_temperature_degree'): return self._m_cpu_temperature_degree if hasattr(self, '_m_cpu_temperature_degree') else None self._m_cpu_temperature_degree = int(self.cpu_temperature) return self._m_cpu_temperature_degree if hasattr(self, '_m_cpu_temperature_degree') else None @property def sd_pic_write_ok(self): if hasattr(self, '_m_sd_pic_write_ok'): return self._m_sd_pic_write_ok if hasattr(self, '_m_sd_pic_write_ok') else None self._m_sd_pic_write_ok = ((int(self.cu_flags, 16) & 1024) >> 10) return self._m_sd_pic_write_ok if hasattr(self, '_m_sd_pic_write_ok') else None @property def sd_pic_read_ok(self): if hasattr(self, '_m_sd_pic_read_ok'): return self._m_sd_pic_read_ok if hasattr(self, '_m_sd_pic_read_ok') else None self._m_sd_pic_read_ok = ((int(self.cu_flags, 16) & 2048) >> 11) return self._m_sd_pic_read_ok if hasattr(self, '_m_sd_pic_read_ok') else None @property def pic_ready_conv(self): if hasattr(self, '_m_pic_ready_conv'): return self._m_pic_ready_conv if hasattr(self, '_m_pic_ready_conv') else None self._m_pic_ready_conv = ((int(self.cu_flags, 16) & 128) >> 7) return self._m_pic_ready_conv if hasattr(self, '_m_pic_ready_conv') else None @property def fault_1v8_r(self): if hasattr(self, '_m_fault_1v8_r'): return self._m_fault_1v8_r if hasattr(self, '_m_fault_1v8_r') else None self._m_fault_1v8_r = ((int(self.cu_flags, 16) & 8) >> 3) return self._m_fault_1v8_r if hasattr(self, '_m_fault_1v8_r') else None @property def fault_1v8_m(self): if hasattr(self, '_m_fault_1v8_m'): return self._m_fault_1v8_m if hasattr(self, '_m_fault_1v8_m') else None self._m_fault_1v8_m = ((int(self.cu_flags, 16) & 16) >> 4) return self._m_fault_1v8_m if hasattr(self, '_m_fault_1v8_m') else None @property def llc_sram_fault(self): if hasattr(self, '_m_llc_sram_fault'): return self._m_llc_sram_fault if hasattr(self, '_m_llc_sram_fault') else None self._m_llc_sram_fault = ((int(self.cu_flags, 16) & 4) >> 2) return self._m_llc_sram_fault if hasattr(self, '_m_llc_sram_fault') else None @property def fault_3v3_12v(self): if hasattr(self, '_m_fault_3v3_12v'): return self._m_fault_3v3_12v if hasattr(self, '_m_fault_3v3_12v') else None self._m_fault_3v3_12v = ((int(self.cu_flags, 16) & 32) >> 5) return self._m_fault_3v3_12v if hasattr(self, '_m_fault_3v3_12v') else None @property def llc_onyx_fault(self): if hasattr(self, '_m_llc_onyx_fault'): return self._m_llc_onyx_fault if hasattr(self, '_m_llc_onyx_fault') else None self._m_llc_onyx_fault = ((int(self.cu_flags, 16) & 2) >> 1) return self._m_llc_onyx_fault if hasattr(self, '_m_llc_onyx_fault') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None @property def sd_erase_ok(self): if hasattr(self, '_m_sd_erase_ok'): return self._m_sd_erase_ok if hasattr(self, '_m_sd_erase_ok') else None self._m_sd_erase_ok = ((int(self.cu_flags, 16) & 8192) >> 13) return self._m_sd_erase_ok if hasattr(self, '_m_sd_erase_ok') else None @property def sd_get_info_ok(self): if hasattr(self, '_m_sd_get_info_ok'): return self._m_sd_get_info_ok if hasattr(self, '_m_sd_get_info_ok') else None self._m_sd_get_info_ok = ((int(self.cu_flags, 16) & 4096) >> 12) return self._m_sd_get_info_ok if hasattr(self, '_m_sd_get_info_ok') else None @property def onyx_on(self): if hasattr(self, '_m_onyx_on'): return self._m_onyx_on if hasattr(self, '_m_onyx_on') else None self._m_onyx_on = (int(self.cu_flags, 16) & 1) return self._m_onyx_on if hasattr(self, '_m_onyx_on') else None @property def pic_ready_raw(self): if hasattr(self, '_m_pic_ready_raw'): return self._m_pic_ready_raw if hasattr(self, '_m_pic_ready_raw') else None self._m_pic_ready_raw = ((int(self.cu_flags, 16) & 64) >> 6) return self._m_pic_ready_raw if hasattr(self, '_m_pic_ready_raw') else None @property def cpu_voltage_volt(self): if hasattr(self, '_m_cpu_voltage_volt'): return self._m_cpu_voltage_volt if hasattr(self, '_m_cpu_voltage_volt') else None self._m_cpu_voltage_volt = (int(self.cpu_voltage) / 1000.0) return self._m_cpu_voltage_volt if hasattr(self, '_m_cpu_voltage_volt') else None @property def sd_full(self): if hasattr(self, '_m_sd_full'): return self._m_sd_full if hasattr(self, '_m_sd_full') else None self._m_sd_full = ((int(self.cu_flags, 16) & 16384) >> 14) return self._m_sd_full if hasattr(self, '_m_sd_full') else None @property def pic_ready_compressed_8(self): if hasattr(self, '_m_pic_ready_compressed_8'): return self._m_pic_ready_compressed_8 if hasattr(self, '_m_pic_ready_compressed_8') else None self._m_pic_ready_compressed_8 = ((int(self.cu_flags, 16) & 512) >> 9) return self._m_pic_ready_compressed_8 if hasattr(self, '_m_pic_ready_compressed_8') else None @property def adc_ready(self): if hasattr(self, '_m_adc_ready'): return self._m_adc_ready if hasattr(self, '_m_adc_ready') else None self._m_adc_ready = ((int(self.cu_flags, 16) & 32768) >> 15) return self._m_adc_ready if hasattr(self, '_m_adc_ready') else None @property def pic_ready_compressed(self): if hasattr(self, '_m_pic_ready_compressed'): return self._m_pic_ready_compressed if hasattr(self, '_m_pic_ready_compressed') else None self._m_pic_ready_compressed = ((int(self.cu_flags, 16) & 256) >> 8) return self._m_pic_ready_compressed if hasattr(self, '_m_pic_ready_compressed') else None class A1GyroType(KaitaiStruct): """A1;GYRO;[Current timestamp];[GyroX];[GyroY];[GyroZ] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.giro_x = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.giro_y = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.giro_z = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") @property def gyro_x_int(self): if hasattr(self, '_m_gyro_x_int'): return self._m_gyro_x_int if hasattr(self, '_m_gyro_x_int') else None self._m_gyro_x_int = int(self.giro_x) return self._m_gyro_x_int if hasattr(self, '_m_gyro_x_int') else None @property def gyro_y_int(self): if hasattr(self, '_m_gyro_y_int'): return self._m_gyro_y_int if hasattr(self, '_m_gyro_y_int') else None self._m_gyro_y_int = int(self.giro_y) return self._m_gyro_y_int if hasattr(self, '_m_gyro_y_int') else None @property def gyro_z_int(self): if hasattr(self, '_m_gyro_z_int'): return self._m_gyro_z_int if hasattr(self, '_m_gyro_z_int') else None self._m_gyro_z_int = int(self.giro_z) return self._m_gyro_z_int if hasattr(self, '_m_gyro_z_int') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None class A1MagType(KaitaiStruct): """A1;MAG;[Current timestamp];[MagX];[MagY];[MagZ] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.mag_x = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.mag_y = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.mag_z = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") @property def mag_x_int(self): if hasattr(self, '_m_mag_x_int'): return self._m_mag_x_int if hasattr(self, '_m_mag_x_int') else None self._m_mag_x_int = int(self.mag_x) return self._m_mag_x_int if hasattr(self, '_m_mag_x_int') else None @property def mag_y_int(self): if hasattr(self, '_m_mag_y_int'): return self._m_mag_y_int if hasattr(self, '_m_mag_y_int') else None self._m_mag_y_int = int(self.mag_y) return self._m_mag_y_int if hasattr(self, '_m_mag_y_int') else None @property def mag_z_int(self): if hasattr(self, '_m_mag_z_int'): return self._m_mag_z_int if hasattr(self, '_m_mag_z_int') else None self._m_mag_z_int = int(self.mag_z) return self._m_mag_z_int if hasattr(self, '_m_mag_z_int') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None class EmType(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.tlm_type = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") _on = self.tlm_type if _on == u"LOG": self.em = Amicalsat.EmLogType(self._io, self, self._root) elif _on == u"MN": self.em = Amicalsat.EmMnType(self._io, self, self._root) class A1Type(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.tlm_type = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") _on = self.tlm_type if _on == u"FLAGS": self.a1 = Amicalsat.A1FlagsType(self._io, self, self._root) elif _on == u"MAG": self.a1 = Amicalsat.A1MagType(self._io, self, self._root) elif _on == u"GYRO": self.a1 = Amicalsat.A1GyroType(self._io, self, self._root) elif _on == u"POSITION": self.a1 = Amicalsat.A1PositionType(self._io, self, self._root) class A1FlagsType(KaitaiStruct): """A1;FLAGS;[timestamp];[mode];[flags];[faults] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.adcs_mode = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.a1_flags = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.faults = (self._io.read_bytes_full()).decode(u"ASCII") @property def sens_on_off(self): if hasattr(self, '_m_sens_on_off'): return self._m_sens_on_off if hasattr(self, '_m_sens_on_off') else None self._m_sens_on_off = ((int(self.a1_flags, 16) & 4) >> 2) return self._m_sens_on_off if hasattr(self, '_m_sens_on_off') else None @property def l3_fault(self): if hasattr(self, '_m_l3_fault'): return self._m_l3_fault if hasattr(self, '_m_l3_fault') else None self._m_l3_fault = ((int(self.faults, 16) & 32) >> 5) return self._m_l3_fault if hasattr(self, '_m_l3_fault') else None @property def manual(self): if hasattr(self, '_m_manual'): return self._m_manual if hasattr(self, '_m_manual') else None self._m_manual = ((int(self.adcs_mode, 16) & 240) >> 4) return self._m_manual if hasattr(self, '_m_manual') else None @property def sun_contr(self): if hasattr(self, '_m_sun_contr'): return self._m_sun_contr if hasattr(self, '_m_sun_contr') else None self._m_sun_contr = ((int(self.a1_flags, 16) & 2) >> 1) return self._m_sun_contr if hasattr(self, '_m_sun_contr') else None @property def gyro_acc_fault(self): if hasattr(self, '_m_gyro_acc_fault'): return self._m_gyro_acc_fault if hasattr(self, '_m_gyro_acc_fault') else None self._m_gyro_acc_fault = (int(self.faults, 16) & 1) return self._m_gyro_acc_fault if hasattr(self, '_m_gyro_acc_fault') else None @property def l1_fault(self): if hasattr(self, '_m_l1_fault'): return self._m_l1_fault if hasattr(self, '_m_l1_fault') else None self._m_l1_fault = ((int(self.faults, 16) & 8) >> 3) return self._m_l1_fault if hasattr(self, '_m_l1_fault') else None @property def act_man_contr(self): if hasattr(self, '_m_act_man_contr'): return self._m_act_man_contr if hasattr(self, '_m_act_man_contr') else None self._m_act_man_contr = ((int(self.a1_flags, 16) & 8) >> 3) return self._m_act_man_contr if hasattr(self, '_m_act_man_contr') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None @property def adcs_on_off(self): if hasattr(self, '_m_adcs_on_off'): return self._m_adcs_on_off if hasattr(self, '_m_adcs_on_off') else None self._m_adcs_on_off = ((int(self.adcs_mode, 16) & 2) >> 1) return self._m_adcs_on_off if hasattr(self, '_m_adcs_on_off') else None @property def detumbling_status(self): if hasattr(self, '_m_detumbling_status'): return self._m_detumbling_status if hasattr(self, '_m_detumbling_status') else None self._m_detumbling_status = ((int(self.adcs_mode, 16) & 12) >> 2) return self._m_detumbling_status if hasattr(self, '_m_detumbling_status') else None @property def act_limited_contr(self): if hasattr(self, '_m_act_limited_contr'): return self._m_act_limited_contr if hasattr(self, '_m_act_limited_contr') else None self._m_act_limited_contr = ((int(self.a1_flags, 16) & 16) >> 4) return self._m_act_limited_contr if hasattr(self, '_m_act_limited_contr') else None @property def act_on_off(self): if hasattr(self, '_m_act_on_off'): return self._m_act_on_off if hasattr(self, '_m_act_on_off') else None self._m_act_on_off = (int(self.a1_flags, 16) & 1) return self._m_act_on_off if hasattr(self, '_m_act_on_off') else None @property def mag_fault(self): if hasattr(self, '_m_mag_fault'): return self._m_mag_fault if hasattr(self, '_m_mag_fault') else None self._m_mag_fault = ((int(self.faults, 16) & 2) >> 1) return self._m_mag_fault if hasattr(self, '_m_mag_fault') else None @property def sun_fault(self): if hasattr(self, '_m_sun_fault'): return self._m_sun_fault if hasattr(self, '_m_sun_fault') else None self._m_sun_fault = ((int(self.faults, 16) & 4) >> 2) return self._m_sun_fault if hasattr(self, '_m_sun_fault') else None @property def l2_fault(self): if hasattr(self, '_m_l2_fault'): return self._m_l2_fault if hasattr(self, '_m_l2_fault') else None self._m_l2_fault = ((int(self.faults, 16) & 16) >> 4) return self._m_l2_fault if hasattr(self, '_m_l2_fault') else None @property def detumbling(self): if hasattr(self, '_m_detumbling'): return self._m_detumbling if hasattr(self, '_m_detumbling') else None self._m_detumbling = (int(self.adcs_mode, 16) & 1) return self._m_detumbling if hasattr(self, '_m_detumbling') else None class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Amicalsat.Callsign(_io__raw_callsign_ror, self, self._root) class M1LogType(KaitaiStruct): """M1;LOG;[Timestamp];[Boot number];[Up time];[CPU voltage];[CPU temperature] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.boot_number = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.up_time = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.cpu_voltage = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.cpu_temperature = (self._io.read_bytes_full()).decode(u"ASCII") @property def cpu_temperature_degree(self): if hasattr(self, '_m_cpu_temperature_degree'): return self._m_cpu_temperature_degree if hasattr(self, '_m_cpu_temperature_degree') else None self._m_cpu_temperature_degree = int(self.cpu_temperature) return self._m_cpu_temperature_degree if hasattr(self, '_m_cpu_temperature_degree') else None @property def up_time_int(self): if hasattr(self, '_m_up_time_int'): return self._m_up_time_int if hasattr(self, '_m_up_time_int') else None self._m_up_time_int = int(self.up_time) return self._m_up_time_int if hasattr(self, '_m_up_time_int') else None @property def boot_number_int(self): if hasattr(self, '_m_boot_number_int'): return self._m_boot_number_int if hasattr(self, '_m_boot_number_int') else None self._m_boot_number_int = int(self.boot_number) return self._m_boot_number_int if hasattr(self, '_m_boot_number_int') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None @property def cpu_voltage_volt(self): if hasattr(self, '_m_cpu_voltage_volt'): return self._m_cpu_voltage_volt if hasattr(self, '_m_cpu_voltage_volt') else None self._m_cpu_voltage_volt = (int(self.cpu_voltage) / 1000.0) return self._m_cpu_voltage_volt if hasattr(self, '_m_cpu_voltage_volt') else None class ErType(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.tlm_type = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") _on = self.tlm_type if _on == u"LOG": self.er = Amicalsat.ErLogType(self._io, self, self._root) elif _on == u"MN": self.er = Amicalsat.ErMnType(self._io, self, self._root) class ErLogType(KaitaiStruct): """ER;LOG;[Timestamp];[Boot number];[Input voltage];[Input current];[Input power];[Peak Power];[Solar panel voltage] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.boot_number = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.input_voltage = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.input_current = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.input_power = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.peak_power = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.solar_panel_voltage = (self._io.read_bytes_full()).decode(u"ASCII") @property def input_current_ma(self): if hasattr(self, '_m_input_current_ma'): return self._m_input_current_ma if hasattr(self, '_m_input_current_ma') else None self._m_input_current_ma = int(self.input_current) return self._m_input_current_ma if hasattr(self, '_m_input_current_ma') else None @property def peak_power_mw(self): if hasattr(self, '_m_peak_power_mw'): return self._m_peak_power_mw if hasattr(self, '_m_peak_power_mw') else None self._m_peak_power_mw = int(self.peak_power) return self._m_peak_power_mw if hasattr(self, '_m_peak_power_mw') else None @property def input_power_mw(self): if hasattr(self, '_m_input_power_mw'): return self._m_input_power_mw if hasattr(self, '_m_input_power_mw') else None self._m_input_power_mw = int(self.input_power) return self._m_input_power_mw if hasattr(self, '_m_input_power_mw') else None @property def boot_number_int(self): if hasattr(self, '_m_boot_number_int'): return self._m_boot_number_int if hasattr(self, '_m_boot_number_int') else None self._m_boot_number_int = int(self.boot_number) return self._m_boot_number_int if hasattr(self, '_m_boot_number_int') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None @property def input_voltage_volt(self): if hasattr(self, '_m_input_voltage_volt'): return self._m_input_voltage_volt if hasattr(self, '_m_input_voltage_volt') else None self._m_input_voltage_volt = (int(self.input_voltage) / 1000.0) return self._m_input_voltage_volt if hasattr(self, '_m_input_voltage_volt') else None @property def solar_panel_voltage_volt(self): if hasattr(self, '_m_solar_panel_voltage_volt'): return self._m_solar_panel_voltage_volt if hasattr(self, '_m_solar_panel_voltage_volt') else None self._m_solar_panel_voltage_volt = (int(self.solar_panel_voltage) / 1000.0) return self._m_solar_panel_voltage_volt if hasattr(self, '_m_solar_panel_voltage_volt') else None class M1FlagsType(KaitaiStruct): """M1;FLAGS;[Timestamp];[Hex flags]; """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.hex_part = (self._io.read_bytes_term(120, False, True, True)).decode(u"ASCII") self.flags = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") @property def beacon_mode(self): if hasattr(self, '_m_beacon_mode'): return self._m_beacon_mode if hasattr(self, '_m_beacon_mode') else None self._m_beacon_mode = ((int(self.flags, 16) & 256) >> 8) return self._m_beacon_mode if hasattr(self, '_m_beacon_mode') else None @property def cur_dead(self): if hasattr(self, '_m_cur_dead'): return self._m_cur_dead if hasattr(self, '_m_cur_dead') else None self._m_cur_dead = ((int(self.flags, 16) & 4026531840) >> 28) return self._m_cur_dead if hasattr(self, '_m_cur_dead') else None @property def cur_on(self): if hasattr(self, '_m_cur_on'): return self._m_cur_on if hasattr(self, '_m_cur_on') else None self._m_cur_on = ((int(self.flags, 16) & 262144) >> 18) return self._m_cur_on if hasattr(self, '_m_cur_on') else None @property def stream(self): if hasattr(self, '_m_stream'): return self._m_stream if hasattr(self, '_m_stream') else None self._m_stream = ((int(self.flags, 16) & 281474976710656) >> 48) return self._m_stream if hasattr(self, '_m_stream') else None @property def imc_aocs_ok(self): if hasattr(self, '_m_imc_aocs_ok'): return self._m_imc_aocs_ok if hasattr(self, '_m_imc_aocs_ok') else None self._m_imc_aocs_ok = (int(self.flags, 16) & 1) return self._m_imc_aocs_ok if hasattr(self, '_m_imc_aocs_ok') else None @property def uhf2_downlink(self): if hasattr(self, '_m_uhf2_downlink'): return self._m_uhf2_downlink if hasattr(self, '_m_uhf2_downlink') else None self._m_uhf2_downlink = ((int(self.flags, 16) & 64) >> 6) return self._m_uhf2_downlink if hasattr(self, '_m_uhf2_downlink') else None @property def cul_on(self): if hasattr(self, '_m_cul_on'): return self._m_cul_on if hasattr(self, '_m_cul_on') else None self._m_cul_on = ((int(self.flags, 16) & 65536) >> 16) return self._m_cul_on if hasattr(self, '_m_cul_on') else None @property def payload_off(self): if hasattr(self, '_m_payload_off'): return self._m_payload_off if hasattr(self, '_m_payload_off') else None self._m_payload_off = ((int(self.flags, 16) & 2048) >> 11) return self._m_payload_off if hasattr(self, '_m_payload_off') else None @property def cu_auto_off(self): if hasattr(self, '_m_cu_auto_off'): return self._m_cu_auto_off if hasattr(self, '_m_cu_auto_off') else None self._m_cu_auto_off = ((int(self.flags, 16) & 4096) >> 12) return self._m_cu_auto_off if hasattr(self, '_m_cu_auto_off') else None @property def survival_start(self): if hasattr(self, '_m_survival_start'): return self._m_survival_start if hasattr(self, '_m_survival_start') else None self._m_survival_start = ((int(self.flags, 16) & 2251799813685248) >> 51) return self._m_survival_start if hasattr(self, '_m_survival_start') else None @property def fault_3v_m(self): if hasattr(self, '_m_fault_3v_m'): return self._m_fault_3v_m if hasattr(self, '_m_fault_3v_m') else None self._m_fault_3v_m = ((int(self.flags, 16) & 2199023255552) >> 41) return self._m_fault_3v_m if hasattr(self, '_m_fault_3v_m') else None @property def plan(self): if hasattr(self, '_m_plan'): return self._m_plan if hasattr(self, '_m_plan') else None self._m_plan = ((int(self.flags, 16) & 140737488355328) >> 47) return self._m_plan if hasattr(self, '_m_plan') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None @property def vhf1_downlink(self): if hasattr(self, '_m_vhf1_downlink'): return self._m_vhf1_downlink if hasattr(self, '_m_vhf1_downlink') else None self._m_vhf1_downlink = ((int(self.flags, 16) & 32) >> 5) return self._m_vhf1_downlink if hasattr(self, '_m_vhf1_downlink') else None @property def cyclic_reset_on(self): if hasattr(self, '_m_cyclic_reset_on'): return self._m_cyclic_reset_on if hasattr(self, '_m_cyclic_reset_on') else None self._m_cyclic_reset_on = ((int(self.flags, 16) & 512) >> 9) return self._m_cyclic_reset_on if hasattr(self, '_m_cyclic_reset_on') else None @property def uhf2_packet_ready(self): if hasattr(self, '_m_uhf2_packet_ready'): return self._m_uhf2_packet_ready if hasattr(self, '_m_uhf2_packet_ready') else None self._m_uhf2_packet_ready = ((int(self.flags, 16) & 1125899906842624) >> 50) return self._m_uhf2_packet_ready if hasattr(self, '_m_uhf2_packet_ready') else None @property def cur_fault(self): if hasattr(self, '_m_cur_fault'): return self._m_cur_fault if hasattr(self, '_m_cur_fault') else None self._m_cur_fault = ((int(self.flags, 16) & 524288) >> 19) return self._m_cur_fault if hasattr(self, '_m_cur_fault') else None @property def vhf1_packet_ready(self): if hasattr(self, '_m_vhf1_packet_ready'): return self._m_vhf1_packet_ready if hasattr(self, '_m_vhf1_packet_ready') else None self._m_vhf1_packet_ready = ((int(self.flags, 16) & 562949953421312) >> 49) return self._m_vhf1_packet_ready if hasattr(self, '_m_vhf1_packet_ready') else None @property def cul_faut(self): if hasattr(self, '_m_cul_faut'): return self._m_cul_faut if hasattr(self, '_m_cul_faut') else None self._m_cul_faut = ((int(self.flags, 16) & 131072) >> 17) return self._m_cul_faut if hasattr(self, '_m_cul_faut') else None @property def tm_log(self): if hasattr(self, '_m_tm_log'): return self._m_tm_log if hasattr(self, '_m_tm_log') else None self._m_tm_log = ((int(self.flags, 16) & 8192) >> 13) return self._m_tm_log if hasattr(self, '_m_tm_log') else None @property def long_log(self): if hasattr(self, '_m_long_log'): return self._m_long_log if hasattr(self, '_m_long_log') else None self._m_long_log = ((int(self.flags, 16) & 35184372088832) >> 45) return self._m_long_log if hasattr(self, '_m_long_log') else None @property def imc_uhf2_ok(self): if hasattr(self, '_m_imc_uhf2_ok'): return self._m_imc_uhf2_ok if hasattr(self, '_m_imc_uhf2_ok') else None self._m_imc_uhf2_ok = ((int(self.flags, 16) & 16) >> 4) return self._m_imc_uhf2_ok if hasattr(self, '_m_imc_uhf2_ok') else None @property def imc_check(self): if hasattr(self, '_m_imc_check'): return self._m_imc_check if hasattr(self, '_m_imc_check') else None self._m_imc_check = ((int(self.flags, 16) & 128) >> 7) return self._m_imc_check if hasattr(self, '_m_imc_check') else None @property def charge_m(self): if hasattr(self, '_m_charge_m'): return self._m_charge_m if hasattr(self, '_m_charge_m') else None self._m_charge_m = ((int(self.flags, 16) & 8796093022208) >> 43) return self._m_charge_m if hasattr(self, '_m_charge_m') else None @property def survival_end(self): if hasattr(self, '_m_survival_end'): return self._m_survival_end if hasattr(self, '_m_survival_end') else None self._m_survival_end = ((int(self.flags, 16) & 4503599627370496) >> 52) return self._m_survival_end if hasattr(self, '_m_survival_end') else None @property def fault_3v_r(self): if hasattr(self, '_m_fault_3v_r'): return self._m_fault_3v_r if hasattr(self, '_m_fault_3v_r') else None self._m_fault_3v_r = ((int(self.flags, 16) & 1099511627776) >> 40) return self._m_fault_3v_r if hasattr(self, '_m_fault_3v_r') else None @property def survival_mode(self): if hasattr(self, '_m_survival_mode'): return self._m_survival_mode if hasattr(self, '_m_survival_mode') else None self._m_survival_mode = ((int(self.flags, 16) & 1024) >> 10) return self._m_survival_mode if hasattr(self, '_m_survival_mode') else None @property def imc_cu_r_ok(self): if hasattr(self, '_m_imc_cu_r_ok'): return self._m_imc_cu_r_ok if hasattr(self, '_m_imc_cu_r_ok') else None self._m_imc_cu_r_ok = ((int(self.flags, 16) & 4) >> 2) return self._m_imc_cu_r_ok if hasattr(self, '_m_imc_cu_r_ok') else None @property def cul_dead(self): if hasattr(self, '_m_cul_dead'): return self._m_cul_dead if hasattr(self, '_m_cul_dead') else None self._m_cul_dead = ((int(self.flags, 16) & 251658240) >> 24) return self._m_cul_dead if hasattr(self, '_m_cul_dead') else None @property def charge_r(self): if hasattr(self, '_m_charge_r'): return self._m_charge_r if hasattr(self, '_m_charge_r') else None self._m_charge_r = ((int(self.flags, 16) & 4398046511104) >> 42) return self._m_charge_r if hasattr(self, '_m_charge_r') else None @property def imc_vhf1_ok(self): if hasattr(self, '_m_imc_vhf1_ok'): return self._m_imc_vhf1_ok if hasattr(self, '_m_imc_vhf1_ok') else None self._m_imc_vhf1_ok = ((int(self.flags, 16) & 8) >> 3) return self._m_imc_vhf1_ok if hasattr(self, '_m_imc_vhf1_ok') else None @property def cu_on(self): if hasattr(self, '_m_cu_on'): return self._m_cu_on if hasattr(self, '_m_cu_on') else None self._m_cu_on = ((int(self.flags, 16) & 1048576) >> 20) return self._m_cu_on if hasattr(self, '_m_cu_on') else None @property def log_to_flash(self): if hasattr(self, '_m_log_to_flash'): return self._m_log_to_flash if hasattr(self, '_m_log_to_flash') else None self._m_log_to_flash = ((int(self.flags, 16) & 70368744177664) >> 46) return self._m_log_to_flash if hasattr(self, '_m_log_to_flash') else None @property def imc_cu_l_ok(self): if hasattr(self, '_m_imc_cu_l_ok'): return self._m_imc_cu_l_ok if hasattr(self, '_m_imc_cu_l_ok') else None self._m_imc_cu_l_ok = ((int(self.flags, 16) & 2) >> 1) return self._m_imc_cu_l_ok if hasattr(self, '_m_imc_cu_l_ok') else None class V1Type(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.tlm_type = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") _on = self.tlm_type if _on == u"RL": self.v1 = Amicalsat.V1RlType(self._io, self, self._root) elif _on == u"MS": self.v1 = Amicalsat.V1MsType(self._io, self, self._root) class U2Type(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.tlm_type = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") _on = self.tlm_type if _on == u"RL": self.u2 = Amicalsat.U2RlType(self._io, self, self._root) elif _on == u"MS": self.u2 = Amicalsat.U2MsType(self._io, self, self._root) class Ax25InfoData(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.start = self._io.read_u1() self.tlm_area = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") _on = self.tlm_area if _on == u"EM": self.tlm_area_switch = Amicalsat.EmType(self._io, self, self._root) elif _on == u"M1": self.tlm_area_switch = Amicalsat.M1Type(self._io, self, self._root) elif _on == u"V1": self.tlm_area_switch = Amicalsat.V1Type(self._io, self, self._root) elif _on == u"U2": self.tlm_area_switch = Amicalsat.U2Type(self._io, self, self._root) elif _on == u"A1": self.tlm_area_switch = Amicalsat.A1Type(self._io, self, self._root) elif _on == u"CU_L": self.tlm_area_switch = Amicalsat.CuLType(self._io, self, self._root) elif _on == u"CU_R": self.tlm_area_switch = Amicalsat.CuRType(self._io, self, self._root) elif _on == u"ER": self.tlm_area_switch = Amicalsat.ErType(self._io, self, self._root) @property def aprs_message(self): if hasattr(self, '_m_aprs_message'): return self._m_aprs_message if hasattr(self, '_m_aprs_message') else None _pos = self._io.pos() self._io.seek(0) self._m_aprs_message = (self._io.read_bytes_full()).decode(u"utf-8") self._io.seek(_pos) return self._m_aprs_message if hasattr(self, '_m_aprs_message') else None class CuROnyxType(KaitaiStruct): """CU_R;ONYX SENSOR T;[Timestamp];[Return value] """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.timestamp = (self._io.read_bytes_term(59, False, True, True)).decode(u"ASCII") self.return_value = (self._io.read_bytes_full()).decode(u"ASCII") @property def return_value_int(self): if hasattr(self, '_m_return_value_int'): return self._m_return_value_int if hasattr(self, '_m_return_value_int') else None self._m_return_value_int = int(self.return_value) return self._m_return_value_int if hasattr(self, '_m_return_value_int') else None @property def timestamp_int(self): if hasattr(self, '_m_timestamp_int'): return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None self._m_timestamp_int = int(self.timestamp) return self._m_timestamp_int if hasattr(self, '_m_timestamp_int') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/amicalsat.py
0.492432
0.163412
amicalsat.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Mirsat1(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_frame.ax25_header.src_ssid_raw.ssid :field dest_ssid: ax25_frame.ax25_header.dest_ssid_raw.ssid :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field packet_type: ax25_frame.payload.payload.beacon.beacon_header.packet_type :field apid: ax25_frame.payload.payload.beacon.beacon_header.apid :field sequence_count: ax25_frame.payload.payload.beacon.beacon_header.sequence_count :field length: ax25_frame.payload.payload.beacon.beacon_header.length :field service_type: ax25_frame.payload.payload.beacon.beacon_header.service_type :field sub_service_type: ax25_frame.payload.payload.beacon.beacon_header.sub_service_type :field obc_boot_image: ax25_frame.payload.payload.beacon.obc_boot_image :field on_board_time: ax25_frame.payload.payload.beacon.on_board_time :field uptime: ax25_frame.payload.payload.beacon.uptime :field spacecraft_mode: ax25_frame.payload.payload.beacon.spacecraft_mode :field seperation_sequence_state: ax25_frame.payload.payload.beacon.seperation_sequence_state :field solar_array_deployment_state_0: ax25_frame.payload.payload.beacon.solar_array_deployment_state_0 :field solar_array_deployment_state_1: ax25_frame.payload.payload.beacon.solar_array_deployment_state_1 :field solar_array_deployment_state_2: ax25_frame.payload.payload.beacon.solar_array_deployment_state_2 :field solar_array_deployment_state_3: ax25_frame.payload.payload.beacon.solar_array_deployment_state_3 :field antenna_deployment_state_0: ax25_frame.payload.payload.beacon.antenna_deployment_state_0 :field antenna_deployment_state_1: ax25_frame.payload.payload.beacon.antenna_deployment_state_1 :field antenna_deployment_state_2: ax25_frame.payload.payload.beacon.antenna_deployment_state_2 :field antenna_deployment_state_3: ax25_frame.payload.payload.beacon.antenna_deployment_state_3 :field antenna_deployment_state_4: ax25_frame.payload.payload.beacon.antenna_deployment_state_4 :field antenna_deployment_state_5: ax25_frame.payload.payload.beacon.antenna_deployment_state_5 :field antenna_deployment_state_6: ax25_frame.payload.payload.beacon.antenna_deployment_state_6 :field antenna_deployment_state_7: ax25_frame.payload.payload.beacon.antenna_deployment_state_7 :field adm_soft_fire_counter: ax25_frame.payload.payload.beacon.adm_soft_fire_counter :field adm_hard_fire_counter: ax25_frame.payload.payload.beacon.adm_hard_fire_counter :field sadm_check_counter: ax25_frame.payload.payload.beacon.sadm_check_counter :field i2c_nack_addr_count: ax25_frame.payload.payload.beacon.i2c_nack_addr_count :field i2c_hw_state_error_count: ax25_frame.payload.payload.beacon.i2c_hw_state_error_count :field i2c_isr_error_count: ax25_frame.payload.payload.beacon.i2c_isr_error_count :field battery_current_direction: ax25_frame.payload.payload.beacon.battery_current_direction :field battery_current_0: ax25_frame.payload.payload.beacon.battery_current_0 :field battery_current_1_msb: ax25_frame.payload.payload.beacon.battery_current_1_msb :field adm_telemetry_0: ax25_frame.payload.payload.beacon.adm_telemetry_0 :field adm_telemetry_1: ax25_frame.payload.payload.beacon.adm_telemetry_1 :field adm_telemetry_2: ax25_frame.payload.payload.beacon.adm_telemetry_2 :field adm_telemetry_3: ax25_frame.payload.payload.beacon.adm_telemetry_3 :field adm_telemetry_4: ax25_frame.payload.payload.beacon.adm_telemetry_4 :field adm_telemetry_5: ax25_frame.payload.payload.beacon.adm_telemetry_5 :field adm_telemetry_6: ax25_frame.payload.payload.beacon.adm_telemetry_6 :field adm_telemetry_7: ax25_frame.payload.payload.beacon.adm_telemetry_7 :field adm_telemetry_8: ax25_frame.payload.payload.beacon.adm_telemetry_8 :field adm_telemetry_9: ax25_frame.payload.payload.beacon.adm_telemetry_9 :field sadm_telemetry_0: ax25_frame.payload.payload.beacon.sadm_telemetry_0 :field sadm_telemetry_1: ax25_frame.payload.payload.beacon.sadm_telemetry_1 :field sadm_telemetry_2: ax25_frame.payload.payload.beacon.sadm_telemetry_2 :field sadm_telemetry_3: ax25_frame.payload.payload.beacon.sadm_telemetry_3 :field sadm_telemetry_4: ax25_frame.payload.payload.beacon.sadm_telemetry_4 :field sadm_telemetry_5: ax25_frame.payload.payload.beacon.sadm_telemetry_5 :field sadm_telemetry_6: ax25_frame.payload.payload.beacon.sadm_telemetry_6 :field sadm_telemetry_7: ax25_frame.payload.payload.beacon.sadm_telemetry_7 :field sadm_telemetry_8: ax25_frame.payload.payload.beacon.sadm_telemetry_8 :field sadm_telemetry_9: ax25_frame.payload.payload.beacon.sadm_telemetry_9 :field battery_current_1_lsbs: ax25_frame.payload.payload.beacon.battery_current_1_lsbs :field battery_current_2: ax25_frame.payload.payload.beacon.battery_current_2 :field battery_voltage_0: ax25_frame.payload.payload.beacon.battery_voltage_0 :field battery_voltage_1: ax25_frame.payload.payload.beacon.battery_voltage_1 :field battery_voltage_2: ax25_frame.payload.payload.beacon.battery_voltage_2 :field battery_temperature: ax25_frame.payload.payload.beacon.battery_temperature :field solar_array_current_0: ax25_frame.payload.payload.beacon.solar_array_current_0 :field solar_array_voltage_0: ax25_frame.payload.payload.beacon.solar_array_voltage_0 :field solar_array_voltage_1: ax25_frame.payload.payload.beacon.solar_array_voltage_1 :field solar_array_voltage_2: ax25_frame.payload.payload.beacon.solar_array_voltage_2 :field solar_array_voltage_3: ax25_frame.payload.payload.beacon.solar_array_voltage_3 :field solar_array_voltage_4: ax25_frame.payload.payload.beacon.solar_array_voltage_4 :field solar_array_voltage_5: ax25_frame.payload.payload.beacon.solar_array_voltage_5 :field solar_array_voltage_6: ax25_frame.payload.payload.beacon.solar_array_voltage_6 :field solar_array_voltage_7: ax25_frame.payload.payload.beacon.solar_array_voltage_7 :field solar_array_voltage_8: ax25_frame.payload.payload.beacon.solar_array_voltage_8 :field eps_bus_voltage_0: ax25_frame.payload.payload.beacon.eps_bus_voltage_0 :field eps_bus_voltage_1: ax25_frame.payload.payload.beacon.eps_bus_voltage_1 :field eps_bus_voltage_2: ax25_frame.payload.payload.beacon.eps_bus_voltage_2 :field eps_bus_voltage_3: ax25_frame.payload.payload.beacon.eps_bus_voltage_3 :field eps_bus_current_0: ax25_frame.payload.payload.beacon.eps_bus_current_0 :field eps_bus_current_1: ax25_frame.payload.payload.beacon.eps_bus_current_1 :field eps_bus_current_2: ax25_frame.payload.payload.beacon.eps_bus_current_2 :field eps_bus_current_3: ax25_frame.payload.payload.beacon.eps_bus_current_3 :field adcs_raw_gyro_rate_0: ax25_frame.payload.payload.beacon.adcs_raw_gyro_rate_0 :field adcs_raw_gyro_rate_1: ax25_frame.payload.payload.beacon.adcs_raw_gyro_rate_1 :field adcs_raw_gyro_rate_2: ax25_frame.payload.payload.beacon.adcs_raw_gyro_rate_2 :field adcs_mtq_direction_duty_0: ax25_frame.payload.payload.beacon.adcs_mtq_direction_duty_0 :field adcs_mtq_direction_duty_1: ax25_frame.payload.payload.beacon.adcs_mtq_direction_duty_1 :field adcs_mtq_direction_duty_2: ax25_frame.payload.payload.beacon.adcs_mtq_direction_duty_2 :field adcs_mtq_direction_duty_3: ax25_frame.payload.payload.beacon.adcs_mtq_direction_duty_3 :field adcs_mtq_direction_duty_4: ax25_frame.payload.payload.beacon.adcs_mtq_direction_duty_4 :field adcs_mtq_direction_duty_5: ax25_frame.payload.payload.beacon.adcs_mtq_direction_duty_5 :field adcs_status: ax25_frame.payload.payload.beacon.adcs_status :field adcs_bus_voltage_0: ax25_frame.payload.payload.beacon.adcs_bus_voltage_0 :field adcs_bus_voltage_1: ax25_frame.payload.payload.beacon.adcs_bus_voltage_1 :field adcs_bus_voltage_2: ax25_frame.payload.payload.beacon.adcs_bus_voltage_2 :field adcs_bus_current_0: ax25_frame.payload.payload.beacon.adcs_bus_current_0 :field adcs_bus_current_1: ax25_frame.payload.payload.beacon.adcs_bus_current_1 :field adcs_bus_current_2: ax25_frame.payload.payload.beacon.adcs_bus_current_2 :field adcs_board_temperature: ax25_frame.payload.payload.beacon.adcs_board_temperature :field adcs_adc_reference: ax25_frame.payload.payload.beacon.adcs_adc_reference :field adcs_sensor_current: ax25_frame.payload.payload.beacon.adcs_sensor_current :field adcs_mtq_current: ax25_frame.payload.payload.beacon.adcs_mtq_current :field adcs_array_temperature_0: ax25_frame.payload.payload.beacon.adcs_array_temperature_0 :field adcs_array_temperature_1: ax25_frame.payload.payload.beacon.adcs_array_temperature_1 :field adcs_array_temperature_2: ax25_frame.payload.payload.beacon.adcs_array_temperature_2 :field adcs_array_temperature_3: ax25_frame.payload.payload.beacon.adcs_array_temperature_3 :field adcs_array_temperature_4: ax25_frame.payload.payload.beacon.adcs_array_temperature_4 :field adcs_array_temperature_5: ax25_frame.payload.payload.beacon.adcs_array_temperature_5 :field adcs_css_raw_0: ax25_frame.payload.payload.beacon.adcs_css_raw_0 :field adcs_css_raw_1: ax25_frame.payload.payload.beacon.adcs_css_raw_1 :field adcs_css_raw_2: ax25_frame.payload.payload.beacon.adcs_css_raw_2 :field adcs_css_raw_3: ax25_frame.payload.payload.beacon.adcs_css_raw_3 :field adcs_css_raw_4: ax25_frame.payload.payload.beacon.adcs_css_raw_4 :field adcs_css_raw_5: ax25_frame.payload.payload.beacon.adcs_css_raw_5 :field fss_active_0: ax25_frame.payload.payload.beacon.fss_active_0 :field fss_active_1: ax25_frame.payload.payload.beacon.fss_active_1 :field fss_active_2: ax25_frame.payload.payload.beacon.fss_active_2 :field fss_active_3: ax25_frame.payload.payload.beacon.fss_active_3 :field fss_active_4: ax25_frame.payload.payload.beacon.fss_active_4 :field fss_active_5: ax25_frame.payload.payload.beacon.fss_active_5 :field css_active_selected_0: ax25_frame.payload.payload.beacon.css_active_selected_0 :field css_active_selected_1: ax25_frame.payload.payload.beacon.css_active_selected_1 :field css_active_selected_2: ax25_frame.payload.payload.beacon.css_active_selected_2 :field css_active_selected_3: ax25_frame.payload.payload.beacon.css_active_selected_3 :field css_active_selected_4: ax25_frame.payload.payload.beacon.css_active_selected_4 :field css_active_selected_5: ax25_frame.payload.payload.beacon.css_active_selected_5 :field adcs_sun_processed_0: ax25_frame.payload.payload.beacon.adcs_sun_processed_0 :field adcs_sun_processed_1: ax25_frame.payload.payload.beacon.adcs_sun_processed_1 :field adcs_sun_processed_2: ax25_frame.payload.payload.beacon.adcs_sun_processed_2 :field adcs_detumble_counter: ax25_frame.payload.payload.beacon.adcs_detumble_counter :field adcs_mode: ax25_frame.payload.payload.beacon.adcs_mode :field adcs_state: ax25_frame.payload.payload.beacon.adcs_state :field cmc_rx_lock: ax25_frame.payload.payload.beacon.cmc_rx_lock :field cmc_rx_frame_count: ax25_frame.payload.payload.beacon.cmc_rx_frame_count :field cmc_rx_packet_count: ax25_frame.payload.payload.beacon.cmc_rx_packet_count :field cmc_rx_dropped_error_count: ax25_frame.payload.payload.beacon.cmc_rx_dropped_error_count :field cmc_rx_crc_error_count: ax25_frame.payload.payload.beacon.cmc_rx_crc_error_count :field cmc_rx_overrun_error_count: ax25_frame.payload.payload.beacon.cmc_rx_overrun_error_count :field cmc_rx_protocol_error_count: ax25_frame.payload.payload.beacon.cmc_rx_protocol_error_count :field cmc_smps_temperature: ax25_frame.payload.payload.beacon.cmc_smps_temperature :field cmc_pa_temperature: ax25_frame.payload.payload.beacon.cmc_pa_temperature :field ax25_mux_channel_enabled_0: ax25_frame.payload.payload.beacon.ax25_mux_channel_enabled_0 :field ax25_mux_channel_enabled_1: ax25_frame.payload.payload.beacon.ax25_mux_channel_enabled_1 :field ax25_mux_channel_enabled_2: ax25_frame.payload.payload.beacon.ax25_mux_channel_enabled_2 :field digipeater_enabled: ax25_frame.payload.payload.beacon.digipeater_enabled :field pacsat_broadcast_enabled: ax25_frame.payload.payload.beacon.pacsat_broadcast_enabled :field pacsat_broadcast_in_progress: ax25_frame.payload.payload.beacon.pacsat_broadcast_in_progress :field paramvalid_flags_0: ax25_frame.payload.payload.beacon.paramvalid_flags_0 :field paramvalid_flags_1: ax25_frame.payload.payload.beacon.paramvalid_flags_1 :field paramvalid_flags_2: ax25_frame.payload.payload.beacon.paramvalid_flags_2 :field paramvalid_flags_3: ax25_frame.payload.payload.beacon.paramvalid_flags_3 :field paramvalid_flags_4: ax25_frame.payload.payload.beacon.paramvalid_flags_4 :field paramvalid_flags_5: ax25_frame.payload.payload.beacon.paramvalid_flags_5 :field paramvalid_flags_6: ax25_frame.payload.payload.beacon.paramvalid_flags_6 :field paramvalid_flags_7: ax25_frame.payload.payload.beacon.paramvalid_flags_7 :field paramvalid_flags_8: ax25_frame.payload.payload.beacon.paramvalid_flags_8 :field paramvalid_flags_9: ax25_frame.payload.payload.beacon.paramvalid_flags_9 :field paramvalid_flags_10: ax25_frame.payload.payload.beacon.paramvalid_flags_10 :field paramvalid_flags_11: ax25_frame.payload.payload.beacon.paramvalid_flags_11 :field paramvalid_flags_12: ax25_frame.payload.payload.beacon.paramvalid_flags_12 :field paramvalid_flags_13: ax25_frame.payload.payload.beacon.paramvalid_flags_13 :field paramvalid_flags_14: ax25_frame.payload.payload.beacon.paramvalid_flags_14 :field paramvalid_flags_15: ax25_frame.payload.payload.beacon.paramvalid_flags_15 :field paramvalid_flags_16: ax25_frame.payload.payload.beacon.paramvalid_flags_16 :field paramvalid_flags_17: ax25_frame.payload.payload.beacon.paramvalid_flags_17 :field paramvalid_flags_18: ax25_frame.payload.payload.beacon.paramvalid_flags_18 :field paramvalid_flags_19: ax25_frame.payload.payload.beacon.paramvalid_flags_19 :field paramvalid_flags_20: ax25_frame.payload.payload.beacon.paramvalid_flags_20 :field paramvalid_flags_21: ax25_frame.payload.payload.beacon.paramvalid_flags_21 :field paramvalid_flags_22: ax25_frame.payload.payload.beacon.paramvalid_flags_22 :field paramvalid_flags_23: ax25_frame.payload.payload.beacon.paramvalid_flags_23 :field paramvalid_flags_24: ax25_frame.payload.payload.beacon.paramvalid_flags_24 :field paramvalid_flags_25: ax25_frame.payload.payload.beacon.paramvalid_flags_25 :field paramvalid_flags_26: ax25_frame.payload.payload.beacon.paramvalid_flags_26 :field paramvalid_flags_27: ax25_frame.payload.payload.beacon.paramvalid_flags_27 :field paramvalid_flags_28: ax25_frame.payload.payload.beacon.paramvalid_flags_28 :field paramvalid_flags_29: ax25_frame.payload.payload.beacon.paramvalid_flags_29 :field paramvalid_flags_30: ax25_frame.payload.payload.beacon.paramvalid_flags_30 :field paramvalid_flags_31: ax25_frame.payload.payload.beacon.paramvalid_flags_31 :field paramvalid_flags_32: ax25_frame.payload.payload.beacon.paramvalid_flags_32 :field paramvalid_flags_33: ax25_frame.payload.payload.beacon.paramvalid_flags_33 :field paramvalid_flags_34: ax25_frame.payload.payload.beacon.paramvalid_flags_34 :field paramvalid_flags_35: ax25_frame.payload.payload.beacon.paramvalid_flags_35 :field paramvalid_flags_36: ax25_frame.payload.payload.beacon.paramvalid_flags_36 :field paramvalid_flags_37: ax25_frame.payload.payload.beacon.paramvalid_flags_37 :field paramvalid_flags_38: ax25_frame.payload.payload.beacon.paramvalid_flags_38 :field paramvalid_flags_39: ax25_frame.payload.payload.beacon.paramvalid_flags_39 :field checksumbytes: ax25_frame.payload.payload.beacon.checksumbytes """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Mirsat1.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Mirsat1.Ax25Header(self._io, self, self._root) _on = (self.ax25_header.ctl & 19) if _on == 0: self.payload = Mirsat1.IFrame(self._io, self, self._root) elif _on == 3: self.payload = Mirsat1.UiFrame(self._io, self, self._root) elif _on == 19: self.payload = Mirsat1.UiFrame(self._io, self, self._root) elif _on == 16: self.payload = Mirsat1.IFrame(self._io, self, self._root) elif _on == 18: self.payload = Mirsat1.IFrame(self._io, self, self._root) elif _on == 2: self.payload = Mirsat1.IFrame(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Mirsat1.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Mirsat1.SsidMask(self._io, self, self._root) self.src_callsign_raw = Mirsat1.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Mirsat1.SsidMask(self._io, self, self._root) self.ctl = self._io.read_u1() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.payload = Mirsat1.PayloadT(self._io, self, self._root) class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") if not ((self.callsign == u"3B8MRC") or (self.callsign == u"3B8MIR")) : raise kaitaistruct.ValidationNotAnyOfError(self.callsign, self._io, u"/types/callsign/seq/0") class BeaconAT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.beacon_header = Mirsat1.BeaconHeaderT(self._io, self, self._root) self.start_byte = self._io.read_bytes(1) if not self.start_byte == b"\x00": raise kaitaistruct.ValidationNotEqualError(b"\x00", self.start_byte, self._io, u"/types/beacon_a_t/seq/1") self.obc_boot_image = self._io.read_bits_int_be(8) self.on_board_time = self._io.read_bits_int_be(32) self.uptime = self._io.read_bits_int_be(32) self.spacecraft_mode = self._io.read_bits_int_be(3) self.seperation_sequence_state = self._io.read_bits_int_be(4) self.solar_array_deployment_state_0 = self._io.read_bits_int_be(4) self.solar_array_deployment_state_1 = self._io.read_bits_int_be(4) self.solar_array_deployment_state_2 = self._io.read_bits_int_be(4) self.solar_array_deployment_state_3 = self._io.read_bits_int_be(4) self.antenna_deployment_state_0 = self._io.read_bits_int_be(16) self.antenna_deployment_state_1 = self._io.read_bits_int_be(16) self.antenna_deployment_state_2 = self._io.read_bits_int_be(16) self.antenna_deployment_state_3 = self._io.read_bits_int_be(16) self.antenna_deployment_state_4 = self._io.read_bits_int_be(16) self.antenna_deployment_state_5 = self._io.read_bits_int_be(16) self.antenna_deployment_state_6 = self._io.read_bits_int_be(16) self.antenna_deployment_state_7 = self._io.read_bits_int_be(16) self.adm_soft_fire_counter = self._io.read_bits_int_be(8) self.adm_hard_fire_counter = self._io.read_bits_int_be(8) self.adm_telemetry_0_h = self._io.read_bits_int_be(32) self.adm_telemetry_0_m = self._io.read_bits_int_be(32) self.adm_telemetry_0_l = self._io.read_bits_int_be(16) self.adm_telemetry_1_h = self._io.read_bits_int_be(32) self.adm_telemetry_1_m = self._io.read_bits_int_be(32) self.adm_telemetry_1_l = self._io.read_bits_int_be(16) self.adm_telemetry_2_h = self._io.read_bits_int_be(32) self.adm_telemetry_2_m = self._io.read_bits_int_be(32) self.adm_telemetry_2_l = self._io.read_bits_int_be(16) self.adm_telemetry_3_h = self._io.read_bits_int_be(32) self.adm_telemetry_3_m = self._io.read_bits_int_be(32) self.adm_telemetry_3_l = self._io.read_bits_int_be(16) self.adm_telemetry_4_h = self._io.read_bits_int_be(32) self.adm_telemetry_4_m = self._io.read_bits_int_be(32) self.adm_telemetry_4_l = self._io.read_bits_int_be(16) self.adm_telemetry_5_h = self._io.read_bits_int_be(32) self.adm_telemetry_5_m = self._io.read_bits_int_be(32) self.adm_telemetry_5_l = self._io.read_bits_int_be(16) self.adm_telemetry_6_h = self._io.read_bits_int_be(32) self.adm_telemetry_6_m = self._io.read_bits_int_be(32) self.adm_telemetry_6_l = self._io.read_bits_int_be(16) self.adm_telemetry_7_h = self._io.read_bits_int_be(32) self.adm_telemetry_7_m = self._io.read_bits_int_be(32) self.adm_telemetry_7_l = self._io.read_bits_int_be(16) self.adm_telemetry_8_h = self._io.read_bits_int_be(32) self.adm_telemetry_8_m = self._io.read_bits_int_be(32) self.adm_telemetry_8_l = self._io.read_bits_int_be(16) self.adm_telemetry_9_h = self._io.read_bits_int_be(32) self.adm_telemetry_9_m = self._io.read_bits_int_be(32) self.adm_telemetry_9_l = self._io.read_bits_int_be(16) self.sadm_check_counter = self._io.read_bits_int_be(5) self.sadm_telemetry_0_h = self._io.read_bits_int_be(32) self.sadm_telemetry_0_l = self._io.read_bits_int_be(32) self.sadm_telemetry_1_h = self._io.read_bits_int_be(32) self.sadm_telemetry_1_l = self._io.read_bits_int_be(32) self.sadm_telemetry_2_h = self._io.read_bits_int_be(32) self.sadm_telemetry_2_l = self._io.read_bits_int_be(32) self.sadm_telemetry_3_h = self._io.read_bits_int_be(32) self.sadm_telemetry_3_l = self._io.read_bits_int_be(32) self.sadm_telemetry_4_h = self._io.read_bits_int_be(32) self.sadm_telemetry_4_l = self._io.read_bits_int_be(32) self.sadm_telemetry_5_h = self._io.read_bits_int_be(32) self.sadm_telemetry_5_l = self._io.read_bits_int_be(32) self.sadm_telemetry_6_h = self._io.read_bits_int_be(32) self.sadm_telemetry_6_l = self._io.read_bits_int_be(32) self.sadm_telemetry_7_h = self._io.read_bits_int_be(32) self.sadm_telemetry_7_l = self._io.read_bits_int_be(32) self.sadm_telemetry_8_h = self._io.read_bits_int_be(32) self.sadm_telemetry_8_l = self._io.read_bits_int_be(32) self.sadm_telemetry_9_h = self._io.read_bits_int_be(32) self.sadm_telemetry_9_l = self._io.read_bits_int_be(32) self.i2c_nack_addr_count = self._io.read_bits_int_be(32) self.i2c_hw_state_error_count = self._io.read_bits_int_be(32) self.i2c_isr_error_count = self._io.read_bits_int_be(32) self.battery_current_direction = self._io.read_bits_int_be(1) != 0 self.battery_current_0 = self._io.read_bits_int_be(10) self.battery_current_1_msb = self._io.read_bits_int_be(1) != 0 @property def sadm_telemetry_4(self): if hasattr(self, '_m_sadm_telemetry_4'): return self._m_sadm_telemetry_4 if hasattr(self, '_m_sadm_telemetry_4') else None self._m_sadm_telemetry_4 = ((self.sadm_telemetry_4_h << 32) | self.sadm_telemetry_4_l) return self._m_sadm_telemetry_4 if hasattr(self, '_m_sadm_telemetry_4') else None @property def adm_telemetry_9(self): if hasattr(self, '_m_adm_telemetry_9'): return self._m_adm_telemetry_9 if hasattr(self, '_m_adm_telemetry_9') else None self._m_adm_telemetry_9 = (((self.adm_telemetry_9_h << 48) | (self.adm_telemetry_9_m << 32)) | self.adm_telemetry_9_l) return self._m_adm_telemetry_9 if hasattr(self, '_m_adm_telemetry_9') else None @property def adm_telemetry_7(self): if hasattr(self, '_m_adm_telemetry_7'): return self._m_adm_telemetry_7 if hasattr(self, '_m_adm_telemetry_7') else None self._m_adm_telemetry_7 = (((self.adm_telemetry_7_h << 48) | (self.adm_telemetry_7_m << 32)) | self.adm_telemetry_7_l) return self._m_adm_telemetry_7 if hasattr(self, '_m_adm_telemetry_7') else None @property def adm_telemetry_4(self): if hasattr(self, '_m_adm_telemetry_4'): return self._m_adm_telemetry_4 if hasattr(self, '_m_adm_telemetry_4') else None self._m_adm_telemetry_4 = (((self.adm_telemetry_4_h << 48) | (self.adm_telemetry_4_m << 32)) | self.adm_telemetry_4_l) return self._m_adm_telemetry_4 if hasattr(self, '_m_adm_telemetry_4') else None @property def adm_telemetry_6(self): if hasattr(self, '_m_adm_telemetry_6'): return self._m_adm_telemetry_6 if hasattr(self, '_m_adm_telemetry_6') else None self._m_adm_telemetry_6 = (((self.adm_telemetry_6_h << 48) | (self.adm_telemetry_6_m << 32)) | self.adm_telemetry_6_l) return self._m_adm_telemetry_6 if hasattr(self, '_m_adm_telemetry_6') else None @property def sadm_telemetry_1(self): if hasattr(self, '_m_sadm_telemetry_1'): return self._m_sadm_telemetry_1 if hasattr(self, '_m_sadm_telemetry_1') else None self._m_sadm_telemetry_1 = ((self.sadm_telemetry_1_h << 32) | self.sadm_telemetry_1_l) return self._m_sadm_telemetry_1 if hasattr(self, '_m_sadm_telemetry_1') else None @property def sadm_telemetry_6(self): if hasattr(self, '_m_sadm_telemetry_6'): return self._m_sadm_telemetry_6 if hasattr(self, '_m_sadm_telemetry_6') else None self._m_sadm_telemetry_6 = ((self.sadm_telemetry_6_h << 32) | self.sadm_telemetry_6_l) return self._m_sadm_telemetry_6 if hasattr(self, '_m_sadm_telemetry_6') else None @property def adm_telemetry_3(self): if hasattr(self, '_m_adm_telemetry_3'): return self._m_adm_telemetry_3 if hasattr(self, '_m_adm_telemetry_3') else None self._m_adm_telemetry_3 = (((self.adm_telemetry_3_h << 48) | (self.adm_telemetry_3_m << 16)) | self.adm_telemetry_3_l) return self._m_adm_telemetry_3 if hasattr(self, '_m_adm_telemetry_3') else None @property def sadm_telemetry_0(self): if hasattr(self, '_m_sadm_telemetry_0'): return self._m_sadm_telemetry_0 if hasattr(self, '_m_sadm_telemetry_0') else None self._m_sadm_telemetry_0 = ((self.sadm_telemetry_0_h << 32) | self.sadm_telemetry_0_l) return self._m_sadm_telemetry_0 if hasattr(self, '_m_sadm_telemetry_0') else None @property def adm_telemetry_8(self): if hasattr(self, '_m_adm_telemetry_8'): return self._m_adm_telemetry_8 if hasattr(self, '_m_adm_telemetry_8') else None self._m_adm_telemetry_8 = (((self.adm_telemetry_8_h << 48) | (self.adm_telemetry_8_m << 32)) | self.adm_telemetry_8_l) return self._m_adm_telemetry_8 if hasattr(self, '_m_adm_telemetry_8') else None @property def adm_telemetry_0(self): if hasattr(self, '_m_adm_telemetry_0'): return self._m_adm_telemetry_0 if hasattr(self, '_m_adm_telemetry_0') else None self._m_adm_telemetry_0 = (((self.adm_telemetry_0_h << 48) | (self.adm_telemetry_0_m << 16)) | self.adm_telemetry_0_l) return self._m_adm_telemetry_0 if hasattr(self, '_m_adm_telemetry_0') else None @property def sadm_telemetry_3(self): if hasattr(self, '_m_sadm_telemetry_3'): return self._m_sadm_telemetry_3 if hasattr(self, '_m_sadm_telemetry_3') else None self._m_sadm_telemetry_3 = ((self.sadm_telemetry_3_h << 32) | self.sadm_telemetry_3_l) return self._m_sadm_telemetry_3 if hasattr(self, '_m_sadm_telemetry_3') else None @property def sadm_telemetry_9(self): if hasattr(self, '_m_sadm_telemetry_9'): return self._m_sadm_telemetry_9 if hasattr(self, '_m_sadm_telemetry_9') else None self._m_sadm_telemetry_9 = ((self.sadm_telemetry_9_h << 32) | self.sadm_telemetry_9_l) return self._m_sadm_telemetry_9 if hasattr(self, '_m_sadm_telemetry_9') else None @property def adm_telemetry_5(self): if hasattr(self, '_m_adm_telemetry_5'): return self._m_adm_telemetry_5 if hasattr(self, '_m_adm_telemetry_5') else None self._m_adm_telemetry_5 = (((self.adm_telemetry_5_h << 48) | (self.adm_telemetry_5_m << 32)) | self.adm_telemetry_5_l) return self._m_adm_telemetry_5 if hasattr(self, '_m_adm_telemetry_5') else None @property def sadm_telemetry_5(self): if hasattr(self, '_m_sadm_telemetry_5'): return self._m_sadm_telemetry_5 if hasattr(self, '_m_sadm_telemetry_5') else None self._m_sadm_telemetry_5 = ((self.sadm_telemetry_5_h << 32) | self.sadm_telemetry_5_l) return self._m_sadm_telemetry_5 if hasattr(self, '_m_sadm_telemetry_5') else None @property def adm_telemetry_2(self): if hasattr(self, '_m_adm_telemetry_2'): return self._m_adm_telemetry_2 if hasattr(self, '_m_adm_telemetry_2') else None self._m_adm_telemetry_2 = (((self.adm_telemetry_2_h << 48) | (self.adm_telemetry_2_m << 16)) | self.adm_telemetry_2_l) return self._m_adm_telemetry_2 if hasattr(self, '_m_adm_telemetry_2') else None @property def sadm_telemetry_2(self): if hasattr(self, '_m_sadm_telemetry_2'): return self._m_sadm_telemetry_2 if hasattr(self, '_m_sadm_telemetry_2') else None self._m_sadm_telemetry_2 = ((self.sadm_telemetry_2_h << 32) | self.sadm_telemetry_2_l) return self._m_sadm_telemetry_2 if hasattr(self, '_m_sadm_telemetry_2') else None @property def sadm_telemetry_8(self): if hasattr(self, '_m_sadm_telemetry_8'): return self._m_sadm_telemetry_8 if hasattr(self, '_m_sadm_telemetry_8') else None self._m_sadm_telemetry_8 = ((self.sadm_telemetry_8_h << 32) | self.sadm_telemetry_8_l) return self._m_sadm_telemetry_8 if hasattr(self, '_m_sadm_telemetry_8') else None @property def sadm_telemetry_7(self): if hasattr(self, '_m_sadm_telemetry_7'): return self._m_sadm_telemetry_7 if hasattr(self, '_m_sadm_telemetry_7') else None self._m_sadm_telemetry_7 = ((self.sadm_telemetry_7_h << 32) | self.sadm_telemetry_7_l) return self._m_sadm_telemetry_7 if hasattr(self, '_m_sadm_telemetry_7') else None @property def adm_telemetry_1(self): if hasattr(self, '_m_adm_telemetry_1'): return self._m_adm_telemetry_1 if hasattr(self, '_m_adm_telemetry_1') else None self._m_adm_telemetry_1 = (((self.adm_telemetry_1_h << 48) | (self.adm_telemetry_1_m << 16)) | self.adm_telemetry_1_l) return self._m_adm_telemetry_1 if hasattr(self, '_m_adm_telemetry_1') else None class BeaconHeaderT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.packet_type = self._io.read_u1() self.apid = self._io.read_u1() self.sequence_count = self._io.read_u2be() self.length = self._io.read_u2be() self.reserved = self._io.read_u1() self.service_type = self._io.read_u1() self.sub_service_type = self._io.read_u1() class BeaconT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.beacon = self._io.read_bytes_full() class IFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self.ax25_info = self._io.read_bytes_full() class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class PayloadT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.header = self._io.read_bytes(6) _on = self._root.frametype if _on == 793: self.beacon = Mirsat1.BeaconAT(self._io, self, self._root) else: self.beacon = Mirsat1.BeaconBT(self._io, self, self._root) class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Mirsat1.Callsign(_io__raw_callsign_ror, self, self._root) class BeaconBT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.battery_current_1_lsbs = self._io.read_bits_int_be(9) self.battery_current_2 = self._io.read_bits_int_be(10) self.battery_voltage_0 = self._io.read_bits_int_be(10) self.battery_voltage_1 = self._io.read_bits_int_be(10) self.battery_voltage_2 = self._io.read_bits_int_be(10) self.battery_temperature = self._io.read_bits_int_be(10) self.solar_array_current_0 = self._io.read_bits_int_be(10) self.solar_array_voltage_0 = self._io.read_bits_int_be(10) self.solar_array_voltage_1 = self._io.read_bits_int_be(10) self.solar_array_voltage_2 = self._io.read_bits_int_be(10) self.solar_array_voltage_3 = self._io.read_bits_int_be(10) self.solar_array_voltage_4 = self._io.read_bits_int_be(10) self.solar_array_voltage_5 = self._io.read_bits_int_be(10) self.solar_array_voltage_6 = self._io.read_bits_int_be(10) self.solar_array_voltage_7 = self._io.read_bits_int_be(10) self.solar_array_voltage_8 = self._io.read_bits_int_be(10) self.eps_bus_voltage_0 = self._io.read_bits_int_be(10) self.eps_bus_voltage_1 = self._io.read_bits_int_be(10) self.eps_bus_voltage_2 = self._io.read_bits_int_be(10) self.eps_bus_voltage_3 = self._io.read_bits_int_be(10) self.eps_bus_current_0 = self._io.read_bits_int_be(10) self.eps_bus_current_1 = self._io.read_bits_int_be(10) self.eps_bus_current_2 = self._io.read_bits_int_be(10) self.eps_bus_current_3 = self._io.read_bits_int_be(10) self.adcs_raw_gyro_rate_0_bits = self._io.read_bits_int_be(16) self.adcs_raw_gyro_rate_1_bits = self._io.read_bits_int_be(16) self.adcs_raw_gyro_rate_2_bits = self._io.read_bits_int_be(16) self.adcs_mtq_direction_duty_0 = self._io.read_bits_int_be(8) self.adcs_mtq_direction_duty_1 = self._io.read_bits_int_be(8) self.adcs_mtq_direction_duty_2 = self._io.read_bits_int_be(8) self.adcs_mtq_direction_duty_3 = self._io.read_bits_int_be(8) self.adcs_mtq_direction_duty_4 = self._io.read_bits_int_be(8) self.adcs_mtq_direction_duty_5 = self._io.read_bits_int_be(8) self.adcs_status = self._io.read_bits_int_be(16) self.adcs_bus_voltage_0 = self._io.read_bits_int_be(16) self.adcs_bus_voltage_1 = self._io.read_bits_int_be(16) self.adcs_bus_voltage_2 = self._io.read_bits_int_be(16) self.adcs_bus_current_0 = self._io.read_bits_int_be(16) self.adcs_bus_current_1 = self._io.read_bits_int_be(16) self.adcs_bus_current_2 = self._io.read_bits_int_be(16) self.adcs_board_temperature = self._io.read_bits_int_be(16) self.adcs_adc_reference = self._io.read_bits_int_be(16) self.adcs_sensor_current = self._io.read_bits_int_be(16) self.adcs_mtq_current = self._io.read_bits_int_be(16) self.adcs_array_temperature_0 = self._io.read_bits_int_be(16) self.adcs_array_temperature_1 = self._io.read_bits_int_be(16) self.adcs_array_temperature_2 = self._io.read_bits_int_be(16) self.adcs_array_temperature_3 = self._io.read_bits_int_be(16) self.adcs_array_temperature_4 = self._io.read_bits_int_be(16) self.adcs_array_temperature_5 = self._io.read_bits_int_be(16) self.adcs_css_raw_0 = self._io.read_bits_int_be(16) self.adcs_css_raw_1 = self._io.read_bits_int_be(16) self.adcs_css_raw_2 = self._io.read_bits_int_be(16) self.adcs_css_raw_3 = self._io.read_bits_int_be(16) self.adcs_css_raw_4 = self._io.read_bits_int_be(16) self.adcs_css_raw_5 = self._io.read_bits_int_be(16) self.fss_active_0 = self._io.read_bits_int_be(2) self.fss_active_1 = self._io.read_bits_int_be(2) self.fss_active_2 = self._io.read_bits_int_be(2) self.fss_active_3 = self._io.read_bits_int_be(2) self.fss_active_4 = self._io.read_bits_int_be(2) self.fss_active_5 = self._io.read_bits_int_be(2) self.css_active_selected_0 = self._io.read_bits_int_be(2) self.css_active_selected_1 = self._io.read_bits_int_be(2) self.css_active_selected_2 = self._io.read_bits_int_be(2) self.css_active_selected_3 = self._io.read_bits_int_be(2) self.css_active_selected_4 = self._io.read_bits_int_be(2) self.css_active_selected_5 = self._io.read_bits_int_be(2) self.adcs_sun_processed_0 = self._io.read_bits_int_be(16) self.adcs_sun_processed_1 = self._io.read_bits_int_be(16) self.adcs_sun_processed_2 = self._io.read_bits_int_be(16) self.reserved_0 = self._io.read_bits_int_be(16) self.reserved_1 = self._io.read_bits_int_be(16) self.reserved_2 = self._io.read_bits_int_be(16) self.reserved_3 = self._io.read_bits_int_be(16) self.adcs_detumble_counter = self._io.read_bits_int_be(16) self.adcs_mode = self._io.read_bits_int_be(16) self.adcs_state = self._io.read_bits_int_be(16) self.reserved_4 = self._io.read_bits_int_be(10) self.reserved_5 = self._io.read_bits_int_be(4) self.reserved_6 = self._io.read_bits_int_be(16) self.reserved_7 = self._io.read_bits_int_be(3) self.reserved_8 = self._io.read_bits_int_be(4) self.cmc_rx_lock = self._io.read_bits_int_be(1) != 0 self.cmc_rx_frame_count = self._io.read_bits_int_be(16) self.cmc_rx_packet_count = self._io.read_bits_int_be(16) self.cmc_rx_dropped_error_count = self._io.read_bits_int_be(16) self.cmc_rx_crc_error_count = self._io.read_bits_int_be(16) self.cmc_rx_overrun_error_count = self._io.read_bits_int_be(8) self.cmc_rx_protocol_error_count = self._io.read_bits_int_be(16) self.cmc_smps_temperature_bits = self._io.read_bits_int_be(8) self.cmc_pa_temperature_bits = self._io.read_bits_int_be(8) self.ax25_mux_channel_enabled_0 = self._io.read_bits_int_be(1) != 0 self.ax25_mux_channel_enabled_1 = self._io.read_bits_int_be(1) != 0 self.ax25_mux_channel_enabled_2 = self._io.read_bits_int_be(1) != 0 self.digipeater_enabled = self._io.read_bits_int_be(1) != 0 self.pacsat_broadcast_enabled = self._io.read_bits_int_be(1) != 0 self.pacsat_broadcast_in_progress = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_0 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_1 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_2 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_3 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_4 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_5 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_6 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_7 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_8 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_9 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_10 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_11 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_12 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_13 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_14 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_15 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_16 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_17 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_18 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_19 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_20 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_21 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_22 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_23 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_24 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_25 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_26 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_27 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_28 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_29 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_30 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_31 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_32 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_33 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_34 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_35 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_36 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_37 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_38 = self._io.read_bits_int_be(1) != 0 self.paramvalid_flags_39 = self._io.read_bits_int_be(1) != 0 self.padding = self._io.read_bits_int_be(5) self.checksumbytes = self._io.read_bits_int_be(16) self._io.align_to_byte() self.tail = self._io.read_bytes(97) @property def cmc_pa_temperature(self): if hasattr(self, '_m_cmc_pa_temperature'): return self._m_cmc_pa_temperature if hasattr(self, '_m_cmc_pa_temperature') else None self._m_cmc_pa_temperature = ((-1 * (self.cmc_pa_temperature_bits & 127)) if (self.cmc_pa_temperature_bits & 128) == 1 else (self.cmc_pa_temperature_bits & 127)) return self._m_cmc_pa_temperature if hasattr(self, '_m_cmc_pa_temperature') else None @property def adcs_raw_gyro_rate_1(self): if hasattr(self, '_m_adcs_raw_gyro_rate_1'): return self._m_adcs_raw_gyro_rate_1 if hasattr(self, '_m_adcs_raw_gyro_rate_1') else None self._m_adcs_raw_gyro_rate_1 = ((-1 * (self.adcs_raw_gyro_rate_1_bits & 32767)) if (self.adcs_raw_gyro_rate_1_bits & 32768) == 1 else (self.adcs_raw_gyro_rate_1_bits & 32767)) return self._m_adcs_raw_gyro_rate_1 if hasattr(self, '_m_adcs_raw_gyro_rate_1') else None @property def adcs_raw_gyro_rate_2(self): if hasattr(self, '_m_adcs_raw_gyro_rate_2'): return self._m_adcs_raw_gyro_rate_2 if hasattr(self, '_m_adcs_raw_gyro_rate_2') else None self._m_adcs_raw_gyro_rate_2 = ((-1 * (self.adcs_raw_gyro_rate_1_bits & 32767)) if (self.adcs_raw_gyro_rate_1_bits & 32768) == 1 else (self.adcs_raw_gyro_rate_1_bits & 32767)) return self._m_adcs_raw_gyro_rate_2 if hasattr(self, '_m_adcs_raw_gyro_rate_2') else None @property def adcs_raw_gyro_rate_0(self): if hasattr(self, '_m_adcs_raw_gyro_rate_0'): return self._m_adcs_raw_gyro_rate_0 if hasattr(self, '_m_adcs_raw_gyro_rate_0') else None self._m_adcs_raw_gyro_rate_0 = ((-1 * (self.adcs_raw_gyro_rate_0_bits & 32767)) if (self.adcs_raw_gyro_rate_0_bits & 32768) == 1 else (self.adcs_raw_gyro_rate_0_bits & 32767)) return self._m_adcs_raw_gyro_rate_0 if hasattr(self, '_m_adcs_raw_gyro_rate_0') else None @property def cmc_smps_temperature(self): if hasattr(self, '_m_cmc_smps_temperature'): return self._m_cmc_smps_temperature if hasattr(self, '_m_cmc_smps_temperature') else None self._m_cmc_smps_temperature = ((-1 * (self.cmc_smps_temperature_bits & 127)) if (self.cmc_smps_temperature_bits & 128) == 1 else (self.cmc_smps_temperature_bits & 127)) return self._m_cmc_smps_temperature if hasattr(self, '_m_cmc_smps_temperature') else None @property def framelength(self): if hasattr(self, '_m_framelength'): return self._m_framelength if hasattr(self, '_m_framelength') else None self._m_framelength = self._io.size() return self._m_framelength if hasattr(self, '_m_framelength') else None @property def frametype(self): if hasattr(self, '_m_frametype'): return self._m_frametype if hasattr(self, '_m_frametype') else None _pos = self._io.pos() self._io.seek(29) self._m_frametype = self._io.read_u2be() self._io.seek(_pos) return self._m_frametype if hasattr(self, '_m_frametype') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/mirsat1.py
0.566258
0.201695
mirsat1.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO from enum import Enum if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Suchai2(KaitaiStruct): """:field prio: sch.csp_h.prio :field source: sch.csp_h.source :field dest: sch.csp_h.dest :field dest_port: sch.csp_h.dest_port :field source_port: sch.csp_h.source_port :field flags: sch.csp_h.flags :field nframe: sch.nframe :field type: sch.type :field node: sch.node :field ndata: sch.ndata :field index: sch.status.index :field timestamp: sch.status.timestamp :field dat_obc_opmode: sch.status.dat_obc_opmode :field dat_rtc_date_time: sch.status.dat_rtc_date_time :field dat_obc_last_reset: sch.status.dat_obc_last_reset :field dat_obc_hrs_alive: sch.status.dat_obc_hrs_alive :field dat_obc_hrs_wo_reset: sch.status.dat_obc_hrs_wo_reset :field dat_obc_reset_counter: sch.status.dat_obc_reset_counter :field dat_obc_executed_cmds: sch.status.dat_obc_executed_cmds :field dat_obc_failed_cmds: sch.status.dat_obc_failed_cmds :field dat_com_count_tm: sch.status.dat_com_count_tm :field dat_com_count_tc: sch.status.dat_com_count_tc :field dat_com_last_tc: sch.status.dat_com_last_tc :field dat_fpl_last: sch.status.dat_fpl_last :field dat_fpl_queue: sch.status.dat_fpl_queue :field dat_ads_tle_epoch: sch.status.dat_ads_tle_epoch :field dat_eps_vbatt: sch.status.dat_eps_vbatt :field dat_eps_cur_sun: sch.status.dat_eps_cur_sun :field dat_eps_cur_sys: sch.status.dat_eps_cur_sys :field dat_obc_temp_1: sch.status.dat_obc_temp_1 :field dat_eps_temp_bat0: sch.status.dat_eps_temp_bat0 :field dat_drp_mach_action: sch.status.dat_drp_mach_action :field dat_drp_mach_state: sch.status.dat_drp_mach_state :field dat_drp_mach_payloads: sch.status.dat_drp_mach_payloads :field dat_drp_mach_step: sch.status.dat_drp_mach_step :field sat_id: sch.sat_id """ class SatName(Enum): suchai2 = 16 suchai3 = 17 plantsat = 18 def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.sch = Suchai2.SuchaiFrame(self._io, self, self._root) class SuchaiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.csp_h = Suchai2.CspHeader(self._io, self, self._root) self.nframe = self._io.read_u2be() self.type = self._io.read_u1() self.node = self._io.read_u1() self.ndata = self._io.read_u4be() self.status = Suchai2.Status(self._io, self, self._root) @property def sat_id(self): if hasattr(self, '_m_sat_id'): return self._m_sat_id if hasattr(self, '_m_sat_id') else None self._m_sat_id = KaitaiStream.resolve_enum(Suchai2.SatName, self.csp_h.dest_port) return self._m_sat_id if hasattr(self, '_m_sat_id') else None class CspHeader(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.prio = self._io.read_bits_int_be(2) self.source = self._io.read_bits_int_be(5) self.dest = self._io.read_bits_int_be(5) self.dest_port = self._io.read_bits_int_be(6) self.source_port = self._io.read_bits_int_be(6) self._io.align_to_byte() self.flags = self._io.read_u1() class Status(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.index = self._io.read_u4be() self.timestamp = self._io.read_u4be() self.dat_obc_opmode = self._io.read_u4be() self.dat_rtc_date_time = self._io.read_u4be() self.dat_obc_last_reset = self._io.read_u4be() self.dat_obc_hrs_alive = self._io.read_u4be() self.dat_obc_hrs_wo_reset = self._io.read_u4be() self.dat_obc_reset_counter = self._io.read_u4be() self.dat_obc_executed_cmds = self._io.read_u4be() self.dat_obc_failed_cmds = self._io.read_u4be() self.dat_com_count_tm = self._io.read_u4be() self.dat_com_count_tc = self._io.read_u4be() self.dat_com_last_tc = self._io.read_u4be() self.dat_fpl_last = self._io.read_u4be() self.dat_fpl_queue = self._io.read_u4be() self.dat_ads_tle_epoch = self._io.read_u4be() self.dat_eps_vbatt = self._io.read_u4be() self.dat_eps_cur_sun = self._io.read_u4be() self.dat_eps_cur_sys = self._io.read_u4be() self.dat_obc_temp_1 = self._io.read_u4be() self.dat_eps_temp_bat0 = self._io.read_u4be() self.dat_drp_mach_action = self._io.read_u4be() self.dat_drp_mach_state = self._io.read_u4be() self.dat_drp_mach_payloads = self._io.read_u4be() self.dat_drp_mach_step = self._io.read_u4be()
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/suchai2.py
0.534855
0.205994
suchai2.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO from enum import Enum if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Equisat(KaitaiStruct): """:field timestamp: equisat_frame.preamble.timestamp :field msg_op_states: equisat_frame.preamble.msg_op_states :field message_type: equisat_frame.preamble.message_type :field bytes_of_data: equisat_frame.preamble.bytes_of_data :field num_errors: equisat_frame.preamble.num_errors :field time_to_flash: equisat_frame.current_info.time_to_flash :field boot_count: equisat_frame.current_info.boot_count :field l1_ref: equisat_frame.current_info.l1_ref.int16 :field l2_ref: equisat_frame.current_info.l2_ref.int16 :field l1_sns: equisat_frame.current_info.l1_sns.int16 :field l2_sns: equisat_frame.current_info.l2_sns.int16 :field l1_temp: equisat_frame.current_info.l1_temp.int16 :field l2_temp: equisat_frame.current_info.l2_temp.int16 :field panel_ref: equisat_frame.current_info.panel_ref.int16 :field l_ref: equisat_frame.current_info.l_ref.int16 :field bat_digsigs_1: equisat_frame.current_info.bat_digsigs_1 :field bat_digsigs_2: equisat_frame.current_info.bat_digsigs_2 :field lf1ref: equisat_frame.current_info.lf1ref.int16 :field lf2ref: equisat_frame.current_info.lf2ref.int16 :field lf3ref: equisat_frame.current_info.lf3ref.int16 :field lf4ref: equisat_frame.current_info.lf4ref.int16 :field idle_batch_0_event_history: equisat_frame.data_section.idle_batch_0.event_history :field idle_batch_0_l1_ref: equisat_frame.data_section.idle_batch_0.l1_ref.int16 :field idle_batch_0_l2_ref: equisat_frame.data_section.idle_batch_0.l2_ref.int16 :field idle_batch_0_l1_sns: equisat_frame.data_section.idle_batch_0.l1_sns.int16 :field idle_batch_0_l2_sns: equisat_frame.data_section.idle_batch_0.l2_sns.int16 :field idle_batch_0_l1_temp: equisat_frame.data_section.idle_batch_0.l1_temp.int16 :field idle_batch_0_l2_temp: equisat_frame.data_section.idle_batch_0.l2_temp.int16 :field idle_batch_0_panel_ref: equisat_frame.data_section.idle_batch_0.panel_ref.int16 :field idle_batch_0_l_ref: equisat_frame.data_section.idle_batch_0.l_ref.int16 :field idle_batch_0_bat_digsigs_1: equisat_frame.data_section.idle_batch_0.bat_digsigs_1 :field idle_batch_0_bat_digsigs_2: equisat_frame.data_section.idle_batch_0.bat_digsigs_2 :field idle_batch_0_rad_temp: equisat_frame.data_section.idle_batch_0.rad_temp.int16 :field idle_batch_0_imu_temp: equisat_frame.data_section.idle_batch_0.imu_temp.int16 :field idle_batch_0_ir_flash_amb: equisat_frame.data_section.idle_batch_0.ir_flash_amb.int16 :field idle_batch_0_ir_side1_amb: equisat_frame.data_section.idle_batch_0.ir_side1_amb.int16 :field idle_batch_0_ir_side2_amb: equisat_frame.data_section.idle_batch_0.ir_side2_amb.int16 :field idle_batch_0_ir_rbf_amb: equisat_frame.data_section.idle_batch_0.ir_rbf_amb.int16 :field idle_batch_0_ir_access_amb: equisat_frame.data_section.idle_batch_0.ir_access_amb.int16 :field idle_batch_0_ir_top1_amb: equisat_frame.data_section.idle_batch_0.ir_top1_amb.int16 :field idle_batch_0_timestamp: equisat_frame.data_section.idle_batch_0.timestamp :field idle_batch_1_event_history: equisat_frame.data_section.idle_batch_1.event_history :field idle_batch_1_l1_ref: equisat_frame.data_section.idle_batch_1.l1_ref.int16 :field idle_batch_1_l2_ref: equisat_frame.data_section.idle_batch_1.l2_ref.int16 :field idle_batch_1_l1_sns: equisat_frame.data_section.idle_batch_1.l1_sns.int16 :field idle_batch_1_l2_sns: equisat_frame.data_section.idle_batch_1.l2_sns.int16 :field idle_batch_1_l1_temp: equisat_frame.data_section.idle_batch_1.l1_temp.int16 :field idle_batch_1_l2_temp: equisat_frame.data_section.idle_batch_1.l2_temp.int16 :field idle_batch_1_panel_ref: equisat_frame.data_section.idle_batch_1.panel_ref.int16 :field idle_batch_1_l_ref: equisat_frame.data_section.idle_batch_1.l_ref.int16 :field idle_batch_1_bat_digsigs_1: equisat_frame.data_section.idle_batch_1.bat_digsigs_1 :field idle_batch_1_bat_digsigs_2: equisat_frame.data_section.idle_batch_1.bat_digsigs_2 :field idle_batch_1_rad_temp: equisat_frame.data_section.idle_batch_1.rad_temp.int16 :field idle_batch_1_imu_temp: equisat_frame.data_section.idle_batch_1.imu_temp.int16 :field idle_batch_1_ir_flash_amb: equisat_frame.data_section.idle_batch_1.ir_flash_amb.int16 :field idle_batch_1_ir_side1_amb: equisat_frame.data_section.idle_batch_1.ir_side1_amb.int16 :field idle_batch_1_ir_side2_amb: equisat_frame.data_section.idle_batch_1.ir_side2_amb.int16 :field idle_batch_1_ir_rbf_amb: equisat_frame.data_section.idle_batch_1.ir_rbf_amb.int16 :field idle_batch_1_ir_access_amb: equisat_frame.data_section.idle_batch_1.ir_access_amb.int16 :field idle_batch_1_ir_top1_amb: equisat_frame.data_section.idle_batch_1.ir_top1_amb.int16 :field idle_batch_1_timestamp: equisat_frame.data_section.idle_batch_1.timestamp :field idle_batch_2_event_history: equisat_frame.data_section.idle_batch_2.event_history :field idle_batch_2_l1_ref: equisat_frame.data_section.idle_batch_2.l1_ref.int16 :field idle_batch_2_l2_ref: equisat_frame.data_section.idle_batch_2.l2_ref.int16 :field idle_batch_2_l1_sns: equisat_frame.data_section.idle_batch_2.l1_sns.int16 :field idle_batch_2_l2_sns: equisat_frame.data_section.idle_batch_2.l2_sns.int16 :field idle_batch_2_l1_temp: equisat_frame.data_section.idle_batch_2.l1_temp.int16 :field idle_batch_2_l2_temp: equisat_frame.data_section.idle_batch_2.l2_temp.int16 :field idle_batch_2_panel_ref: equisat_frame.data_section.idle_batch_2.panel_ref.int16 :field idle_batch_2_l_ref: equisat_frame.data_section.idle_batch_2.l_ref.int16 :field idle_batch_2_bat_digsigs_1: equisat_frame.data_section.idle_batch_2.bat_digsigs_1 :field idle_batch_2_bat_digsigs_2: equisat_frame.data_section.idle_batch_2.bat_digsigs_2 :field idle_batch_2_rad_temp: equisat_frame.data_section.idle_batch_2.rad_temp.int16 :field idle_batch_2_imu_temp: equisat_frame.data_section.idle_batch_2.imu_temp.int16 :field idle_batch_2_ir_flash_amb: equisat_frame.data_section.idle_batch_2.ir_flash_amb.int16 :field idle_batch_2_ir_side1_amb: equisat_frame.data_section.idle_batch_2.ir_side1_amb.int16 :field idle_batch_2_ir_side2_amb: equisat_frame.data_section.idle_batch_2.ir_side2_amb.int16 :field idle_batch_2_ir_rbf_amb: equisat_frame.data_section.idle_batch_2.ir_rbf_amb.int16 :field idle_batch_2_ir_access_amb: equisat_frame.data_section.idle_batch_2.ir_access_amb.int16 :field idle_batch_2_ir_top1_amb: equisat_frame.data_section.idle_batch_2.ir_top1_amb.int16 :field idle_batch_2_timestamp: equisat_frame.data_section.idle_batch_2.timestamp :field idle_batch_3_event_history: equisat_frame.data_section.idle_batch_3.event_history :field idle_batch_3_l1_ref: equisat_frame.data_section.idle_batch_3.l1_ref.int16 :field idle_batch_3_l2_ref: equisat_frame.data_section.idle_batch_3.l2_ref.int16 :field idle_batch_3_l1_sns: equisat_frame.data_section.idle_batch_3.l1_sns.int16 :field idle_batch_3_l2_sns: equisat_frame.data_section.idle_batch_3.l2_sns.int16 :field idle_batch_3_l1_temp: equisat_frame.data_section.idle_batch_3.l1_temp.int16 :field idle_batch_3_l2_temp: equisat_frame.data_section.idle_batch_3.l2_temp.int16 :field idle_batch_3_panel_ref: equisat_frame.data_section.idle_batch_3.panel_ref.int16 :field idle_batch_3_l_ref: equisat_frame.data_section.idle_batch_3.l_ref.int16 :field idle_batch_3_bat_digsigs_1: equisat_frame.data_section.idle_batch_3.bat_digsigs_1 :field idle_batch_3_bat_digsigs_2: equisat_frame.data_section.idle_batch_3.bat_digsigs_2 :field idle_batch_3_rad_temp: equisat_frame.data_section.idle_batch_3.rad_temp.int16 :field idle_batch_3_imu_temp: equisat_frame.data_section.idle_batch_3.imu_temp.int16 :field idle_batch_3_ir_flash_amb: equisat_frame.data_section.idle_batch_3.ir_flash_amb.int16 :field idle_batch_3_ir_side1_amb: equisat_frame.data_section.idle_batch_3.ir_side1_amb.int16 :field idle_batch_3_ir_side2_amb: equisat_frame.data_section.idle_batch_3.ir_side2_amb.int16 :field idle_batch_3_ir_rbf_amb: equisat_frame.data_section.idle_batch_3.ir_rbf_amb.int16 :field idle_batch_3_ir_access_amb: equisat_frame.data_section.idle_batch_3.ir_access_amb.int16 :field idle_batch_3_ir_top1_amb: equisat_frame.data_section.idle_batch_3.ir_top1_amb.int16 :field idle_batch_3_timestamp: equisat_frame.data_section.idle_batch_3.timestamp :field idle_batch_4_event_history: equisat_frame.data_section.idle_batch_4.event_history :field idle_batch_4_l1_ref: equisat_frame.data_section.idle_batch_4.l1_ref.int16 :field idle_batch_4_l2_ref: equisat_frame.data_section.idle_batch_4.l2_ref.int16 :field idle_batch_4_l1_sns: equisat_frame.data_section.idle_batch_4.l1_sns.int16 :field idle_batch_4_l2_sns: equisat_frame.data_section.idle_batch_4.l2_sns.int16 :field idle_batch_4_l1_temp: equisat_frame.data_section.idle_batch_4.l1_temp.int16 :field idle_batch_4_l2_temp: equisat_frame.data_section.idle_batch_4.l2_temp.int16 :field idle_batch_4_panel_ref: equisat_frame.data_section.idle_batch_4.panel_ref.int16 :field idle_batch_4_l_ref: equisat_frame.data_section.idle_batch_4.l_ref.int16 :field idle_batch_4_bat_digsigs_1: equisat_frame.data_section.idle_batch_4.bat_digsigs_1 :field idle_batch_4_bat_digsigs_2: equisat_frame.data_section.idle_batch_4.bat_digsigs_2 :field idle_batch_4_rad_temp: equisat_frame.data_section.idle_batch_4.rad_temp.int16 :field idle_batch_4_imu_temp: equisat_frame.data_section.idle_batch_4.imu_temp.int16 :field idle_batch_4_ir_flash_amb: equisat_frame.data_section.idle_batch_4.ir_flash_amb.int16 :field idle_batch_4_ir_side1_amb: equisat_frame.data_section.idle_batch_4.ir_side1_amb.int16 :field idle_batch_4_ir_side2_amb: equisat_frame.data_section.idle_batch_4.ir_side2_amb.int16 :field idle_batch_4_ir_rbf_amb: equisat_frame.data_section.idle_batch_4.ir_rbf_amb.int16 :field idle_batch_4_ir_access_amb: equisat_frame.data_section.idle_batch_4.ir_access_amb.int16 :field idle_batch_4_ir_top1_amb: equisat_frame.data_section.idle_batch_4.ir_top1_amb.int16 :field idle_batch_4_timestamp: equisat_frame.data_section.idle_batch_4.timestamp :field idle_batch_5_event_history: equisat_frame.data_section.idle_batch_5.event_history :field idle_batch_5_l1_ref: equisat_frame.data_section.idle_batch_5.l1_ref.int16 :field idle_batch_5_l2_ref: equisat_frame.data_section.idle_batch_5.l2_ref.int16 :field idle_batch_5_l1_sns: equisat_frame.data_section.idle_batch_5.l1_sns.int16 :field idle_batch_5_l2_sns: equisat_frame.data_section.idle_batch_5.l2_sns.int16 :field idle_batch_5_l1_temp: equisat_frame.data_section.idle_batch_5.l1_temp.int16 :field idle_batch_5_l2_temp: equisat_frame.data_section.idle_batch_5.l2_temp.int16 :field idle_batch_5_panel_ref: equisat_frame.data_section.idle_batch_5.panel_ref.int16 :field idle_batch_5_l_ref: equisat_frame.data_section.idle_batch_5.l_ref.int16 :field idle_batch_5_bat_digsigs_1: equisat_frame.data_section.idle_batch_5.bat_digsigs_1 :field idle_batch_5_bat_digsigs_2: equisat_frame.data_section.idle_batch_5.bat_digsigs_2 :field idle_batch_5_rad_temp: equisat_frame.data_section.idle_batch_5.rad_temp.int16 :field idle_batch_5_imu_temp: equisat_frame.data_section.idle_batch_5.imu_temp.int16 :field idle_batch_5_ir_flash_amb: equisat_frame.data_section.idle_batch_5.ir_flash_amb.int16 :field idle_batch_5_ir_side1_amb: equisat_frame.data_section.idle_batch_5.ir_side1_amb.int16 :field idle_batch_5_ir_side2_amb: equisat_frame.data_section.idle_batch_5.ir_side2_amb.int16 :field idle_batch_5_ir_rbf_amb: equisat_frame.data_section.idle_batch_5.ir_rbf_amb.int16 :field idle_batch_5_ir_access_amb: equisat_frame.data_section.idle_batch_5.ir_access_amb.int16 :field idle_batch_5_ir_top1_amb: equisat_frame.data_section.idle_batch_5.ir_top1_amb.int16 :field idle_batch_5_timestamp: equisat_frame.data_section.idle_batch_5.timestamp :field idle_batch_6_event_history: equisat_frame.data_section.idle_batch_6.event_history :field idle_batch_6_l1_ref: equisat_frame.data_section.idle_batch_6.l1_ref.int16 :field idle_batch_6_l2_ref: equisat_frame.data_section.idle_batch_6.l2_ref.int16 :field idle_batch_6_l1_sns: equisat_frame.data_section.idle_batch_6.l1_sns.int16 :field idle_batch_6_l2_sns: equisat_frame.data_section.idle_batch_6.l2_sns.int16 :field idle_batch_6_l1_temp: equisat_frame.data_section.idle_batch_6.l1_temp.int16 :field idle_batch_6_l2_temp: equisat_frame.data_section.idle_batch_6.l2_temp.int16 :field idle_batch_6_panel_ref: equisat_frame.data_section.idle_batch_6.panel_ref.int16 :field idle_batch_6_l_ref: equisat_frame.data_section.idle_batch_6.l_ref.int16 :field idle_batch_6_bat_digsigs_1: equisat_frame.data_section.idle_batch_6.bat_digsigs_1 :field idle_batch_6_bat_digsigs_2: equisat_frame.data_section.idle_batch_6.bat_digsigs_2 :field idle_batch_6_rad_temp: equisat_frame.data_section.idle_batch_6.rad_temp.int16 :field idle_batch_6_imu_temp: equisat_frame.data_section.idle_batch_6.imu_temp.int16 :field idle_batch_6_ir_flash_amb: equisat_frame.data_section.idle_batch_6.ir_flash_amb.int16 :field idle_batch_6_ir_side1_amb: equisat_frame.data_section.idle_batch_6.ir_side1_amb.int16 :field idle_batch_6_ir_side2_amb: equisat_frame.data_section.idle_batch_6.ir_side2_amb.int16 :field idle_batch_6_ir_rbf_amb: equisat_frame.data_section.idle_batch_6.ir_rbf_amb.int16 :field idle_batch_6_ir_access_amb: equisat_frame.data_section.idle_batch_6.ir_access_amb.int16 :field idle_batch_6_ir_top1_amb: equisat_frame.data_section.idle_batch_6.ir_top1_amb.int16 :field idle_batch_6_timestamp: equisat_frame.data_section.idle_batch_6.timestamp :field attitude_batch_0_ir_flash_obj: equisat_frame.data_section.attitude_batch_0.ir_flash_obj :field attitude_batch_0_ir_side1_obj: equisat_frame.data_section.attitude_batch_0.ir_side1_obj :field attitude_batch_0_ir_side2_obj: equisat_frame.data_section.attitude_batch_0.ir_side2_obj :field attitude_batch_0_ir_rbf_obj: equisat_frame.data_section.attitude_batch_0.ir_rbf_obj :field attitude_batch_0_ir_access_obj: equisat_frame.data_section.attitude_batch_0.ir_access_obj :field attitude_batch_0_ir_top1_obj: equisat_frame.data_section.attitude_batch_0.ir_top1_obj :field attitude_batch_0_pd_1: equisat_frame.data_section.attitude_batch_0.pd_1 :field attitude_batch_0_pd_2: equisat_frame.data_section.attitude_batch_0.pd_2 :field attitude_batch_0_accelerometer1_x: equisat_frame.data_section.attitude_batch_0.accelerometer1_x.int16 :field attitude_batch_0_accelerometer1_z: equisat_frame.data_section.attitude_batch_0.accelerometer1_z.int16 :field attitude_batch_0_accelerometer1_y: equisat_frame.data_section.attitude_batch_0.accelerometer1_y.int16 :field attitude_batch_0_accelerometer2_x: equisat_frame.data_section.attitude_batch_0.accelerometer2_x.int16 :field attitude_batch_0_accelerometer2_z: equisat_frame.data_section.attitude_batch_0.accelerometer2_z.int16 :field attitude_batch_0_accelerometer2_y: equisat_frame.data_section.attitude_batch_0.accelerometer2_y.int16 :field attitude_batch_0_gyroscope_x: equisat_frame.data_section.attitude_batch_0.gyroscope_x.int16 :field attitude_batch_0_gyroscope_z: equisat_frame.data_section.attitude_batch_0.gyroscope_z.int16 :field attitude_batch_0_gyroscope_y: equisat_frame.data_section.attitude_batch_0.gyroscope_y.int16 :field attitude_batch_0_magnetometer1_x: equisat_frame.data_section.attitude_batch_0.magnetometer1_x.int16 :field attitude_batch_0_magnetometer1_z: equisat_frame.data_section.attitude_batch_0.magnetometer1_z.int16 :field attitude_batch_0_magnetometer1_y: equisat_frame.data_section.attitude_batch_0.magnetometer1_y.int16 :field attitude_batch_0_magnetometer2_x: equisat_frame.data_section.attitude_batch_0.magnetometer2_x.int16 :field attitude_batch_0_magnetometer2_z: equisat_frame.data_section.attitude_batch_0.magnetometer2_z.int16 :field attitude_batch_0_magnetometer2_y: equisat_frame.data_section.attitude_batch_0.magnetometer2_y.int16 :field attitude_batch_0_timestamp: equisat_frame.data_section.attitude_batch_0.timestamp :field attitude_batch_0_pd_flash: equisat_frame.data_section.attitude_batch_0.pd_flash :field attitude_batch_0_pd_side1: equisat_frame.data_section.attitude_batch_0.pd_side1 :field attitude_batch_0_pd_side2: equisat_frame.data_section.attitude_batch_0.pd_side2 :field attitude_batch_0_pd_access: equisat_frame.data_section.attitude_batch_0.pd_access :field attitude_batch_0_pd_top1: equisat_frame.data_section.attitude_batch_0.pd_top1 :field attitude_batch_0_pd_top2: equisat_frame.data_section.attitude_batch_0.pd_top2 :field attitude_batch_1_ir_flash_obj: equisat_frame.data_section.attitude_batch_1.ir_flash_obj :field attitude_batch_1_ir_side1_obj: equisat_frame.data_section.attitude_batch_1.ir_side1_obj :field attitude_batch_1_ir_side2_obj: equisat_frame.data_section.attitude_batch_1.ir_side2_obj :field attitude_batch_1_ir_rbf_obj: equisat_frame.data_section.attitude_batch_1.ir_rbf_obj :field attitude_batch_1_ir_access_obj: equisat_frame.data_section.attitude_batch_1.ir_access_obj :field attitude_batch_1_ir_top1_obj: equisat_frame.data_section.attitude_batch_1.ir_top1_obj :field attitude_batch_1_pd_1: equisat_frame.data_section.attitude_batch_1.pd_1 :field attitude_batch_1_pd_2: equisat_frame.data_section.attitude_batch_1.pd_2 :field attitude_batch_1_accelerometer1_x: equisat_frame.data_section.attitude_batch_1.accelerometer1_x.int16 :field attitude_batch_1_accelerometer1_z: equisat_frame.data_section.attitude_batch_1.accelerometer1_z.int16 :field attitude_batch_1_accelerometer1_y: equisat_frame.data_section.attitude_batch_1.accelerometer1_y.int16 :field attitude_batch_1_accelerometer2_x: equisat_frame.data_section.attitude_batch_1.accelerometer2_x.int16 :field attitude_batch_1_accelerometer2_z: equisat_frame.data_section.attitude_batch_1.accelerometer2_z.int16 :field attitude_batch_1_accelerometer2_y: equisat_frame.data_section.attitude_batch_1.accelerometer2_y.int16 :field attitude_batch_1_gyroscope_x: equisat_frame.data_section.attitude_batch_1.gyroscope_x.int16 :field attitude_batch_1_gyroscope_z: equisat_frame.data_section.attitude_batch_1.gyroscope_z.int16 :field attitude_batch_1_gyroscope_y: equisat_frame.data_section.attitude_batch_1.gyroscope_y.int16 :field attitude_batch_1_magnetometer1_x: equisat_frame.data_section.attitude_batch_1.magnetometer1_x.int16 :field attitude_batch_1_magnetometer1_z: equisat_frame.data_section.attitude_batch_1.magnetometer1_z.int16 :field attitude_batch_1_magnetometer1_y: equisat_frame.data_section.attitude_batch_1.magnetometer1_y.int16 :field attitude_batch_1_magnetometer2_x: equisat_frame.data_section.attitude_batch_1.magnetometer2_x.int16 :field attitude_batch_1_magnetometer2_z: equisat_frame.data_section.attitude_batch_1.magnetometer2_z.int16 :field attitude_batch_1_magnetometer2_y: equisat_frame.data_section.attitude_batch_1.magnetometer2_y.int16 :field attitude_batch_1_timestamp: equisat_frame.data_section.attitude_batch_1.timestamp :field attitude_batch_1_pd_flash: equisat_frame.data_section.attitude_batch_1.pd_flash :field attitude_batch_1_pd_side1: equisat_frame.data_section.attitude_batch_1.pd_side1 :field attitude_batch_1_pd_side2: equisat_frame.data_section.attitude_batch_1.pd_side2 :field attitude_batch_1_pd_access: equisat_frame.data_section.attitude_batch_1.pd_access :field attitude_batch_1_pd_top1: equisat_frame.data_section.attitude_batch_1.pd_top1 :field attitude_batch_1_pd_top2: equisat_frame.data_section.attitude_batch_1.pd_top2 :field attitude_batch_2_ir_flash_obj: equisat_frame.data_section.attitude_batch_2.ir_flash_obj :field attitude_batch_2_ir_side1_obj: equisat_frame.data_section.attitude_batch_2.ir_side1_obj :field attitude_batch_2_ir_side2_obj: equisat_frame.data_section.attitude_batch_2.ir_side2_obj :field attitude_batch_2_ir_rbf_obj: equisat_frame.data_section.attitude_batch_2.ir_rbf_obj :field attitude_batch_2_ir_access_obj: equisat_frame.data_section.attitude_batch_2.ir_access_obj :field attitude_batch_2_ir_top1_obj: equisat_frame.data_section.attitude_batch_2.ir_top1_obj :field attitude_batch_2_pd_1: equisat_frame.data_section.attitude_batch_2.pd_1 :field attitude_batch_2_pd_2: equisat_frame.data_section.attitude_batch_2.pd_2 :field attitude_batch_2_accelerometer1_x: equisat_frame.data_section.attitude_batch_2.accelerometer1_x.int16 :field attitude_batch_2_accelerometer1_z: equisat_frame.data_section.attitude_batch_2.accelerometer1_z.int16 :field attitude_batch_2_accelerometer1_y: equisat_frame.data_section.attitude_batch_2.accelerometer1_y.int16 :field attitude_batch_2_accelerometer2_x: equisat_frame.data_section.attitude_batch_2.accelerometer2_x.int16 :field attitude_batch_2_accelerometer2_z: equisat_frame.data_section.attitude_batch_2.accelerometer2_z.int16 :field attitude_batch_2_accelerometer2_y: equisat_frame.data_section.attitude_batch_2.accelerometer2_y.int16 :field attitude_batch_2_gyroscope_x: equisat_frame.data_section.attitude_batch_2.gyroscope_x.int16 :field attitude_batch_2_gyroscope_z: equisat_frame.data_section.attitude_batch_2.gyroscope_z.int16 :field attitude_batch_2_gyroscope_y: equisat_frame.data_section.attitude_batch_2.gyroscope_y.int16 :field attitude_batch_2_magnetometer1_x: equisat_frame.data_section.attitude_batch_2.magnetometer1_x.int16 :field attitude_batch_2_magnetometer1_z: equisat_frame.data_section.attitude_batch_2.magnetometer1_z.int16 :field attitude_batch_2_magnetometer1_y: equisat_frame.data_section.attitude_batch_2.magnetometer1_y.int16 :field attitude_batch_2_magnetometer2_x: equisat_frame.data_section.attitude_batch_2.magnetometer2_x.int16 :field attitude_batch_2_magnetometer2_z: equisat_frame.data_section.attitude_batch_2.magnetometer2_z.int16 :field attitude_batch_2_magnetometer2_y: equisat_frame.data_section.attitude_batch_2.magnetometer2_y.int16 :field attitude_batch_2_timestamp: equisat_frame.data_section.attitude_batch_2.timestamp :field attitude_batch_2_pd_flash: equisat_frame.data_section.attitude_batch_2.pd_flash :field attitude_batch_2_pd_side1: equisat_frame.data_section.attitude_batch_2.pd_side1 :field attitude_batch_2_pd_side2: equisat_frame.data_section.attitude_batch_2.pd_side2 :field attitude_batch_2_pd_access: equisat_frame.data_section.attitude_batch_2.pd_access :field attitude_batch_2_pd_top1: equisat_frame.data_section.attitude_batch_2.pd_top1 :field attitude_batch_2_pd_top2: equisat_frame.data_section.attitude_batch_2.pd_top2 :field attitude_batch_3_ir_flash_obj: equisat_frame.data_section.attitude_batch_3.ir_flash_obj :field attitude_batch_3_ir_side1_obj: equisat_frame.data_section.attitude_batch_3.ir_side1_obj :field attitude_batch_3_ir_side2_obj: equisat_frame.data_section.attitude_batch_3.ir_side2_obj :field attitude_batch_3_ir_rbf_obj: equisat_frame.data_section.attitude_batch_3.ir_rbf_obj :field attitude_batch_3_ir_access_obj: equisat_frame.data_section.attitude_batch_3.ir_access_obj :field attitude_batch_3_ir_top1_obj: equisat_frame.data_section.attitude_batch_3.ir_top1_obj :field attitude_batch_3_pd_1: equisat_frame.data_section.attitude_batch_3.pd_1 :field attitude_batch_3_pd_2: equisat_frame.data_section.attitude_batch_3.pd_2 :field attitude_batch_3_accelerometer1_x: equisat_frame.data_section.attitude_batch_3.accelerometer1_x.int16 :field attitude_batch_3_accelerometer1_z: equisat_frame.data_section.attitude_batch_3.accelerometer1_z.int16 :field attitude_batch_3_accelerometer1_y: equisat_frame.data_section.attitude_batch_3.accelerometer1_y.int16 :field attitude_batch_3_accelerometer2_x: equisat_frame.data_section.attitude_batch_3.accelerometer2_x.int16 :field attitude_batch_3_accelerometer2_z: equisat_frame.data_section.attitude_batch_3.accelerometer2_z.int16 :field attitude_batch_3_accelerometer2_y: equisat_frame.data_section.attitude_batch_3.accelerometer2_y.int16 :field attitude_batch_3_gyroscope_x: equisat_frame.data_section.attitude_batch_3.gyroscope_x.int16 :field attitude_batch_3_gyroscope_z: equisat_frame.data_section.attitude_batch_3.gyroscope_z.int16 :field attitude_batch_3_gyroscope_y: equisat_frame.data_section.attitude_batch_3.gyroscope_y.int16 :field attitude_batch_3_magnetometer1_x: equisat_frame.data_section.attitude_batch_3.magnetometer1_x.int16 :field attitude_batch_3_magnetometer1_z: equisat_frame.data_section.attitude_batch_3.magnetometer1_z.int16 :field attitude_batch_3_magnetometer1_y: equisat_frame.data_section.attitude_batch_3.magnetometer1_y.int16 :field attitude_batch_3_magnetometer2_x: equisat_frame.data_section.attitude_batch_3.magnetometer2_x.int16 :field attitude_batch_3_magnetometer2_z: equisat_frame.data_section.attitude_batch_3.magnetometer2_z.int16 :field attitude_batch_3_magnetometer2_y: equisat_frame.data_section.attitude_batch_3.magnetometer2_y.int16 :field attitude_batch_3_timestamp: equisat_frame.data_section.attitude_batch_3.timestamp :field attitude_batch_3_pd_flash: equisat_frame.data_section.attitude_batch_3.pd_flash :field attitude_batch_3_pd_side1: equisat_frame.data_section.attitude_batch_3.pd_side1 :field attitude_batch_3_pd_side2: equisat_frame.data_section.attitude_batch_3.pd_side2 :field attitude_batch_3_pd_access: equisat_frame.data_section.attitude_batch_3.pd_access :field attitude_batch_3_pd_top1: equisat_frame.data_section.attitude_batch_3.pd_top1 :field attitude_batch_3_pd_top2: equisat_frame.data_section.attitude_batch_3.pd_top2 :field attitude_batch_4_ir_flash_obj: equisat_frame.data_section.attitude_batch_4.ir_flash_obj :field attitude_batch_4_ir_side1_obj: equisat_frame.data_section.attitude_batch_4.ir_side1_obj :field attitude_batch_4_ir_side2_obj: equisat_frame.data_section.attitude_batch_4.ir_side2_obj :field attitude_batch_4_ir_rbf_obj: equisat_frame.data_section.attitude_batch_4.ir_rbf_obj :field attitude_batch_4_ir_access_obj: equisat_frame.data_section.attitude_batch_4.ir_access_obj :field attitude_batch_4_ir_top1_obj: equisat_frame.data_section.attitude_batch_4.ir_top1_obj :field attitude_batch_4_pd_1: equisat_frame.data_section.attitude_batch_4.pd_1 :field attitude_batch_4_pd_2: equisat_frame.data_section.attitude_batch_4.pd_2 :field attitude_batch_4_accelerometer1_x: equisat_frame.data_section.attitude_batch_4.accelerometer1_x.int16 :field attitude_batch_4_accelerometer1_z: equisat_frame.data_section.attitude_batch_4.accelerometer1_z.int16 :field attitude_batch_4_accelerometer1_y: equisat_frame.data_section.attitude_batch_4.accelerometer1_y.int16 :field attitude_batch_4_accelerometer2_x: equisat_frame.data_section.attitude_batch_4.accelerometer2_x.int16 :field attitude_batch_4_accelerometer2_z: equisat_frame.data_section.attitude_batch_4.accelerometer2_z.int16 :field attitude_batch_4_accelerometer2_y: equisat_frame.data_section.attitude_batch_4.accelerometer2_y.int16 :field attitude_batch_4_gyroscope_x: equisat_frame.data_section.attitude_batch_4.gyroscope_x.int16 :field attitude_batch_4_gyroscope_z: equisat_frame.data_section.attitude_batch_4.gyroscope_z.int16 :field attitude_batch_4_gyroscope_y: equisat_frame.data_section.attitude_batch_4.gyroscope_y.int16 :field attitude_batch_4_magnetometer1_x: equisat_frame.data_section.attitude_batch_4.magnetometer1_x.int16 :field attitude_batch_4_magnetometer1_z: equisat_frame.data_section.attitude_batch_4.magnetometer1_z.int16 :field attitude_batch_4_magnetometer1_y: equisat_frame.data_section.attitude_batch_4.magnetometer1_y.int16 :field attitude_batch_4_magnetometer2_x: equisat_frame.data_section.attitude_batch_4.magnetometer2_x.int16 :field attitude_batch_4_magnetometer2_z: equisat_frame.data_section.attitude_batch_4.magnetometer2_z.int16 :field attitude_batch_4_magnetometer2_y: equisat_frame.data_section.attitude_batch_4.magnetometer2_y.int16 :field attitude_batch_4_timestamp: equisat_frame.data_section.attitude_batch_4.timestamp :field attitude_batch_4_pd_flash: equisat_frame.data_section.attitude_batch_4.pd_flash :field attitude_batch_4_pd_side1: equisat_frame.data_section.attitude_batch_4.pd_side1 :field attitude_batch_4_pd_side2: equisat_frame.data_section.attitude_batch_4.pd_side2 :field attitude_batch_4_pd_access: equisat_frame.data_section.attitude_batch_4.pd_access :field attitude_batch_4_pd_top1: equisat_frame.data_section.attitude_batch_4.pd_top1 :field attitude_batch_4_pd_top2: equisat_frame.data_section.attitude_batch_4.pd_top2 :field flash_burst_data_led1_temp_0: equisat_frame.data_section.led1_temp_0.int16 :field flash_burst_data_led1_temp_1: equisat_frame.data_section.led1_temp_1.int16 :field flash_burst_data_led1_temp_2: equisat_frame.data_section.led1_temp_2.int16 :field flash_burst_data_led1_temp_3: equisat_frame.data_section.led1_temp_3.int16 :field flash_burst_data_led1_temp_4: equisat_frame.data_section.led1_temp_4.int16 :field flash_burst_data_led1_temp_5: equisat_frame.data_section.led1_temp_5.int16 :field flash_burst_data_led1_temp_6: equisat_frame.data_section.led1_temp_6.int16 :field flash_burst_data_led2_temp_0: equisat_frame.data_section.led2_temp_0.int16 :field flash_burst_data_led2_temp_1: equisat_frame.data_section.led2_temp_1.int16 :field flash_burst_data_led2_temp_2: equisat_frame.data_section.led2_temp_2.int16 :field flash_burst_data_led2_temp_3: equisat_frame.data_section.led2_temp_3.int16 :field flash_burst_data_led2_temp_4: equisat_frame.data_section.led2_temp_4.int16 :field flash_burst_data_led2_temp_5: equisat_frame.data_section.led2_temp_5.int16 :field flash_burst_data_led2_temp_6: equisat_frame.data_section.led2_temp_6.int16 :field flash_burst_data_led3_temp_0: equisat_frame.data_section.led3_temp_0.int16 :field flash_burst_data_led3_temp_1: equisat_frame.data_section.led3_temp_1.int16 :field flash_burst_data_led3_temp_2: equisat_frame.data_section.led3_temp_2.int16 :field flash_burst_data_led3_temp_3: equisat_frame.data_section.led3_temp_3.int16 :field flash_burst_data_led3_temp_4: equisat_frame.data_section.led3_temp_4.int16 :field flash_burst_data_led3_temp_5: equisat_frame.data_section.led3_temp_5.int16 :field flash_burst_data_led3_temp_6: equisat_frame.data_section.led3_temp_6.int16 :field flash_burst_data_led4_temp_0: equisat_frame.data_section.led4_temp_0.int16 :field flash_burst_data_led4_temp_1: equisat_frame.data_section.led4_temp_1.int16 :field flash_burst_data_led4_temp_2: equisat_frame.data_section.led4_temp_2.int16 :field flash_burst_data_led4_temp_3: equisat_frame.data_section.led4_temp_3.int16 :field flash_burst_data_led4_temp_4: equisat_frame.data_section.led4_temp_4.int16 :field flash_burst_data_led4_temp_5: equisat_frame.data_section.led4_temp_5.int16 :field flash_burst_data_led4_temp_6: equisat_frame.data_section.led4_temp_6.int16 :field flash_burst_data_lf1_temp_0: equisat_frame.data_section.lf1_temp_0.int16 :field flash_burst_data_lf1_temp_1: equisat_frame.data_section.lf1_temp_1.int16 :field flash_burst_data_lf1_temp_2: equisat_frame.data_section.lf1_temp_2.int16 :field flash_burst_data_lf1_temp_3: equisat_frame.data_section.lf1_temp_3.int16 :field flash_burst_data_lf1_temp_4: equisat_frame.data_section.lf1_temp_4.int16 :field flash_burst_data_lf1_temp_5: equisat_frame.data_section.lf1_temp_5.int16 :field flash_burst_data_lf1_temp_6: equisat_frame.data_section.lf1_temp_6.int16 :field flash_burst_data_lf3_temp_0: equisat_frame.data_section.lf3_temp_0.int16 :field flash_burst_data_lf3_temp_1: equisat_frame.data_section.lf3_temp_1.int16 :field flash_burst_data_lf3_temp_2: equisat_frame.data_section.lf3_temp_2.int16 :field flash_burst_data_lf3_temp_3: equisat_frame.data_section.lf3_temp_3.int16 :field flash_burst_data_lf3_temp_4: equisat_frame.data_section.lf3_temp_4.int16 :field flash_burst_data_lf3_temp_5: equisat_frame.data_section.lf3_temp_5.int16 :field flash_burst_data_lf3_temp_6: equisat_frame.data_section.lf3_temp_6.int16 :field flash_burst_data_lfb1_sns_0: equisat_frame.data_section.lfb1_sns_0.int16 :field flash_burst_data_lfb1_sns_1: equisat_frame.data_section.lfb1_sns_1.int16 :field flash_burst_data_lfb1_sns_2: equisat_frame.data_section.lfb1_sns_2.int16 :field flash_burst_data_lfb1_sns_3: equisat_frame.data_section.lfb1_sns_3.int16 :field flash_burst_data_lfb1_sns_4: equisat_frame.data_section.lfb1_sns_4.int16 :field flash_burst_data_lfb1_sns_5: equisat_frame.data_section.lfb1_sns_5.int16 :field flash_burst_data_lfb1_sns_6: equisat_frame.data_section.lfb1_sns_6.int16 :field flash_burst_data_lfb1_osns_0: equisat_frame.data_section.lfb1_osns_0.int16 :field flash_burst_data_lfb1_osns_1: equisat_frame.data_section.lfb1_osns_1.int16 :field flash_burst_data_lfb1_osns_2: equisat_frame.data_section.lfb1_osns_2.int16 :field flash_burst_data_lfb1_osns_3: equisat_frame.data_section.lfb1_osns_3.int16 :field flash_burst_data_lfb1_osns_4: equisat_frame.data_section.lfb1_osns_4.int16 :field flash_burst_data_lfb1_osns_5: equisat_frame.data_section.lfb1_osns_5.int16 :field flash_burst_data_lfb1_osns_6: equisat_frame.data_section.lfb1_osns_6.int16 :field flash_burst_data_lfb2_sns_0: equisat_frame.data_section.lfb2_sns_0.int16 :field flash_burst_data_lfb2_sns_1: equisat_frame.data_section.lfb2_sns_1.int16 :field flash_burst_data_lfb2_sns_2: equisat_frame.data_section.lfb2_sns_2.int16 :field flash_burst_data_lfb2_sns_3: equisat_frame.data_section.lfb2_sns_3.int16 :field flash_burst_data_lfb2_sns_4: equisat_frame.data_section.lfb2_sns_4.int16 :field flash_burst_data_lfb2_sns_5: equisat_frame.data_section.lfb2_sns_5.int16 :field flash_burst_data_lfb2_sns_6: equisat_frame.data_section.lfb2_sns_6.int16 :field flash_burst_data_lfb2_osns_0: equisat_frame.data_section.lfb2_osns_0.int16 :field flash_burst_data_lfb2_osns_1: equisat_frame.data_section.lfb2_osns_1.int16 :field flash_burst_data_lfb2_osns_2: equisat_frame.data_section.lfb2_osns_2.int16 :field flash_burst_data_lfb2_osns_3: equisat_frame.data_section.lfb2_osns_3.int16 :field flash_burst_data_lfb2_osns_4: equisat_frame.data_section.lfb2_osns_4.int16 :field flash_burst_data_lfb2_osns_5: equisat_frame.data_section.lfb2_osns_5.int16 :field flash_burst_data_lfb2_osns_6: equisat_frame.data_section.lfb2_osns_6.int16 :field flash_burst_data_lf1_ref_0: equisat_frame.data_section.lf1_ref_0.int16 :field flash_burst_data_lf1_ref_1: equisat_frame.data_section.lf1_ref_1.int16 :field flash_burst_data_lf1_ref_2: equisat_frame.data_section.lf1_ref_2.int16 :field flash_burst_data_lf1_ref_3: equisat_frame.data_section.lf1_ref_3.int16 :field flash_burst_data_lf1_ref_4: equisat_frame.data_section.lf1_ref_4.int16 :field flash_burst_data_lf1_ref_5: equisat_frame.data_section.lf1_ref_5.int16 :field flash_burst_data_lf1_ref_6: equisat_frame.data_section.lf1_ref_6.int16 :field flash_burst_data_lf2_ref_0: equisat_frame.data_section.lf2_ref_0.int16 :field flash_burst_data_lf2_ref_1: equisat_frame.data_section.lf2_ref_1.int16 :field flash_burst_data_lf2_ref_2: equisat_frame.data_section.lf2_ref_2.int16 :field flash_burst_data_lf2_ref_3: equisat_frame.data_section.lf2_ref_3.int16 :field flash_burst_data_lf2_ref_4: equisat_frame.data_section.lf2_ref_4.int16 :field flash_burst_data_lf2_ref_5: equisat_frame.data_section.lf2_ref_5.int16 :field flash_burst_data_lf2_ref_6: equisat_frame.data_section.lf2_ref_6.int16 :field flash_burst_data_lf3_ref_0: equisat_frame.data_section.lf3_ref_0.int16 :field flash_burst_data_lf3_ref_1: equisat_frame.data_section.lf3_ref_1.int16 :field flash_burst_data_lf3_ref_2: equisat_frame.data_section.lf3_ref_2.int16 :field flash_burst_data_lf3_ref_3: equisat_frame.data_section.lf3_ref_3.int16 :field flash_burst_data_lf3_ref_4: equisat_frame.data_section.lf3_ref_4.int16 :field flash_burst_data_lf3_ref_5: equisat_frame.data_section.lf3_ref_5.int16 :field flash_burst_data_lf3_ref_6: equisat_frame.data_section.lf3_ref_6.int16 :field flash_burst_data_lf4_ref_0: equisat_frame.data_section.lf4_ref_0.int16 :field flash_burst_data_lf4_ref_1: equisat_frame.data_section.lf4_ref_1.int16 :field flash_burst_data_lf4_ref_2: equisat_frame.data_section.lf4_ref_2.int16 :field flash_burst_data_lf4_ref_3: equisat_frame.data_section.lf4_ref_3.int16 :field flash_burst_data_lf4_ref_4: equisat_frame.data_section.lf4_ref_4.int16 :field flash_burst_data_lf4_ref_5: equisat_frame.data_section.lf4_ref_5.int16 :field flash_burst_data_lf4_ref_6: equisat_frame.data_section.lf4_ref_6.int16 :field flash_burst_data_led1_sns_0: equisat_frame.data_section.led1_sns_0.int16 :field flash_burst_data_led1_sns_1: equisat_frame.data_section.led1_sns_1.int16 :field flash_burst_data_led1_sns_2: equisat_frame.data_section.led1_sns_2.int16 :field flash_burst_data_led1_sns_3: equisat_frame.data_section.led1_sns_3.int16 :field flash_burst_data_led1_sns_4: equisat_frame.data_section.led1_sns_4.int16 :field flash_burst_data_led1_sns_5: equisat_frame.data_section.led1_sns_5.int16 :field flash_burst_data_led1_sns_6: equisat_frame.data_section.led1_sns_6.int16 :field flash_burst_data_led2_sns_0: equisat_frame.data_section.led2_sns_0.int16 :field flash_burst_data_led2_sns_1: equisat_frame.data_section.led2_sns_1.int16 :field flash_burst_data_led2_sns_2: equisat_frame.data_section.led2_sns_2.int16 :field flash_burst_data_led2_sns_3: equisat_frame.data_section.led2_sns_3.int16 :field flash_burst_data_led2_sns_4: equisat_frame.data_section.led2_sns_4.int16 :field flash_burst_data_led2_sns_5: equisat_frame.data_section.led2_sns_5.int16 :field flash_burst_data_led2_sns_6: equisat_frame.data_section.led2_sns_6.int16 :field flash_burst_data_led3_sns_0: equisat_frame.data_section.led3_sns_0.int16 :field flash_burst_data_led3_sns_1: equisat_frame.data_section.led3_sns_1.int16 :field flash_burst_data_led3_sns_2: equisat_frame.data_section.led3_sns_2.int16 :field flash_burst_data_led3_sns_3: equisat_frame.data_section.led3_sns_3.int16 :field flash_burst_data_led3_sns_4: equisat_frame.data_section.led3_sns_4.int16 :field flash_burst_data_led3_sns_5: equisat_frame.data_section.led3_sns_5.int16 :field flash_burst_data_led3_sns_6: equisat_frame.data_section.led3_sns_6.int16 :field flash_burst_data_led4_sns_0: equisat_frame.data_section.led4_sns_0.int16 :field flash_burst_data_led4_sns_1: equisat_frame.data_section.led4_sns_1.int16 :field flash_burst_data_led4_sns_2: equisat_frame.data_section.led4_sns_2.int16 :field flash_burst_data_led4_sns_3: equisat_frame.data_section.led4_sns_3.int16 :field flash_burst_data_led4_sns_4: equisat_frame.data_section.led4_sns_4.int16 :field flash_burst_data_led4_sns_5: equisat_frame.data_section.led4_sns_5.int16 :field flash_burst_data_led4_sns_6: equisat_frame.data_section.led4_sns_6.int16 :field flash_burst_data_gyroscope_x_0: equisat_frame.data_section.gyroscope_x_0.int16 :field flash_burst_data_gyroscope_x_1: equisat_frame.data_section.gyroscope_x_1.int16 :field flash_burst_data_gyroscope_x_2: equisat_frame.data_section.gyroscope_x_2.int16 :field flash_burst_data_gyroscope_x_3: equisat_frame.data_section.gyroscope_x_3.int16 :field flash_burst_data_gyroscope_x_4: equisat_frame.data_section.gyroscope_x_4.int16 :field flash_burst_data_gyroscope_x_5: equisat_frame.data_section.gyroscope_x_5.int16 :field flash_burst_data_gyroscope_x_6: equisat_frame.data_section.gyroscope_x_6.int16 :field flash_burst_data_gyroscope_z_0: equisat_frame.data_section.gyroscope_z_0.int16 :field flash_burst_data_gyroscope_z_1: equisat_frame.data_section.gyroscope_z_1.int16 :field flash_burst_data_gyroscope_z_2: equisat_frame.data_section.gyroscope_z_2.int16 :field flash_burst_data_gyroscope_z_3: equisat_frame.data_section.gyroscope_z_3.int16 :field flash_burst_data_gyroscope_z_4: equisat_frame.data_section.gyroscope_z_4.int16 :field flash_burst_data_gyroscope_z_5: equisat_frame.data_section.gyroscope_z_5.int16 :field flash_burst_data_gyroscope_z_6: equisat_frame.data_section.gyroscope_z_6.int16 :field flash_burst_data_gyroscope_y_0: equisat_frame.data_section.gyroscope_y_0.int16 :field flash_burst_data_gyroscope_y_1: equisat_frame.data_section.gyroscope_y_1.int16 :field flash_burst_data_gyroscope_y_2: equisat_frame.data_section.gyroscope_y_2.int16 :field flash_burst_data_gyroscope_y_3: equisat_frame.data_section.gyroscope_y_3.int16 :field flash_burst_data_gyroscope_y_4: equisat_frame.data_section.gyroscope_y_4.int16 :field flash_burst_data_gyroscope_y_5: equisat_frame.data_section.gyroscope_y_5.int16 :field flash_burst_data_gyroscope_y_6: equisat_frame.data_section.gyroscope_y_6.int16 :field flash_cmp_batch_0_led1_temp: equisat_frame.data_section.flash_cmp_batch_0.led1_temp.int16 :field flash_cmp_batch_0_led2_temp: equisat_frame.data_section.flash_cmp_batch_0.led2_temp.int16 :field flash_cmp_batch_0_led3_temp: equisat_frame.data_section.flash_cmp_batch_0.led3_temp.int16 :field flash_cmp_batch_0_led4_temp: equisat_frame.data_section.flash_cmp_batch_0.led4_temp.int16 :field flash_cmp_batch_0_lf1_temp: equisat_frame.data_section.flash_cmp_batch_0.lf1_temp.int16 :field flash_cmp_batch_0_lf3_temp: equisat_frame.data_section.flash_cmp_batch_0.lf3_temp.int16 :field flash_cmp_batch_0_lfb1_sns: equisat_frame.data_section.flash_cmp_batch_0.lfb1_sns.int16 :field flash_cmp_batch_0_lfb1_osns: equisat_frame.data_section.flash_cmp_batch_0.lfb1_osns.int16 :field flash_cmp_batch_0_lfb2_sns: equisat_frame.data_section.flash_cmp_batch_0.lfb2_sns.int16 :field flash_cmp_batch_0_lfb2_osns: equisat_frame.data_section.flash_cmp_batch_0.lfb2_osns.int16 :field flash_cmp_batch_0_lf1_ref: equisat_frame.data_section.flash_cmp_batch_0.lf1_ref.int16 :field flash_cmp_batch_0_lf2_ref: equisat_frame.data_section.flash_cmp_batch_0.lf2_ref.int16 :field flash_cmp_batch_0_lf3_ref: equisat_frame.data_section.flash_cmp_batch_0.lf3_ref.int16 :field flash_cmp_batch_0_lf4_ref: equisat_frame.data_section.flash_cmp_batch_0.lf4_ref.int16 :field flash_cmp_batch_0_led1_sns: equisat_frame.data_section.flash_cmp_batch_0.led1_sns.int16 :field flash_cmp_batch_0_led2_sns: equisat_frame.data_section.flash_cmp_batch_0.led2_sns.int16 :field flash_cmp_batch_0_led3_sns: equisat_frame.data_section.flash_cmp_batch_0.led3_sns.int16 :field flash_cmp_batch_0_led4_sns: equisat_frame.data_section.flash_cmp_batch_0.led4_sns.int16 :field flash_cmp_batch_0_magnetometer_x: equisat_frame.data_section.flash_cmp_batch_0.magnetometer_x.int16 :field flash_cmp_batch_0_magnetometer_z: equisat_frame.data_section.flash_cmp_batch_0.magnetometer_z.int16 :field flash_cmp_batch_0_magnetometer_y: equisat_frame.data_section.flash_cmp_batch_0.magnetometer_y.int16 :field flash_cmp_batch_0_timestamp: equisat_frame.data_section.flash_cmp_batch_0.timestamp :field flash_cmp_batch_1_led1_temp: equisat_frame.data_section.flash_cmp_batch_1.led1_temp.int16 :field flash_cmp_batch_1_led2_temp: equisat_frame.data_section.flash_cmp_batch_1.led2_temp.int16 :field flash_cmp_batch_1_led3_temp: equisat_frame.data_section.flash_cmp_batch_1.led3_temp.int16 :field flash_cmp_batch_1_led4_temp: equisat_frame.data_section.flash_cmp_batch_1.led4_temp.int16 :field flash_cmp_batch_1_lf1_temp: equisat_frame.data_section.flash_cmp_batch_1.lf1_temp.int16 :field flash_cmp_batch_1_lf3_temp: equisat_frame.data_section.flash_cmp_batch_1.lf3_temp.int16 :field flash_cmp_batch_1_lfb1_sns: equisat_frame.data_section.flash_cmp_batch_1.lfb1_sns.int16 :field flash_cmp_batch_1_lfb1_osns: equisat_frame.data_section.flash_cmp_batch_1.lfb1_osns.int16 :field flash_cmp_batch_1_lfb2_sns: equisat_frame.data_section.flash_cmp_batch_1.lfb2_sns.int16 :field flash_cmp_batch_1_lfb2_osns: equisat_frame.data_section.flash_cmp_batch_1.lfb2_osns.int16 :field flash_cmp_batch_1_lf1_ref: equisat_frame.data_section.flash_cmp_batch_1.lf1_ref.int16 :field flash_cmp_batch_1_lf2_ref: equisat_frame.data_section.flash_cmp_batch_1.lf2_ref.int16 :field flash_cmp_batch_1_lf3_ref: equisat_frame.data_section.flash_cmp_batch_1.lf3_ref.int16 :field flash_cmp_batch_1_lf4_ref: equisat_frame.data_section.flash_cmp_batch_1.lf4_ref.int16 :field flash_cmp_batch_1_led1_sns: equisat_frame.data_section.flash_cmp_batch_1.led1_sns.int16 :field flash_cmp_batch_1_led2_sns: equisat_frame.data_section.flash_cmp_batch_1.led2_sns.int16 :field flash_cmp_batch_1_led3_sns: equisat_frame.data_section.flash_cmp_batch_1.led3_sns.int16 :field flash_cmp_batch_1_led4_sns: equisat_frame.data_section.flash_cmp_batch_1.led4_sns.int16 :field flash_cmp_batch_1_magnetometer_x: equisat_frame.data_section.flash_cmp_batch_1.magnetometer_x.int16 :field flash_cmp_batch_1_magnetometer_z: equisat_frame.data_section.flash_cmp_batch_1.magnetometer_z.int16 :field flash_cmp_batch_1_magnetometer_y: equisat_frame.data_section.flash_cmp_batch_1.magnetometer_y.int16 :field flash_cmp_batch_1_timestamp: equisat_frame.data_section.flash_cmp_batch_1.timestamp :field flash_cmp_batch_2_led1_temp: equisat_frame.data_section.flash_cmp_batch_2.led1_temp.int16 :field flash_cmp_batch_2_led2_temp: equisat_frame.data_section.flash_cmp_batch_2.led2_temp.int16 :field flash_cmp_batch_2_led3_temp: equisat_frame.data_section.flash_cmp_batch_2.led3_temp.int16 :field flash_cmp_batch_2_led4_temp: equisat_frame.data_section.flash_cmp_batch_2.led4_temp.int16 :field flash_cmp_batch_2_lf1_temp: equisat_frame.data_section.flash_cmp_batch_2.lf1_temp.int16 :field flash_cmp_batch_2_lf3_temp: equisat_frame.data_section.flash_cmp_batch_2.lf3_temp.int16 :field flash_cmp_batch_2_lfb1_sns: equisat_frame.data_section.flash_cmp_batch_2.lfb1_sns.int16 :field flash_cmp_batch_2_lfb1_osns: equisat_frame.data_section.flash_cmp_batch_2.lfb1_osns.int16 :field flash_cmp_batch_2_lfb2_sns: equisat_frame.data_section.flash_cmp_batch_2.lfb2_sns.int16 :field flash_cmp_batch_2_lfb2_osns: equisat_frame.data_section.flash_cmp_batch_2.lfb2_osns.int16 :field flash_cmp_batch_2_lf1_ref: equisat_frame.data_section.flash_cmp_batch_2.lf1_ref.int16 :field flash_cmp_batch_2_lf2_ref: equisat_frame.data_section.flash_cmp_batch_2.lf2_ref.int16 :field flash_cmp_batch_2_lf3_ref: equisat_frame.data_section.flash_cmp_batch_2.lf3_ref.int16 :field flash_cmp_batch_2_lf4_ref: equisat_frame.data_section.flash_cmp_batch_2.lf4_ref.int16 :field flash_cmp_batch_2_led1_sns: equisat_frame.data_section.flash_cmp_batch_2.led1_sns.int16 :field flash_cmp_batch_2_led2_sns: equisat_frame.data_section.flash_cmp_batch_2.led2_sns.int16 :field flash_cmp_batch_2_led3_sns: equisat_frame.data_section.flash_cmp_batch_2.led3_sns.int16 :field flash_cmp_batch_2_led4_sns: equisat_frame.data_section.flash_cmp_batch_2.led4_sns.int16 :field flash_cmp_batch_2_magnetometer_x: equisat_frame.data_section.flash_cmp_batch_2.magnetometer_x.int16 :field flash_cmp_batch_2_magnetometer_z: equisat_frame.data_section.flash_cmp_batch_2.magnetometer_z.int16 :field flash_cmp_batch_2_magnetometer_y: equisat_frame.data_section.flash_cmp_batch_2.magnetometer_y.int16 :field flash_cmp_batch_2_timestamp: equisat_frame.data_section.flash_cmp_batch_2.timestamp :field flash_cmp_batch_3_led1_temp: equisat_frame.data_section.flash_cmp_batch_3.led1_temp.int16 :field flash_cmp_batch_3_led2_temp: equisat_frame.data_section.flash_cmp_batch_3.led2_temp.int16 :field flash_cmp_batch_3_led3_temp: equisat_frame.data_section.flash_cmp_batch_3.led3_temp.int16 :field flash_cmp_batch_3_led4_temp: equisat_frame.data_section.flash_cmp_batch_3.led4_temp.int16 :field flash_cmp_batch_3_lf1_temp: equisat_frame.data_section.flash_cmp_batch_3.lf1_temp.int16 :field flash_cmp_batch_3_lf3_temp: equisat_frame.data_section.flash_cmp_batch_3.lf3_temp.int16 :field flash_cmp_batch_3_lfb1_sns: equisat_frame.data_section.flash_cmp_batch_3.lfb1_sns.int16 :field flash_cmp_batch_3_lfb1_osns: equisat_frame.data_section.flash_cmp_batch_3.lfb1_osns.int16 :field flash_cmp_batch_3_lfb2_sns: equisat_frame.data_section.flash_cmp_batch_3.lfb2_sns.int16 :field flash_cmp_batch_3_lfb2_osns: equisat_frame.data_section.flash_cmp_batch_3.lfb2_osns.int16 :field flash_cmp_batch_3_lf1_ref: equisat_frame.data_section.flash_cmp_batch_3.lf1_ref.int16 :field flash_cmp_batch_3_lf2_ref: equisat_frame.data_section.flash_cmp_batch_3.lf2_ref.int16 :field flash_cmp_batch_3_lf3_ref: equisat_frame.data_section.flash_cmp_batch_3.lf3_ref.int16 :field flash_cmp_batch_3_lf4_ref: equisat_frame.data_section.flash_cmp_batch_3.lf4_ref.int16 :field flash_cmp_batch_3_led1_sns: equisat_frame.data_section.flash_cmp_batch_3.led1_sns.int16 :field flash_cmp_batch_3_led2_sns: equisat_frame.data_section.flash_cmp_batch_3.led2_sns.int16 :field flash_cmp_batch_3_led3_sns: equisat_frame.data_section.flash_cmp_batch_3.led3_sns.int16 :field flash_cmp_batch_3_led4_sns: equisat_frame.data_section.flash_cmp_batch_3.led4_sns.int16 :field flash_cmp_batch_3_magnetometer_x: equisat_frame.data_section.flash_cmp_batch_3.magnetometer_x.int16 :field flash_cmp_batch_3_magnetometer_z: equisat_frame.data_section.flash_cmp_batch_3.magnetometer_z.int16 :field flash_cmp_batch_3_magnetometer_y: equisat_frame.data_section.flash_cmp_batch_3.magnetometer_y.int16 :field flash_cmp_batch_3_timestamp: equisat_frame.data_section.flash_cmp_batch_3.timestamp :field flash_cmp_batch_4_led1_temp: equisat_frame.data_section.flash_cmp_batch_4.led1_temp.int16 :field flash_cmp_batch_4_led2_temp: equisat_frame.data_section.flash_cmp_batch_4.led2_temp.int16 :field flash_cmp_batch_4_led3_temp: equisat_frame.data_section.flash_cmp_batch_4.led3_temp.int16 :field flash_cmp_batch_4_led4_temp: equisat_frame.data_section.flash_cmp_batch_4.led4_temp.int16 :field flash_cmp_batch_4_lf1_temp: equisat_frame.data_section.flash_cmp_batch_4.lf1_temp.int16 :field flash_cmp_batch_4_lf3_temp: equisat_frame.data_section.flash_cmp_batch_4.lf3_temp.int16 :field flash_cmp_batch_4_lfb1_sns: equisat_frame.data_section.flash_cmp_batch_4.lfb1_sns.int16 :field flash_cmp_batch_4_lfb1_osns: equisat_frame.data_section.flash_cmp_batch_4.lfb1_osns.int16 :field flash_cmp_batch_4_lfb2_sns: equisat_frame.data_section.flash_cmp_batch_4.lfb2_sns.int16 :field flash_cmp_batch_4_lfb2_osns: equisat_frame.data_section.flash_cmp_batch_4.lfb2_osns.int16 :field flash_cmp_batch_4_lf1_ref: equisat_frame.data_section.flash_cmp_batch_4.lf1_ref.int16 :field flash_cmp_batch_4_lf2_ref: equisat_frame.data_section.flash_cmp_batch_4.lf2_ref.int16 :field flash_cmp_batch_4_lf3_ref: equisat_frame.data_section.flash_cmp_batch_4.lf3_ref.int16 :field flash_cmp_batch_4_lf4_ref: equisat_frame.data_section.flash_cmp_batch_4.lf4_ref.int16 :field flash_cmp_batch_4_led1_sns: equisat_frame.data_section.flash_cmp_batch_4.led1_sns.int16 :field flash_cmp_batch_4_led2_sns: equisat_frame.data_section.flash_cmp_batch_4.led2_sns.int16 :field flash_cmp_batch_4_led3_sns: equisat_frame.data_section.flash_cmp_batch_4.led3_sns.int16 :field flash_cmp_batch_4_led4_sns: equisat_frame.data_section.flash_cmp_batch_4.led4_sns.int16 :field flash_cmp_batch_4_magnetometer_x: equisat_frame.data_section.flash_cmp_batch_4.magnetometer_x.int16 :field flash_cmp_batch_4_magnetometer_z: equisat_frame.data_section.flash_cmp_batch_4.magnetometer_z.int16 :field flash_cmp_batch_4_magnetometer_y: equisat_frame.data_section.flash_cmp_batch_4.magnetometer_y.int16 :field flash_cmp_batch_4_timestamp: equisat_frame.data_section.flash_cmp_batch_4.timestamp :field flash_cmp_batch_5_led1_temp: equisat_frame.data_section.flash_cmp_batch_5.led1_temp.int16 :field flash_cmp_batch_5_led2_temp: equisat_frame.data_section.flash_cmp_batch_5.led2_temp.int16 :field flash_cmp_batch_5_led3_temp: equisat_frame.data_section.flash_cmp_batch_5.led3_temp.int16 :field flash_cmp_batch_5_led4_temp: equisat_frame.data_section.flash_cmp_batch_5.led4_temp.int16 :field flash_cmp_batch_5_lf1_temp: equisat_frame.data_section.flash_cmp_batch_5.lf1_temp.int16 :field flash_cmp_batch_5_lf3_temp: equisat_frame.data_section.flash_cmp_batch_5.lf3_temp.int16 :field flash_cmp_batch_5_lfb1_sns: equisat_frame.data_section.flash_cmp_batch_5.lfb1_sns.int16 :field flash_cmp_batch_5_lfb1_osns: equisat_frame.data_section.flash_cmp_batch_5.lfb1_osns.int16 :field flash_cmp_batch_5_lfb2_sns: equisat_frame.data_section.flash_cmp_batch_5.lfb2_sns.int16 :field flash_cmp_batch_5_lfb2_osns: equisat_frame.data_section.flash_cmp_batch_5.lfb2_osns.int16 :field flash_cmp_batch_5_lf1_ref: equisat_frame.data_section.flash_cmp_batch_5.lf1_ref.int16 :field flash_cmp_batch_5_lf2_ref: equisat_frame.data_section.flash_cmp_batch_5.lf2_ref.int16 :field flash_cmp_batch_5_lf3_ref: equisat_frame.data_section.flash_cmp_batch_5.lf3_ref.int16 :field flash_cmp_batch_5_lf4_ref: equisat_frame.data_section.flash_cmp_batch_5.lf4_ref.int16 :field flash_cmp_batch_5_led1_sns: equisat_frame.data_section.flash_cmp_batch_5.led1_sns.int16 :field flash_cmp_batch_5_led2_sns: equisat_frame.data_section.flash_cmp_batch_5.led2_sns.int16 :field flash_cmp_batch_5_led3_sns: equisat_frame.data_section.flash_cmp_batch_5.led3_sns.int16 :field flash_cmp_batch_5_led4_sns: equisat_frame.data_section.flash_cmp_batch_5.led4_sns.int16 :field flash_cmp_batch_5_magnetometer_x: equisat_frame.data_section.flash_cmp_batch_5.magnetometer_x.int16 :field flash_cmp_batch_5_magnetometer_z: equisat_frame.data_section.flash_cmp_batch_5.magnetometer_z.int16 :field flash_cmp_batch_5_magnetometer_y: equisat_frame.data_section.flash_cmp_batch_5.magnetometer_y.int16 :field flash_cmp_batch_5_timestamp: equisat_frame.data_section.flash_cmp_batch_5.timestamp :field lowpower_batch_0_event_history: equisat_frame.data_section.lowpower_batch_0.event_history :field lowpower_batch_0_l1_ref: equisat_frame.data_section.lowpower_batch_0.l1_ref.int16 :field lowpower_batch_0_l2_ref: equisat_frame.data_section.lowpower_batch_0.l2_ref.int16 :field lowpower_batch_0_l1_sns: equisat_frame.data_section.lowpower_batch_0.l1_sns.int16 :field lowpower_batch_0_l2_sns: equisat_frame.data_section.lowpower_batch_0.l2_sns.int16 :field lowpower_batch_0_l1_temp: equisat_frame.data_section.lowpower_batch_0.l1_temp.int16 :field lowpower_batch_0_l2_temp: equisat_frame.data_section.lowpower_batch_0.l2_temp.int16 :field lowpower_batch_0_panel_ref: equisat_frame.data_section.lowpower_batch_0.panel_ref.int16 :field lowpower_batch_0_l_ref: equisat_frame.data_section.lowpower_batch_0.l_ref.int16 :field lowpower_batch_0_bat_digsigs_1: equisat_frame.data_section.lowpower_batch_0.bat_digsigs_1 :field lowpower_batch_0_bat_digsigs_2: equisat_frame.data_section.lowpower_batch_0.bat_digsigs_2 :field lowpower_batch_0_ir_flash_obj: equisat_frame.data_section.lowpower_batch_0.ir_flash_obj :field lowpower_batch_0_ir_side1_obj: equisat_frame.data_section.lowpower_batch_0.ir_side1_obj :field lowpower_batch_0_ir_side2_obj: equisat_frame.data_section.lowpower_batch_0.ir_side2_obj :field lowpower_batch_0_ir_rbf_obj: equisat_frame.data_section.lowpower_batch_0.ir_rbf_obj :field lowpower_batch_0_ir_access_obj: equisat_frame.data_section.lowpower_batch_0.ir_access_obj :field lowpower_batch_0_ir_top1_obj: equisat_frame.data_section.lowpower_batch_0.ir_top1_obj :field lowpower_batch_0_gyroscope_x: equisat_frame.data_section.lowpower_batch_0.gyroscope_x.int16 :field lowpower_batch_0_gyroscope_z: equisat_frame.data_section.lowpower_batch_0.gyroscope_z.int16 :field lowpower_batch_0_gyroscope_y: equisat_frame.data_section.lowpower_batch_0.gyroscope_y.int16 :field lowpower_batch_1_event_history: equisat_frame.data_section.lowpower_batch_1.event_history :field lowpower_batch_1_l1_ref: equisat_frame.data_section.lowpower_batch_1.l1_ref.int16 :field lowpower_batch_1_l2_ref: equisat_frame.data_section.lowpower_batch_1.l2_ref.int16 :field lowpower_batch_1_l1_sns: equisat_frame.data_section.lowpower_batch_1.l1_sns.int16 :field lowpower_batch_1_l2_sns: equisat_frame.data_section.lowpower_batch_1.l2_sns.int16 :field lowpower_batch_1_l1_temp: equisat_frame.data_section.lowpower_batch_1.l1_temp.int16 :field lowpower_batch_1_l2_temp: equisat_frame.data_section.lowpower_batch_1.l2_temp.int16 :field lowpower_batch_1_panel_ref: equisat_frame.data_section.lowpower_batch_1.panel_ref.int16 :field lowpower_batch_1_l_ref: equisat_frame.data_section.lowpower_batch_1.l_ref.int16 :field lowpower_batch_1_bat_digsigs_1: equisat_frame.data_section.lowpower_batch_1.bat_digsigs_1 :field lowpower_batch_1_bat_digsigs_2: equisat_frame.data_section.lowpower_batch_1.bat_digsigs_2 :field lowpower_batch_1_ir_flash_obj: equisat_frame.data_section.lowpower_batch_1.ir_flash_obj :field lowpower_batch_1_ir_side1_obj: equisat_frame.data_section.lowpower_batch_1.ir_side1_obj :field lowpower_batch_1_ir_side2_obj: equisat_frame.data_section.lowpower_batch_1.ir_side2_obj :field lowpower_batch_1_ir_rbf_obj: equisat_frame.data_section.lowpower_batch_1.ir_rbf_obj :field lowpower_batch_1_ir_access_obj: equisat_frame.data_section.lowpower_batch_1.ir_access_obj :field lowpower_batch_1_ir_top1_obj: equisat_frame.data_section.lowpower_batch_1.ir_top1_obj :field lowpower_batch_1_gyroscope_x: equisat_frame.data_section.lowpower_batch_1.gyroscope_x.int16 :field lowpower_batch_1_gyroscope_z: equisat_frame.data_section.lowpower_batch_1.gyroscope_z.int16 :field lowpower_batch_1_gyroscope_y: equisat_frame.data_section.lowpower_batch_1.gyroscope_y.int16 :field lowpower_batch_2_event_history: equisat_frame.data_section.lowpower_batch_2.event_history :field lowpower_batch_2_l1_ref: equisat_frame.data_section.lowpower_batch_2.l1_ref.int16 :field lowpower_batch_2_l2_ref: equisat_frame.data_section.lowpower_batch_2.l2_ref.int16 :field lowpower_batch_2_l1_sns: equisat_frame.data_section.lowpower_batch_2.l1_sns.int16 :field lowpower_batch_2_l2_sns: equisat_frame.data_section.lowpower_batch_2.l2_sns.int16 :field lowpower_batch_2_l1_temp: equisat_frame.data_section.lowpower_batch_2.l1_temp.int16 :field lowpower_batch_2_l2_temp: equisat_frame.data_section.lowpower_batch_2.l2_temp.int16 :field lowpower_batch_2_panel_ref: equisat_frame.data_section.lowpower_batch_2.panel_ref.int16 :field lowpower_batch_2_l_ref: equisat_frame.data_section.lowpower_batch_2.l_ref.int16 :field lowpower_batch_2_bat_digsigs_1: equisat_frame.data_section.lowpower_batch_2.bat_digsigs_1 :field lowpower_batch_2_bat_digsigs_2: equisat_frame.data_section.lowpower_batch_2.bat_digsigs_2 :field lowpower_batch_2_ir_flash_obj: equisat_frame.data_section.lowpower_batch_2.ir_flash_obj :field lowpower_batch_2_ir_side1_obj: equisat_frame.data_section.lowpower_batch_2.ir_side1_obj :field lowpower_batch_2_ir_side2_obj: equisat_frame.data_section.lowpower_batch_2.ir_side2_obj :field lowpower_batch_2_ir_rbf_obj: equisat_frame.data_section.lowpower_batch_2.ir_rbf_obj :field lowpower_batch_2_ir_access_obj: equisat_frame.data_section.lowpower_batch_2.ir_access_obj :field lowpower_batch_2_ir_top1_obj: equisat_frame.data_section.lowpower_batch_2.ir_top1_obj :field lowpower_batch_2_gyroscope_x: equisat_frame.data_section.lowpower_batch_2.gyroscope_x.int16 :field lowpower_batch_2_gyroscope_z: equisat_frame.data_section.lowpower_batch_2.gyroscope_z.int16 :field lowpower_batch_2_gyroscope_y: equisat_frame.data_section.lowpower_batch_2.gyroscope_y.int16 :field lowpower_batch_3_event_history: equisat_frame.data_section.lowpower_batch_3.event_history :field lowpower_batch_3_l1_ref: equisat_frame.data_section.lowpower_batch_3.l1_ref.int16 :field lowpower_batch_3_l2_ref: equisat_frame.data_section.lowpower_batch_3.l2_ref.int16 :field lowpower_batch_3_l1_sns: equisat_frame.data_section.lowpower_batch_3.l1_sns.int16 :field lowpower_batch_3_l2_sns: equisat_frame.data_section.lowpower_batch_3.l2_sns.int16 :field lowpower_batch_3_l1_temp: equisat_frame.data_section.lowpower_batch_3.l1_temp.int16 :field lowpower_batch_3_l2_temp: equisat_frame.data_section.lowpower_batch_3.l2_temp.int16 :field lowpower_batch_3_panel_ref: equisat_frame.data_section.lowpower_batch_3.panel_ref.int16 :field lowpower_batch_3_l_ref: equisat_frame.data_section.lowpower_batch_3.l_ref.int16 :field lowpower_batch_3_bat_digsigs_1: equisat_frame.data_section.lowpower_batch_3.bat_digsigs_1 :field lowpower_batch_3_bat_digsigs_2: equisat_frame.data_section.lowpower_batch_3.bat_digsigs_2 :field lowpower_batch_3_ir_flash_obj: equisat_frame.data_section.lowpower_batch_3.ir_flash_obj :field lowpower_batch_3_ir_side1_obj: equisat_frame.data_section.lowpower_batch_3.ir_side1_obj :field lowpower_batch_3_ir_side2_obj: equisat_frame.data_section.lowpower_batch_3.ir_side2_obj :field lowpower_batch_3_ir_rbf_obj: equisat_frame.data_section.lowpower_batch_3.ir_rbf_obj :field lowpower_batch_3_ir_access_obj: equisat_frame.data_section.lowpower_batch_3.ir_access_obj :field lowpower_batch_3_ir_top1_obj: equisat_frame.data_section.lowpower_batch_3.ir_top1_obj :field lowpower_batch_3_gyroscope_x: equisat_frame.data_section.lowpower_batch_3.gyroscope_x.int16 :field lowpower_batch_3_gyroscope_z: equisat_frame.data_section.lowpower_batch_3.gyroscope_z.int16 :field lowpower_batch_3_gyroscope_y: equisat_frame.data_section.lowpower_batch_3.gyroscope_y.int16 :field lowpower_batch_4_event_history: equisat_frame.data_section.lowpower_batch_4.event_history :field lowpower_batch_4_l1_ref: equisat_frame.data_section.lowpower_batch_4.l1_ref.int16 :field lowpower_batch_4_l2_ref: equisat_frame.data_section.lowpower_batch_4.l2_ref.int16 :field lowpower_batch_4_l1_sns: equisat_frame.data_section.lowpower_batch_4.l1_sns.int16 :field lowpower_batch_4_l2_sns: equisat_frame.data_section.lowpower_batch_4.l2_sns.int16 :field lowpower_batch_4_l1_temp: equisat_frame.data_section.lowpower_batch_4.l1_temp.int16 :field lowpower_batch_4_l2_temp: equisat_frame.data_section.lowpower_batch_4.l2_temp.int16 :field lowpower_batch_4_panel_ref: equisat_frame.data_section.lowpower_batch_4.panel_ref.int16 :field lowpower_batch_4_l_ref: equisat_frame.data_section.lowpower_batch_4.l_ref.int16 :field lowpower_batch_4_bat_digsigs_1: equisat_frame.data_section.lowpower_batch_4.bat_digsigs_1 :field lowpower_batch_4_bat_digsigs_2: equisat_frame.data_section.lowpower_batch_4.bat_digsigs_2 :field lowpower_batch_4_ir_flash_obj: equisat_frame.data_section.lowpower_batch_4.ir_flash_obj :field lowpower_batch_4_ir_side1_obj: equisat_frame.data_section.lowpower_batch_4.ir_side1_obj :field lowpower_batch_4_ir_side2_obj: equisat_frame.data_section.lowpower_batch_4.ir_side2_obj :field lowpower_batch_4_ir_rbf_obj: equisat_frame.data_section.lowpower_batch_4.ir_rbf_obj :field lowpower_batch_4_ir_access_obj: equisat_frame.data_section.lowpower_batch_4.ir_access_obj :field lowpower_batch_4_ir_top1_obj: equisat_frame.data_section.lowpower_batch_4.ir_top1_obj :field lowpower_batch_4_gyroscope_x: equisat_frame.data_section.lowpower_batch_4.gyroscope_x.int16 :field lowpower_batch_4_gyroscope_z: equisat_frame.data_section.lowpower_batch_4.gyroscope_z.int16 :field lowpower_batch_4_gyroscope_y: equisat_frame.data_section.lowpower_batch_4.gyroscope_y.int16 """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.equisat_frame = Equisat.EquisatFrameT(self._io, self, self._root) class CompressedMagnetometerT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 11 - 2800) return self._m_int16 if hasattr(self, '_m_int16') else None class CompressedImuTempT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 1 - 20374) return self._m_int16 if hasattr(self, '_m_int16') else None class CompressedGyroscopeT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 1 - 32750) return self._m_int16 if hasattr(self, '_m_int16') else None class CurrentInfoT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.time_to_flash = self._io.read_u1() self.boot_count = self._io.read_u1() self.l1_ref = Equisat.CompressedLRefT(self._io, self, self._root) self.l2_ref = Equisat.CompressedLRefT(self._io, self, self._root) self.l1_sns = Equisat.CompressedLSnsT(self._io, self, self._root) self.l2_sns = Equisat.CompressedLSnsT(self._io, self, self._root) self.l1_temp = Equisat.CompressedLTempT(self._io, self, self._root) self.l2_temp = Equisat.CompressedLTempT(self._io, self, self._root) self.panel_ref = Equisat.CompressedPanelrefT(self._io, self, self._root) self.l_ref = Equisat.CompressedLRefT(self._io, self, self._root) self.bat_digsigs_1 = self._io.read_u1() self.bat_digsigs_2 = self._io.read_u1() self.lf1ref = Equisat.CompressedLRefT(self._io, self, self._root) self.lf2ref = Equisat.CompressedLRefT(self._io, self, self._root) self.lf3ref = Equisat.CompressedLRefT(self._io, self, self._root) self.lf4ref = Equisat.CompressedLRefT(self._io, self, self._root) class CompressedLedSnsT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 650 - 0) return self._m_int16 if hasattr(self, '_m_int16') else None class EquisatFrameT(KaitaiStruct): class SatState(Enum): initial = 0 antenna_deploy = 1 hello_world = 2 idle_no_flash = 3 idle_flash = 4 low_power = 5 class MessageType(Enum): idle = 0 attitude = 1 flash_burst = 2 flash_cmp = 3 low_power = 4 def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw_preamble = self._io.read_bytes(13) _io__raw_preamble = KaitaiStream(BytesIO(self._raw_preamble)) self.preamble = Equisat.PreambleT(_io__raw_preamble, self, self._root) self._raw_current_info = self._io.read_bytes(16) _io__raw_current_info = KaitaiStream(BytesIO(self._raw_current_info)) self.current_info = Equisat.CurrentInfoT(_io__raw_current_info, self, self._root) _on = self.preamble.message_type if _on == 0: self.data_section = Equisat.IdleDataT(self._io, self, self._root) elif _on == 4: self.data_section = Equisat.LowpowerDataT(self._io, self, self._root) elif _on == 1: self.data_section = Equisat.AttitudeDataT(self._io, self, self._root) elif _on == 3: self.data_section = Equisat.FlashCmpDataT(self._io, self, self._root) elif _on == 2: self.data_section = Equisat.FlashBurstDataT(self._io, self, self._root) self.unparsed = self._io.read_bytes_full() class LowpowerDataT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.lowpower_batch_0 = Equisat.LowpowerBatchT(self._io, self, self._root) self.lowpower_batch_1 = Equisat.LowpowerBatchT(self._io, self, self._root) self.lowpower_batch_2 = Equisat.LowpowerBatchT(self._io, self, self._root) self.lowpower_batch_3 = Equisat.LowpowerBatchT(self._io, self, self._root) self.lowpower_batch_4 = Equisat.LowpowerBatchT(self._io, self, self._root) class CompressedLfbSnsT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 45 - -960) return self._m_int16 if hasattr(self, '_m_int16') else None class FlashCmpDataT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.flash_cmp_batch_0 = Equisat.FlashCmpBatchT(self._io, self, self._root) self.flash_cmp_batch_1 = Equisat.FlashCmpBatchT(self._io, self, self._root) self.flash_cmp_batch_2 = Equisat.FlashCmpBatchT(self._io, self, self._root) self.flash_cmp_batch_3 = Equisat.FlashCmpBatchT(self._io, self, self._root) self.flash_cmp_batch_4 = Equisat.FlashCmpBatchT(self._io, self, self._root) self.flash_cmp_batch_5 = Equisat.FlashCmpBatchT(self._io, self, self._root) class CallsignStrT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign_string = (self._io.read_bytes_full()).decode(u"utf-8") class IdleDataT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.idle_batch_0 = Equisat.IdleBatchT(self._io, self, self._root) self.idle_batch_1 = Equisat.IdleBatchT(self._io, self, self._root) self.idle_batch_2 = Equisat.IdleBatchT(self._io, self, self._root) self.idle_batch_3 = Equisat.IdleBatchT(self._io, self, self._root) self.idle_batch_4 = Equisat.IdleBatchT(self._io, self, self._root) self.idle_batch_5 = Equisat.IdleBatchT(self._io, self, self._root) self.idle_batch_6 = Equisat.IdleBatchT(self._io, self, self._root) class AttitudeBatchT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ir_flash_obj = self._io.read_u2le() self.ir_side1_obj = self._io.read_u2le() self.ir_side2_obj = self._io.read_u2le() self.ir_rbf_obj = self._io.read_u2le() self.ir_access_obj = self._io.read_u2le() self.ir_top1_obj = self._io.read_u2le() self.pd_1 = self._io.read_u1() self.pd_2 = self._io.read_u1() self.accelerometer1_x = Equisat.CompressedAccelerometerT(self._io, self, self._root) self.accelerometer1_z = Equisat.CompressedAccelerometerT(self._io, self, self._root) self.accelerometer1_y = Equisat.CompressedAccelerometerT(self._io, self, self._root) self.accelerometer2_x = Equisat.CompressedAccelerometerT(self._io, self, self._root) self.accelerometer2_z = Equisat.CompressedAccelerometerT(self._io, self, self._root) self.accelerometer2_y = Equisat.CompressedAccelerometerT(self._io, self, self._root) self.gyroscope_x = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_z = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_y = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.magnetometer1_x = Equisat.CompressedMagnetometerT(self._io, self, self._root) self.magnetometer1_z = Equisat.CompressedMagnetometerT(self._io, self, self._root) self.magnetometer1_y = Equisat.CompressedMagnetometerT(self._io, self, self._root) self.magnetometer2_x = Equisat.CompressedMagnetometerT(self._io, self, self._root) self.magnetometer2_z = Equisat.CompressedMagnetometerT(self._io, self, self._root) self.magnetometer2_y = Equisat.CompressedMagnetometerT(self._io, self, self._root) self.timestamp = self._io.read_u4le() @property def pd_flash(self): if hasattr(self, '_m_pd_flash'): return self._m_pd_flash if hasattr(self, '_m_pd_flash') else None self._m_pd_flash = ((self.pd_1 >> 6) & 3) return self._m_pd_flash if hasattr(self, '_m_pd_flash') else None @property def pd_access(self): if hasattr(self, '_m_pd_access'): return self._m_pd_access if hasattr(self, '_m_pd_access') else None self._m_pd_access = ((self.pd_1 >> 0) & 3) return self._m_pd_access if hasattr(self, '_m_pd_access') else None @property def pd_top2(self): if hasattr(self, '_m_pd_top2'): return self._m_pd_top2 if hasattr(self, '_m_pd_top2') else None self._m_pd_top2 = ((self.pd_2 >> 4) & 3) return self._m_pd_top2 if hasattr(self, '_m_pd_top2') else None @property def pd_top1(self): if hasattr(self, '_m_pd_top1'): return self._m_pd_top1 if hasattr(self, '_m_pd_top1') else None self._m_pd_top1 = ((self.pd_2 >> 6) & 3) return self._m_pd_top1 if hasattr(self, '_m_pd_top1') else None @property def pd_side2(self): if hasattr(self, '_m_pd_side2'): return self._m_pd_side2 if hasattr(self, '_m_pd_side2') else None self._m_pd_side2 = ((self.pd_1 >> 2) & 3) return self._m_pd_side2 if hasattr(self, '_m_pd_side2') else None @property def pd_side1(self): if hasattr(self, '_m_pd_side1'): return self._m_pd_side1 if hasattr(self, '_m_pd_side1') else None self._m_pd_side1 = ((self.pd_1 >> 4) & 3) return self._m_pd_side1 if hasattr(self, '_m_pd_side1') else None class CompressedLfbOsnsT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 72 - 0) return self._m_int16 if hasattr(self, '_m_int16') else None class FlashBurstDataT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.led1_temp_0 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led1_temp_1 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led1_temp_2 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led1_temp_3 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led1_temp_4 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led1_temp_5 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led1_temp_6 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led2_temp_0 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led2_temp_1 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led2_temp_2 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led2_temp_3 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led2_temp_4 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led2_temp_5 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led2_temp_6 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led3_temp_0 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led3_temp_1 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led3_temp_2 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led3_temp_3 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led3_temp_4 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led3_temp_5 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led3_temp_6 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led4_temp_0 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led4_temp_1 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led4_temp_2 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led4_temp_3 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led4_temp_4 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led4_temp_5 = Equisat.CompressedLedTempT(self._io, self, self._root) self.led4_temp_6 = Equisat.CompressedLedTempT(self._io, self, self._root) self.lf1_temp_0 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf1_temp_1 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf1_temp_2 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf1_temp_3 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf1_temp_4 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf1_temp_5 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf1_temp_6 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf3_temp_0 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf3_temp_1 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf3_temp_2 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf3_temp_3 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf3_temp_4 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf3_temp_5 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf3_temp_6 = Equisat.CompressedLfTempT(self._io, self, self._root) self.lfb1_sns_0 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb1_sns_1 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb1_sns_2 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb1_sns_3 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb1_sns_4 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb1_sns_5 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb1_sns_6 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb1_osns_0 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb1_osns_1 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb1_osns_2 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb1_osns_3 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb1_osns_4 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb1_osns_5 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb1_osns_6 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb2_sns_0 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb2_sns_1 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb2_sns_2 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb2_sns_3 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb2_sns_4 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb2_sns_5 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb2_sns_6 = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb2_osns_0 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb2_osns_1 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb2_osns_2 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb2_osns_3 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb2_osns_4 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb2_osns_5 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb2_osns_6 = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lf1_ref_0 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf1_ref_1 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf1_ref_2 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf1_ref_3 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf1_ref_4 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf1_ref_5 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf1_ref_6 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf2_ref_0 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf2_ref_1 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf2_ref_2 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf2_ref_3 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf2_ref_4 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf2_ref_5 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf2_ref_6 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf3_ref_0 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf3_ref_1 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf3_ref_2 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf3_ref_3 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf3_ref_4 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf3_ref_5 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf3_ref_6 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf4_ref_0 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf4_ref_1 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf4_ref_2 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf4_ref_3 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf4_ref_4 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf4_ref_5 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf4_ref_6 = Equisat.CompressedLfVoltT(self._io, self, self._root) self.led1_sns_0 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led1_sns_1 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led1_sns_2 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led1_sns_3 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led1_sns_4 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led1_sns_5 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led1_sns_6 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led2_sns_0 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led2_sns_1 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led2_sns_2 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led2_sns_3 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led2_sns_4 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led2_sns_5 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led2_sns_6 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led3_sns_0 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led3_sns_1 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led3_sns_2 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led3_sns_3 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led3_sns_4 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led3_sns_5 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led3_sns_6 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led4_sns_0 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led4_sns_1 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led4_sns_2 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led4_sns_3 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led4_sns_4 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led4_sns_5 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led4_sns_6 = Equisat.CompressedLedSnsT(self._io, self, self._root) self.gyroscope_x_0 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_x_1 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_x_2 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_x_3 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_x_4 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_x_5 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_x_6 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_z_0 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_z_1 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_z_2 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_z_3 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_z_4 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_z_5 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_z_6 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_y_0 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_y_1 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_y_2 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_y_3 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_y_4 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_y_5 = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_y_6 = Equisat.CompressedGyroscopeT(self._io, self, self._root) class CompressedPanelrefT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 6 - 0) return self._m_int16 if hasattr(self, '_m_int16') else None class PreambleT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.source = self._io.read_bytes(6) if not self.source == b"\x57\x4C\x39\x58\x5A\x45": raise kaitaistruct.ValidationNotEqualError(b"\x57\x4C\x39\x58\x5A\x45", self.source, self._io, u"/types/preamble_t/seq/0") self.timestamp = self._io.read_u4le() self.msg_op_states = self._io.read_u1() self.bytes_of_data = self._io.read_u1() self.num_errors = self._io.read_u1() @property def satellite_state(self): if hasattr(self, '_m_satellite_state'): return self._m_satellite_state if hasattr(self, '_m_satellite_state') else None self._m_satellite_state = ((self.msg_op_states >> 3) & 7) return self._m_satellite_state if hasattr(self, '_m_satellite_state') else None @property def flash_killed(self): if hasattr(self, '_m_flash_killed'): return self._m_flash_killed if hasattr(self, '_m_flash_killed') else None self._m_flash_killed = (self.msg_op_states & (1 << 6)) // (1 << 6) return self._m_flash_killed if hasattr(self, '_m_flash_killed') else None @property def message_type(self): if hasattr(self, '_m_message_type'): return self._m_message_type if hasattr(self, '_m_message_type') else None self._m_message_type = (self.msg_op_states & 7) return self._m_message_type if hasattr(self, '_m_message_type') else None @property def mram_killed(self): if hasattr(self, '_m_mram_killed'): return self._m_mram_killed if hasattr(self, '_m_mram_killed') else None self._m_mram_killed = (self.msg_op_states & (1 << 7)) // (1 << 7) return self._m_mram_killed if hasattr(self, '_m_mram_killed') else None @property def callsign(self): if hasattr(self, '_m_callsign'): return self._m_callsign if hasattr(self, '_m_callsign') else None self._m_callsign = self.source return self._m_callsign if hasattr(self, '_m_callsign') else None class LowpowerBatchT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.event_history = self._io.read_u1() self.l1_ref = Equisat.CompressedLRefT(self._io, self, self._root) self.l2_ref = Equisat.CompressedLRefT(self._io, self, self._root) self.l1_sns = Equisat.CompressedLSnsT(self._io, self, self._root) self.l2_sns = Equisat.CompressedLSnsT(self._io, self, self._root) self.l1_temp = Equisat.CompressedLTempT(self._io, self, self._root) self.l2_temp = Equisat.CompressedLTempT(self._io, self, self._root) self.panel_ref = Equisat.CompressedPanelrefT(self._io, self, self._root) self.l_ref = Equisat.CompressedLRefT(self._io, self, self._root) self.bat_digsigs_1 = self._io.read_u1() self.bat_digsigs_2 = self._io.read_u1() self.ir_flash_obj = self._io.read_u2le() self.ir_side1_obj = self._io.read_u2le() self.ir_side2_obj = self._io.read_u2le() self.ir_rbf_obj = self._io.read_u2le() self.ir_access_obj = self._io.read_u2le() self.ir_top1_obj = self._io.read_u2le() self.gyroscope_x = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_z = Equisat.CompressedGyroscopeT(self._io, self, self._root) self.gyroscope_y = Equisat.CompressedGyroscopeT(self._io, self, self._root) class CompressedAccelerometerT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 1 - 32768) return self._m_int16 if hasattr(self, '_m_int16') else None class IdleBatchT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.event_history = self._io.read_u1() self.l1_ref = Equisat.CompressedLRefT(self._io, self, self._root) self.l2_ref = Equisat.CompressedLRefT(self._io, self, self._root) self.l1_sns = Equisat.CompressedLSnsT(self._io, self, self._root) self.l2_sns = Equisat.CompressedLSnsT(self._io, self, self._root) self.l1_temp = Equisat.CompressedLTempT(self._io, self, self._root) self.l2_temp = Equisat.CompressedLTempT(self._io, self, self._root) self.panel_ref = Equisat.CompressedPanelrefT(self._io, self, self._root) self.l_ref = Equisat.CompressedLRefT(self._io, self, self._root) self.bat_digsigs_1 = self._io.read_u1() self.bat_digsigs_2 = self._io.read_u1() self.rad_temp = Equisat.CompressedRadTempT(self._io, self, self._root) self.imu_temp = Equisat.CompressedImuTempT(self._io, self, self._root) self.ir_flash_amb = Equisat.CompressedIrAmbT(self._io, self, self._root) self.ir_side1_amb = Equisat.CompressedIrAmbT(self._io, self, self._root) self.ir_side2_amb = Equisat.CompressedIrAmbT(self._io, self, self._root) self.ir_rbf_amb = Equisat.CompressedIrAmbT(self._io, self, self._root) self.ir_access_amb = Equisat.CompressedIrAmbT(self._io, self, self._root) self.ir_top1_amb = Equisat.CompressedIrAmbT(self._io, self, self._root) self.timestamp = self._io.read_u4le() class CompressedLSnsT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 20 - 150) return self._m_int16 if hasattr(self, '_m_int16') else None class CompressedLTempT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 32 - 0) return self._m_int16 if hasattr(self, '_m_int16') else None class CompressedRadTempT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 16 - 2000) return self._m_int16 if hasattr(self, '_m_int16') else None class CompressedLedTempT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 32 - 0) return self._m_int16 if hasattr(self, '_m_int16') else None class CompressedLRefT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 14 - 0) return self._m_int16 if hasattr(self, '_m_int16') else None class CompressedLfVoltT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 14 - 0) return self._m_int16 if hasattr(self, '_m_int16') else None class CompressedLfTempT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 32 - 0) return self._m_int16 if hasattr(self, '_m_int16') else None class FlashCmpBatchT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.led1_temp = Equisat.CompressedLedTempT(self._io, self, self._root) self.led2_temp = Equisat.CompressedLedTempT(self._io, self, self._root) self.led3_temp = Equisat.CompressedLedTempT(self._io, self, self._root) self.led4_temp = Equisat.CompressedLedTempT(self._io, self, self._root) self.lf1_temp = Equisat.CompressedLfTempT(self._io, self, self._root) self.lf3_temp = Equisat.CompressedLfTempT(self._io, self, self._root) self.lfb1_sns = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb1_osns = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lfb2_sns = Equisat.CompressedLfbSnsT(self._io, self, self._root) self.lfb2_osns = Equisat.CompressedLfbOsnsT(self._io, self, self._root) self.lf1_ref = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf2_ref = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf3_ref = Equisat.CompressedLfVoltT(self._io, self, self._root) self.lf4_ref = Equisat.CompressedLfVoltT(self._io, self, self._root) self.led1_sns = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led2_sns = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led3_sns = Equisat.CompressedLedSnsT(self._io, self, self._root) self.led4_sns = Equisat.CompressedLedSnsT(self._io, self, self._root) self.magnetometer_x = Equisat.CompressedMagnetometerT(self._io, self, self._root) self.magnetometer_z = Equisat.CompressedMagnetometerT(self._io, self, self._root) self.magnetometer_y = Equisat.CompressedMagnetometerT(self._io, self, self._root) self.timestamp = self._io.read_u4le() class CompressedIrAmbT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cint16 = self._io.read_s1() @property def int16(self): if hasattr(self, '_m_int16'): return self._m_int16 if hasattr(self, '_m_int16') else None self._m_int16 = ((self.cint16 << 8) // 7 - -11657) return self._m_int16 if hasattr(self, '_m_int16') else None class AttitudeDataT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.attitude_batch_0 = Equisat.AttitudeBatchT(self._io, self, self._root) self.attitude_batch_1 = Equisat.AttitudeBatchT(self._io, self, self._root) self.attitude_batch_2 = Equisat.AttitudeBatchT(self._io, self, self._root) self.attitude_batch_3 = Equisat.AttitudeBatchT(self._io, self, self._root) self.attitude_batch_4 = Equisat.AttitudeBatchT(self._io, self, self._root) @property def frame_length(self): if hasattr(self, '_m_frame_length'): return self._m_frame_length if hasattr(self, '_m_frame_length') else None self._m_frame_length = self._io.size() return self._m_frame_length if hasattr(self, '_m_frame_length') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/equisat.py
0.508056
0.192501
equisat.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Neudose(KaitaiStruct): """:field dest_callsign: ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_header.src_ssid_raw.ssid :field dest_ssid: ax25_header.dest_ssid_raw.ssid :field ctl: ax25_header.ctl :field pid: ax25_header.pid :field csp_hdr_crc: csp_header.crc :field csp_hdr_rdp: csp_header.rdp :field csp_hdr_xtea: csp_header.xtea :field csp_hdr_hmac: csp_header.hmac :field csp_hdr_src_port: csp_header.source_port :field csp_hdr_dst_port: csp_header.destination_port :field csp_hdr_destination: csp_header.destination :field csp_hdr_source: csp_header.source :field csp_hdr_priority: csp_header.priority :field last_rx_timestamp_raw: beacon.last_rx_timestamp_raw :field packet_version: beacon.packet_version :field unix_timestamp: beacon.unix_timestamp :field cdh_on: beacon.sat_status.cdh_on :field eps_on: beacon.sat_status.eps_on :field comms_on: beacon.sat_status.comms_on :field antenna_on: beacon.sat_status.antenna_on :field payload_on: beacon.sat_status.payload_on :field mech: beacon.sat_status.mech :field thermal: beacon.sat_status.thermal :field antenna_deployed: beacon.sat_status.antenna_deployed :field last_gs_conn_timestamp: beacon.last_gs_conn_timestamp :field eps_bat_state: beacon.eps_status.bat_state :field eps_bat_htr_state: beacon.eps_status.bat_htr_state :field eps_bat_htr_mode: beacon.eps_status.bat_htr_mode :field eps_last_reset_rsn: beacon.eps_status.last_reset_rsn :field eps_gs_wtdg_rst_mark: beacon.eps_status.gs_wtdg_rst_mark :field eps_uptime: beacon.eps_uptime :field eps_vbat: beacon.eps_vbat :field eps_bat_chrge_curr: beacon.eps_bat_chrge_curr :field eps_bat_dischrge_curr: beacon.eps_bat_dischrge_curr :field eps_mppt_conv1_temp: beacon.eps_temp.mppt_conv1 :field eps_mppt_conv2_temp: beacon.eps_temp.mppt_conv2 :field eps_mppt_conv3_temp: beacon.eps_temp.mppt_conv3 :field eps_out_conv_3v3_temp: beacon.eps_temp.out_conv_3v3 :field eps_out_conv_5v0_temp: beacon.eps_temp.out_conv_5v0 :field eps_battery_pack_temp: beacon.eps_temp.battery_pack :field eps_solar_panel_y_n_curr: beacon.eps_solar_panel_curr.y_n :field eps_solar_panel_y_p_curr: beacon.eps_solar_panel_curr.y_p :field eps_solar_panel_x_n_curr: beacon.eps_solar_panel_curr.x_n :field eps_solar_panel_x_p_curr: beacon.eps_solar_panel_curr.x_p :field eps_solar_panel_z_n_curr: beacon.eps_solar_panel_curr.z_n :field eps_solar_panel_z_p_curr: beacon.eps_solar_panel_curr.z_p :field eps_cdh_channel_curr_out: beacon.eps_channel_curr_out.cdh :field eps_comm_3v3_channel_curr_out: beacon.eps_channel_curr_out.comm_3v3 :field eps_comm_5v0_channel_curr_out: beacon.eps_channel_curr_out.comm_5v0 :field eps_ant_channel_curr_out: beacon.eps_channel_curr_out.ant :field eps_pld_channel_curr_out: beacon.eps_channel_curr_out.pld :field cdh_curr_state: beacon.cdh_curr_state :field cdh_prev_state: beacon.cdh_prev_state :field cdh_reset_cause: beacon.cdh_boot_reset_cause.reset_cause :field cdh_boot_cause: beacon.cdh_boot_reset_cause.boot_cause :field cdh_uptime: beacon.cdh_uptime :field cdh_temp_mcu_raw: beacon.cdh_temp_mcu_raw :field cdh_temp_ram_raw: beacon.cdh_temp_ram_raw :field comms_rtsm_state: beacon.comms_status.rtsm_state :field comms_rst_reason: beacon.comms_status.rst_reason :field comms_boot_img_bank: beacon.comms_status.boot_img_bank :field comms_uptime_raw: beacon.comms_uptime_raw :field comms_ina233_pa_curr_raw: beacon.comms_ina233_pa_curr_raw :field comms_ad7294_pa_curr_raw: beacon.comms_ad7294_pa_curr_raw :field comms_ad7294_gate_volt_raw: beacon.comms_ad7294_gate_volt_raw :field comms_cc1125_rssi_raw: beacon.comms_cc1125_rssi_raw :field comms_lna_therm_temp: beacon.comms_temp.lna_therm :field comms_lna_diode_temp: beacon.comms_temp.lna_diode :field comms_stm32_internal_temp: beacon.comms_temp.stm32_internal :field comms_cc1125_uhf_temp: beacon.comms_temp.cc1125_uhf :field comms_cc1125_vhf_temp: beacon.comms_temp.cc1125_vhf :field comms_pa_therm_temp: beacon.comms_temp.pa_therm :field comms_pa_diode_temp: beacon.comms_temp.pa_diode :field comms_pa_therm_strap_temp: beacon.comms_temp.pa_therm_strap :field comms_ad7294_internal_temp: beacon.comms_temp.ad7294_internal :field ant_deployment_status: beacon.ant_deployment_status :field ant_prev_isis_status: beacon.ant_prev_isis_status :field pld_status: beacon.pld_status """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Neudose.Ax25HeaderT(self._io, self, self._root) self.csp_header = Neudose.CspHeaderT(self._io, self, self._root) self.beacon = Neudose.BeaconT(self._io, self, self._root) class EpsSolarPanelCurrT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.eps_solar_panel_curr = self._io.read_bytes(12) @property def z_p(self): if hasattr(self, '_m_z_p'): return self._m_z_p if hasattr(self, '_m_z_p') else None self._m_z_p = ((KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 10) << 8) + KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 11)) return self._m_z_p if hasattr(self, '_m_z_p') else None @property def x_p(self): if hasattr(self, '_m_x_p'): return self._m_x_p if hasattr(self, '_m_x_p') else None self._m_x_p = ((KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 6) << 8) + KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 7)) return self._m_x_p if hasattr(self, '_m_x_p') else None @property def y_p(self): if hasattr(self, '_m_y_p'): return self._m_y_p if hasattr(self, '_m_y_p') else None self._m_y_p = ((KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 2) << 8) + KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 3)) return self._m_y_p if hasattr(self, '_m_y_p') else None @property def x_n(self): if hasattr(self, '_m_x_n'): return self._m_x_n if hasattr(self, '_m_x_n') else None self._m_x_n = ((KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 4) << 8) + KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 5)) return self._m_x_n if hasattr(self, '_m_x_n') else None @property def y_n(self): if hasattr(self, '_m_y_n'): return self._m_y_n if hasattr(self, '_m_y_n') else None self._m_y_n = ((KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 0) << 8) + KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 1)) return self._m_y_n if hasattr(self, '_m_y_n') else None @property def z_n(self): if hasattr(self, '_m_z_n'): return self._m_z_n if hasattr(self, '_m_z_n') else None self._m_z_n = ((KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 8) << 8) + KaitaiStream.byte_array_index(self.eps_solar_panel_curr, 9)) return self._m_z_n if hasattr(self, '_m_z_n') else None class SatStatusT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.sat_status = self._io.read_u1() @property def comms_on(self): if hasattr(self, '_m_comms_on'): return self._m_comms_on if hasattr(self, '_m_comms_on') else None self._m_comms_on = ((self.sat_status >> 5) & 1) return self._m_comms_on if hasattr(self, '_m_comms_on') else None @property def antenna_on(self): if hasattr(self, '_m_antenna_on'): return self._m_antenna_on if hasattr(self, '_m_antenna_on') else None self._m_antenna_on = ((self.sat_status >> 4) & 1) return self._m_antenna_on if hasattr(self, '_m_antenna_on') else None @property def cdh_on(self): if hasattr(self, '_m_cdh_on'): return self._m_cdh_on if hasattr(self, '_m_cdh_on') else None self._m_cdh_on = ((self.sat_status >> 7) & 1) return self._m_cdh_on if hasattr(self, '_m_cdh_on') else None @property def mech(self): if hasattr(self, '_m_mech'): return self._m_mech if hasattr(self, '_m_mech') else None self._m_mech = ((self.sat_status >> 2) & 1) return self._m_mech if hasattr(self, '_m_mech') else None @property def antenna_deployed(self): if hasattr(self, '_m_antenna_deployed'): return self._m_antenna_deployed if hasattr(self, '_m_antenna_deployed') else None self._m_antenna_deployed = ((self.sat_status >> 0) & 1) return self._m_antenna_deployed if hasattr(self, '_m_antenna_deployed') else None @property def thermal(self): if hasattr(self, '_m_thermal'): return self._m_thermal if hasattr(self, '_m_thermal') else None self._m_thermal = ((self.sat_status >> 1) & 1) return self._m_thermal if hasattr(self, '_m_thermal') else None @property def eps_on(self): if hasattr(self, '_m_eps_on'): return self._m_eps_on if hasattr(self, '_m_eps_on') else None self._m_eps_on = ((self.sat_status >> 6) & 1) return self._m_eps_on if hasattr(self, '_m_eps_on') else None @property def payload_on(self): if hasattr(self, '_m_payload_on'): return self._m_payload_on if hasattr(self, '_m_payload_on') else None self._m_payload_on = ((self.sat_status >> 3) & 1) return self._m_payload_on if hasattr(self, '_m_payload_on') else None class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") class Ax25HeaderT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Neudose.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Neudose.SsidMask(self._io, self, self._root) self.src_callsign_raw = Neudose.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Neudose.SsidMask(self._io, self, self._root) self.ctl = self._io.read_u1() self.pid = self._io.read_u1() class CommsStatusT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.comms_status = self._io.read_u1() @property def rtsm_state(self): if hasattr(self, '_m_rtsm_state'): return self._m_rtsm_state if hasattr(self, '_m_rtsm_state') else None self._m_rtsm_state = ((self.comms_status >> 5) & 7) return self._m_rtsm_state if hasattr(self, '_m_rtsm_state') else None @property def rst_reason(self): if hasattr(self, '_m_rst_reason'): return self._m_rst_reason if hasattr(self, '_m_rst_reason') else None self._m_rst_reason = ((self.comms_status >> 2) & 7) return self._m_rst_reason if hasattr(self, '_m_rst_reason') else None @property def boot_img_bank(self): if hasattr(self, '_m_boot_img_bank'): return self._m_boot_img_bank if hasattr(self, '_m_boot_img_bank') else None self._m_boot_img_bank = ((self.comms_status >> 0) & 3) return self._m_boot_img_bank if hasattr(self, '_m_boot_img_bank') else None class EpsChannelCurrOutT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.eps_channel_curr_out = self._io.read_bytes(10) @property def cdh(self): if hasattr(self, '_m_cdh'): return self._m_cdh if hasattr(self, '_m_cdh') else None self._m_cdh = ((KaitaiStream.byte_array_index(self.eps_channel_curr_out, 0) << 8) + KaitaiStream.byte_array_index(self.eps_channel_curr_out, 1)) return self._m_cdh if hasattr(self, '_m_cdh') else None @property def ant(self): if hasattr(self, '_m_ant'): return self._m_ant if hasattr(self, '_m_ant') else None self._m_ant = ((KaitaiStream.byte_array_index(self.eps_channel_curr_out, 6) << 8) + KaitaiStream.byte_array_index(self.eps_channel_curr_out, 7)) return self._m_ant if hasattr(self, '_m_ant') else None @property def comm_3v3(self): if hasattr(self, '_m_comm_3v3'): return self._m_comm_3v3 if hasattr(self, '_m_comm_3v3') else None self._m_comm_3v3 = ((KaitaiStream.byte_array_index(self.eps_channel_curr_out, 2) << 8) + KaitaiStream.byte_array_index(self.eps_channel_curr_out, 3)) return self._m_comm_3v3 if hasattr(self, '_m_comm_3v3') else None @property def comm_5v0(self): if hasattr(self, '_m_comm_5v0'): return self._m_comm_5v0 if hasattr(self, '_m_comm_5v0') else None self._m_comm_5v0 = ((KaitaiStream.byte_array_index(self.eps_channel_curr_out, 4) << 8) + KaitaiStream.byte_array_index(self.eps_channel_curr_out, 5)) return self._m_comm_5v0 if hasattr(self, '_m_comm_5v0') else None @property def pld(self): if hasattr(self, '_m_pld'): return self._m_pld if hasattr(self, '_m_pld') else None self._m_pld = ((KaitaiStream.byte_array_index(self.eps_channel_curr_out, 8) << 8) + KaitaiStream.byte_array_index(self.eps_channel_curr_out, 9)) return self._m_pld if hasattr(self, '_m_pld') else None class CommsTempT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.lna_therm = self._io.read_s1() self.lna_diode = self._io.read_s1() self.stm32_internal = self._io.read_s1() self.cc1125_uhf = self._io.read_s1() self.cc1125_vhf = self._io.read_s1() self.pa_therm = self._io.read_s1() self.pa_diode = self._io.read_s1() self.pa_therm_strap = self._io.read_s1() self.ad7294_internal = self._io.read_s1() class BeaconT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.last_rx_timestamp_raw = self._io.read_u4be() self.packet_version = self._io.read_u1() self.unix_timestamp = self._io.read_u4be() self.sat_status = Neudose.SatStatusT(self._io, self, self._root) self.last_gs_conn_timestamp = self._io.read_u4be() self.eps_status = Neudose.EpsStatusT(self._io, self, self._root) self.eps_uptime = self._io.read_u4be() self.eps_vbat = self._io.read_u2be() self.eps_bat_chrge_curr = self._io.read_u2be() self.eps_bat_dischrge_curr = self._io.read_u2be() self.eps_temp = Neudose.EpsTempT(self._io, self, self._root) self.eps_solar_panel_curr = Neudose.EpsSolarPanelCurrT(self._io, self, self._root) self.eps_channel_curr_out = Neudose.EpsChannelCurrOutT(self._io, self, self._root) self.cdh_curr_state = self._io.read_u1() self.cdh_prev_state = self._io.read_u1() self.cdh_boot_reset_cause = Neudose.CdhBootResetCauseT(self._io, self, self._root) self.cdh_uptime = self._io.read_u4be() self.cdh_temp_mcu_raw = self._io.read_s2be() self.cdh_temp_ram_raw = self._io.read_s2be() self.comms_status = Neudose.CommsStatusT(self._io, self, self._root) self.comms_uptime_raw = self._io.read_u4be() self.comms_ina233_pa_curr_raw = self._io.read_u2be() self.comms_ad7294_pa_curr_raw = self._io.read_u2be() self.comms_ad7294_gate_volt_raw = self._io.read_u2be() self.comms_cc1125_rssi_raw = self._io.read_u2be() self.comms_temp = Neudose.CommsTempT(self._io, self, self._root) self.ant_deployment_status = self._io.read_u1() self.ant_prev_isis_status = self._io.read_u2be() self.pld_status = self._io.read_u1() class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class EpsTempT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.mppt_conv1 = self._io.read_s1() self.mppt_conv2 = self._io.read_s1() self.mppt_conv3 = self._io.read_s1() self.out_conv_3v3 = self._io.read_s1() self.out_conv_5v0 = self._io.read_s1() self.battery_pack = self._io.read_s1() class CspHeaderT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.csp_length = self._io.read_u2be() self.csp_header_raw = self._io.read_u4be() @property def source(self): if hasattr(self, '_m_source'): return self._m_source if hasattr(self, '_m_source') else None self._m_source = ((self.csp_header_raw >> 25) & 31) return self._m_source if hasattr(self, '_m_source') else None @property def source_port(self): if hasattr(self, '_m_source_port'): return self._m_source_port if hasattr(self, '_m_source_port') else None self._m_source_port = ((self.csp_header_raw >> 8) & 63) return self._m_source_port if hasattr(self, '_m_source_port') else None @property def destination_port(self): if hasattr(self, '_m_destination_port'): return self._m_destination_port if hasattr(self, '_m_destination_port') else None self._m_destination_port = ((self.csp_header_raw >> 14) & 63) return self._m_destination_port if hasattr(self, '_m_destination_port') else None @property def rdp(self): if hasattr(self, '_m_rdp'): return self._m_rdp if hasattr(self, '_m_rdp') else None self._m_rdp = ((self.csp_header_raw & 2) >> 1) return self._m_rdp if hasattr(self, '_m_rdp') else None @property def destination(self): if hasattr(self, '_m_destination'): return self._m_destination if hasattr(self, '_m_destination') else None self._m_destination = ((self.csp_header_raw >> 20) & 31) return self._m_destination if hasattr(self, '_m_destination') else None @property def priority(self): if hasattr(self, '_m_priority'): return self._m_priority if hasattr(self, '_m_priority') else None self._m_priority = (self.csp_header_raw >> 30) return self._m_priority if hasattr(self, '_m_priority') else None @property def reserved(self): if hasattr(self, '_m_reserved'): return self._m_reserved if hasattr(self, '_m_reserved') else None self._m_reserved = ((self.csp_header_raw >> 4) & 15) return self._m_reserved if hasattr(self, '_m_reserved') else None @property def xtea(self): if hasattr(self, '_m_xtea'): return self._m_xtea if hasattr(self, '_m_xtea') else None self._m_xtea = ((self.csp_header_raw & 4) >> 2) return self._m_xtea if hasattr(self, '_m_xtea') else None @property def hmac(self): if hasattr(self, '_m_hmac'): return self._m_hmac if hasattr(self, '_m_hmac') else None self._m_hmac = ((self.csp_header_raw & 8) >> 3) return self._m_hmac if hasattr(self, '_m_hmac') else None @property def crc(self): if hasattr(self, '_m_crc'): return self._m_crc if hasattr(self, '_m_crc') else None self._m_crc = (self.csp_header_raw & 1) return self._m_crc if hasattr(self, '_m_crc') else None class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Neudose.Callsign(_io__raw_callsign_ror, self, self._root) class CdhBootResetCauseT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cdh_boot_reset_cause = self._io.read_u1() @property def boot_cause(self): if hasattr(self, '_m_boot_cause'): return self._m_boot_cause if hasattr(self, '_m_boot_cause') else None self._m_boot_cause = ((self.cdh_boot_reset_cause >> 4) & 15) return self._m_boot_cause if hasattr(self, '_m_boot_cause') else None @property def reset_cause(self): if hasattr(self, '_m_reset_cause'): return self._m_reset_cause if hasattr(self, '_m_reset_cause') else None self._m_reset_cause = ((self.cdh_boot_reset_cause >> 0) & 15) return self._m_reset_cause if hasattr(self, '_m_reset_cause') else None class EpsStatusT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.eps_status = self._io.read_u1() @property def gs_wtdg_rst_mark(self): if hasattr(self, '_m_gs_wtdg_rst_mark'): return self._m_gs_wtdg_rst_mark if hasattr(self, '_m_gs_wtdg_rst_mark') else None self._m_gs_wtdg_rst_mark = ((self.eps_status >> 0) & 1) return self._m_gs_wtdg_rst_mark if hasattr(self, '_m_gs_wtdg_rst_mark') else None @property def bat_htr_mode(self): if hasattr(self, '_m_bat_htr_mode'): return self._m_bat_htr_mode if hasattr(self, '_m_bat_htr_mode') else None self._m_bat_htr_mode = ((self.eps_status >> 4) & 1) return self._m_bat_htr_mode if hasattr(self, '_m_bat_htr_mode') else None @property def bat_htr_state(self): if hasattr(self, '_m_bat_htr_state'): return self._m_bat_htr_state if hasattr(self, '_m_bat_htr_state') else None self._m_bat_htr_state = ((self.eps_status >> 5) & 1) return self._m_bat_htr_state if hasattr(self, '_m_bat_htr_state') else None @property def bat_state(self): if hasattr(self, '_m_bat_state'): return self._m_bat_state if hasattr(self, '_m_bat_state') else None self._m_bat_state = ((self.eps_status >> 6) & 3) return self._m_bat_state if hasattr(self, '_m_bat_state') else None @property def last_reset_rsn(self): if hasattr(self, '_m_last_reset_rsn'): return self._m_last_reset_rsn if hasattr(self, '_m_last_reset_rsn') else None self._m_last_reset_rsn = ((self.eps_status >> 1) & 7) return self._m_last_reset_rsn if hasattr(self, '_m_last_reset_rsn') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/neudose.py
0.434941
0.186077
neudose.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Bisonsat(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_frame.ax25_header.src_ssid_raw.ssid :field dest_ssid: ax25_frame.ax25_header.dest_ssid_raw.ssid :field rpt_callsign: ax25_frame.ax25_header.repeater.rpt_instance[0].rpt_callsign_raw.callsign_ror.callsign :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field rtc_time_year: ax25_frame.payload.ax25_info.rtc_time_year :field rtc_time_month: ax25_frame.payload.ax25_info.rtc_time_month :field rtc_time_day: ax25_frame.payload.ax25_info.rtc_time_day :field rtc_time_hour: ax25_frame.payload.ax25_info.rtc_time_hour :field rtc_time_minutes: ax25_frame.payload.ax25_info.rtc_time_minutes :field rtc_time_seconds: ax25_frame.payload.ax25_info.rtc_time_seconds :field rtc_time_th: ax25_frame.payload.ax25_info.rtc_time_th :field os_ticks: ax25_frame.payload.ax25_info.os_ticks :field last_cmd_1: ax25_frame.payload.ax25_info.last_cmd_1 :field last_cmd_2: ax25_frame.payload.ax25_info.last_cmd_2 :field cmd_queue_length: ax25_frame.payload.ax25_info.cmd_queue_length :field filename_jpeg: ax25_frame.payload.ax25_info.filename_jpeg :field filename_raw: ax25_frame.payload.ax25_info.filename_raw :field cdh_reset_events: ax25_frame.payload.ax25_info.cdh_reset_events :field y_plus_current: ax25_frame.payload.ax25_info.y_plus_current :field y_plus_temperature: ax25_frame.payload.ax25_info.y_plus_temperature :field y_pair_voltage: ax25_frame.payload.ax25_info.y_pair_voltage :field x_minus_current: ax25_frame.payload.ax25_info.x_minus_current :field x_minus_temperature: ax25_frame.payload.ax25_info.x_minus_temperature :field x_pair_voltage: ax25_frame.payload.ax25_info.x_pair_voltage :field x_plus_current: ax25_frame.payload.ax25_info.x_plus_current :field x_plus_temperature: ax25_frame.payload.ax25_info.x_plus_temperature :field z_pair_voltage: ax25_frame.payload.ax25_info.z_pair_voltage :field z_plus__current: ax25_frame.payload.ax25_info.z_plus__current :field z_plus_temperature: ax25_frame.payload.ax25_info.z_plus_temperature :field y_minus_current: ax25_frame.payload.ax25_info.y_minus_current :field y_minus_temperature: ax25_frame.payload.ax25_info.y_minus_temperature :field battery_current: ax25_frame.payload.ax25_info.battery_current :field battery1_temperature: ax25_frame.payload.ax25_info.battery1_temperature :field battery1_full_voltage: ax25_frame.payload.ax25_info.battery1_full_voltage :field battery1_current_direction: ax25_frame.payload.ax25_info.battery1_current_direction :field battery1_current: ax25_frame.payload.ax25_info.battery1_current :field battery0_temperature: ax25_frame.payload.ax25_info.battery0_temperature :field battery0_full_voltage: ax25_frame.payload.ax25_info.battery0_full_voltage :field bus_current_5v: ax25_frame.payload.ax25_info.bus_current_5v :field bus_current_3v3: ax25_frame.payload.ax25_info.bus_current_3v3 :field battery0_current_direction: ax25_frame.payload.ax25_info.battery0_current_direction :field battery0_current: ax25_frame.payload.ax25_info.battery0_current :field z_minus_temperature: ax25_frame.payload.ax25_info.z_minus_temperature :field z_minus_current: ax25_frame.payload.ax25_info.z_minus_current :field hmb_accelx: ax25_frame.payload.ax25_info.hmb_accelx :field hmb_accely: ax25_frame.payload.ax25_info.hmb_accely :field hmb_accelz: ax25_frame.payload.ax25_info.hmb_accelz :field hmb_temperature: ax25_frame.payload.ax25_info.hmb_temperature :field hmb_gyrox: ax25_frame.payload.ax25_info.hmb_gyrox :field hmb_gyroy: ax25_frame.payload.ax25_info.hmb_gyroy :field hmb_gyroz: ax25_frame.payload.ax25_info.hmb_gyroz :field hmb_magx: ax25_frame.payload.ax25_info.hmb_magx :field hmb_magy: ax25_frame.payload.ax25_info.hmb_magy :field hmb_magz: ax25_frame.payload.ax25_info.hmb_magz :field task_rst_status: ax25_frame.payload.ax25_info.task_rst_status :field task_antenna_deploy_status: ax25_frame.payload.ax25_info.task_antenna_deploy_status :field task_telemetry_gather_status: ax25_frame.payload.ax25_info.task_telemetry_gather_status :field task_image_capture_status: ax25_frame.payload.ax25_info.task_image_capture_status :field task_jpeg_status: ax25_frame.payload.ax25_info.task_jpeg_status :field task_com_receive_status: ax25_frame.payload.ax25_info.task_com_receive_status :field task_cmd_decoder_status: ax25_frame.payload.ax25_info.task_cmd_decoder_status :field task_bisonsat_cmd_decoder_status: ax25_frame.payload.ax25_info.task_bisonsat_cmd_decoder_status :field task_tranmit_image_status: ax25_frame.payload.ax25_info.task_tranmit_image_status :field cdh_wdt_events: ax25_frame.payload.ax25_info.cdh_wdt_events :field eps_status: ax25_frame.payload.ax25_info.eps_status .. seealso:: Source - http://cubesat.skc.edu/beacon-decoding-information/ """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Bisonsat.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Bisonsat.Ax25Header(self._io, self, self._root) _on = (self.ax25_header.ctl & 19) if _on == 0: self.payload = Bisonsat.IFrame(self._io, self, self._root) elif _on == 3: self.payload = Bisonsat.UiFrame(self._io, self, self._root) elif _on == 19: self.payload = Bisonsat.UiFrame(self._io, self, self._root) elif _on == 16: self.payload = Bisonsat.IFrame(self._io, self, self._root) elif _on == 18: self.payload = Bisonsat.IFrame(self._io, self, self._root) elif _on == 2: self.payload = Bisonsat.IFrame(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Bisonsat.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Bisonsat.SsidMask(self._io, self, self._root) self.src_callsign_raw = Bisonsat.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Bisonsat.SsidMask(self._io, self, self._root) if (self.src_ssid_raw.ssid_mask & 1) == 0: self.repeater = Bisonsat.Repeater(self._io, self, self._root) self.ctl = self._io.read_u1() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Bisonsat.Ax25InfoData(_io__raw_ax25_info, self, self._root) class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") class IFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Bisonsat.Ax25InfoData(_io__raw_ax25_info, self, self._root) class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class Repeaters(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_callsign_raw = Bisonsat.CallsignRaw(self._io, self, self._root) self.rpt_ssid_raw = Bisonsat.SsidMask(self._io, self, self._root) class Repeater(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_instance = [] i = 0 while True: _ = Bisonsat.Repeaters(self._io, self, self._root) self.rpt_instance.append(_) if (_.rpt_ssid_raw.ssid_mask & 1) == 1: break i += 1 class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Bisonsat.Callsign(_io__raw_callsign_ror, self, self._root) class Ax25InfoData(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.offset = (self._io.read_bytes(7)).decode(u"ASCII") self.preamble = (self._io.read_bytes(3)).decode(u"ASCII") self.call_sign = (self._io.read_bytes(6)).decode(u"ASCII") self.rtc_time_year = self._io.read_u1() self.rtc_time_month = self._io.read_u1() self.rtc_time_day = self._io.read_u1() self.rtc_time_hour = self._io.read_u1() self.rtc_time_minutes = self._io.read_u1() self.rtc_time_seconds = self._io.read_u1() self.rtc_time_th = self._io.read_u1() self.os_ticks = self._io.read_u4le() self.last_cmd_1 = self._io.read_u1() self.last_cmd_2 = self._io.read_u1() self.cmd_queue_length = self._io.read_u1() self.filename_jpeg = (self._io.read_bytes(8)).decode(u"ASCII") self.filename_raw = (self._io.read_bytes(8)).decode(u"ASCII") self.cdh_reset_events = self._io.read_u1() self.y_plus_current = self._io.read_u2le() self.y_plus_temperature = self._io.read_u2le() self.y_pair_voltage = self._io.read_u2le() self.x_minus_current = self._io.read_u2le() self.x_minus_temperature = self._io.read_u2le() self.x_pair_voltage = self._io.read_u2le() self.x_plus_current = self._io.read_u2le() self.x_plus_temperature = self._io.read_u2le() self.z_pair_voltage = self._io.read_u2le() self.z_plus__current = self._io.read_u2le() self.z_plus_temperature = self._io.read_u2le() self.y_minus_current = self._io.read_u2le() self.y_minus_temperature = self._io.read_u2le() self.battery_current = self._io.read_u2le() self.battery1_temperature = self._io.read_u2le() self.battery1_full_voltage = self._io.read_u2le() self.battery1_current_direction = self._io.read_u2le() self.battery1_current = self._io.read_u2le() self.battery0_temperature = self._io.read_u2le() self.battery0_full_voltage = self._io.read_u2le() self.bus_current_5v = self._io.read_u2le() self.bus_current_3v3 = self._io.read_u2le() self.battery0_current_direction = self._io.read_u2le() self.battery0_current = self._io.read_u2le() self.z_minus_temperature = self._io.read_u2le() self.z_minus_current = self._io.read_u2le() self.hmb_accelx = self._io.read_u2le() self.hmb_accely = self._io.read_u2le() self.hmb_accelz = self._io.read_u2le() self.hmb_temperature = self._io.read_u2le() self.hmb_gyrox = self._io.read_u2le() self.hmb_gyroy = self._io.read_u2le() self.hmb_gyroz = self._io.read_u2le() self.hmb_magx = self._io.read_u2le() self.hmb_magy = self._io.read_u2le() self.hmb_magz = self._io.read_u2le() self.task_rst_status = self._io.read_u1() self.task_antenna_deploy_status = self._io.read_u1() self.task_telemetry_gather_status = self._io.read_u1() self.task_image_capture_status = self._io.read_u1() self.task_jpeg_status = self._io.read_u1() self.task_com_receive_status = self._io.read_u1() self.task_cmd_decoder_status = self._io.read_u1() self.task_bisonsat_cmd_decoder_status = self._io.read_u1() self.task_tranmit_image_status = self._io.read_u1() self.cdh_wdt_events = self._io.read_u1() self.eps_status = self._io.read_u2le()
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/bisonsat.py
0.557364
0.16654
bisonsat.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Grizu263a(KaitaiStruct): """:field teamid: header.teamid :field year: header.year :field month: header.month :field date: header.date :field hour: header.hour :field minute: header.minute :field second: header.second :field temp: header.temp :field epstoobcina1_current: header.epstoobcina1_current :field epstoobcina1_busvoltage: header.epstoobcina1_busvoltage :field epsina2_current: header.epsina2_current :field epsina2_busvoltage: header.epsina2_busvoltage :field baseina3_current: header.baseina3_current :field baseina3_busvoltage: header.baseina3_busvoltage :field topina4_current: header.topina4_current :field topina4_busvoltage: header.topina4_busvoltage :field behindantenina5_current: header.behindantenina5_current :field behindantenina5_busvoltage: header.behindantenina5_busvoltage :field rightsideina6_current: header.rightsideina6_current :field rightsideina6_busvoltage: header.rightsideina6_busvoltage :field leftsideina7_current: header.leftsideina7_current :field leftsideina7_busvoltage: header.leftsideina7_busvoltage :field imumx: header.imumx :field imumy: header.imumy :field imumz: header.imumz :field imuax: header.imuax :field imuay: header.imuay :field imuaz: header.imuaz :field imugx: header.imugx :field imugy: header.imugy :field imugz: header.imugz """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.header = Grizu263a.Header(self._io, self, self._root) class Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pad = self._io.read_bytes(1) self.teamid = (self._io.read_bytes(6)).decode(u"ASCII") if not ((self.teamid == u"YM2VRZ")) : raise kaitaistruct.ValidationNotAnyOfError(self.teamid, self._io, u"/types/header/seq/1") self.year = self._io.read_u1() self.month = self._io.read_u1() self.date = self._io.read_u1() self.hour = self._io.read_u1() self.minute = self._io.read_u1() self.second = self._io.read_u1() self.temp = self._io.read_s2le() self.epstoobcina1_current = self._io.read_u2le() self.epstoobcina1_busvoltage = self._io.read_u2le() self.epsina2_current = self._io.read_u2le() self.epsina2_busvoltage = self._io.read_u2le() self.baseina3_current = self._io.read_u2le() self.baseina3_busvoltage = self._io.read_u2le() self.topina4_current = self._io.read_u2le() self.topina4_busvoltage = self._io.read_u2le() self.behindantenina5_current = self._io.read_u2le() self.behindantenina5_busvoltage = self._io.read_u2le() self.rightsideina6_current = self._io.read_u2le() self.rightsideina6_busvoltage = self._io.read_u2le() self.leftsideina7_current = self._io.read_u2le() self.leftsideina7_busvoltage = self._io.read_u2le() self.imumx = self._io.read_s2le() self.imumy = self._io.read_s2le() self.imumz = self._io.read_s2le() self.imuax = self._io.read_s2le() self.imuay = self._io.read_s2le() self.imuaz = self._io.read_s2le() self.imugx = self._io.read_s2le() self.imugy = self._io.read_s2le() self.imugz = self._io.read_s2le()
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/grizu263a.py
0.506591
0.173813
grizu263a.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Ledsat(KaitaiStruct): """:field priority: csp_header.priority :field source: csp_header.source :field destination: csp_header.destination :field destination_port: csp_header.destination_port :field source_port: csp_header.source_port :field reserved: csp_header.reserved :field hmac: csp_header.hmac :field xtea: csp_header.xtea :field rdp: csp_header.rdp :field crc: csp_header.crc :field telemetry_identifier: csp_data.payload.telemetry_identifier :field unix_ts_ms: csp_data.payload.unix_ts_ms :field unix_ts_s: csp_data.payload.unix_ts_s :field tlm_process_time: csp_data.payload.tlm_process_time :field panel_x_voltage: csp_data.payload.panel_x_voltage :field panel_y_voltage: csp_data.payload.panel_y_voltage :field panel_z_voltage: csp_data.payload.panel_z_voltage :field panel_x_current: csp_data.payload.panel_x_current :field panel_y_current: csp_data.payload.panel_y_current :field panel_z_current: csp_data.payload.panel_z_current :field eps_boot_cause: csp_data.payload.eps_boot_cause :field eps_battery_mode: csp_data.payload.eps_battery_mode :field mppt_x_temp: csp_data.payload.mppt_x_temp :field mppt_y_temp: csp_data.payload.mppt_y_temp :field eps_board_temp: csp_data.payload.eps_board_temp :field battery_pack1_temp: csp_data.payload.battery_pack1_temp :field battery_pack2_temp: csp_data.payload.battery_pack2_temp :field battery_pack3_temp: csp_data.payload.battery_pack3_temp :field solar_current: csp_data.payload.solar_current :field system_current: csp_data.payload.system_current :field battery_voltage: csp_data.payload.battery_voltage :field gps_current: csp_data.payload.gps_current :field eps_boot_count: csp_data.payload.eps_boot_count :field trx_pa_temp: csp_data.payload.trx_pa_temp :field trx_total_tx_cnt: csp_data.payload.trx_total_tx_cnt :field trx_total_rx_cnt: csp_data.payload.trx_total_rx_cnt :field last_rssi: csp_data.payload.last_rssi :field radio_boot_cnt: csp_data.payload.radio_boot_cnt :field obc_temp_1: csp_data.payload.obc_temp_1 :field obc_temp_2: csp_data.payload.obc_temp_2 :field gyro_x: csp_data.payload.gyro_x :field gyro_y: csp_data.payload.gyro_y :field gyro_z: csp_data.payload.gyro_z :field mag_x: csp_data.payload.mag_x :field mag_y: csp_data.payload.mag_y :field mag_z: csp_data.payload.mag_z :field px_solar_panel_temp: csp_data.payload.px_solar_panel_temp :field py_solar_panel_temp: csp_data.payload.py_solar_panel_temp :field nx_solar_panel_temp: csp_data.payload.nx_solar_panel_temp :field ny_solar_panel_temp: csp_data.payload.ny_solar_panel_temp :field pz_solar_panel_temp: csp_data.payload.pz_solar_panel_temp :field nz_solar_panel_temp: csp_data.payload.nz_solar_panel_temp :field px_sun_sensor_coarse: csp_data.payload.px_sun_sensor_coarse :field py_sun_sensor_coarse: csp_data.payload.py_sun_sensor_coarse :field pz_sun_sensor_coarse: csp_data.payload.pz_sun_sensor_coarse :field nx_sun_sensor_coarse: csp_data.payload.nx_sun_sensor_coarse :field ny_sun_sensor_coarse: csp_data.payload.ny_sun_sensor_coarse :field nz_sun_sensor_coarse: csp_data.payload.nz_sun_sensor_coarse :field eps_outputs_status: csp_data.payload.eps_outputs_status :field obc_boot_counter: csp_data.payload.obc_boot_counter :field leds_status: csp_data.payload.leds_status :field gps_status: csp_data.payload.gps_status :field gps_fix_time: csp_data.payload.gps_fix_time :field gps_lat: csp_data.payload.gps_lat :field gps_lon: csp_data.payload.gps_lon :field gps_alt: csp_data.payload.gps_alt :field software_status: csp_data.payload.software_status :field ext_gyro_x: csp_data.payload.ext_gyro_x :field ext_gyro_y: csp_data.payload.ext_gyro_y :field ext_gyro_z: csp_data.payload.ext_gyro_z :field ext_mag_x: csp_data.payload.ext_mag_x :field ext_mag_y: csp_data.payload.ext_mag_y :field ext_mag_z: csp_data.payload.ext_mag_z :field framelength: framelength """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.csp_header = Ledsat.CspHeaderT(self._io, self, self._root) self.csp_data = Ledsat.CspDataT(self._io, self, self._root) class CspHeaderT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.raw_csp_header = self._io.read_u4be() @property def source(self): if hasattr(self, '_m_source'): return self._m_source if hasattr(self, '_m_source') else None self._m_source = ((self.raw_csp_header >> 25) & 31) return self._m_source if hasattr(self, '_m_source') else None @property def source_port(self): if hasattr(self, '_m_source_port'): return self._m_source_port if hasattr(self, '_m_source_port') else None self._m_source_port = ((self.raw_csp_header >> 8) & 63) return self._m_source_port if hasattr(self, '_m_source_port') else None @property def destination_port(self): if hasattr(self, '_m_destination_port'): return self._m_destination_port if hasattr(self, '_m_destination_port') else None self._m_destination_port = ((self.raw_csp_header >> 14) & 63) return self._m_destination_port if hasattr(self, '_m_destination_port') else None @property def rdp(self): if hasattr(self, '_m_rdp'): return self._m_rdp if hasattr(self, '_m_rdp') else None self._m_rdp = ((self.raw_csp_header & 2) >> 1) return self._m_rdp if hasattr(self, '_m_rdp') else None @property def destination(self): if hasattr(self, '_m_destination'): return self._m_destination if hasattr(self, '_m_destination') else None self._m_destination = ((self.raw_csp_header >> 20) & 31) return self._m_destination if hasattr(self, '_m_destination') else None @property def priority(self): if hasattr(self, '_m_priority'): return self._m_priority if hasattr(self, '_m_priority') else None self._m_priority = (self.raw_csp_header >> 30) return self._m_priority if hasattr(self, '_m_priority') else None @property def reserved(self): if hasattr(self, '_m_reserved'): return self._m_reserved if hasattr(self, '_m_reserved') else None self._m_reserved = ((self.raw_csp_header >> 4) & 15) return self._m_reserved if hasattr(self, '_m_reserved') else None @property def xtea(self): if hasattr(self, '_m_xtea'): return self._m_xtea if hasattr(self, '_m_xtea') else None self._m_xtea = ((self.raw_csp_header & 4) >> 2) return self._m_xtea if hasattr(self, '_m_xtea') else None @property def hmac(self): if hasattr(self, '_m_hmac'): return self._m_hmac if hasattr(self, '_m_hmac') else None self._m_hmac = ((self.raw_csp_header & 8) >> 3) return self._m_hmac if hasattr(self, '_m_hmac') else None @property def crc(self): if hasattr(self, '_m_crc'): return self._m_crc if hasattr(self, '_m_crc') else None self._m_crc = (self.raw_csp_header & 1) return self._m_crc if hasattr(self, '_m_crc') else None class CspDataT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): _on = self._parent.csp_header.destination_port if _on == 8: self.payload = Ledsat.LedsatTlmT(self._io, self, self._root) class LedsatTlmT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.telemetry_identifier = self._io.read_u2be() if not ((self.telemetry_identifier == 5672) or (self.telemetry_identifier == 5673) or (self.telemetry_identifier == 5674)) : raise kaitaistruct.ValidationNotAnyOfError(self.telemetry_identifier, self._io, u"/types/ledsat_tlm_t/seq/0") self.unix_ts_ms = self._io.read_u2be() self.unix_ts_s = self._io.read_u4be() self.tlm_process_time = self._io.read_u2be() self.panel_x_voltage = self._io.read_u2be() self.panel_y_voltage = self._io.read_u2be() self.panel_z_voltage = self._io.read_u2be() self.panel_x_current = self._io.read_u2be() self.panel_y_current = self._io.read_u2be() self.panel_z_current = self._io.read_u2be() self.eps_boot_cause = self._io.read_u1() self.eps_battery_mode = self._io.read_u1() self.mppt_x_temp = self._io.read_s2be() self.mppt_y_temp = self._io.read_s2be() self.eps_board_temp = self._io.read_s2be() self.battery_pack1_temp = self._io.read_s2be() self.battery_pack2_temp = self._io.read_s2be() self.battery_pack3_temp = self._io.read_s2be() self.solar_current = self._io.read_u2be() self.system_current = self._io.read_u2be() self.battery_voltage = self._io.read_u2be() self.gps_current = self._io.read_u1() self.pad_0 = self._io.read_u1() self.eps_boot_count = self._io.read_u2be() self.trx_pa_temp = self._io.read_s2be() self.trx_total_tx_cnt = self._io.read_u4be() self.trx_total_rx_cnt = self._io.read_u4be() self.last_rssi = self._io.read_s2be() self.radio_boot_cnt = self._io.read_u2be() self.obc_temp_1 = self._io.read_s2be() self.obc_temp_2 = self._io.read_s2be() self.gyro_x = self._io.read_s2be() self.gyro_y = self._io.read_s2be() self.gyro_z = self._io.read_s2be() self.mag_x = self._io.read_s2be() self.mag_y = self._io.read_s2be() self.mag_z = self._io.read_s2be() self.px_solar_panel_temp = self._io.read_s2be() self.py_solar_panel_temp = self._io.read_s2be() self.nx_solar_panel_temp = self._io.read_s2be() self.ny_solar_panel_temp = self._io.read_s2be() self.pz_solar_panel_temp = self._io.read_s2be() self.nz_solar_panel_temp = self._io.read_s2be() self.px_sun_sensor_coarse = self._io.read_u2be() self.py_sun_sensor_coarse = self._io.read_u2be() self.pz_sun_sensor_coarse = self._io.read_u2be() self.nx_sun_sensor_coarse = self._io.read_u2be() self.ny_sun_sensor_coarse = self._io.read_u2be() self.nz_sun_sensor_coarse = self._io.read_u2be() self.eps_outputs_status = self._io.read_u1() self.pad_1 = self._io.read_u1() self.obc_boot_counter = self._io.read_s2be() self.leds_status = self._io.read_u1() self.pad_2 = self._io.read_u1() self.gps_status = self._io.read_u1() self.pad_3 = self._io.read_u1() self.gps_fix_time = self._io.read_u4be() self.gps_lat = self._io.read_s4be() self.gps_lon = self._io.read_s4be() self.gps_alt = self._io.read_s4be() self.software_status = self._io.read_u1() self.pad_4 = self._io.read_u1() self.ext_gyro_x = self._io.read_s2be() self.ext_gyro_y = self._io.read_s2be() self.ext_gyro_z = self._io.read_s2be() self.ext_mag_x = self._io.read_s2be() self.ext_mag_y = self._io.read_s2be() self.ext_mag_z = self._io.read_s2be() self.pad_5 = self._io.read_u2be() @property def framelength(self): if hasattr(self, '_m_framelength'): return self._m_framelength if hasattr(self, '_m_framelength') else None self._m_framelength = self._io.size() return self._m_framelength if hasattr(self, '_m_framelength') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/ledsat.py
0.541651
0.246749
ledsat.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Irazu(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_frame.ax25_header.src_ssid_raw.ssid :field dest_ssid: ax25_frame.ax25_header.dest_ssid_raw.ssid :field rpt_callsign: ax25_frame.ax25_header.repeater.rpt_instance[0].rpt_callsign_raw.callsign_ror.callsign :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field beacon_verf_code: ax25_frame.payload.ax25_info.data.beacon_verf_code :field time_sync: ax25_frame.payload.ax25_info.data.time_sync_int :field timestamp: ax25_frame.payload.ax25_info.data.timestamp :field mission_files: ax25_frame.payload.ax25_info.data.mission_files_int :field buffers_free: ax25_frame.payload.ax25_info.data.buffers_free_int :field last_rssi: ax25_frame.payload.ax25_info.data.last_rssi_int :field obc_temp1: ax25_frame.payload.ax25_info.data.obc_temp1_flt :field obc_temp2: ax25_frame.payload.ax25_info.data.obc_temp2_flt :field com_temp_pa: ax25_frame.payload.ax25_info.data.com_temp_pa_int :field com_temp_mcu: ax25_frame.payload.ax25_info.data.com_temp_mcu_int :field eps_temp_t4: ax25_frame.payload.ax25_info.data.eps_temp_t4_int :field bat_voltage: ax25_frame.payload.ax25_info.data.bat_voltage_int :field cur_sun: ax25_frame.payload.ax25_info.data.cur_sun_int :field cur_sys: ax25_frame.payload.ax25_info.data.cur_sys_int :field batt_mode: ax25_frame.payload.ax25_info.data.batt_mode_int :field panel1_voltage: ax25_frame.payload.ax25_info.data.panel1_voltage_int :field panel2_voltage: ax25_frame.payload.ax25_info.data.panel2_voltage_int :field panel3_voltage: ax25_frame.payload.ax25_info.data.panel3_voltage_int :field panel1_current: ax25_frame.payload.ax25_info.data.panel1_current_int :field panel2_current: ax25_frame.payload.ax25_info.data.panel2_current_int :field panel3_current: ax25_frame.payload.ax25_info.data.panel3_current_int :field bat_bootcount: ax25_frame.payload.ax25_info.data.bat_bootcount_int :field gyro_x: ax25_frame.payload.ax25_info.data.gyro_x_flt :field gyro_y: ax25_frame.payload.ax25_info.data.gyro_y_flt :field gyro_z: ax25_frame.payload.ax25_info.data.gyro_z_flt :field magneto_x: ax25_frame.payload.ax25_info.data.magneto_x_flt :field magneto_y: ax25_frame.payload.ax25_info.data.magneto_y_flt :field magneto_z: ax25_frame.payload.ax25_info.data.magneto_z_flt Attention: `rpt_callsign` cannot be accessed because `rpt_instance` is an array of unknown size at the beginning of the parsing process! Left an example in here. """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Irazu.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Irazu.Ax25Header(self._io, self, self._root) _on = (self.ax25_header.ctl & 19) if _on == 0: self.payload = Irazu.IFrame(self._io, self, self._root) elif _on == 3: self.payload = Irazu.UiFrame(self._io, self, self._root) elif _on == 19: self.payload = Irazu.UiFrame(self._io, self, self._root) elif _on == 16: self.payload = Irazu.IFrame(self._io, self, self._root) elif _on == 18: self.payload = Irazu.IFrame(self._io, self, self._root) elif _on == 2: self.payload = Irazu.IFrame(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Irazu.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Irazu.SsidMask(self._io, self, self._root) self.src_callsign_raw = Irazu.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Irazu.SsidMask(self._io, self, self._root) if (self.src_ssid_raw.ssid_mask & 1) == 0: self.repeater = Irazu.Repeater(self._io, self, self._root) self.ctl = self._io.read_u1() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Irazu.Ax25InfoData(_io__raw_ax25_info, self, self._root) class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") class IFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Irazu.Ax25InfoData(_io__raw_ax25_info, self, self._root) class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class Beacon(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.prefix = self._io.read_bytes(4) self.beacon_verf_code = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.time_sync_label = (self._io.read_bytes(1)).decode(u"utf-8") self.time_sync = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.timestamp_label = (self._io.read_bytes(1)).decode(u"utf-8") self.timestamp = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.mission_files_label = (self._io.read_bytes(1)).decode(u"utf-8") self.mission_files = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.buffers_free_label = (self._io.read_bytes(1)).decode(u"utf-8") self.buffers_free = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.last_rssi_label = (self._io.read_bytes(1)).decode(u"utf-8") self.last_rssi = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.obc_temperature_label = (self._io.read_bytes(1)).decode(u"utf-8") self.obc_temp1_int = (self._io.read_bytes_term(46, False, True, True)).decode(u"utf-8") self.obc_temp1_frac = (self._io.read_bytes_term(47, False, True, True)).decode(u"utf-8") self.obc_temp2_int = (self._io.read_bytes_term(46, False, True, True)).decode(u"utf-8") self.obc_temp2_frac = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.com_temperature_label = (self._io.read_bytes(1)).decode(u"utf-8") self.com_temp_pa = (self._io.read_bytes_term(47, False, True, True)).decode(u"utf-8") self.com_temp_mcu = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.eps_temp_label = (self._io.read_bytes(1)).decode(u"utf-8") self.eps_temp_t4 = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.bat_voltage_label = (self._io.read_bytes(1)).decode(u"utf-8") self.bat_voltage = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.cur_sun_label = (self._io.read_bytes(1)).decode(u"utf-8") self.cur_sun = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.cur_sys_label = (self._io.read_bytes(1)).decode(u"utf-8") self.cur_sys = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.batt_mode_label = (self._io.read_bytes(1)).decode(u"utf-8") self.batt_mode = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.panels_voltage_label = (self._io.read_bytes(1)).decode(u"utf-8") self.panel1_voltage = (self._io.read_bytes_term(47, False, True, True)).decode(u"utf-8") self.panel2_voltage = (self._io.read_bytes_term(47, False, True, True)).decode(u"utf-8") self.panel3_voltage = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.panels_current_label = (self._io.read_bytes(1)).decode(u"utf-8") self.panel1_current = (self._io.read_bytes_term(47, False, True, True)).decode(u"utf-8") self.panel2_current = (self._io.read_bytes_term(47, False, True, True)).decode(u"utf-8") self.panel3_current = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.bat_bootcount_label = (self._io.read_bytes(1)).decode(u"utf-8") self.bat_bootcount = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.gyro_label = (self._io.read_bytes(1)).decode(u"utf-8") self.gyro_x_int = (self._io.read_bytes_term(46, False, True, True)).decode(u"utf-8") self.gyro_x_frac = (self._io.read_bytes_term(47, False, True, True)).decode(u"utf-8") self.gyro_y_int = (self._io.read_bytes_term(46, False, True, True)).decode(u"utf-8") self.gyro_y_frac = (self._io.read_bytes_term(47, False, True, True)).decode(u"utf-8") self.gyro_z_int = (self._io.read_bytes_term(46, False, True, True)).decode(u"utf-8") self.gyro_z_frac = (self._io.read_bytes_term(44, False, True, True)).decode(u"utf-8") self.magneto_label = (self._io.read_bytes(1)).decode(u"utf-8") self.magneto_x_int = (self._io.read_bytes_term(46, False, True, True)).decode(u"utf-8") self.magneto_x_frac = (self._io.read_bytes_term(47, False, True, True)).decode(u"utf-8") self.magneto_y_int = (self._io.read_bytes_term(46, False, True, True)).decode(u"utf-8") self.magneto_y_frac = (self._io.read_bytes_term(47, False, True, True)).decode(u"utf-8") self.magneto_z_int = (self._io.read_bytes_term(46, False, True, True)).decode(u"utf-8") self.magneto_z_frac = (self._io.read_bytes_term(0, False, True, True)).decode(u"utf-8") self.suffix = self._io.read_bytes(5) @property def magneto_y_flt(self): """R[1].""" if hasattr(self, '_m_magneto_y_flt'): return self._m_magneto_y_flt if hasattr(self, '_m_magneto_y_flt') else None self._m_magneto_y_flt = (int(self.magneto_y_int) + ((((int(int(self.magneto_y_int) < 0) * -2) + 1) * int(self.magneto_y_frac)) / 1000.0)) return self._m_magneto_y_flt if hasattr(self, '_m_magneto_y_flt') else None @property def batt_mode_int(self): """M.""" if hasattr(self, '_m_batt_mode_int'): return self._m_batt_mode_int if hasattr(self, '_m_batt_mode_int') else None self._m_batt_mode_int = int(self.batt_mode) return self._m_batt_mode_int if hasattr(self, '_m_batt_mode_int') else None @property def time_sync_int(self): """A.""" if hasattr(self, '_m_time_sync_int'): return self._m_time_sync_int if hasattr(self, '_m_time_sync_int') else None self._m_time_sync_int = int(self.time_sync) return self._m_time_sync_int if hasattr(self, '_m_time_sync_int') else None @property def panel2_voltage_int(self): """N[1].""" if hasattr(self, '_m_panel2_voltage_int'): return self._m_panel2_voltage_int if hasattr(self, '_m_panel2_voltage_int') else None self._m_panel2_voltage_int = int(self.panel2_voltage) return self._m_panel2_voltage_int if hasattr(self, '_m_panel2_voltage_int') else None @property def panel1_current_int(self): """O[0].""" if hasattr(self, '_m_panel1_current_int'): return self._m_panel1_current_int if hasattr(self, '_m_panel1_current_int') else None self._m_panel1_current_int = int(self.panel1_current) return self._m_panel1_current_int if hasattr(self, '_m_panel1_current_int') else None @property def obc_temp2_flt(self): """G[1].""" if hasattr(self, '_m_obc_temp2_flt'): return self._m_obc_temp2_flt if hasattr(self, '_m_obc_temp2_flt') else None self._m_obc_temp2_flt = (int(self.obc_temp2_int) + ((((int(int(self.obc_temp2_int) < 0) * -2) + 1) * int(self.obc_temp2_frac)) / 100.0)) return self._m_obc_temp2_flt if hasattr(self, '_m_obc_temp2_flt') else None @property def gyro_y_flt(self): """Q[1].""" if hasattr(self, '_m_gyro_y_flt'): return self._m_gyro_y_flt if hasattr(self, '_m_gyro_y_flt') else None self._m_gyro_y_flt = (int(self.gyro_y_int) + ((((int(int(self.gyro_y_int) < 0) * -2) + 1) * int(self.gyro_y_frac)) / 1000000.0)) return self._m_gyro_y_flt if hasattr(self, '_m_gyro_y_flt') else None @property def magneto_z_flt(self): """R[2].""" if hasattr(self, '_m_magneto_z_flt'): return self._m_magneto_z_flt if hasattr(self, '_m_magneto_z_flt') else None self._m_magneto_z_flt = (int(self.magneto_z_int) + ((((int(int(self.magneto_z_int) < 0) * -2) + 1) * int(self.magneto_z_frac)) / 1000.0)) return self._m_magneto_z_flt if hasattr(self, '_m_magneto_z_flt') else None @property def gyro_x_flt(self): """Q[0].""" if hasattr(self, '_m_gyro_x_flt'): return self._m_gyro_x_flt if hasattr(self, '_m_gyro_x_flt') else None self._m_gyro_x_flt = (int(self.gyro_x_int) + ((((int(int(self.gyro_x_int) < 0) * -2) + 1) * int(self.gyro_x_frac)) / 1000000.0)) return self._m_gyro_x_flt if hasattr(self, '_m_gyro_x_flt') else None @property def magneto_x_flt(self): """R[0].""" if hasattr(self, '_m_magneto_x_flt'): return self._m_magneto_x_flt if hasattr(self, '_m_magneto_x_flt') else None self._m_magneto_x_flt = (int(self.magneto_x_int) + ((((int(int(self.magneto_x_int) < 0) * -2) + 1) * int(self.magneto_x_frac)) / 1000.0)) return self._m_magneto_x_flt if hasattr(self, '_m_magneto_x_flt') else None @property def panel2_current_int(self): """O[1].""" if hasattr(self, '_m_panel2_current_int'): return self._m_panel2_current_int if hasattr(self, '_m_panel2_current_int') else None self._m_panel2_current_int = int(self.panel2_current) return self._m_panel2_current_int if hasattr(self, '_m_panel2_current_int') else None @property def com_temp_mcu_int(self): """H[1].""" if hasattr(self, '_m_com_temp_mcu_int'): return self._m_com_temp_mcu_int if hasattr(self, '_m_com_temp_mcu_int') else None self._m_com_temp_mcu_int = int(self.com_temp_mcu) return self._m_com_temp_mcu_int if hasattr(self, '_m_com_temp_mcu_int') else None @property def obc_temp1_flt(self): """G[0].""" if hasattr(self, '_m_obc_temp1_flt'): return self._m_obc_temp1_flt if hasattr(self, '_m_obc_temp1_flt') else None self._m_obc_temp1_flt = (int(self.obc_temp1_int) + ((((int(int(self.obc_temp1_int) < 0) * -2) + 1) * int(self.obc_temp1_frac)) / 100.0)) return self._m_obc_temp1_flt if hasattr(self, '_m_obc_temp1_flt') else None @property def panel3_voltage_int(self): """N[2].""" if hasattr(self, '_m_panel3_voltage_int'): return self._m_panel3_voltage_int if hasattr(self, '_m_panel3_voltage_int') else None self._m_panel3_voltage_int = int(self.panel3_voltage) return self._m_panel3_voltage_int if hasattr(self, '_m_panel3_voltage_int') else None @property def buffers_free_int(self): """E.""" if hasattr(self, '_m_buffers_free_int'): return self._m_buffers_free_int if hasattr(self, '_m_buffers_free_int') else None self._m_buffers_free_int = int(self.buffers_free) return self._m_buffers_free_int if hasattr(self, '_m_buffers_free_int') else None @property def bat_voltage_int(self): """J.""" if hasattr(self, '_m_bat_voltage_int'): return self._m_bat_voltage_int if hasattr(self, '_m_bat_voltage_int') else None self._m_bat_voltage_int = int(self.bat_voltage) return self._m_bat_voltage_int if hasattr(self, '_m_bat_voltage_int') else None @property def panel3_current_int(self): """O[2].""" if hasattr(self, '_m_panel3_current_int'): return self._m_panel3_current_int if hasattr(self, '_m_panel3_current_int') else None self._m_panel3_current_int = int(self.panel3_current) return self._m_panel3_current_int if hasattr(self, '_m_panel3_current_int') else None @property def cur_sun_int(self): """K.""" if hasattr(self, '_m_cur_sun_int'): return self._m_cur_sun_int if hasattr(self, '_m_cur_sun_int') else None self._m_cur_sun_int = int(self.cur_sun) return self._m_cur_sun_int if hasattr(self, '_m_cur_sun_int') else None @property def mission_files_int(self): """D.""" if hasattr(self, '_m_mission_files_int'): return self._m_mission_files_int if hasattr(self, '_m_mission_files_int') else None self._m_mission_files_int = int(self.mission_files) return self._m_mission_files_int if hasattr(self, '_m_mission_files_int') else None @property def com_temp_pa_int(self): """H[0].""" if hasattr(self, '_m_com_temp_pa_int'): return self._m_com_temp_pa_int if hasattr(self, '_m_com_temp_pa_int') else None self._m_com_temp_pa_int = int(self.com_temp_pa) return self._m_com_temp_pa_int if hasattr(self, '_m_com_temp_pa_int') else None @property def bat_bootcount_int(self): """P.""" if hasattr(self, '_m_bat_bootcount_int'): return self._m_bat_bootcount_int if hasattr(self, '_m_bat_bootcount_int') else None self._m_bat_bootcount_int = int(self.bat_bootcount) return self._m_bat_bootcount_int if hasattr(self, '_m_bat_bootcount_int') else None @property def gyro_z_flt(self): """Q[2].""" if hasattr(self, '_m_gyro_z_flt'): return self._m_gyro_z_flt if hasattr(self, '_m_gyro_z_flt') else None self._m_gyro_z_flt = (int(self.gyro_z_int) + ((((int(int(self.gyro_z_int) < 0) * -2) + 1) * int(self.gyro_z_frac)) / 1000000.0)) return self._m_gyro_z_flt if hasattr(self, '_m_gyro_z_flt') else None @property def panel1_voltage_int(self): """N[0].""" if hasattr(self, '_m_panel1_voltage_int'): return self._m_panel1_voltage_int if hasattr(self, '_m_panel1_voltage_int') else None self._m_panel1_voltage_int = int(self.panel1_voltage) return self._m_panel1_voltage_int if hasattr(self, '_m_panel1_voltage_int') else None @property def last_rssi_int(self): """F.""" if hasattr(self, '_m_last_rssi_int'): return self._m_last_rssi_int if hasattr(self, '_m_last_rssi_int') else None self._m_last_rssi_int = int(self.last_rssi) return self._m_last_rssi_int if hasattr(self, '_m_last_rssi_int') else None @property def cur_sys_int(self): """L.""" if hasattr(self, '_m_cur_sys_int'): return self._m_cur_sys_int if hasattr(self, '_m_cur_sys_int') else None self._m_cur_sys_int = int(self.cur_sys) return self._m_cur_sys_int if hasattr(self, '_m_cur_sys_int') else None @property def eps_temp_t4_int(self): """I.""" if hasattr(self, '_m_eps_temp_t4_int'): return self._m_eps_temp_t4_int if hasattr(self, '_m_eps_temp_t4_int') else None self._m_eps_temp_t4_int = int(self.eps_temp_t4) return self._m_eps_temp_t4_int if hasattr(self, '_m_eps_temp_t4_int') else None class Repeaters(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_callsign_raw = Irazu.CallsignRaw(self._io, self, self._root) self.rpt_ssid_raw = Irazu.SsidMask(self._io, self, self._root) class Repeater(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_instance = [] i = 0 while True: _ = Irazu.Repeaters(self._io, self, self._root) self.rpt_instance.append(_) if (_.rpt_ssid_raw.ssid_mask & 1) == 1: break i += 1 class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Irazu.Callsign(_io__raw_callsign_ror, self, self._root) class Ax25InfoData(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): _on = self.tlm_type if _on == 66: self.data = Irazu.Beacon(self._io, self, self._root) @property def tlm_type(self): if hasattr(self, '_m_tlm_type'): return self._m_tlm_type if hasattr(self, '_m_tlm_type') else None _pos = self._io.pos() self._io.seek(4) self._m_tlm_type = self._io.read_u1() self._io.seek(_pos) return self._m_tlm_type if hasattr(self, '_m_tlm_type') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/irazu.py
0.527317
0.183795
irazu.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Bobcat1(KaitaiStruct): """:field data: frame.cspheader.data :field callsign: frame.data.callsigns.callsign :field bobcat1: frame.data.callsigns.bobcat1 :field bat_v: frame.data.bat_v :field bat_i_out: frame.data.bat_i_out :field bat_i_in: frame.data.bat_i_in :field bootcount_a3200: frame.data.bootcount_a3200 :field resetcause_a3200: frame.data.resetcause_a3200 :field bootcause_a3200: frame.data.bootcause_a3200 :field uptime_a3200: frame.data.uptime_a3200 :field bootcount_ax100: frame.data.bootcount_ax100 :field bootcause_ax100: frame.data.bootcause_ax100 :field i_pwm: frame.data.i_pwm :field fs_mounted: frame.data.fs_mounted :field antennas_deployed: frame.data.antennas_deployed :field deploy_attempts1: frame.data.deploy_attempts1 :field deploy_attempts2: frame.data.deploy_attempts2 :field deploy_attempts3: frame.data.deploy_attempts3 :field deploy_attempts4: frame.data.deploy_attempts4 :field gyro_x: frame.data.gyro_x :field gyro_y: frame.data.gyro_y :field gyro_z: frame.data.gyro_z :field timestamp: frame.data.timestamp :field protocol_version: frame.hk_header.protocol_version :field type: frame.hk_header.type :field version: frame.hk_header.version :field satid: frame.hk_header.satid :field checksum: frame.hk_frame.a3200_hktable0.checksum :field a3200_hktable0_timestamp: frame.hk_frame.a3200_hktable0.timestamp :field source: frame.hk_frame.a3200_hktable0.source :field callsign: frame.hk_frame.callsigns.callsign :field bobcat1: frame.hk_frame.callsigns.bobcat1 :field bat_v: frame.hk_frame.bat_v :field bat_i_in: frame.hk_frame.bat_i_in :field bat_i_out: frame.hk_frame.bat_i_out :field solar1_i: frame.hk_frame.solar1_i :field solar1_v: frame.hk_frame.solar1_v :field solar2_i: frame.hk_frame.solar2_i :field solar2_v: frame.hk_frame.solar2_v :field solar3_i: frame.hk_frame.solar3_i :field solar3_v: frame.hk_frame.solar3_v :field novatel_i: frame.hk_frame.novatel_i :field sdr_i: frame.hk_frame.sdr_i :field bootcount_p31: frame.hk_frame.bootcount_p31 :field bootcause_p31: frame.hk_frame.bootcause_p31 :field bootcount_a3200: frame.hk_frame.bootcount_a3200 :field bootcause_a3200: frame.hk_frame.bootcause_a3200 :field resetcause_a3200: frame.hk_frame.resetcause_a3200 :field uptime_a3200: frame.hk_frame.uptime_a3200 :field temp_mcu: frame.hk_frame.temp_mcu :field i_gssb1: frame.hk_frame.i_gssb1 :field i_pwm: frame.hk_frame.i_pwm :field panel_temp1: frame.hk_frame.panel_temp1 :field panel_temp2: frame.hk_frame.panel_temp2 :field panel_temp3: frame.hk_frame.panel_temp3 :field panel_temp4: frame.hk_frame.panel_temp4 :field panel_temp5: frame.hk_frame.panel_temp5 :field panel_temp6: frame.hk_frame.panel_temp6 :field panel_temp7: frame.hk_frame.panel_temp7 :field panel_temp8: frame.hk_frame.panel_temp8 :field panel_temp9: frame.hk_frame.panel_temp9 :field p31_temp1: frame.hk_frame.p31_temp1 :field p31_temp2: frame.hk_frame.p31_temp2 :field p31_temp3: frame.hk_frame.p31_temp3 :field p31_temp4: frame.hk_frame.p31_temp4 :field p31_temp5: frame.hk_frame.p31_temp5 :field p31_temp6: frame.hk_frame.p31_temp6 :field flash0_free: frame.hk_frame.flash0_free :field flash1_free: frame.hk_frame.flash1_free :field coll_running: frame.hk_frame.coll_running :field ax100_telemtable_checksum: frame.hk_frame.ax100_telemtable.checksum :field ax100_telemtable_timestamp: frame.hk_frame.ax100_telemtable.timestamp :field ax100_telemtable_source: frame.hk_frame.ax100_telemtable.source :field temp_brd: frame.hk_frame.temp_brd :field temp_pa: frame.hk_frame.temp_pa :field bgnd_rssi: frame.hk_frame.bgnd_rssi :field tot_tx_count: frame.hk_frame.tot_tx_count :field tot_rx_count: frame.hk_frame.tot_rx_count :field tot_tx_bytes: frame.hk_frame.tot_tx_bytes :field tot_rx_bytes: frame.hk_frame.tot_rx_bytes :field bootcount_ax100: frame.hk_frame.bootcount_ax100 :field bootcause_ax100: frame.hk_frame.bootcause_ax100 :field a3200_hktable_17_1_checksum: frame.extra_frame.a3200_hktable_17_1.checksum :field a3200_hktable_17_1_timestamp: frame.extra_frame.a3200_hktable_17_1.timestamp :field a3200_hktable_17_1_source: frame.extra_frame.a3200_hktable_17_1.source :field callsign: frame.extra_frame.callsigns.callsign :field bobcat1: frame.extra_frame.callsigns.bobcat1 :field coll_running: frame.extra_frame.coll_running :field lat: frame.extra_frame.lat :field long: frame.extra_frame.long :field height: frame.extra_frame.height :field sec_of_week: frame.extra_frame.sec_of_week :field a3200_hktable_10_checksum: frame.extra_frame.a3200_hktable_10.checksum :field a3200_hktable_10_timestamp: frame.extra_frame.a3200_hktable_10.timestamp :field a3200_hktable_10_source: frame.extra_frame.a3200_hktable_10.source :field cfg_path: frame.extra_frame.cfg_path :field bc1_wdcnt: frame.extra_frame.bc1_wdcnt :field collect_id: frame.extra_frame.collect_id :field adcs_mode: frame.extra_frame.adcs_mode :field a3200_hktable_17_2_checksum: frame.extra_frame.a3200_hktable_17_2.checksum :field a3200_hktable_17_2_timestamp: frame.extra_frame.a3200_hktable_17_2.timestamp :field a3200_hktable_17_2_source: frame.extra_frame.a3200_hktable_17_2.source :field custom_message: frame.extra_frame.custom_message :field rev: frame.fwdebug_frame.rev :field swload_cnt1: frame.fwdebug_frame.swload_cnt1 :field swload_cnt2: frame.fwdebug_frame.swload_cnt2 :field ram_image: frame.fwdebug_frame.ram_image :field framelength: framelength :field pos_sol_status: frame.xyz_frame.pos_sol_status :field gps_week: frame.xyz_frame.gps_week :field gps_ms: frame.xyz_frame.gps_ms :field pos_x: frame.xyz_frame.pos_x :field pos_y: frame.xyz_frame.pos_y :field pos_z: frame.xyz_frame.pos_z :field vel_x: frame.xyz_frame.vel_x :field vel_y: frame.xyz_frame.vel_y :field vel_z: frame.xyz_frame.vel_z :field vel_latency: frame.xyz_frame.vel_latency :field diff_age: frame.xyz_frame.diff_age :field sol_age: frame.xyz_frame.sol_age :field num_soln_svs: frame.xyz_frame.num_soln_svs """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): _on = self._root.framelength if _on == 150: self.frame = Bobcat1.Bc1ExtraFrame(self._io, self, self._root) elif _on == 98: self.frame = Bobcat1.Bc1XyzFrame(self._io, self, self._root) elif _on == 69: self.frame = Bobcat1.Bc1BasicFrame(self._io, self, self._root) elif _on == 156: self.frame = Bobcat1.Bc1HkFrame(self._io, self, self._root) elif _on == 70: self.frame = Bobcat1.Bc1FwdebugFrame(self._io, self, self._root) class BeaconElementHeader(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.checksum = self._io.read_u2be() self.timestamp = self._io.read_u4be() self.source = self._io.read_u2be() class XyzFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsigns = Bobcat1.Callsigns(self._io, self, self._root) self.pos_sol_status = self._io.read_u4be() self.gps_week = self._io.read_u2be() self.gps_ms = self._io.read_u4be() self.pos_x = self._io.read_f8be() self.pos_y = self._io.read_f8be() self.pos_z = self._io.read_f8be() self.vel_x = self._io.read_f8be() self.vel_y = self._io.read_f8be() self.vel_z = self._io.read_f8be() self.vel_latency = self._io.read_f4be() self.diff_age = self._io.read_f4be() self.sol_age = self._io.read_f4be() self.num_soln_svs = self._io.read_u1() class Cspheader(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.data = self._io.read_u4be() class Bc1XyzFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cspheader = Bobcat1.Cspheader(self._io, self, self._root) self.xyz_frame = Bobcat1.XyzFrame(self._io, self, self._root) class Bc1HkFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cspheader = Bobcat1.Cspheader(self._io, self, self._root) self.hk_header = Bobcat1.HkHeader(self._io, self, self._root) self.hk_frame = Bobcat1.HkData(self._io, self, self._root) class ExtraData(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.a3200_hktable_17_1 = Bobcat1.BeaconElementHeader(self._io, self, self._root) self.callsigns = Bobcat1.Callsigns(self._io, self, self._root) self.coll_running = self._io.read_u1() self.lat = self._io.read_f4be() self.long = self._io.read_f4be() self.height = self._io.read_f4be() self.sec_of_week = self._io.read_u2be() self.a3200_hktable_10 = Bobcat1.BeaconElementHeader(self._io, self, self._root) self.cfg_path = (KaitaiStream.bytes_terminate(self._io.read_bytes(50), 0, False)).decode(u"ASCII") self.bc1_wdcnt = self._io.read_u4be() self.collect_id = self._io.read_u4be() self.adcs_mode = self._io.read_u1() self.a3200_hktable_17_2 = Bobcat1.BeaconElementHeader(self._io, self, self._root) self.custom_message = (KaitaiStream.bytes_terminate(self._io.read_bytes(20), 0, False)).decode(u"ascii") class HkData(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.a3200_hktable0 = Bobcat1.BeaconElementHeader(self._io, self, self._root) self.callsigns = Bobcat1.Callsigns(self._io, self, self._root) self.bat_v = self._io.read_u2be() self.bat_i_in = self._io.read_u2be() self.bat_i_out = self._io.read_u2be() self.solar1_i = self._io.read_u2be() self.solar1_v = self._io.read_u2be() self.solar2_i = self._io.read_u2be() self.solar2_v = self._io.read_u2be() self.solar3_i = self._io.read_u2be() self.solar3_v = self._io.read_u2be() self.novatel_i = self._io.read_u2be() self.sdr_i = self._io.read_u2be() self.bootcount_p31 = self._io.read_u4be() self.bootcause_p31 = self._io.read_u1() self.bootcount_a3200 = self._io.read_u2be() self.bootcause_a3200 = self._io.read_u1() self.resetcause_a3200 = self._io.read_u1() self.uptime_a3200 = self._io.read_u4be() self.temp_mcu = self._io.read_s2be() self.i_gssb1 = self._io.read_u2be() self.i_pwm = self._io.read_u2be() self.panel_temp1 = self._io.read_s2be() self.panel_temp2 = self._io.read_s2be() self.panel_temp3 = self._io.read_s2be() self.panel_temp4 = self._io.read_s2be() self.panel_temp5 = self._io.read_s2be() self.panel_temp6 = self._io.read_s2be() self.panel_temp7 = self._io.read_s2be() self.panel_temp8 = self._io.read_s2be() self.panel_temp9 = self._io.read_s2be() self.p31_temp1 = self._io.read_s2be() self.p31_temp2 = self._io.read_s2be() self.p31_temp3 = self._io.read_s2be() self.p31_temp4 = self._io.read_s2be() self.p31_temp5 = self._io.read_s2be() self.p31_temp6 = self._io.read_s2be() self.flash0_free = self._io.read_u4be() self.flash1_free = self._io.read_u4be() self.coll_running = self._io.read_u1() self.ax100_telemtable = Bobcat1.BeaconElementHeader(self._io, self, self._root) self.temp_brd = self._io.read_s2be() self.temp_pa = self._io.read_s2be() self.bgnd_rssi = self._io.read_s2be() self.tot_tx_count = self._io.read_u4be() self.tot_rx_count = self._io.read_u4be() self.tot_tx_bytes = self._io.read_u4be() self.tot_rx_bytes = self._io.read_u4be() self.bootcount_ax100 = self._io.read_u2be() self.bootcause_ax100 = self._io.read_u4be() class FwdebugFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.a3200_hktable17 = Bobcat1.BeaconElementHeader(self._io, self, self._root) self.callsigns = Bobcat1.Callsigns(self._io, self, self._root) self.a3200_hktable0 = Bobcat1.BeaconElementHeader(self._io, self, self._root) self.rev = self._io.read_u1() self.a3200_hktable1 = Bobcat1.BeaconElementHeader(self._io, self, self._root) self.swload_cnt1 = self._io.read_u2be() self.swload_cnt2 = self._io.read_u2be() self.a3200_hktable4 = Bobcat1.BeaconElementHeader(self._io, self, self._root) self.ram_image = self._io.read_u1() class Bc1ExtraFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cspheader = Bobcat1.Cspheader(self._io, self, self._root) self.hk_header = Bobcat1.HkHeader(self._io, self, self._root) self.extra_frame = Bobcat1.ExtraData(self._io, self, self._root) class HkHeader(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.protocol_version = self._io.read_u1() self.type = self._io.read_u1() self.version = self._io.read_u1() self.satid = self._io.read_u2be() class Basic(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsigns = Bobcat1.Callsigns(self._io, self, self._root) self.bat_v = self._io.read_u2be() self.bat_i_out = self._io.read_u2be() self.bat_i_in = self._io.read_u2be() self.bootcount_a3200 = self._io.read_u2be() self.resetcause_a3200 = self._io.read_u1() self.bootcause_a3200 = self._io.read_u1() self.uptime_a3200 = self._io.read_u4be() self.bootcount_ax100 = self._io.read_u2be() self.bootcause_ax100 = self._io.read_u4be() self.i_pwm = self._io.read_u2be() self.fs_mounted = self._io.read_u1() self.antennas_deployed = self._io.read_u1() self.deploy_attempts1 = self._io.read_u2be() self.deploy_attempts2 = self._io.read_u2be() self.deploy_attempts3 = self._io.read_u2be() self.deploy_attempts4 = self._io.read_u2be() self.gyro_x = self._io.read_s2be() self.gyro_y = self._io.read_s2be() self.gyro_z = self._io.read_s2be() self.timestamp = self._io.read_u4be() class Bc1FwdebugFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cspheader = Bobcat1.Cspheader(self._io, self, self._root) self.hk_header = Bobcat1.HkHeader(self._io, self, self._root) self.fwdebug_frame = Bobcat1.FwdebugFrame(self._io, self, self._root) class Callsigns(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes_term(0, False, True, True)).decode(u"ASCII") if not self.callsign == u"W8PZS": raise kaitaistruct.ValidationNotEqualError(u"W8PZS", self.callsign, self._io, u"/types/callsigns/seq/0") self.bobcat1 = (self._io.read_bytes_term(0, False, True, True)).decode(u"ASCII") if not self.bobcat1 == u"BOBCAT-1": raise kaitaistruct.ValidationNotEqualError(u"BOBCAT-1", self.bobcat1, self._io, u"/types/callsigns/seq/1") class Bc1BasicFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cspheader = Bobcat1.Cspheader(self._io, self, self._root) self.data = Bobcat1.Basic(self._io, self, self._root) @property def framelength(self): if hasattr(self, '_m_framelength'): return self._m_framelength if hasattr(self, '_m_framelength') else None self._m_framelength = self._io.size() return self._m_framelength if hasattr(self, '_m_framelength') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/bobcat1.py
0.481941
0.280598
bobcat1.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Rhoksat(KaitaiStruct): """:field panel_temp: sp_telemetry.panel0.panel_temp :field panel_status: sp_telemetry.panel0.panel_status :field panel_voltage: sp_telemetry.panel0.panel_voltage :field panel_photodiode: sp_telemetry.panel0.panel_photodiode :field panel1_panel_temp: sp_telemetry.panel1.panel_temp :field panel1_panel_status: sp_telemetry.panel1.panel_status :field panel1_panel_voltage: sp_telemetry.panel1.panel_voltage :field panel1_panel_photodiode: sp_telemetry.panel1.panel_photodiode :field panel2_panel_temp: sp_telemetry.panel2.panel_temp :field panel2_panel_status: sp_telemetry.panel2.panel_status :field panel2_panel_voltage: sp_telemetry.panel2.panel_voltage :field panel2_panel_photodiode: sp_telemetry.panel2.panel_photodiode :field panel3_panel_temp: sp_telemetry.panel3.panel_temp :field panel3_panel_status: sp_telemetry.panel3.panel_status :field panel3_panel_voltage: sp_telemetry.panel3.panel_voltage :field panel3_panel_photodiode: sp_telemetry.panel3.panel_photodiode :field panel4_panel_temp: sp_telemetry.panel4.panel_temp :field panel4_panel_status: sp_telemetry.panel4.panel_status :field panel4_panel_voltage: sp_telemetry.panel4.panel_voltage :field panel4_panel_photodiode: sp_telemetry.panel4.panel_photodiode :field volt_brdsup: eps_telemetry.volt_brdsup :field volt: eps_telemetry.dist_input.volt :field current: eps_telemetry.dist_input.current :field power: eps_telemetry.dist_input.power :field batt_input_volt: eps_telemetry.batt_input.volt :field batt_input_current: eps_telemetry.batt_input.current :field batt_input_power: eps_telemetry.batt_input.power :field stat_obc_on: eps_telemetry.stat_obc_on :field stat_obc_ocf: eps_telemetry.stat_obc_ocf :field bat_stat: eps_telemetry.bat_stat :field temp: eps_telemetry.temp :field temp2: eps_telemetry.temp2 :field temp3: eps_telemetry.temp3 :field stid: eps_telemetry.status.reply_header.stid :field ivid: eps_telemetry.status.reply_header.ivid :field rc: eps_telemetry.status.reply_header.rc :field bid: eps_telemetry.status.reply_header.bid :field cmderrstat: eps_telemetry.status.reply_header.cmderrstat :field mode: eps_telemetry.status.mode :field conf: eps_telemetry.status.conf :field reset_cause: eps_telemetry.status.reset_cause :field uptime: eps_telemetry.status.uptime :field error: eps_telemetry.status.error :field rc_cnt_pwron: eps_telemetry.status.rc_cnt_pwron :field rc_cnt_wdg: eps_telemetry.status.rc_cnt_wdg :field rc_cnt_cmd: eps_telemetry.status.rc_cnt_cmd :field rc_cnt_pweron_mcu: eps_telemetry.status.rc_cnt_pweron_mcu :field rc_cnt_emlopo: eps_telemetry.status.rc_cnt_emlopo :field prevcmd_elapsed: eps_telemetry.status.prevcmd_elapsed :field ants_temperature: anta_telemetry.ants_temperature :field ants_deployment: anta_telemetry.ants_deployment :field ants_uptime: anta_telemetry.ants_uptime :field antb_telemetry_ants_temperature: antb_telemetry.ants_temperature :field antb_telemetry_ants_deployment: antb_telemetry.ants_deployment :field antb_telemetry_ants_uptime: antb_telemetry.ants_uptime :field imtq_system_state_mode: imtq_system_state.mode :field err: imtq_system_state.err :field imtq_system_state_conf: imtq_system_state.conf :field imtq_system_state_uptime: imtq_system_state.uptime :field x: imtq_magnetometer.cal_magf.x :field y: imtq_magnetometer.cal_magf.y :field z: imtq_magnetometer.cal_magf.z :field coilact: imtq_magnetometer.coilact :field last_detumble_time: last_detumble_time :field acc_x: acc.x :field acc_y: acc.y :field acc_z: acc.z :field gyro_x: gyro.x :field gyro_y: gyro.y :field gyro_z: gyro.z :field trxvu_mode: trxvu_mode :field onboard_time: onboard_time :field obc_up_time: obc_up_time :field num_reboots: num_reboots :field rtcok: rtcok :field storage_available_ram: storage_available_ram :field storage_available_sd: storage_available_sd """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.sp_telemetry = Rhoksat.SpTelemetry(self._io, self, self._root) self.eps_telemetry = Rhoksat.EpsTelemetry(self._io, self, self._root) self.anta_telemetry = Rhoksat.IsisAntsTelemetry(self._io, self, self._root) self.antb_telemetry = Rhoksat.IsisAntsTelemetry(self._io, self, self._root) self.imtq_system_state = Rhoksat.ImtqSystemstateT(self._io, self, self._root) self.imtq_magnetometer = Rhoksat.ImtqCalMagfT(self._io, self, self._root) self.last_detumble_time = self._io.read_u4le() self.acc = Rhoksat.Axis(self._io, self, self._root) self.gyro = Rhoksat.Axis(self._io, self, self._root) self.trxvu_mode = self._io.read_u1() self.onboard_time = self._io.read_u4le() self.obc_up_time = self._io.read_u4le() self.num_reboots = self._io.read_u1() self.rtcok = self._io.read_u1() self.storage_available_ram = self._io.read_u4le() self.storage_available_sd = self._io.read_u4le() class IsisAntsTelemetry(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ants_temperature = self._io.read_u2le() self.ants_deployment = self._io.read_u2le() self.ants_uptime = self._io.read_u4le() class Panel(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.panel_temp = self._io.read_f4le() self.panel_status = self._io.read_u1() self.panel_voltage = self._io.read_u2le() self.panel_photodiode = self._io.read_u2le() class IsisEpsGetsystemstatusFromT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.reply_header = Rhoksat.IsisEpsReplyheaderT(self._io, self, self._root) self.mode = self._io.read_u1() self.conf = self._io.read_u1() self.reset_cause = self._io.read_u1() self.uptime = self._io.read_u4le() self.error = self._io.read_u2le() self.rc_cnt_pwron = self._io.read_u2le() self.rc_cnt_wdg = self._io.read_u2le() self.rc_cnt_cmd = self._io.read_u2le() self.rc_cnt_pweron_mcu = self._io.read_u2le() self.rc_cnt_emlopo = self._io.read_u2le() self.prevcmd_elapsed = self._io.read_u2le() class ImtqSystemstateT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.mode = self._io.read_u1() self.err = self._io.read_u1() self.conf = self._io.read_u1() self.uptime = self._io.read_u4le() class IsisEpsReplyheaderT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.stid = self._io.read_u1() self.ivid = self._io.read_u1() self.rc = self._io.read_u1() self.bid = self._io.read_u1() self.cmderrstat = self._io.read_u1() class Vec3(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.x = self._io.read_s4le() self.y = self._io.read_s4le() self.z = self._io.read_s4le() class ImtqCalMagfT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.cal_magf = Rhoksat.Vec3(self._io, self, self._root) self.coilact = self._io.read_u1() class IsisEpsVipdengT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.volt = self._io.read_u2le() self.current = self._io.read_u2le() self.power = self._io.read_u2le() class SpTelemetry(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.panel0 = Rhoksat.Panel(self._io, self, self._root) self.panel1 = Rhoksat.Panel(self._io, self, self._root) self.panel2 = Rhoksat.Panel(self._io, self, self._root) self.panel3 = Rhoksat.Panel(self._io, self, self._root) self.panel4 = Rhoksat.Panel(self._io, self, self._root) class EpsTelemetry(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.volt_brdsup = self._io.read_s2le() self.dist_input = Rhoksat.IsisEpsVipdengT(self._io, self, self._root) self.batt_input = Rhoksat.IsisEpsVipdengT(self._io, self, self._root) self.stat_obc_on = self._io.read_bits_int_be(16) self._io.align_to_byte() self.stat_obc_ocf = self._io.read_u2le() self.bat_stat = self._io.read_u2le() self.temp = self._io.read_s2le() self.temp2 = self._io.read_s2le() self.temp3 = self._io.read_s2le() self.status = Rhoksat.IsisEpsGetsystemstatusFromT(self._io, self, self._root) class Axis(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.x = self._io.read_f4le() self.y = self._io.read_f4le() self.z = self._io.read_f4le()
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/rhoksat.py
0.517083
0.209187
rhoksat.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Bugsat1(KaitaiStruct): """:field dest_callsign: ax25_frame.ax25_header.dest_callsign_raw.callsign_ror.callsign :field src_callsign: ax25_frame.ax25_header.src_callsign_raw.callsign_ror.callsign :field src_ssid: ax25_frame.ax25_header.src_ssid_raw.ssid :field dest_ssid: ax25_frame.ax25_header.dest_ssid_raw.ssid :field rpt_callsign: ax25_frame.ax25_header.repeater.rpt_instance[0].rpt_callsign_raw.callsign_ror.callsign :field ctl: ax25_frame.ax25_header.ctl :field pid: ax25_frame.payload.pid :field uptime_s: ax25_frame.payload.ax25_info.beacon_type.uptime_s :field rtc_s: ax25_frame.payload.ax25_info.beacon_type.rtc_s :field reset_count: ax25_frame.payload.ax25_info.beacon_type.reset_count_be :field current_mode: ax25_frame.payload.ax25_info.beacon_type.current_mode :field last_boot_reason: ax25_frame.payload.ax25_info.beacon_type.last_boot_reason :field free: ax25_frame.payload.ax25_info.beacon_type.free :field last_seen_sequence_number: ax25_frame.payload.ax25_info.beacon_type.last_seen_sequence_number :field antenna_deploy_status: ax25_frame.payload.ax25_info.beacon_type.antenna_deploy_status :field low_voltage_counter: ax25_frame.payload.ax25_info.beacon_type.low_voltage_counter :field nice_battery_mv: ax25_frame.payload.ax25_info.beacon_type.nice_battery_mv :field raw_battery_mv: ax25_frame.payload.ax25_info.beacon_type.raw_battery_mv :field battery_amps: ax25_frame.payload.ax25_info.beacon_type.battery_amps :field pcm_3v3_v: ax25_frame.payload.ax25_info.beacon_type.pcm_3v3_v :field pcm_3v3_a: ax25_frame.payload.ax25_info.beacon_type.pcm_3v3_a :field pcm_5v_v: ax25_frame.payload.ax25_info.beacon_type.pcm_5v_v :field pcm_5v_a: ax25_frame.payload.ax25_info.beacon_type.pcm_5v_a :field cpu_c: ax25_frame.payload.ax25_info.beacon_type.cpu_c :field mirror_cell_c: ax25_frame.payload.ax25_info.beacon_type.mirror_cell_c :field mode: ax25_frame.payload.ax25_info.beacon_type.mode :field sun_vector_x: ax25_frame.payload.ax25_info.beacon_type.sun_vector_x :field sun_vector_y: ax25_frame.payload.ax25_info.beacon_type.sun_vector_y :field sun_vector_z: ax25_frame.payload.ax25_info.beacon_type.sun_vector_z :field magnetometer_x_mg: ax25_frame.payload.ax25_info.beacon_type.magnetometer_x_mg :field magnetometer_y_mg: ax25_frame.payload.ax25_info.beacon_type.magnetometer_y_mg :field magnetometer_z_mg: ax25_frame.payload.ax25_info.beacon_type.magnetometer_z_mg :field gyro_x_dps: ax25_frame.payload.ax25_info.beacon_type.gyro_x_dps :field gyro_y_dps: ax25_frame.payload.ax25_info.beacon_type.gyro_y_dps :field gyro_z_dps: ax25_frame.payload.ax25_info.beacon_type.gyro_z_dps :field temperature_imu_c: ax25_frame.payload.ax25_info.beacon_type.temperature_imu_c :field fine_gyro_x_dps: ax25_frame.payload.ax25_info.beacon_type.fine_gyro_x_dps :field fine_gyro_y_dps: ax25_frame.payload.ax25_info.beacon_type.fine_gyro_y_dps :field fine_gyro_z_dps: ax25_frame.payload.ax25_info.beacon_type.fine_gyro_z_dps :field wheel_1_radsec: ax25_frame.payload.ax25_info.beacon_type.wheel_1_radsec :field wheel_2_radsec: ax25_frame.payload.ax25_info.beacon_type.wheel_2_radsec :field wheel_3_radsec: ax25_frame.payload.ax25_info.beacon_type.wheel_3_radsec :field wheel_4_radsec: ax25_frame.payload.ax25_info.beacon_type.wheel_4_radsec :field experiments_run: ax25_frame.payload.ax25_info.beacon_type.experiments_run :field experiments_failed: ax25_frame.payload.ax25_info.beacon_type.experiments_failed :field last_experiment_run: ax25_frame.payload.ax25_info.beacon_type.last_experiment_run :field current_state: ax25_frame.payload.ax25_info.beacon_type.current_state :field message: ax25_frame.payload.ax25_info.beacon_type.message Attention: `rpt_callsign` cannot be accessed because `rpt_instance` is an array of unknown size at the beginning of the parsing process! Left an example in here. """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_frame = Bugsat1.Ax25Frame(self._io, self, self._root) class Ax25Frame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ax25_header = Bugsat1.Ax25Header(self._io, self, self._root) _on = (self.ax25_header.ctl & 19) if _on == 0: self.payload = Bugsat1.IFrame(self._io, self, self._root) elif _on == 3: self.payload = Bugsat1.UiFrame(self._io, self, self._root) elif _on == 19: self.payload = Bugsat1.UiFrame(self._io, self, self._root) elif _on == 16: self.payload = Bugsat1.IFrame(self._io, self, self._root) elif _on == 18: self.payload = Bugsat1.IFrame(self._io, self, self._root) elif _on == 2: self.payload = Bugsat1.IFrame(self._io, self, self._root) class Ax25Header(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.dest_callsign_raw = Bugsat1.CallsignRaw(self._io, self, self._root) self.dest_ssid_raw = Bugsat1.SsidMask(self._io, self, self._root) self.src_callsign_raw = Bugsat1.CallsignRaw(self._io, self, self._root) self.src_ssid_raw = Bugsat1.SsidMask(self._io, self, self._root) if (self.src_ssid_raw.ssid_mask & 1) == 0: self.repeater = Bugsat1.Repeater(self._io, self, self._root) self.ctl = self._io.read_u1() class UiFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Bugsat1.Ax25InfoData(_io__raw_ax25_info, self, self._root) class Callsign(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.callsign = (self._io.read_bytes(6)).decode(u"ASCII") class IFrame(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.pid = self._io.read_u1() self._raw_ax25_info = self._io.read_bytes_full() _io__raw_ax25_info = KaitaiStream(BytesIO(self._raw_ax25_info)) self.ax25_info = Bugsat1.Ax25InfoData(_io__raw_ax25_info, self, self._root) class SsidMask(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.ssid_mask = self._io.read_u1() @property def ssid(self): if hasattr(self, '_m_ssid'): return self._m_ssid if hasattr(self, '_m_ssid') else None self._m_ssid = ((self.ssid_mask & 15) >> 1) return self._m_ssid if hasattr(self, '_m_ssid') else None class Repeaters(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_callsign_raw = Bugsat1.CallsignRaw(self._io, self, self._root) self.rpt_ssid_raw = Bugsat1.SsidMask(self._io, self, self._root) class Repeater(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.rpt_instance = [] i = 0 while True: _ = Bugsat1.Repeaters(self._io, self, self._root) self.rpt_instance.append(_) if (_.rpt_ssid_raw.ssid_mask & 1) == 1: break i += 1 class Message(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.message = (self._io.read_bytes_full()).decode(u"utf-8") class CallsignRaw(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self._raw__raw_callsign_ror = self._io.read_bytes(6) self._raw_callsign_ror = KaitaiStream.process_rotate_left(self._raw__raw_callsign_ror, 8 - (1), 1) _io__raw_callsign_ror = KaitaiStream(BytesIO(self._raw_callsign_ror)) self.callsign_ror = Bugsat1.Callsign(_io__raw_callsign_ror, self, self._root) class Ax25InfoData(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.beacon_id0 = self._io.read_u1() if self.beacon_id0 == 255: self.beacon_id1 = self._io.read_bytes(1) if not self.beacon_id1 == b"\xFF": raise kaitaistruct.ValidationNotEqualError(b"\xFF", self.beacon_id1, self._io, u"/types/ax25_info_data/seq/1") if self.beacon_id0 == 255: self.beacon_id2 = self._io.read_bytes(1) if not self.beacon_id2 == b"\xF0": raise kaitaistruct.ValidationNotEqualError(b"\xF0", self.beacon_id2, self._io, u"/types/ax25_info_data/seq/2") _on = self.beacon_id0 if _on == 58: self.beacon_type = Bugsat1.Message(self._io, self, self._root) else: self.beacon_type = Bugsat1.Telemetry(self._io, self, self._root) class Telemetry(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.platform_id = self._io.read_bytes(2) if not self.platform_id == b"\x00\x01": raise kaitaistruct.ValidationNotEqualError(b"\x00\x01", self.platform_id, self._io, u"/types/telemetry/seq/0") self.uptime_s = self._io.read_u4be() self.rtc_s = self._io.read_u4be() self.rstcnt_b = [None] * (3) for i in range(3): self.rstcnt_b[i] = self._io.read_u1() self.current_mode = self._io.read_u1() self.last_boot_reason = self._io.read_u4be() self.mem_tlm_id = self._io.read_bytes(2) if not self.mem_tlm_id == b"\x01\x01": raise kaitaistruct.ValidationNotEqualError(b"\x01\x01", self.mem_tlm_id, self._io, u"/types/telemetry/seq/6") self.free = self._io.read_u4be() self.cdh_id = self._io.read_bytes(2) if not self.cdh_id == b"\x02\x01": raise kaitaistruct.ValidationNotEqualError(b"\x02\x01", self.cdh_id, self._io, u"/types/telemetry/seq/8") self.last_seen_sequence_number = self._io.read_u4be() self.antenna_deploy_status = self._io.read_u1() self.pwr_tlm_id = self._io.read_bytes(2) if not self.pwr_tlm_id == b"\x03\x01": raise kaitaistruct.ValidationNotEqualError(b"\x03\x01", self.pwr_tlm_id, self._io, u"/types/telemetry/seq/11") self.low_voltage_counter = self._io.read_u2be() self.nice_battery_mv = self._io.read_u2be() self.raw_battery_mv = self._io.read_u2be() self.battery_amps = self._io.read_u2be() self.pcm_3v3_v = self._io.read_u2be() self.pcm_3v3_a = self._io.read_u2be() self.pcm_5v_v = self._io.read_u2be() self.pcm_5v_a = self._io.read_u2be() self.thermal_tlm_id = self._io.read_bytes(2) if not self.thermal_tlm_id == b"\x04\x01": raise kaitaistruct.ValidationNotEqualError(b"\x04\x01", self.thermal_tlm_id, self._io, u"/types/telemetry/seq/20") self.cpu_c = self._io.read_s2be() self.mirror_cell_c = self._io.read_s2be() self.aocs_tlm_id = self._io.read_bytes(2) if not self.aocs_tlm_id == b"\x05\x01": raise kaitaistruct.ValidationNotEqualError(b"\x05\x01", self.aocs_tlm_id, self._io, u"/types/telemetry/seq/23") self.mode = self._io.read_u4be() self.sun_vector_x = self._io.read_s2be() self.sun_vector_y = self._io.read_s2be() self.sun_vector_z = self._io.read_s2be() self.magnetometer_x_mg = self._io.read_s2be() self.magnetometer_y_mg = self._io.read_s2be() self.magnetometer_z_mg = self._io.read_s2be() self.gyro_x_dps = self._io.read_s2be() self.gyro_y_dps = self._io.read_s2be() self.gyro_z_dps = self._io.read_s2be() self.temperature_imu_c = self._io.read_s2be() self.fine_gyro_x_dps = self._io.read_s4be() self.fine_gyro_y_dps = self._io.read_s4be() self.fine_gyro_z_dps = self._io.read_s4be() self.wheel_1_radsec = self._io.read_s2be() self.wheel_2_radsec = self._io.read_s2be() self.wheel_3_radsec = self._io.read_s2be() self.wheel_4_radsec = self._io.read_s2be() self.payload_tlm_id = self._io.read_bytes(2) if not self.payload_tlm_id == b"\x06\x01": raise kaitaistruct.ValidationNotEqualError(b"\x06\x01", self.payload_tlm_id, self._io, u"/types/telemetry/seq/42") self.experiments_run = self._io.read_u2be() self.experiments_failed = self._io.read_u2be() self.last_experiment_run = self._io.read_s2be() self.current_state = self._io.read_u1() @property def reset_count_be(self): if hasattr(self, '_m_reset_count_be'): return self._m_reset_count_be if hasattr(self, '_m_reset_count_be') else None self._m_reset_count_be = (((self.rstcnt_b[0] << 16) | (self.rstcnt_b[1] << 8)) | self.rstcnt_b[2]) return self._m_reset_count_be if hasattr(self, '_m_reset_count_be') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/bugsat1.py
0.636805
0.188735
bugsat1.py
pypi
from pkg_resources import parse_version import kaitaistruct from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO if parse_version(kaitaistruct.__version__) < parse_version('0.9'): raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__)) class Diy1(KaitaiStruct): """:field timestamp: diy1_frame.timestamp :field nn1: diy1_frame.nn1 :field nn2: diy1_frame.nn2 :field nn3: diy1_frame.nn3 :field nn4: diy1_frame.nn4 :field nn5: diy1_frame.nn5 :field nn6: diy1_frame.nn6 :field nn7: diy1_frame.nn7 :field nn8: diy1_frame.nn8 :field nn9: diy1_frame.nn9 :field ssb: diy1_frame.ssb """ def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.diy1_frame = Diy1.Diy1FrameT(self._io, self, self._root) class Diy1FrameT(KaitaiStruct): def __init__(self, _io, _parent=None, _root=None): self._io = _io self._parent = _parent self._root = _root if _root else self self._read() def _read(self): self.control = self._io.read_bytes(5) self.sentence_init = (self._io.read_bytes(1)).decode(u"ASCII") if not self.sentence_init == u"$": raise kaitaistruct.ValidationNotEqualError(u"$", self.sentence_init, self._io, u"/types/diy1_frame_t/seq/1") self.ts_hh_str = (self._io.read_bytes(2)).decode(u"ASCII") self.ts_mm_str = (self._io.read_bytes(2)).decode(u"ASCII") self.ts_ss_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.nn1_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.nn2_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.nn3_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.nn4_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.nn5_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.nn6_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.nn7_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.nn8_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.nn9_str = (self._io.read_bytes_term(44, False, True, True)).decode(u"ASCII") self.ssb_raw = self._io.read_bytes(2) self.sentence_end = (self._io.read_bytes(1)).decode(u"ASCII") if not self.sentence_end == u"*": raise kaitaistruct.ValidationNotEqualError(u"*", self.sentence_end, self._io, u"/types/diy1_frame_t/seq/15") @property def ssb(self): """status bits hex numbers bit state state 0 1 = PA Mediam Power 0 = PA High Power (bit 5 = 0) OPERATIVE MODE 1 1 = ROBOT logger full 0 = logger ROBOT free 2 1 = ROBOT CALLSIGN change 0 = Robot CALLSIGN not change 3 1 = ROBOT OP ON 0 = ROBOT OP OFF 4 1 = logger full 0 = logger empty 5 1 = PA Low Power 0 = disable (bit 1 = 0) RECOVERY MODE 6 1 = RTC setted 0 = RTC no setted 7 1 = command received 0 = command not received """ if hasattr(self, '_m_ssb'): return self._m_ssb if hasattr(self, '_m_ssb') else None self._m_ssb = (((KaitaiStream.byte_array_index(self.ssb_raw, 0) - 48) * 16) + (KaitaiStream.byte_array_index(self.ssb_raw, 1) - 48)) return self._m_ssb if hasattr(self, '_m_ssb') else None @property def nn1(self): """solar charger current [mA].""" if hasattr(self, '_m_nn1'): return self._m_nn1 if hasattr(self, '_m_nn1') else None self._m_nn1 = int(self.nn1_str) return self._m_nn1 if hasattr(self, '_m_nn1') else None @property def nn6(self): """RSSI value [dBm].""" if hasattr(self, '_m_nn6'): return self._m_nn6 if hasattr(self, '_m_nn6') else None self._m_nn6 = int(self.nn6_str) return self._m_nn6 if hasattr(self, '_m_nn6') else None @property def nn4(self): """transceiver current in TX mode [mA].""" if hasattr(self, '_m_nn4'): return self._m_nn4 if hasattr(self, '_m_nn4') else None self._m_nn4 = int(self.nn4_str) return self._m_nn4 if hasattr(self, '_m_nn4') else None @property def nn5(self): """battery voltage [cV].""" if hasattr(self, '_m_nn5'): return self._m_nn5 if hasattr(self, '_m_nn5') else None self._m_nn5 = int(self.nn5_str) return self._m_nn5 if hasattr(self, '_m_nn5') else None @property def nn7(self): """OBC temperature [cdegC].""" if hasattr(self, '_m_nn7'): return self._m_nn7 if hasattr(self, '_m_nn7') else None self._m_nn7 = int(self.nn7_str) return self._m_nn7 if hasattr(self, '_m_nn7') else None @property def nn8(self): """temperature of transceiver PA [cdegC].""" if hasattr(self, '_m_nn8'): return self._m_nn8 if hasattr(self, '_m_nn8') else None self._m_nn8 = int(self.nn8_str) return self._m_nn8 if hasattr(self, '_m_nn8') else None @property def nn9(self): """resets numbers.""" if hasattr(self, '_m_nn9'): return self._m_nn9 if hasattr(self, '_m_nn9') else None self._m_nn9 = int(self.nn9_str) return self._m_nn9 if hasattr(self, '_m_nn9') else None @property def timestamp(self): """time since last reset (DL4PD: in [s]).""" if hasattr(self, '_m_timestamp'): return self._m_timestamp if hasattr(self, '_m_timestamp') else None self._m_timestamp = ((((int(self.ts_hh_str) * 60) * 60) + (int(self.ts_mm_str) * 60)) + int(self.ts_ss_str)) return self._m_timestamp if hasattr(self, '_m_timestamp') else None @property def nn2(self): """logic current [mA].""" if hasattr(self, '_m_nn2'): return self._m_nn2 if hasattr(self, '_m_nn2') else None self._m_nn2 = int(self.nn2_str) return self._m_nn2 if hasattr(self, '_m_nn2') else None @property def nn3(self): """transceiver current in RX mode [mA].""" if hasattr(self, '_m_nn3'): return self._m_nn3 if hasattr(self, '_m_nn3') else None self._m_nn3 = int(self.nn3_str) return self._m_nn3 if hasattr(self, '_m_nn3') else None
/satnogs_decoders-1.60.0-py3-none-any.whl/satnogsdecoders/decoder/diy1.py
0.753648
0.15006
diy1.py
pypi