Commit 522af97c authored by Moritz Huetten's avatar Moritz Huetten
Browse files

Merge branch 'dev-aberti-fix-mc-hillas' into 'master'

Hillas calculation for MC creates empty files

Closes #14

See merge request ievo/icrr-mpp-pipe!6
parents 44e3396a 3d62b619
...@@ -244,7 +244,7 @@ def get_num_islands(camera, clean_mask, event_image): ...@@ -244,7 +244,7 @@ def get_num_islands(camera, clean_mask, event_image):
return num_islands return num_islands
def process_dataset_mc(input_mask, output_name, image_cleaning_settings): def process_dataset_mc(input_mask, tel_id, output_name, image_cleaning_settings):
# Create event metadata container to hold event / observation / telescope IDs # Create event metadata container to hold event / observation / telescope IDs
# and MC true values for the event energy and direction. We will need it to add # and MC true values for the event energy and direction. We will need it to add
# this information to the event Hillas parameters when dumping the results to disk. # this information to the event Hillas parameters when dumping the results to disk.
...@@ -300,7 +300,7 @@ def process_dataset_mc(input_mask, output_name, image_cleaning_settings): ...@@ -300,7 +300,7 @@ def process_dataset_mc(input_mask, output_name, image_cleaning_settings):
source = MAGICEventSource(input_url=input_file) source = MAGICEventSource(input_url=input_file)
# Looping over the events # Looping over the events
for event in source: for event in source._mono_event_generator(telescope=f'M{tel_id}'):
tels_with_data = event.r1.tels_with_data tels_with_data = event.r1.tels_with_data
# Calibrating an event # Calibrating an event
...@@ -681,13 +681,15 @@ for data_type in data_type_to_process: ...@@ -681,13 +681,15 @@ for data_type in data_type_to_process:
is_mc = data_type.lower() == "mc" is_mc = data_type.lower() == "mc"
tel_id = re.findall('.*([_\d]+)', telescope)[0]
tel_id = int(tel_id)
if is_mc: if is_mc:
process_dataset_mc(input_mask=config['data_files'][data_type][sample][telescope]['input_mask'], process_dataset_mc(input_mask=config['data_files'][data_type][sample][telescope]['input_mask'],
tel_id=tel_id,
output_name=config['data_files'][data_type][sample][telescope]['hillas_output'], output_name=config['data_files'][data_type][sample][telescope]['hillas_output'],
image_cleaning_settings=config['image_cleaning'][telescope_type]) image_cleaning_settings=config['image_cleaning'][telescope_type])
else: else:
tel_id = re.findall('.*([_\d]+)', telescope)[0]
tel_id = int(tel_id)
process_dataset_data(input_mask=config['data_files'][data_type][sample][telescope]['input_mask'], process_dataset_data(input_mask=config['data_files'][data_type][sample][telescope]['input_mask'],
tel_id=tel_id, tel_id=tel_id,
output_name=config['data_files'][data_type][sample][telescope]['hillas_output'], output_name=config['data_files'][data_type][sample][telescope]['hillas_output'],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment