-
Notifications
You must be signed in to change notification settings - Fork 77
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
DL1 checks fix and updates #881
Conversation
moralejo
commented
Jan 21, 2022
•
edited
Loading
edited
- Solved issue with non-updating histograms when moving the run number slider
- extend run slider bar in case of more than 300 runs
- added RA and dec info in dl1 data check tables to allow selection by sky region
- added pixel-wise counting of nearby bright stars, and use that info for excluding some pixels/subruns from the calculations of averages, so that we avoid mistaking them for e.g. noisy pixels
Codecov Report
@@ Coverage Diff @@
## master #881 +/- ##
=======================================
Coverage 83.83% 83.83%
=======================================
Files 77 77
Lines 5968 5968
=======================================
Hits 5003 5003
Misses 965 965 Continue to review full report at Codecov.
|
from lstchain.reco.utils import location should be ok, right? No need to use EarthLocation explicitly |
Yes, that is the correct position for LST-1 |
c951780
to
eb710df
Compare
Extend run slider bar in case of more than 300 runs
|
||
Usage | ||
----- | ||
.. argparse:: |
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.
TIL! nice
lstchain/datachecks/containers.py
Outdated
@@ -35,6 +40,8 @@ class DL1DataCheckContainer(Container): | |||
num_ucts_jumps = Field(-1, 'Number of observed (and corrected) UCTS jumps') | |||
mean_alt_tel = Field(None, 'Mean telescope altitude') | |||
mean_az_tel = Field(None, 'Mean telescope azimuth') | |||
tel_ra = Field(None, 'Telescope pointing RA (deg)') | |||
tel_dec = Field(None, 'Telescope pointing declination') |
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.
container fields should have the correct defaults, so that if a default container is written, the correct tables are setup. None will result in the column being skipped. I think these (and the above) should be np.nan * u.deg
and ucts_trigger_type
and trigger_type
should probably be 0
(they are bitfields of which at least one bit must be set to be a valid trigger type, so 0 would make sense as invalid value marker.
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 comment here because I cannot comment on the old code. But to setup a logger related to ctapipe.instrument.camera
in a container class definition is really strange and should probably be (re)moved.
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.
Having this in the class body get's executed at import time. So this will set it for the whole of lstchain, as soon as lstchain/datachecks/container
is imported. If you need this for some reason, I guess connected to cta-observatory/ctapipe#1828, you should set this in the main method of the script, not here.
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 comment here because I cannot comment on the old code. But to setup a logger related to
ctapipe.instrument.camera
in a container class definition is really strange and should probably be (re)moved.
I don't remember why I put that there in the first place... gone!
I "remembered":
Coordinate (nan m, nan m) lies outside camera
Coordinate (nan m, nan m) lies outside camera
Coordinate (nan m, nan m) lies outside camera
Coordinate (nan m, nan m) lies outside camera
Coordinate (nan m, nan m) lies outside camera
....
etc etc
In this way I don't get a warning when I try to get the pixel id which corresponds to certain coordinates, some of which turn out to be nans (I know there would be other solutions, but this one is simple).
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.
Having this in the class body get's executed at import time. So this will set it for the whole of lstchain, as soon as
lstchain/datachecks/container
is imported. If you need this for some reason, I guess connected to cta-observatory/ctapipe#1828, you should set this in the main method of the script, not here.
Ok, understood. I moved the geometry warning suppressing to the beginning of the script lstchain_check_dl1.py
This also made me realize I was still projecting wrongly some rare events outside the camera (=> index -1) onto the last pixel, so I fixed that also.
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.
This logging setup
lstchain/datachecks/containers.py
Outdated
time_utc = Time(table['dragon_time'][int(len(table)/2)], | ||
format="unix", scale="utc") | ||
# Calculate telescope pointing in sky coordinates | ||
telescope_pointing = SkyCoord(alt=self.mean_alt_tel*u.rad, |
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.
Why do self.mean_alt_tel
/ self.mean_az_tel
not already have units?
lstchain/datachecks/containers.py
Outdated
az=self.mean_az_tel*u.rad, | ||
frame=AltAz(obstime=time_utc, | ||
location=location)) | ||
self.tel_ra = telescope_pointing.icrs.ra.to(u.deg).value |
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.
to_value(u.deg)
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.
Why strip the unit away at all?
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, this does the altaz → icrs transformation twice I believe. Transform once, than access the result.
I would probably only store self.pointing_icrs = self.pointing_altaz.transform_to('icrs')
and not the individual values without units.
lstchain/datachecks/containers.py
Outdated
obstime = Time(sampled_times[int(len(sampled_times)/2)], | ||
scale='utc', format='unix') | ||
horizon_frame = AltAz(location=location, obstime=obstime) | ||
pointing = SkyCoord(az=self.mean_az_tel*u.rad, |
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.
See? just store the coordinate as astropy coordinate above and you don't have to reconstruct the same object here.
# currently (as of lstchain 0.5.3) event numbers are post-cleaning!: | ||
'min_azimuth': [], | ||
'max_azimuth': [], | ||
'mean_azimuth': [], |
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.
Maybe nothing to change now, but this approach of dict of lists seems rather clumsy as you have multiple locations where you have to update if you add a new column.
I think a list of dicts would be much easier to maintain:
subrunwise_data = []
for subrun in subruns:
data = {}
data['charge_mean'] = ....
subrunwise_data.append(data)
Like this, you only have a single place and much less to setup and pandas and astropy tables understand the format the same (its the difference between DataFrame.to_dict()
and DataFrame.to_dict(orient='records')
in pandas.
Solved projection of (rare) image centroids outside the camera onto the last pixel
…e pandas dataframes by astropy tables
@maxnoe I think your suggestions are now implemented, and I have tested this with a few hours of DL1 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.
Let's merge this as is now.
We should break this up into manageable and reviewable parts, but that can be done at a later stage together with the rest of lstchain.
Ok, thanks!
Absolutely... but at least this PR, besides adding quite some functionality, goes in the right direction of doing some simplifications (e.g. use of astropy tables). |