def read_posar_data(self, checked): self.logger.info("read_posar_data") self.rec_dates = [f"{self.flight.day}_" + h for h in self.flight.hours] self.rec_dirs = [ os.path.join(self.flight.dir_posar, self.flight.day, d) for d in self.rec_dates ] self.records = [ posar.Record(rec_dir, "record", "bin", utc=self.logs.utc, period=expectedPeriod, version="X_v1") for rec_dir in self.rec_dirs ]
def __init__(self, filename, tag="Sa", alongTrack=1, pointsFile="py", corr=False): self.filename = filename self.pointsFile = pointsFile self.tag = tag self.alongTrack = alongTrack self.corr = corr print(f"======= Conf") self.conf = Conf(filename, pointsFile=pointsFile) print("======= Track") self.track = Track(self.conf, filename=None) print("======= Load analytic signal...") self.signal = Signal(self.conf, tag=tag, filename=None) if self.signal.load() is False: # load signal.sa and signal.coupling print("/!\\ signal.load() failed, try to build the analytic signal /!\\") record = posar.Record(self.conf.rec_dir, "record", "bin", version="X_v1") A_reshaped = record.readBins("ADLINKCh0") self.signal.build(A_reshaped) self.signal.save() else: print("existing analytic signal found and loaded") self.sa = self.signal.sa self.avg = self.signal.avg print("======= Load antenna positions...") self.loadAntennaPositions() print("======= Load Digital Terrain Elevation Data...") if self.conf.hScene == -1: self.dted = Dted(self.conf.dted) else: print(f"DTED not loaded, conf.hScene {self.conf.hScene:.2f}") print("======= Scene") self.buildScene() print("======= Set focusingParameters") self.parameters = MyParameters_LETG() self.setFocusingParameters() self.out_dir = os.path.join(self.conf.root_dir, "FOCUSING", self.conf.data_date) try: os.makedirs(self.out_dir, exist_ok=True) logger.info(f"{self.out_dir} created successfully") except OSError as error: logger.error(f"{self.out_dir} can not be created, error: {error}")
def read_hour(self, item): if self.logs is not None: self.ui.textEdit_logging.append("") text = item.text() hour = text.split(" ")[0] rec_date = f"{self.flight.day}_{hour}" rec_dir = os.path.join(self.flight.dir_posar, self.flight.day, rec_date) self.record = posar.Record(rec_dir, "record", "bin", utc=self.logs.utc, period=expectedPeriod, version="X_v1") else: self.logger.error("self.logs does not exists")
def __init__(self, filename, pointsFile="py"): self.filename = filename self.name = filename.split("/")[-1].split(".ini")[0] self.pointsFile = pointsFile # [posar] self.dir_posar, self.day, self.hour = self.__get_posar() self.data_date = f"{self.day}_{self.hour}" self.root_dir = os.path.join(self.dir_posar, self.day) self.rec_dir = os.path.join(self.root_dir, self.data_date) self.out_dir = os.path.join(self.root_dir, "OUT", self.data_date) self.record = posar.Record(self.rec_dir, "record", "bin", version="X_v1") # insert dir_posar in the path to have an access to the references sys.path.insert(0, self.dir_posar) # [scene] self.__get_scene() # [sbg] self.nav = self.__get_sbg() # [dted] self.__get_dted() # [focusing] self.__get_focusing() self.params_filename = os.path.join(self.rec_dir, self.data_date + "_parameters.xml") self.params = posar.PosarXParameters(self.params_filename) self.Tp = self.params.rampPeriod / 1e6 self.B0 = (self.params.stopFrequency - self.params.startFrequency) * 1e6 self.fc = (self.params.stopFrequency + self.params.startFrequency) * 1e6 / 2 self.fs = self.params.samplingFrequency self.c = 3e8 self.lambda_c = self.c / self.fc
def load_data(self, upOrDown): # set window to "None" self.conf.upOrDown = upOrDown self.conf.window = "None" print( f"======= Load analytic signal, upOrDown {upOrDown}, window {self.conf.window}..." ) signal = Signal(self.conf, filename=None) if signal.load() is False: # load signal.sa and signal.coupling print( "/!\\ signal.load() failed, try to build the analytic signal /!\\" ) record = posar.Record(self.conf.rec_dir, "record", "bin", version="X_v1") A_reshaped = record.readBins("ADLINKCh0") signal.build(A_reshaped) signal.save() else: print("existing analytic signal found and loaded") return signal