Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a script for the standard data processing of RNO-G data #790

Open
wants to merge 69 commits into
base: develop
Choose a base branch
from

Conversation

fschlueter
Copy link
Collaborator

Coming soon.

fschlueter and others added 30 commits January 16, 2025 17:24
…mple script for the simulation of RNOG is being added to NuRadioMC with PR #788
added to eventParameters
Added functionality to calculate the RPR (root power ratio)
philippwindischhofer and others added 5 commits January 28, 2025 13:27
Added error message if channel as no parameter SNR or RPR and made sure function utilized channels to include. Also modified names of functions to calculate SNR and RPR, to be more clear
@fschlueter
Copy link
Collaborator Author

I'm not sure if this is already ready for review; I just noticed you are adding a number of new methods to the Event class. I'm not set in stone against this but typically properties like SNR, glitches etc. are obtained by dedicated modules and stored in parameters. They can then be obtained in subsequent analysis by get_parameter or dictionary access (station[parameter]) where needed.

What I am worried about is two things: splitting information across multiple places, and cluttering the basic Event class with many methods that may or may not be relevant to different users. But if you or @fschlueter feel that there is a good reason to implement things this way I am willing to listen to arguments.

@sjoerd-bouma, I understand your concern! Indeed I think we should make sure that we are not duplicating data in the various data-structure "levels". What we have started implementing are getter functions to simplify the access to certain data. Smart getter functions like get_average_snr which allow you to on-the-fly calculate the avg SNR for, e.g., the PA channels, also add useful functionality and allow us easy access to such data without the need to extra store them.

One problem I see with the current functions is that they access channel information for an event while "by-passing" the station level. One solution could be to implement those functions on the station-level and implement wrapper for those on the event level. Regarding cluttering the basic event class. Yes I am also not super happy with this. Do you think it is time to implement a subclass of Event a RNOGEvent for example?

@@ -261,33 +261,37 @@ def get_magnetic_field_vector(self, time=None):
logger.error(f"Reference reconstruction not set / unknown: {self.__reference_reconstruction}")
raise ValueError(f"Reference reconstruction not set / unknown: {self.__reference_reconstruction}")

def avg_SNR(self, channels_to_include = [0, 1, 2, 3, 5, 6, 7, 22, 23]):
def get_average_signal_to_noise_ratio(self, channels_to_include = [0, 1, 2, 3, 5, 6, 7, 22, 23]):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set the default value for channels_to_include to None? This class should be a rather generic class and the channels id only make sense for RNO-G.

"""
Returns the average SNR across all channels
"""
snr_all = []
for channel in station.iter_channels():
for channel in station.iter_channels(channels_to_include):
if (channel.has_parameter(chp.SNR)):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove the parentheses from the if condition?

if (channel.has_parameter(chp.SNR)):
snr_ch = channel.get_parameter(chp.SNR)
if (snr_ch == np.inf):
return np.inf
else:
snr_all.append(snr_ch)
else:
raise LookupError(f"Channel {channel.get_id()} has no parameter SNR")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValueError or KeyError?

@cg-laser
Copy link
Collaborator

I second Sjoerd that I'm afraid that event and station classes get too cluttered with analysis/RNO-G specific functions. On the other hand, we want to offer this flexibility.

Wouldn't the better way to implement utility functions such as
get_average_SNR(station, include_channels=[xxx])
that we provide in NuRadioReco/utlities/RNOG_utilities.py
Or a more general name, depending on how general the functions are.

So instead of writing station.get_average_SNR one writes get_average_SNR(station)

@cg-laser
Copy link
Collaborator

Hi everyone, I provided an example data analysis script with extensive documentation.

I have one technical question. Why is the hardwareResponeIncorporator configured to only remove the phases but not correct for amplitudes? I suggest to do the full correction. A bandpass filter is applied before that module so that we won't have any "division by zero" problems.

cg-laser and others added 4 commits February 3, 2025 15:30
Fixed functions to get average SNR and RPR
Fixed functions to get average SNR and RPR
Added eventParametersRNOG class for L2 parameters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants