IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 577f47cd authored by Nikos Karastathis's avatar Nikos Karastathis :ocean:
Browse files

Radio produces a nice dataframe with all showers and all antennas for each radio process

parent 0d3fc2a3
No related branches found
No related tags found
No related merge requests found
Pipeline #11634 failed
......@@ -10,10 +10,8 @@
import logging
import os.path as op
from typing import Any
import pyarrow.parquet as pq
import pandas as pd
import numpy as np
from .output import Output
......@@ -60,11 +58,13 @@ class RadioProcess(Output):
The path to the directory containing this output.
"""
data = pq.read_table(op.join(path, "antennas.parquet"))
nshowers = data.to_pandas()['shower'].iloc[-1] + 1
antennas = list(self.config["antennas"].keys())
nr_antennas = len(antennas)
# check that we got some events
if nshowers == 0:
logging.warn(f"Radio Process {self.config['name']} contains 0 showers.")
# if there are no antennas,
if len(antennas) == 0:
......@@ -72,19 +72,22 @@ class RadioProcess(Output):
ant_nr = 0
dictionary = {}
# loop over each of the antennas
for name in antennas:
dictionary[ant_nr] = name
sampling_period = self.config["antennas"][name]["number of bins"]
antenna_data = data[ant_nr*sampling_period:(ant_nr+1)*sampling_period].to_pandas()
shower = antenna_data["shower"]#.to_numpy()
times = antenna_data["Time"]#.to_numpy()
Ex = antenna_data["Ex"]#.to_numpy()
Ey = antenna_data["Ey"]#.to_numpy()
Ez = antenna_data["Ez"]#.to_numpy()
dataset = pd.DataFrame({'shower': shower, 'time': times, 'Ex': Ex, 'Ey': Ey, 'Ez': Ez})
ant_nr = ant_nr+ 1
dataset = {}
# loop over all showers
for i in range(nshowers):
# loop over each of the antennas
for name in antennas:
dictionary[ant_nr] = name
sampling_period = self.config["antennas"][name]["number of bins"]
antenna_data = data[ant_nr*sampling_period:(ant_nr+1)*sampling_period].to_pandas()
times = antenna_data["Time"]
Ex = antenna_data["Ex"]
Ey = antenna_data["Ey"]
Ez = antenna_data["Ez"]
dictionary[name] = pd.DataFrame({'time': times, 'Ex': Ex, 'Ey': Ey, 'Ez': Ez})
ant_nr = ant_nr+ 1
dataset[str(i)] = dictionary
return dataset
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment