Changes in / [5ba04b8:d8483f7] in ammosreader


Ignore:
Location:
ammosreader
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ammosreader/PDW.py

    r5ba04b8 rd8483f7  
    141141        self.pdw_format_identifier = pdw_format_identifier
    142142        self.center_frequency = center_frequency #
    143         self.is_valid = is_valid #
     143        self.__is_valid = is_valid #
    144144        self.is_pulse = is_pulse #
    145145        self.level_unit = level_unit #
     
    169169                  "Center frequency: " + str(self.center_frequency) + " KHz\n")
    170170
    171         if self.is_valid:
     171        if self.__is_valid:
    172172            output += "Signal: Valid\n"
    173173        else:
     
    221221
    222222        return output
     223
     224    def is_valid(self):
     225        return self.__is_valid
    223226
    224227    def to_json(self):
     
    226229                'FORMATIDENTIFIER': self.pdw_format_identifier,
    227230                'center frequency': self.center_frequency,
    228                 'VALID': self.is_valid,
     231                'VALID': self.__is_valid,
    229232                'PULSE': self.is_pulse,
    230233                'PULSELEVEL': self.pulse_level_or_pulse_field_strength,
  • ammosreader/PPDWContainer.py

    r5ba04b8 rd8483f7  
    1616            self.signals = signals
    1717
     18        self.name = name
     19
    1820    def __str__(self):
    1921        return "\n".join(["Number of pulses:" + str(len(self.signals)),
     22                          "Number of invalid pulses:" + str(self.number_of_invalid_pulses()),
    2023                          "Start time:" + str(self.start_time()),
    2124                          "End time:" + str(self.end_time())])
    2225
    2326    def add(self, a_pdw):
     27        # print(a_pdw)
    2428        self.signals.append(a_pdw)
    2529
    2630    def as_pulse_dict(self):
     31        print(datetime.now())
    2732        pulse_dict = {}
    2833        pulse_dict[0] = self.signals[0].to_json()
     
    3136            pulse_dict[index]["dtoa"] = (current_pdw.time_of_arrival - pulse_dict[index]["time of arrival"]).item()/1000.0
    3237        pulse_dict[index+1]["dtoa"] = 0.0  # np.timedelta64(0, 'us')
     38        print(datetime.now())
    3339        return pulse_dict
     40
     41    def number_of_invalid_pulses(self):
     42        return sum(not each.is_valid() for each in self.signals)
     43
     44    def without_invalids(self):
     45        return PPDWContainer(self.name, [each for each in self.signals if each.is_valid()])
    3446
    3547    def julian_date_string(self):
  • ammosreader/PPDWReader.py

    r5ba04b8 rd8483f7  
    2323                    break
    2424                if self.cursor + 32 >= len(self.content):
    25                     # print('Can not read all 32 bytes of next PDW')
     25                    # print('Can not read all 32 bytes of next PDW. EOF')
    2626                    break
    2727                self.container.add(PDW.from_bytes(current_bytes))
Note: See TracChangeset for help on using the changeset viewer.