File

class Data_Reduction.DSN.RSData.File(name=None, sessionpath=None, filename=None)

Bases: object

class to read and convert data in radio science recorder data files

Attributes Summary

headerFormats

headerSize

Methods Summary

checkFormat()

check the file format

data2float(data)

data sample to float

data2int(data)

data sample to integer

exit()

finish()

quit()

readHeader([record])

get the header

readRecordData([record])

read and convert data to array of complex samples

timeOfRecord()

convert time in header to people format

Attributes Documentation

headerFormats = {'RDEF': {'AGENCY_FLAG': {'Size': 2, 'Type': 'UNSIGNED INTEGER'}, 'CHANNEL_ACCUMULATED_PHASE': {'Size': 8, 'Type': 'FLOATING POINT'}, 'CHANNEL_NUMBER': {'Size': 1, 'Type': 'UNSIGNED INTEGER'}, 'CHANNEL_PHASE_POLYNOMIAL_COEFFICIENT0': {'Size': 8, 'Type': 'FLOATING POINT'}, 'CHANNEL_PHASE_POLYNOMIAL_COEFFICIENT1': {'Size': 8, 'Type': 'FLOATING POINT'}, 'CHANNEL_PHASE_POLYNOMIAL_COEFFICIENT2': {'Size': 8, 'Type': 'FLOATING POINT'}, 'CHANNEL_PHASE_POLYNOMIAL_COEFFICIENT3': {'Size': 8, 'Type': 'FLOATING POINT'}, 'CHANNEL_POWER_CALIBRATION_FACTOR': {'Size': 4, 'Type': 'FLOATING POINT'}, 'DOWNLINK_BAND': {'Size': 1, 'Type': 'UNSIGNED INTEGER'}, 'EMPTY_FIELDS1': {'Size': 36, 'Type': 'EMPTY'}, 'EMPTY_FIELDS2': {'Size': 19, 'Type': 'EMPTY'}, 'END_LABEL': {'Size': 4, 'Type': 'UNSIGNED INTEGER'}, 'IF_TO_CHANNEL_DOWNCONV': {'Size': 8, 'Type': 'FLOATING POINT'}, 'OLR_ID': {'Size': 1, 'Type': 'UNSIGNED INTEGER'}, 'OLR_SOFTWARE_VERSION': {'Size': 1, 'Type': 'UNSIGNED INTEGER'}, 'PREDICT_PASS_NUMBER': {'Size': 2, 'Type': 'UNSIGNED INTEGER'}, 'RECORD_LABEL': {'Size': 4, 'Type': 'CHARACTER'}, 'RECORD_LENGTH': {'Size': 4, 'Type': 'UNSIGNED INTEGER'}, 'RECORD_VERSION_ID': {'Size': 2, 'Type': 'UNSIGNED INTEGER'}, 'RF_TO_IF_DOWNCONV': {'Size': 8, 'Type': 'FLOATING POINT'}, 'SAMPLE_RATE': {'Size': 4, 'Type': 'UNSIGNED INTEGER'}, 'SAMPLE_SIZE': {'Size': 2, 'Type': 'UNSIGNED INTEGER'}, 'SPACECRAFT_ID': {'Size': 2, 'Type': 'UNSIGNED INTEGER'}, 'STATION_ID': {'Size': 2, 'Type': 'UNSIGNED INTEGER'}, 'TIMETAG_PICOSECONDS_OF_THE_SECOND': {'Size': 8, 'Type': 'FLOATING POINT'}, 'TIME_TAG_DOY': {'Size': 2, 'Type': 'UNSIGNED INTEGER'}, 'TIME_TAG_SECOND_OF_DAY': {'Size': 4, 'Type': 'UNSIGNED INTEGER'}, 'TIME_TAG_YEAR': {'Size': 2, 'Type': 'UNSIGNED INTEGER'}, 'TOTAL_FREQUENCY_OFFSET': {'Size': 8, 'Type': 'FLOATING POINT'}, 'TRACK_MODE': {'Size': 1, 'Type': 'UNSIGNED INTEGER'}, 'UPLINK_BAND': {'Size': 1, 'Type': 'UNSIGNED INTEGER'}, 'UPLINK_DSS_ID': {'Size': 1, 'Type': 'UNSIGNED INTEGER'}, 'VALIDITY_FLAG': {'Size': 2, 'Type': 'UNSIGNED INTEGER'}}}
headerSize = {'RDEF': 176}

Methods Documentation

checkFormat()

check the file format

data2float(data)

data sample to float

data2int(data)

data sample to integer

The digitizer only tests for > or < some level. This makes a 1s-complement notation preferred. The -0 value is avoided. >0 is represented as 00000000 and <0 by 11111111. So then:

In [11]: bin2sint('00000000')
Out[11]: 1
In [12]: bin2sint('11111111')
Out[12]: -1

In [13]: bin2sint('00000001')
Out[13]: 3
In [14]: bin2sint('11111110')
Out[14]: -3

In [15]: bin2sint('00000011')
Out[15]: 7
In [16]: bin2sint('11111100')
Out[16]: -7

In [17]: bin2sint('10000000')
Out[17]: -255
In [18]: bin2sint('01111111')
Out[18]: 255
exit()
finish()
quit()
readHeader(record=0)

get the header

readRecordData(record=0)

read and convert data to array of complex samples

The array returned will have records [startRecord:endRecord-1] in the usual Python way of defining ranges.

timeOfRecord()

convert time in header to people format

Note that the default way of displaying a datetime object is without the fractional seconds, and to the nearest integer microsecond if using strftime(). So anything less than 500,000 ps will be seen as 0.