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

Further LOFAR development #656

Open
wants to merge 188 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 182 commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
9d63122
Update channelGalacticNoiseAdder.py
karenterveer Jul 13, 2023
e87020f
Read channel_group_id from Detector in LOFAR reader
MijnheerD Dec 14, 2023
1a66d93
Read channels from Event rather than Detector to avoid selecting flag…
MijnheerD Dec 18, 2023
1bc2eb3
Relative calibration clarification
MijnheerD Jan 30, 2024
d17aa03
Ensure LORA zenith and azimuth are within expected range
MijnheerD Jan 30, 2024
fee4d6b
Removed print statement and refactoring
MijnheerD Jan 30, 2024
7273b33
Added option to make LOFAR antenna model for X/Y dipoles
MijnheerD Feb 7, 2024
a7b045d
Restructuring relative calibration code
MijnheerD Feb 7, 2024
298a45d
Updates to beamformingDirectionFitter_LOFAR.py - needs further testing
MijnheerD Feb 7, 2024
a99c958
Add files with LOFAR calibration coefficients
MijnheerD Feb 8, 2024
8289274
Added LOFAR JSON including inner LBA, removed reference channels
karenterveer Feb 19, 2024
3e6ff35
Added LOFAR detector file
karenterveer Feb 19, 2024
0b7e65c
Implemented ant_mode key in Detector description
karenterveer Feb 19, 2024
7aa7396
specified get_antenna_mode docstring
karenterveer Feb 19, 2024
d5989e1
added conversion functions for tbb ID to nrr channel ID
karenterveer Feb 19, 2024
c0a15c7
included get_antenna_mode, updated docstring
karenterveer Feb 19, 2024
38a099a
Update channelGalacticNoiseAdder.py
karenterveer Feb 19, 2024
cd54549
Extended docstrings + reformatting for PEP8 compliance
MijnheerD Feb 21, 2024
f55d893
updated relative calibration to get channel polarisation from ant ori…
karenterveer Feb 21, 2024
060f762
fixed reader to only loop over channels of given antenna set
karenterveer Feb 21, 2024
d162734
added astropy.Time import to update detector time
karenterveer Feb 21, 2024
6ac19fe
fixed commission and deployment times
karenterveer Feb 21, 2024
91facb4
Update TBB path on COMA
MijnheerD Feb 22, 2024
360d43c
Update TBB path on COMA
MijnheerD Feb 22, 2024
88c93b2
fixed antenna_set location and definition
karenterveer Feb 22, 2024
07c8f58
Merge remote-tracking branch 'origin/lofar/lba_inner' into lofar/lba_…
MijnheerD Feb 22, 2024
41bbb95
Streamlined timestamps + refactoring
MijnheerD Feb 22, 2024
1fda764
Get channel polarisation from Detector
MijnheerD Feb 22, 2024
e9cfc65
Only use metadata if station has files
MijnheerD Feb 22, 2024
e4352ed
set station time, fixed channel IDs for inner and outer
karenterveer Feb 28, 2024
936b383
converted TBB to NRR IDs to remove bad antennas
karenterveer Feb 28, 2024
da748e3
fixed typo
karenterveer Feb 28, 2024
a863ac2
fixed missing import
karenterveer Feb 28, 2024
6d486cd
fixed small issues
karenterveer Feb 28, 2024
b4b3444
Corrected LBA inner ant_position_x
MijnheerD Feb 28, 2024
59b2cbb
Refactoring
MijnheerD Feb 28, 2024
50e6cd4
Ensure both channels are removed when antenna is flagged
MijnheerD Mar 13, 2024
ed317b7
Merge branch 'LOFAR' into lofar/development
MijnheerD Mar 18, 2024
3e31955
Merge branch 'lofar/development' into lofar/lba_inner
MijnheerD Mar 20, 2024
b6eb1ec
Merge branch 'hotfix/detector-from-nur' into lofar/lba_inner
MijnheerD Mar 20, 2024
32051e5
corrected antenna positions for LBA_outer, added missing antennas
karenterveer Mar 26, 2024
6e91177
Changed remove_channel function name
MijnheerD Mar 26, 2024
475c250
Corrected generic_detector.py docstring
MijnheerD Mar 27, 2024
f6df327
Corrected group ID info in docstring
MijnheerD Mar 28, 2024
069c702
Merge branch 'hotfix/detector-from-nur' into lofar/development
MijnheerD Mar 28, 2024
c9e19de
Merge branch 'hotfix-detector-interface' into lofar/development
MijnheerD Mar 28, 2024
9efd589
Merge branch 'save_detector_keywords' into lofar/development
MijnheerD Mar 28, 2024
4e0c8d1
Corrected weird positions for some LOFAR stations
MijnheerD Mar 28, 2024
ea77474
Merge branch 'lofar/lba_inner' into lofar/development
MijnheerD Mar 28, 2024
1599868
added LOFAR site longitude and latitude to get_site_coordinates()
karenterveer Apr 4, 2024
da01a4a
updated begin parameters to include interpolation frequencies
karenterveer Apr 9, 2024
a6f118f
updated docstring
karenterveer Apr 9, 2024
eed4111
Removed begin call from stationGalacticCalibrator init
MijnheerD Apr 10, 2024
a1e76ac
added cable lengths to channels
karenterveer Apr 15, 2024
052e1c5
analog components for LOFAR added
karenterveer Apr 15, 2024
f7dd5be
added cable lengths to channels
karenterveer Apr 16, 2024
04df09f
corrected indexing and added correct path
karenterveer Apr 16, 2024
fd9469b
added cable lengths and type
karenterveer Apr 16, 2024
dec40f6
Corrected sparse antenna layouts in rawTBBio_metadata.py
MijnheerD Apr 18, 2024
1c346ad
corrected paths
karenterveer Apr 18, 2024
6c57e8f
added hardwareResponseIncorporator for LOFAR
karenterveer Apr 18, 2024
a08494a
upload files
karenterveer Apr 18, 2024
c4b27c6
upload cable attenuation files
karenterveer Apr 18, 2024
fd28eeb
added try-except statements to make sky model module installation opt…
karenterveer Apr 18, 2024
7f32002
Create README.md
karenterveer Apr 18, 2024
3ffefae
Corrected sparse antenna layouts in rawTBBio_metadata.py
MijnheerD Apr 18, 2024
143d1e2
added cable lengths and type
karenterveer Apr 16, 2024
3df5612
logging
karenterveer Apr 19, 2024
f328661
Merge branch 'lofar/development' into lofar/signalchain
karenterveer Apr 19, 2024
194783f
Merge pull request #674 from nu-radio/lofar/signalchain
karenterveer Apr 19, 2024
6cfef25
Added docstring + refactoring
MijnheerD Apr 19, 2024
6bf60c0
Cleanup imports + add attributes to init
MijnheerD Apr 19, 2024
0a0e0a1
Restructured try block
MijnheerD Apr 19, 2024
02147b3
Simplify interpolation freq expression
MijnheerD Apr 19, 2024
a4b8b75
Merge pull request #670 from nu-radio/feature/galacticNoiseAdderUpgrade
MijnheerD Apr 19, 2024
73c34b3
Raise IndexError when TBB file does not contain enough samples to ret…
MijnheerD May 15, 2024
c479b72
Fix datatypes in flagged channel sets
MijnheerD May 15, 2024
0a55cf0
Ensure both channels are removed when a channel cannot be read in pro…
MijnheerD May 16, 2024
a0ed035
Switch integer type channel group ID for consistency with Detector de…
MijnheerD May 16, 2024
5662b22
Remove channels after loop to avoid modifying dicts in iteration
MijnheerD May 16, 2024
e37283f
Make LOFAR reader return calibration delays as dictionary per station
MijnheerD May 15, 2024
933a0ea
Skip TBB files from remote stations on read-in
Apr 4, 2024
bcf5ccb
Use channel list from TBB file instead of Detector description
MijnheerD May 17, 2024
4126ca0
Add more specific exception when reading data
MijnheerD May 17, 2024
ad35a0b
Fix channel group ID assumption
MijnheerD May 17, 2024
58be2f3
Get metadata from all TBB files for a station
MijnheerD May 17, 2024
516afd3
Save blocks which cannot be read for antenna
MijnheerD May 17, 2024
b1c30c2
Flagged TBB channel IDs must be str to compare to names from rawTBBio
MijnheerD May 22, 2024
9f50e98
Merge pull request #679 from nu-radio/lofar/hotfixes
karenterveer May 24, 2024
8c523f9
use fixed noise and pulse windows for SNR calculation
PhilippLaub Jul 10, 2024
7cf8645
revert: channel group id is already integer
PhilippLaub Jul 10, 2024
d90b7f4
Clarified docstrings
MijnheerD Jul 10, 2024
33db7d7
preliminary fix + debug plots
PhilippLaub Jul 15, 2024
eec6894
edit signal window length
PhilippLaub Jul 17, 2024
c3e463e
remove messy debug code
PhilippLaub Jul 17, 2024
7a9cd3b
remove unnecessary stuff
PhilippLaub Jul 18, 2024
dc3beee
Merge pull request #697 from nu-radio/lofar/stationPulseFinder_SNRfix
PhilippLaub Jul 23, 2024
ed8b17e
added cable lengths to missing stations
karenterveer Aug 1, 2024
af7d0d2
Update README.md
karenterveer Aug 1, 2024
2da21b1
fixed error where cable lengths were stored as strings
karenterveer Aug 2, 2024
fd44c6f
Renamed functions - removed unnecessary code - docstrings
MijnheerD Aug 7, 2024
3b028f4
Use function from beamform_utilities
MijnheerD Aug 7, 2024
2a54438
Merge pull request #715 from nu-radio/lofar/beamforming_utilities_cle…
acorstanje Aug 8, 2024
bb3a385
Fixed array indexing mistake. Add option to process polarizations sep…
Aug 21, 2024
0ad3761
Merge branch 'refs/heads/develop' into lofar/development
MijnheerD Oct 10, 2024
f4ea4e2
Merge branch 'refs/heads/improve_logging_interface' into lofar/develo…
MijnheerD Oct 10, 2024
91f99d1
Merge branch 'refs/heads/develop' into lofar/development
MijnheerD Oct 21, 2024
39b212d
Merge branch 'develop' into lofar/development
MijnheerD Nov 18, 2024
a18b55b
Save debug plots to current directory/event_id
Nov 19, 2024
2e09dd9
Merge branch 'develop' into lofar/development
MijnheerD Nov 19, 2024
b900eec
Merge remote-tracking branch 'origin/add_flagged_channels_dict' into …
MijnheerD Nov 19, 2024
f7d73e4
Store flagged reasons in reader and RFI filter
MijnheerD Nov 19, 2024
5283003
Avoid printing suspicious antenna locations bizzilion times
MijnheerD Nov 19, 2024
b594900
Make suspicious antenna logging status
MijnheerD Nov 19, 2024
302f17e
Merge remote-tracking branch 'origin/develop' into lofar/development
MijnheerD Nov 20, 2024
975a27b
Merge remote-tracking branch 'origin/feature/iterate-group-ids' into …
MijnheerD Nov 20, 2024
d6666d6
Insert preliminary plane wave fitter code into new branch. Not tested…
PhilippLaub Apr 17, 2024
3293b4d
small bug fixes, should run now without errors
PhilippLaub Apr 22, 2024
b653f8f
attempt to improve reconstruction using non-horizontal array. Still n…
PhilippLaub Apr 25, 2024
90dd1bb
updated fitting procedure, setting trace start time to 0, direction r…
PhilippLaub May 14, 2024
7f65b9f
add min amplitude to plane wave fitter
PhilippLaub Jul 8, 2024
6dd741f
clean up planeWaveFitter. Should be usable now
PhilippLaub Jul 8, 2024
c177fc7
Improve plane wave fitter. Include pulse search window and add debug …
PhilippLaub Jul 24, 2024
9263de5
changed default value for min_amp to None, so that this parameter is …
PhilippLaub Jul 31, 2024
b68f7c9
General code cleanup
Jul 31, 2024
b823698
Improved logger statements
MijnheerD Jul 31, 2024
c88d6a8
More code cleanup - specified except statement
MijnheerD Aug 7, 2024
b19408f
Some TODO items
MijnheerD Aug 7, 2024
1b5b024
Clean up _directionForHorizontalArray
MijnheerD Aug 22, 2024
84d7348
Simplify functions - save channelParameters
MijnheerD Aug 21, 2024
6a44f19
Optimise find_snr_of_timeseries
MijnheerD Aug 22, 2024
cad4dfe
Added documentation for time lags
MijnheerD Aug 22, 2024
a895e01
Use channelParameters - WIP
MijnheerD Aug 21, 2024
017ca17
Construct good antenna using dominant polarisation from station param…
MijnheerD Aug 22, 2024
53eac85
station.iter_channels changes order of times, use loop over ids instead
MijnheerD Aug 22, 2024
3fcd8ff
Use beamforming utilities to calculate delays - change fit failure co…
MijnheerD Aug 22, 2024
ab67846
Follow Python naming scheme
MijnheerD Aug 22, 2024
5303edb
Fix debug plots
MijnheerD Aug 22, 2024
efb52b4
Removed unnecessary code
MijnheerD Aug 22, 2024
dc21e0b
Revert change to stationPulseFinder.py to get channels from Event
MijnheerD Aug 23, 2024
9e02518
add function and method to electric_field to compute Stokes parameters
sjoerd-bouma Nov 19, 2024
64770bb
fix bug/typo in get_stokes
sjoerd-bouma Nov 19, 2024
4434cd0
first version of additional debug plots
PhilippLaub Nov 19, 2024
45bad0d
refine debug plots and stuff
PhilippLaub Nov 19, 2024
17600f0
Clean up and docstrings
MijnheerD Nov 19, 2024
980736b
Making logging of planeWaveDirectionFitter_LOFAR.py compliant with ne…
MijnheerD Nov 19, 2024
7f99ee8
add core and energy estimate from LORA!
karenterveer Nov 20, 2024
5d421dd
store signal times in channelParameters in stationPulseFinder and acc…
PhilippLaub Nov 20, 2024
18177c7
fix LORA core Z coordinate
karenterveer Nov 20, 2024
7dc0f54
Merge pull request #756 from nu-radio/lofar/lora_json_information
karenterveer Nov 20, 2024
a2751c4
Merge branch 'no-ice-at-lofar' of github.com:nu-radio/NuRadioMC into …
sjoerd-bouma Nov 21, 2024
ca86d93
refine plotting and use of flags etc...
PhilippLaub Nov 21, 2024
4d51156
Definition of SNR (testgit add stationPulseFinder.py ), use SNR for d…
Nov 21, 2024
675c6e9
created pipeline visualizer
karenterveer Nov 21, 2024
cccd171
boost pipelineVisualizer speed
karenterveer Nov 21, 2024
6ac4656
small improvements
karenterveer Nov 21, 2024
2f12a1f
Plot debug before if-else in case of crash
MijnheerD Nov 22, 2024
4e58f47
Reset to LORA estimate if planewave fit fails
MijnheerD Nov 22, 2024
f9783cf
Actually use event timestamp to calculate clock corrections
MijnheerD Nov 22, 2024
4460a62
Do not set station parameters every iteration as they are not used
MijnheerD Nov 22, 2024
1c5b89d
Restructure plotting functions
MijnheerD Nov 22, 2024
5d5deb5
Make sure the returned RMS is still what we think it should be
MijnheerD Nov 22, 2024
e30bbea
Merge branch 'lofar/add_pipeline_plots' into lofar/planewave_fitter
MijnheerD Nov 22, 2024
8bd0404
Merge remote-tracking branch 'origin/lofar/planewave_fitter' into lof…
MijnheerD Nov 22, 2024
df5db9d
Merge remote-tracking branch 'origin/lofar/debug_plots_ac' into lofar…
MijnheerD Nov 22, 2024
37e29b6
Add docstring
MijnheerD Nov 22, 2024
aa982ee
Make default SNR cut match the new calculation
MijnheerD Nov 22, 2024
2a2363d
Move all plots to visualiser to avoid duplicate code
MijnheerD Nov 22, 2024
f92c20d
Clean up and docstrings
MijnheerD Nov 22, 2024
a824586
Fix indents
MijnheerD Nov 22, 2024
49c73b6
add function to calculate average plane wave direction for an event
PhilippLaub Nov 26, 2024
a6f74aa
remove per-station RadioShowers and use one RadioShower per event ins…
PhilippLaub Nov 26, 2024
e5849f6
remove commented out lines
PhilippLaub Nov 27, 2024
055040f
Remove check_for_good_ant usage
MijnheerD Nov 29, 2024
bd14ce6
Get info from Event
MijnheerD Nov 29, 2024
05ec4eb
Remove resolved TODO item
MijnheerD Nov 29, 2024
44e02ba
Merge pull request #771 from nu-radio/lofar/one-radio-shower-to-rule-…
PhilippLaub Dec 2, 2024
cff9cc3
Update LOFAR detector description with positions from ASTRON database
MijnheerD Dec 4, 2024
636ef41
Merge branch 'lofar/fix-lba-inner' into lofar/development
MijnheerD Dec 4, 2024
8143fb0
Merge pull request #769 from nu-radio/lofar/average_direction
PhilippLaub Dec 19, 2024
40ccf35
Merge branch 'develop' into lofar/development
MijnheerD Dec 19, 2024
11f47a8
Update changelog.txt
MijnheerD Dec 19, 2024
e939802
Update TODO and variable name
MijnheerD Dec 20, 2024
508fd86
Rename file and clarify contents
MijnheerD Dec 20, 2024
b86dbe7
No longer use experiment_parameters.txt to get parameters, but detect…
MijnheerD Dec 20, 2024
232dd87
Fix logging statement
MijnheerD Dec 20, 2024
e7f6d8f
fixed filenames, added docstrings
karenterveer Jan 9, 2025
76b5091
fix typo
karenterveer Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138,630 changes: 138,630 additions & 0 deletions NuRadioReco/detector/LOFAR/LOFAR.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions NuRadioReco/detector/LOFAR/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The signalchain folder contains cable attenuation and RCU gains. The RCU gain contains the gain of the RCU in dB, one value for every frequency in the 30-80MHz band.
The cable attenuation files (one for each cable length) contain the frequency in MHz and the attenuation in dB (careful with the sign).
The cable lengths for station 11, 28 and 201 are all set to 80.0 (careful here!) as the files containing their true lengths are missing. This will be changed as soon as the corresponding files are found.
78 changes: 78 additions & 0 deletions NuRadioReco/detector/LOFAR/analog_components.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import numpy as np
import os
import logging
from NuRadioReco.utilities import units
from scipy.interpolate import interp1d
from radiotools import helper as hp

logger = logging.getLogger("NuRadioReco.LOFAR_analog_components")


def load_cable_response(cable_length):
"""
Parameters
----------
path: string
Path to the folder containing the cable response
cable_length: int
length of the coax cable of the corresponding channel
"""
module_dir = os.path.dirname(__file__)
file_path = os.path.join(module_dir, "signalchain", f"attenuation_RG58_{cable_length}m.txt")

data = np.loadtxt(file_path)

default = {}
default['frequencies'] = np.arange(30,81) * units.MHz
default['attenuation'] = -1*data #data is in dB
return default

def get_cable_response(frequencies, cable_length):

karenterveer marked this conversation as resolved.
Show resolved Hide resolved
cable_response = {}
cable_response['default'] = load_cable_response(cable_length=cable_length)

orig_frequencies = cable_response['default']['frequencies']
gain = cable_response['default']['attenuation']

interp_gain = interp1d(orig_frequencies, gain[:,1], bounds_error=False, fill_value=0)

cable = {}
cable['attenuation'] = interp_gain(frequencies)
return cable


def load_RCU_response():
"""
Parameters
----------
path: string
Path to the folder containing the RCU response
"""

module_dir = os.path.dirname(__file__)
file_path = os.path.join(module_dir, "signalchain/RCU_gain_new_5.txt")

data = np.loadtxt(file_path)

default = {}
default['frequencies'] = np.arange(30,81) * units.MHz
default['gain'] = data # data is in dB

return default

def get_RCU_response(frequencies):

karenterveer marked this conversation as resolved.
Show resolved Hide resolved

RCU_response = {}
RCU_response['default'] = load_RCU_response()
orig_frequencies = RCU_response['default']['frequencies']

gain = RCU_response['default']['gain']

interp_gain = interp1d(orig_frequencies, gain, bounds_error=False, fill_value=0)

system = {}
system['gain'] = interp_gain(frequencies)

return system
51 changes: 51 additions & 0 deletions NuRadioReco/detector/LOFAR/signalchain/RCU_gain_new_5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
0.571199977723
karenterveer marked this conversation as resolved.
Show resolved Hide resolved
0.721199977723
0.799800695235
0.825966036527
0.815430246143
0.783927568626
0.746950424766
0.712983105812
0.682589587584
0.655908728285
0.633079386122
0.614226566278
0.599111687582
0.587105693931
0.577560289905
0.569827180085
0.563258069051
0.557204661382
0.55101866166
0.544051774464
0.535655704375
0.525182155973
0.511982833838
0.495409442551
0.474813686691
0.44954727084
0.418961899576
0.382409277481
0.339241109135
0.288809099118
0.23046495201
0.163560372391
0.0874470648419
0.00147673394283
-0.0949989157261
-0.202628179585
-0.322059353052
-0.453940731549
-0.598920610495
-0.757647285309
-0.930769051412
-1.11893420422
-1.32279103916
-1.54298785165
-2.0801729371
-2.38499459094
-2.71223456883
-3.23061184212
-4.13436889849
-5.92420576122
-8.50082245357
51 changes: 51 additions & 0 deletions NuRadioReco/detector/LOFAR/signalchain/attenuation_RG58_115m.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
30 9.37884232408
31 9.53487220268
32 9.68842092213
33 9.83960368097
34 9.98852702327
35 10.1352897227
36 10.2799835538
37 10.4226939673
38 10.5635006844
39 10.7024782204
40 10.839696349
41 10.9752205142
42 11.1091121976
43 11.2414292464
44 11.3722261673
45 11.5015543907
46 11.6294625085
47 11.7559964886
48 11.8811998694
49 12.0051139356
50 12.1277778787
51 12.2492289422
52 12.3695025551
53 12.4886324526
54 12.6066507884
55 12.7235882355
56 12.8394740809
57 12.9543363114
58 13.0682016927
59 13.1810958433
60 13.293043302
61 13.4040675904
62 13.5141912711
63 13.6234360018
64 13.7318225849
65 13.8393710144
66 13.9461005192
67 14.0520296034
68 14.1571760837
69 14.2615571255
70 14.3651892746
71 14.4680884892
72 14.5702701679
73 14.6717491772
74 14.7725398768
75 14.8726561435
76 14.9721113935
77 15.0709186038
78 15.1690903319
79 15.2666387345
80 15.3635755852
51 changes: 51 additions & 0 deletions NuRadioReco/detector/LOFAR/signalchain/attenuation_RG58_50m.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
30 4.07775753221
31 4.14559660986
32 4.21235692266
33 4.27808855694
34 4.3428378362
35 4.40664770552
36 4.46955806685
37 4.53160607273
38 4.59282638451
39 4.65325140018
40 4.7129114561
41 4.77183500619
42 4.83004878157
43 4.8875779332
44 4.94444615968
45 5.00067582203
46 5.05628804716
47 5.11130282113
48 5.16573907364
49 5.21961475461
50 5.27294690378
51 5.32575171402
52 5.37804458916
53 5.4298401968
54 5.48115251668
55 5.531994885
56 5.58238003519
57 5.63232013538
58 5.6818268229
59 5.73091123623
60 5.77958404435
61 5.82785547408
62 5.87573533527
63 5.92323304425
64 5.9703576456
65 6.01711783236
66 6.06352196489
67 6.10957808842
68 6.15529394945
69 6.20067701107
70 6.24573446722
71 6.29047325617
72 6.334900073
73 6.37902138139
74 6.4228434247
75 6.46637223629
76 6.50961364935
77 6.55257330602
78 6.59525666605
79 6.63766901499
80 6.67981547185
51 changes: 51 additions & 0 deletions NuRadioReco/detector/LOFAR/signalchain/attenuation_RG58_80m.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
30 6.52441205153
31 6.63295457577
32 6.73977107626
33 6.84494169111
34 6.94854053793
35 7.05063632883
36 7.15129290696
37 7.25056971637
38 7.34852221522
39 7.44520224029
40 7.54065832975
41 7.6349360099
42 7.72807805051
43 7.82012469312
44 7.91111385548
45 8.00108131525
46 8.09006087545
47 8.1780845138
48 8.26518251782
49 8.35138360738
50 8.43671504605
51 8.52120274243
52 8.60487134266
53 8.68774431488
54 8.76984402669
55 8.851191816
56 8.93180805631
57 9.0117122166
58 9.09092291664
59 9.16945797796
60 9.24733447096
61 9.32456875853
62 9.40117653643
63 9.47717287081
64 9.55257223297
65 9.62738853178
66 9.70163514382
67 9.77532494147
68 9.84847031912
69 9.92108321771
70 9.99317514756
71 10.0647572099
72 10.1358401168
73 10.2064342102
74 10.2765494795
75 10.3461955781
76 10.415381839
77 10.4841172896
78 10.5524106657
79 10.620270424
80 10.687704755
24 changes: 17 additions & 7 deletions NuRadioReco/detector/antennapattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,24 +1008,31 @@ def parse_LOFAR_txt_file(path_theta, path_phi):
return freq, theta, phi, real_theta, imaginary_theta, real_phi, imaginary_phi


def preprocess_LOFAR_txt(directory, ant='LBA'):
def preprocess_LOFAR_txt(directory, ant='LBA', orientation=None):
"""
Function to parse the LOFAR antenna model simulation files in TXT format. It extracts the
vector effective length for all simulated frequencies, azimuth and zenith angles and dumps
them into a pickle file according to the NuRadioReco specification.
Function to process the TXT files from the old LOFAR antenna model (only tested for LBA). The paths to these
files is currently hardcoded. Because of a weird issue which requires minus signs to be added for the X and Y
dipoles separately, the orientation can be specified to create separate antenna models for each. If the
orientation is not set, the values for the Y dipole are returned.

Parameters
----------
directory : str
The path to the directory where the TXT files are stored
Path to where the text files are stored
ant : str, default='LBA'
The antenna type
The antenna type, either LBA or HBA (not tested)
orientation : str, default=None
If set, must be either X or Y.
"""
path_theta = os.path.join(directory, f'{ant}_Vout_theta.txt')
path_phi = os.path.join(directory, f'{ant}_Vout_phi.txt')

frequencies, thetas, phis, theta_real, theta_imag, phi_real, phi_imag = parse_LOFAR_txt_file(path_theta, path_phi)

if orientation == 'X':
for ar in [theta_real, theta_imag, phi_real, phi_imag]:
ar *= -1

VEL_thetas = theta_real + 1j * theta_imag
VEL_phis = phi_real + 1j * phi_imag

Expand All @@ -1046,7 +1053,10 @@ def preprocess_LOFAR_txt(directory, ant='LBA'):
orientation_theta, orientation_phi, rotation_theta, rotation_phi = \
90 * units.deg, 0 * units.deg, 0 * units.deg, 0 * units.deg

fname = f'LOFAR_{ant}'
if orientation is not None:
fname = f'LOFAR_{ant}_{orientation}'
else:
fname = f'LOFAR_{ant}'
output_filename = '{}.pkl'.format(os.path.join(path_to_antennamodels, fname, fname))

directory = os.path.dirname(output_filename)
Expand Down
26 changes: 26 additions & 0 deletions NuRadioReco/detector/detector_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,32 @@ def get_channel_group_id(self, station_id, channel_id):
return channel_id
else:
return res['channel_group_id']

def get_antenna_mode(self, station_id, channel_id):
"""
returns the antenna mode of a given channel - this is specific to LOFAR antennae, as they operate in either inner or outer mode.
karenterveer marked this conversation as resolved.
Show resolved Hide resolved

Parameters
----------
station_id: int
the station id
channel_id: int
the channel id

Returns
-------
ant_mode : str
the antenna mode (LBA inner/outer)
"""

res = self.__get_channel(station_id, channel_id)
if 'ant_mode' not in res.keys():
logger.warning(
'Antenna mode not set for channel {} in station {}, returning None'.format(
channel_id, station_id))
return None
else:
return res['ant_mode']

def get_noise_RMS(self, station_id, channel_id, stage='amp'):
"""
Expand Down
Loading
Loading