Radio IO
This MR aims to provide a nice output for the pulses coming out of radio using the corsika library.
Merge request reports
Activity
requested review from @acoleman
assigned to @Nikos
- Resolved by Felix Riehn
@acoleman I tried tons of things and I think I see why Remy chose to use xArray for this. Apparently it is the easiest and best way to create a multi-dimensional array of the form Array([shower number], [antenna name], [time, Ex, Ey, Ez]). So far, I managed to create a pandas dataframe that works nicely with one 1 antenna, as when there are more it simply considers the last one. Have you by any chance ever had to create a dataframe of dataframes? This way we can store each antenna dataframe into a big dataframe for the simulation. I am open to discussion on this so we can push this forward.
added 1 commit
- 577f47cd - Radio produces a nice dataframe with all showers and all antennas for each radio process
@acoleman, @huege Ok fixed it. I think I came up with an elegant solution. You run your simulation with any number of radio processes, let's assume one for ZHS and one for CoREAS. The library is loaded the standard way like the rest of the modules (i.e. by simply giving the directory of the simulation output).
Then you ask for ZHS for example using the standard way of the library (i.e.
get("ZHS").astype("pandas")
). You get back 1 pandas dataframe which let's assume you nameradio_data
. The first index is the number of shower in case you run multiple showers in one simulation, the second one is the name of the antenna you want to access and the last one is either the time or a specific polarization (Ex, Ey, Ez). Here is an example:radio_data['0']['ZHS_R=500_m--Phi=270degrees']['time']
-> access the time in the antenna named "ZHS_R=500_m--Phi=270degrees" of the first shower in the simulation.To access the polarization it's the same deal, i.e. ->
radio_data['0']['ZHS_R=500_m--Phi=270degrees']['Ey']
added Ready for Code Review code review in progress labels
- Resolved by Nikos Karastathis
Ah sorry, I marked this, but I see that some of the unit tests are failing and that there are lots of
unused variable
warnings. Anyway, I will try to look into this MR before the IC meeting to take a look at the functionality. But maybe in the meantime you can get the tests working again.
added 1 commit
- 99ec1189 - add getters for antennas and units in the output
- Resolved by Nikos Karastathis
- Resolved by Nikos Karastathis
- Resolved by Nikos Karastathis
One more thing. If I run a simulation using corsika.cpp without adding antennas, then when I make the python
Library
, then I get this error:An error occured loading a RadioProcess: single positional indexer is out-of-bounds Unable to instantiate an instance of 'RadioProcess' for a process called 'CoREAS' 'RadioProcess' object has no attribute '_RadioProcess__data' An error occured loading a RadioProcess: single positional indexer is out-of-bounds Unable to instantiate an instance of 'RadioProcess' for a process called 'ZHS' 'RadioProcess' object has no attribute '_RadioProcess__data'
We should either make the error not occur or to not make any output directories if there are no antennas.
All good points @acoleman! I will have a look first thing when I get some spare time and will get back to you.
removed code review in progress label
removed Ready for Code Review label