Changeset 4180d6a in ammosreader
- Timestamp:
- 05/06/22 11:23:51 (3 years ago)
- Branches:
- AmmosSource, guix
- Children:
- 1d0974d, a574a93
- Parents:
- 94f7c24
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sample_scripts/import_signal.py
r94f7c24 r4180d6a 3 3 import sqlite3 4 4 import argparse 5 import numpy as np 6 from datetime import datetime 5 7 from pathlib import Path 8 from pymongo import MongoClient 6 9 from ammosreader.AmmosIFReader import AmmosIFReader 7 10 from ammosreader.PPDWReader import PPDWReader … … 16 19 args = parser.parse_args() 17 20 21 source = args.source.upper() 18 22 code = args.code.upper() 19 23 signal_number = args.signal_number 20 24 input_dir = Path(args.input_dir) 21 25 sqlite3_file = Path(args.output_file) 26 27 if not re.match('[A-Z0-9]{2}', source): 28 print("Source identifier", source, "invalid") 29 sys.exit() 22 30 23 31 if not re.match('[A-Z][0-9]{3}[A-Z]', code): … … 49 57 # sys.exit(1) 50 58 51 try:52 connection = sqlite3.connect(str(sqlite3_file))53 cursor = connection.cursor()54 except Exception:55 print("Can not connect to database file", str(sqlite3_file))56 # sys.exit(1)59 # try: 60 # connection = sqlite3.connect(str(sqlite3_file)) 61 # cursor = connection.cursor() 62 # except Exception: 63 # print("Can not connect to database file", str(sqlite3_file)) 64 # sys.exit(1) 57 65 58 ammos_if_reader = AmmosIFReader(str(iqdw_file))59 ammos_if_reader.read_all_frames_left()66 #ammos_if_reader = AmmosIFReader(str(iqdw_file)) 67 #ammos_if_reader.read_all_frames_left() 60 68 # for each_frame in ammos_if_reader.container.global_frames: 61 69 # print(each_frame) … … 63 71 ppdw_reader = PPDWReader(ppdw_file) 64 72 ppdw_reader.read_all_frames_left() 65 print(ppdw_reader.container) 73 74 client = MongoClient('hackathon.kid.local', 27017) 75 76 database = client['ELINT'] 77 ts = (ppdw_reader.container.start_time() - np.datetime64('1970-01-01T00:00:00')) / np.timedelta64(1, 's') 78 time_tuple = datetime.utcfromtimestamp(ts).timetuple() 79 julian_date_string = str(time_tuple.tm_year)[2:] + str(time_tuple.tm_yday).zfill(3) 80 code_collection = database[code] 81 year_collection = code_collection[str(time_tuple.tm_year)] 82 source_collection = year_collection[source] 83 84 85 for each in ppdw_reader.container.signals: 86 each_json = each.to_json() 87 each_json['SIGNALNUMBER'] = signal_number 88 each_json['JULIANDATE'] = julian_date_string 89 # each_json['SOURCEFILE'] = str(ppdw_file) 90 source_collection.insert_one(each_json) -
sample_scripts/iqdw_reader.py
r94f7c24 r4180d6a 18 18 dat_file.read_all_frames_left() 19 19 print(dat_file.container) 20 21 for each in dat_file.container.global_frames: 22 print(each) -
src/_version.py
r94f7c24 r4180d6a 2 2 # file generated by setuptools_scm 3 3 # don't change, don't track in version control 4 version = '0.1.dev5 7+gbfab5ea.d20220505'5 version_tuple = (0, 1, 'dev5 7', 'gbfab5ea.d20220505')4 version = '0.1.dev59+g94f7c24.d20220506' 5 version_tuple = (0, 1, 'dev59', 'g94f7c24.d20220506') -
src/ammosreader.egg-info/PKG-INFO
r94f7c24 r4180d6a 1 1 Metadata-Version: 2.1 2 2 Name: ammosreader 3 Version: 0.1.dev5 7+gbfab5ea.d202205053 Version: 0.1.dev59+g94f7c24.d20220506 4 4 Summary: ammosreader: tool to parse R&S Ammos files 5 5 Home-page: http://gitlab.kid.local/kidzg/ammosreader -
src/ammosreader/PDW.py
r94f7c24 r4180d6a 138 138 :rtype: PDW 139 139 """ 140 self.time_of_arrival = time_of_arrival 140 self.time_of_arrival = time_of_arrival # 141 141 self.pdw_format_identifier = pdw_format_identifier 142 self.center_frequency = center_frequency 143 self.is_valid = is_valid 144 self.is_pulse = is_pulse 145 self.level_unit = level_unit 142 self.center_frequency = center_frequency # 143 self.is_valid = is_valid # 144 self.is_pulse = is_pulse # 145 self.level_unit = level_unit # 146 146 self.signal_start_missing = signal_start_missing 147 147 self.signal_end_missing = signal_end_missing 148 self.pulse_width = pulse_width 149 self.frequency_shift_or_bandwidth = frequency_shift_or_bandwidth 150 self.pulse_level_or_pulse_field_strength = pulse_level_or_pulse_field_strength 148 self.pulse_width = pulse_width # 149 self.frequency_shift_or_bandwidth = frequency_shift_or_bandwidth # 150 self.pulse_level_or_pulse_field_strength = pulse_level_or_pulse_field_strength # 151 151 self.region_of_interest = region_of_interest 152 152 self.azimuth_confidence = azimuth_confidence 153 self.modulation = modulation 153 self.modulation = modulation # 154 154 self.sector = sector 155 155 self.polarity = polarity 156 self.df_quality = df_quality 157 self.elevation = elevation 156 self.df_quality = df_quality # 157 self.elevation = elevation # 158 158 self.azimuth = azimuth 159 self.channel = channel 159 self.channel = channel # 160 160 161 161 def __str__(self): … … 222 222 return output 223 223 224 def to_json(self): 225 return {'TIMEOFARRIVAL': self.time_of_arrival.item(), 226 'CENTERFREQUENCY': self.center_frequency, 227 'VALID': self.is_valid, 228 'PULSE': self.is_pulse, 229 'PULSEWIDTH': self.pulse_width, 230 'LEVELUNIT': self.level_unit, 231 'FREQUENCYSHIFTORBANDWIDTH': self.frequency_shift_or_bandwidth, 232 'PULSELEVELORFIELDSTRENGTH': self.pulse_level_or_pulse_field_strength, 233 'MODULATION': self.modulation, 234 'ELEVATION': self.elevation, 235 'AZIMUTH': self.azimuth, 236 'CHANNEL': self.channel 237 } 224 238 225 239 if __name__ == '__main__':
Note:
See TracChangeset
for help on using the changeset viewer.