nu-radio / NuRadioReco

reconstruction framework for radio detectors of high-energy neutrinos
GNU General Public License v3.0
5 stars 3 forks source link

Refactor phased array #259

Closed cg-laser closed 3 years ago

cg-laser commented 4 years ago

Refactors the phased array trigger module to provide a function that can be called on traces to calculate the trigger. This is required to use this code to calculate the thermal noise trigger rate.

This PR also adds a chebychev filter to the bandstopfilter module

cg-laser commented 4 years ago

Hi Brian, thanks for the thorough check of the module. As I agree with you on most of the points, I won't be able to do something about it as I did not write this module. I just refactored it a bit, so that the noise trigger rate calculation can directly use this module (Before it was done by code duplication which I find quite error prone as any change needs to be implemented in two places)

clark2668 commented 4 years ago

Hi Christian--fair enough! I defer to and others on how to proceed then. The typos and function renaming is probably easy, but the "What is this actually trying to do" is probably harder.

cg-laser commented 4 years ago

I think there is a problem in the script that calculates the trigger efficiency curves. The SNR is calculated on the unfiltered signal.

dansmithphysics commented 4 years ago

I've been banging my head against the wall for a week and a half now making diagnostic plots. The issue is that the phased array isn't triggering at the single-dipole rate that it should be. The efficiency vs SNR plots (currently running, will upload later) don't look good when running over the same sim data sample that is used to create the Veff plots. The efficiency vs SNR plots look much better if I use boresight only data samples, which suggests somethings wrong with beaming.

Screen Shot 2020-10-07 at 9 42 15 AM Screen Shot 2020-10-07 at 9 40 59 AM Screen Shot 2020-10-07 at 9 39 18 AM Screen Shot 2020-10-07 at 9 38 46 AM Screen Shot 2020-10-07 at 9 38 08 AM

dansmithphysics commented 4 years ago

While the github linter continues to allude me, I think I've figured out what was wrong with my above problem. I wasn't correctly upsampling, so beams were extremely narrow. I thought things were working last week because I was making efficiency vs SNR plots using only boresight data, where beaming was 'correct'. As soon as I considered events evenly distributed in space, the holes between beams became clearer so dropped performance. With proper number of taps for upsampling, makes things much more reasonable. Attached plots are for a 100 m station. Besides fixing the linter code and commenting out some deprecated code, the phased array module is close to being done.

One thing of note, the RNO-G proposal has a figure made by Daniel that has a quoted sensitive curve quite a bit worse than what I have here. Only thing that comes to mind is that one of us got the noise level wrong.

Screen Shot 2020-10-08 at 12 10 44 AM Screen Shot 2020-10-08 at 12 09 40 AM
cg-laser commented 4 years ago

What uptime did you assume to convert the Veff to expected sensitivity? And how many stations did you use? I expect this the main difference to the RNO-G white paper plot which assumed a realistic uptime (only solar power I think) and 5 years of operation

cg-laser commented 4 years ago

I saw that you used an upsampling of 2 for the 4 channel setup, and an upsampling of 4 for the 8 channel setup. How much does the sensitivity change if a 4 channel setup is used without upsampling (which I thought was the baseline plan)? And just to be sure: The module is flexible enough to correctly calculate the beams for any upsampling and number of antennas?

dansmithphysics commented 4 years ago

Good point about the livetime, I was assuming 100% livetime. I used 35 stations, 5 years. So the livetime would explain a factor of 2. I guess one question is with noise. If the digitizer goes up to say 1 GHz but we have a trigger that goes from 0-250 Mhz, which bandwidth should be used to calculate the noise, ~250 Mhz or ~1 GHz?

I believe the baseline plan for the 4 channel setup was going to be no upsampling with some secondary beaming, but the beams work out pretty well with an upsampling factor of 2. The module should be flexible enough to do any integer upsampling and number of antennas. I did strip away the code for the secondary beams, something I'm planning to add back in just in case. I also should fix any code (for example, envelope phase trigger) that depends on this triggering module.

cg-laser commented 4 years ago

You need to use the bandwidth of the filter which should be more like ~140MHz (100 - 240MHz). You get the precise number by integrating over the filter.

dansmithphysics commented 4 years ago

After a bit more debugging, I found I was misunderstanding how the noise gets added in the various functions that NuRadioMC call up (I redefined the _detector_simulation_part2 so filters in the _detector_simulation_filter_amp weren't getting called). There was also a small filtering bug that I removed. Attached are the most up to date results.

The efficiency vs SNR still isn't behaving exactly as we expect for the single antenna equivalent. Note that, for the Veff plot, there is noise for the phased array but not the single antenna equivalent. I made a residual plot against the 1.5 sigma single dipole trigger to better see the behavior in the Veff plot. For certain energies, things agree with the efficiency vs SNR plot, but things perform worse at lower energies and better at high energies than we would expect from the single antenna. Not sure if this points to things not being properly coded or a breakdown of our understanding of the phased array. Only thing that comes to mind is planewavy-ness and spectral content vs energy.

I also ran for two different integration window, and found a slight improvement using a shorter (16 ns) integration window.

Screen Shot 2020-10-16 at 10 28 00 AM Screen Shot 2020-10-16 at 10 24 24 AM Screen Shot 2020-10-16 at 9 57 19 AM Screen Shot 2020-10-16 at 9 52 42 AM Screen Shot 2020-10-16 at 9 52 33 AM Screen Shot 2020-10-16 at 9 52 21 AM