示例#1
0
def test_loop_over_events():
    from ctapipe.io.lsteventsource import LSTEventSource

    n_events = 10
    inputfile_reader = LSTEventSource(input_url=example_file_path,
                                      max_events=n_events)

    for i, event in enumerate(inputfile_reader):
        assert event.r0.tels_with_data == [0]
        for telid in event.r0.tels_with_data:
            assert event.r0.event_id == FIRST_EVENT_NUMBER_IN_FILE + i
            n_gain = 2
            num_pixels = event.lst.tel[telid].svc.num_pixels
            num_samples = event.lst.tel[telid].svc.num_samples
            waveform_shape = (n_gain, num_pixels, num_samples)
            assert event.r0.tel[telid].waveform.shape == waveform_shape

    # make sure max_events works
    assert i == n_events - 1
parser.add_argument(
    "--input_file",
    help=
    "Path to fitz.fz file to create pedestal file. Can be one path or more",
    nargs='+',
    type=str)
parser.add_argument("--output_file",
                    help="Path where script should create pedestal file",
                    nargs=1,
                    type=str)
args = parser.parse_args()

print("Input file: ", args.input_file)
print("Output file: ", args.output_file)

reader = LSTEventSource(input_url=args.input_file[0])
seeker = EventSeeker(reader)
ev = seeker[0]
n_modules = ev.lst.tel[0].svc.num_modules

ped = DragonPedestal()
PedList = []
pedestal_value_array = np.zeros((n_modules, 2, 7, 4096), dtype=np.uint16)

# create list of Pedestal class for each module
for i in range(0, n_modules):
    PedList.append(DragonPedestal())

using_files_name = ''
for file_path in args.input_file:
    using_files_name += (file_path.split("/")[-1])
import numpy as np
import os
import sys
from ctapipe.io.lsteventsource import LSTEventSource
from ctapipe.io import EventSeeker

from create_binary_file_with_pedestals_functions import DragonPedestal, write_pedestal_to_file

path_to_data = sys.argv[1]
output_path = sys.argv[2]

reader = LSTEventSource(input_url=path_to_data)
seeker = EventSeeker(reader)
ev = seeker[0]
number_modules = ev.lst.tel[0].svc.num_modules

ped = DragonPedestal()
PedList = []

inputfile_reader_event = LSTEventSource(input_url=path_to_data)

# create list of Pedestal class
for i in range(0, number_modules):
    PedList.append(DragonPedestal())

for nr_event, event in enumerate(inputfile_reader_event):
    print(nr_event)
    for nr_module in range(0, number_modules):
        PedList[nr_module].fill_pedestal_event(event, nr=nr_module)

for i in range(0, number_modules):
 def setup(self):
     # load LST data
     self.log.info("Read file:{}".format(self.infile))
     self.reader = LSTEventSource(input_url=self.infile,
                                  max_events=self.max_events)
def test_is_compatible():
    from ctapipe.io.lsteventsource import LSTEventSource

    assert LSTEventSource.is_compatible(example_file_path)
示例#6
0
def test_is_compatible():
    from ctapipe.io.lsteventsource import LSTEventSource

    assert LSTEventSource.is_compatible(example_file_path)