-
Notifications
You must be signed in to change notification settings - Fork 272
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
WIP: put TelescopeDescription input inst.subarray
#720
Conversation
Codecov Report
@@ Coverage Diff @@
## master #720 +/- ##
==========================================
+ Coverage 68.14% 68.15% +<.01%
==========================================
Files 196 196
Lines 10546 10548 +2
==========================================
+ Hits 7187 7189 +2
Misses 3359 3359
Continue to review full report at Codecov.
|
It should be noted that ctapipe contains no information (yet) about the pixel positions, and relies on them being supplied to the
For HESSIOEventSource the pixel positions are read from the hessio file. For the TargetIOEventSource I utilise TargetCalib which contains the pixel positions for each pixel. I'm not sure what options you have available to you, but perhaps one option is a HDF5 with the pixel positions stored inside? I believe in the future the pixel positions will be stored in a central CTA instruments database, and we will not need all these unique solutions. |
Thanks for your comment. I am however a bit puzzled by: "ctapipe contains no information (yet) about the pixel positions".
I get this result ... ....which looks very much like the camera view, which is created by the digicam viewer which currently exists in digicampipe: https://github.com/cta-sst-1m/digicampipe#example-viewer. However I had to do play around with the axes like this So ... may it be your information about missing pixel positions is outdated? |
Ah! Very true, my knowledge is outdated. I assume these are the pixel positions extracted from MC. The only caution I have then is that the pixel ordering of MC might not be the same as the pixel ordering inside SST1M (it certainly isn't for CHEC), so you should check that. |
Yes I have to check that |
@watsonjj you are right, just looking at the first 3 pixels shows clearly, that in digicampipe and in ctapipe the I am not sure how to proceed here. In ctapipe/ctapipe/instrument/camera.py Line 209 in c7d73cd
Alternatively I could just try to find the a mapping between the pixel ids, so that the result is closest to the result I would get in digicampipe... I am confused. from digicampipe.utils import DigiCam
digicampipe_geometry = DigiCam.geometry.to_table()
from astropy.table import Table
ctapipe_geometry = Table.read('DigiCam.camgeom.fits')
digicampipe_geometry[:3] <Table length=3>
ctapipe_geometry[:3] <Table length=3>
|
I assume there is some historical evolution involved here which predates my time in SST1M, I will have to check this. |
I think I made a mistake regarding the ids ... it seems the ids are in fact pretty much okay (after some shuffling around with the axes) ... however the positions are not the same. |
Yes, the EventSource should for now fill the |
@@ -31,6 +32,10 @@ def _generator(self): | |||
data.count = count | |||
data.sst1m.fill_from_zfile_event(event, self._pixel_sort_ids) | |||
self.fill_R0Container_from_zfile_event(data.r0, event) | |||
data.inst.subarray.tels[0] = TelescopeDescription.from_name( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is zero the correct index? Correct me if I'm wrong, but isn't event.telescopeID
in fill_R0Container_from_zfile_event
1?
Do you think you could also make the same updates to NectarcamEventSource in this PR? |
@@ -31,6 +32,10 @@ def _generator(self): | |||
data.count = count | |||
data.sst1m.fill_from_zfile_event(event, self._pixel_sort_ids) | |||
self.fill_R0Container_from_zfile_event(data.r0, event) | |||
data.inst.subarray.tels[0] = TelescopeDescription.from_name( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be better to pass this to the SubarrayDescription constructor instead, but this should work for existing code. If in the future we pre-compute some things in the constructor, however, it will fail.
e.g. this may be safer:
event.inst.subarray = SubarrayDescription(
name="SST1MTestBenchArray",
tel_positions={0: [0,0]*u.m},
tel_descriptions={0:TelescopeDescription.from_name("SST-1M","DigiCam")}
)
or similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, using TelescopeDescription.from_name()
of course assumes the DigiCam.camgeom.fits.gz
and optics.ecsv.txt
files in your CTAPIPE_SVC_PATH
(or ctapipe-extra package) correspond to the input file your give (i.e. the pixel numbers are correct, etc). Since currently that was generated from Monte-Carlo, it may not be exactly right, so just keep that in mind. You might add a check in the code to make sure at least the number of pixels, etc, makes sense in case you load a file with a slightly modified camera geom.
Not outdated, but there is no guarantee the MC pixel positions correspond to your testbench camera pixels. The MCs, as you found out use a very strange coordinate system where x and y are swapped for some reason, with North along the y-axis, and we don't yet support conversion between this "MCCameraFrame" and the "EngineeringCameraFrame", which is probably more like what you get if you look at the front of the camera, rather than through it from the back as in the MCs. So the point is if you use SST1m data and the default camera loaded up, which was generated from MCs, you may have a mismatch in pixel ids and camera rotation. |
I merged this for now, I think you can add tests afterward - the basic functionality is there |
Good to hear that we (FACT) are not the only Collaboration with this :D |
@watsonjj spotted a bug in the SST1MEventSource.
The problem came up in connection with the new bokeh plotter in #714.
As far as I understood, EventSources are supposed to fill also the
inst
Field, which was not done by the SST1MEventSource. This PR tries to solve the problem.Unit test still missing
In digicampipe the pixel positions are read from a file named
camera_config
In ctapipe the camera definition seems to be created from the file
DigiCam.camgeom.fits.gz