-
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
First step of implementing CEP-002: Change container structure #2204
base: main
Are you sure you want to change the base?
Conversation
9a4bb8e
to
1e8ad14
Compare
Before I continue changing everything, could you review the new container structure? I think it's already a big step in the right direction, as the structure is much simpler, we could get rid of many indirections... |
|
Because all our telescopes are alt/az mounts, so this is the actual information that is monitored.
Because that's the reference point the array is tracking, which might be in sky-fixed coordinates.
Isn't this accomplished by adding the
I think it's important to distinguish invalid from valid data, 0 trigger pixels are possible (e.g. for pedestal events which are randomly triggered), so better distinguish. Same for the other positive integers. |
Just nice to have I guess. |
That's connected to all the other |
ce1d8ad
to
352b041
Compare
The Why do we save the array event reconstructions at telescope level again? This is a little bit confusing to me |
The The inheritance here is just to get the same fields, but I agree that it's confusing that |
352b041
to
c522715
Compare
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
ctapipe/image/image_processor.py
Outdated
@@ -209,51 +210,49 @@ def _parameterize_image( | |||
# parameterization | |||
return default | |||
|
|||
def _process_telescope_event(self, event): | |||
def _process_telescope_event(self, tel_event): |
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.
I'd suggest adding type hints for functions like this while you are at it, especially for ones where the type changed.
def _process_telescope_event(self, tel_event: DL1TelescopeContainer):
That will make it more clear what is expected where, and also support language servers and mypy to do better completion, etc.
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's a TelescopeEventContainer
, but yes, I'll add type hints for these. However, these are not terribly helpful, since at least my lsp only looks at the class variable, not the instance variables or rather assumes they are of the same type.
Can we add a |
900249d
to
bd7d777
Compare
Hi all, I rebased this on the current main and squashed the commits into one, to ease follow-up rebases when we make updates to main. I'd appreciate a fresh review now. I suggest to first only review the container structure in ctapipe.containers (beware, this is collapsed by default) before reviewing any of the resulting code changes. Once we are happy with the container structure and renaming, I'll fix up the rest of the code and we can commence the review there. |
ctapipe/containers.py
Outdated
@@ -759,12 +748,11 @@ class SimulatedCameraContainer(Container): | |||
) | |||
|
|||
|
|||
class SimulatedEventContainer(Container): | |||
class SimulationSubarrayContainer(Container): | |||
shower = Field( |
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.
Right now, simulationsubarrayContainer has a single subcontainer, shower.
We could just attach the shower
container at the SubarrayEventContainer
to get rid of one level of indirection.
On this part. This, to me, is related to how people parse the file and shouldn't be in the container itself, or if it is, should be hidden and not publicly exposed (even if in python, private just means harder to type). But that's a minor comment and not the main purpose of CEP-002. |
ctapipe/image/image_processor.py
Outdated
) | ||
for container in simulation.true_parameters.values(): |
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.
If the prefix doesn't start with "true_", doesn't that mean there's something wrong with the file and we should raise an error rather than silently correcting it?
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.
If the prefix doesn't start with "true_", doesn't that mean there's something wrong with the file
Has nothing to do with the input file, since the container is created by the _parametrize_image
methods, but you are right, this is confusing.
I will check if it is needed / can be improved.
(Sorry, commented on file without realizing it wasn't container.py anymore, got carried away.) |
02e167c
to
2a71a42
Compare
Wow, resolving the conflicts here was no fun.... I'd really appreciate if we can tackle this one next. I will do a self-review again and it would be nice if others could start reviewing the structure in One particular issue (noted with a fixme in the CameraCalibrator) is that we (in accordance with the CTAO data model) moved the trigger information to dl0, but the This has the issue of the I see two solutions:
I think the latter is the option that is more closely aligned with how we expect actual CTAO operations to be. Studies for DVR can still be done, if we for example at dvr options to simteleventsource or in an intermediate step. |
2a71a42
to
7022224
Compare
This comment has been minimized.
This comment has been minimized.
description="DL2 reconstructed event properties", | ||
) | ||
|
||
pointing = Field( |
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.
Move into dl0?
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.
Not sure, is it very helpful?
Putting pointing in dl0 means you can't make geometry reconstruction using pure dl2 files, but maybe that's fine? Not sure what other costs there are.
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.
DL2 files could always include the dl0 monitoring table. Independent of where this field is stored in the object, it is written to /dl0
in the hdf5 data files.
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.
There is also pointing information in the tel
field below, although it is per telescope rather than for the subarray.
Putting the subarray pointing info into the dl0 now seems strange, are there any quantities that depend on the subarray pointing at dl0? Isn't the telescope pointing the natural pointing until you do stereo?
This comment has been minimized.
This comment has been minimized.
e475e40
to
e6719b0
Compare
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
description="DL2 reconstructed event properties", | ||
) | ||
|
||
pointing = Field( |
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.
Not sure, is it very helpful?
Putting pointing in dl0 means you can't make geometry reconstruction using pure dl2 files, but maybe that's fine? Not sure what other costs there are.
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.
I don't see any major problem.
f8939d0
to
7f603c4
Compare
bbecf66
to
1a17ad8
Compare
1a17ad8
to
399bb24
Compare
This comment has been minimized.
This comment has been minimized.
399bb24
to
8603de0
Compare
8603de0
to
5474dca
Compare
Analysis Details12 IssuesCoverage and DuplicationsProject ID: cta-observatory_ctapipe_AY52EYhuvuGcMFidNyUs |
@@ -262,6 +272,25 @@ class TelEventIndexContainer(Container): | |||
tel_id = tel_id_field() | |||
|
|||
|
|||
class TelescopeTriggerContainer(Container): | |||
default_prefix = "" |
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.
No docstring here?
|
||
|
||
class SubarrayTriggerContainer(Container): | ||
default_prefix = "" |
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.
No docstring here?
@@ -773,12 +775,11 @@ class SimulatedCameraContainer(Container): | |||
) | |||
|
|||
|
|||
class SimulatedEventContainer(Container): | |||
class SimulationSubarrayContainer(Container): |
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.
No docstring here?
array_altitude = Field(nan * u.rad, "Array pointing altitude", unit=u.rad) | ||
array_ra = Field(nan * u.rad, "Array pointing right ascension", unit=u.rad) | ||
array_dec = Field(nan * u.rad, "Array pointing declination", unit=u.rad) | ||
class SubarrayPointingContainer(Container): |
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.
No docstring here?
shower = Field( | ||
default_factory=SimulatedShowerContainer, | ||
description="True event information", | ||
) | ||
tel = Field(default_factory=partial(Map, SimulatedCameraContainer)) |
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.
With the tel removed this container now only contains one thing, so its not clear what the extra indirection step achieves.
description="DL2 reconstructed event properties", | ||
) | ||
|
||
pointing = Field( |
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.
There is also pointing information in the tel
field below, although it is per telescope rather than for the subarray.
Putting the subarray pointing info into the dl0 now seems strange, are there any quantities that depend on the subarray pointing at dl0? Isn't the telescope pointing the natural pointing until you do stereo?
No description provided.