示例#1
0
    def __init__(self, filename):
        super().__init__("DataReader")

        self.reader = DataReader(filename)
        print(self.reader)

        print("Simulation config:", self.reader.sim_attr_dict)
        self.cout_camconfig = "CameraConfiguration"
        self.out_raw_resp = "raw_resp"
        self.out_time = "time"
        self._loaded_data = False
示例#2
0
class Reader(ProcessingModule):
    def __init__(self, filename):
        super().__init__("DataReader")

        self.reader = DataReader(filename)
        print(self.reader)

        print("Simulation config:", self.reader.sim_attr_dict)
        self.cout_camconfig = "CameraConfiguration"
        self.out_raw_resp = "raw_resp"
        self.out_time = "time"
        self._loaded_data = False

    def configure(self, config):
        # should be read from the file in the future
        from target_calib import CameraConfiguration

        config[self.cout_camconfig] = CameraConfiguration("1.1.0")
        # for the time being we load all data at once
        config["n_frames"] = 1

    def run(self, frame):
        # Only read the data once

        if not self._loaded_data:
            self.res = []
            self.times = []
            for r in self.reader.read():
                self.res.append(r.flatten())
                self.times.append(self.reader.cpu_t)
            self._loaded_data = True
        frame[self.out_raw_resp] = np.array(copy.copy(self.res))
        frame[self.out_time] = np.array(copy.copy(self.times))
        return frame
示例#3
0
class Reader(ProcessingModule):
    def __init__(
        self,
        filename,
        focal_length=2.15,
        mirror_area=6.5,
        location=EarthLocation.from_geodetic(lon=14.974609, lat=37.693267, height=1730),
    ):
        super().__init__("DataReader")

        self.reader = DataReader(filename)
        print(self.reader)

        print("Simulation config:", self.reader.sim_attr_dict)
        self.cout_camconfig = "CameraConfiguration"
        self.out_raw_resp = "raw_resp"
        self._loaded_data = False
        self.location = location
        self.focal_length = focal_length
        self.mirror_area = mirror_area

    def configure(self, config={}):
        # should be read from the file in the future
        from target_calib import CameraConfiguration

        self.cam_config = CameraConfiguration("1.1.0")
        self._mapping = self.cam_config.GetMapping()
        config[self.cout_camconfig] = self.cam_config
        self.pixsize = self._mapping.GetSize()
        self.pix_posx = np.array(self._mapping.GetXPixVector())
        self.pix_posy = np.array(self._mapping.GetYPixVector())
        self.pix_pos = np.array(list(zip(self.pix_posx, self.pix_posy)))
        # for the time being we load all data at once
        config["n_frames"] = 1

    def run(self, frame={}):
        # Only read the data once

        if not self._loaded_data:
            self.res = []
            self.times = []
            for r in self.reader.read():
                self.res.append(r.flatten())
                self.times.append(self.reader.cpu_t)
            self._loaded_data = True
            self.res = np.array(self.res)
            self.times = np.array(self.times)
        frame[self.out_raw_resp] = SlowSignalData(
            copy.copy(self.res),
            copy.copy(self.times),
            {"xpix": self.pix_posx, "ypix": self.pix_posy, "size": self.pixsize},
            focal_length=self.focal_length,
            mirror_area=self.mirror_area,
            location=self.location,
        )

        return frame
示例#4
0
    def __init__(
        self,
        filename,
        focal_length=2.15,
        mirror_area=6.5,
        location=EarthLocation.from_geodetic(lon=14.974609, lat=37.693267, height=1730),
    ):
        super().__init__("DataReader")

        self.reader = DataReader(filename)
        print(self.reader)

        print("Simulation config:", self.reader.sim_attr_dict)
        self.cout_camconfig = "CameraConfiguration"
        self.out_raw_resp = "raw_resp"
        self._loaded_data = False
        self.location = location
        self.focal_length = focal_length
        self.mirror_area = mirror_area