-
Notifications
You must be signed in to change notification settings - Fork 270
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
bump version of ctapipe-extra directory to v0.3.2 #1588
bump version of ctapipe-extra directory to v0.3.2 #1588
Conversation
This is the same as v0.3.1, but with camera definitions from prod3b
@kosack something seems to have changed for the LSTCam that makes tests fail. |
Strangely the test for concentration passes on my machine. But I do get a failure for test_data_volume_reducer. |
The only changes in the new files are:
The reference pulse is used during image extraction, if the integration correction is enabled (normally yes). So for tests that did not load up a real event, perhaps this causes some difference? |
- improved the calculation of the correction for not full integration of a pulse in SlidingWindowMaxSum extractor - added another test (temporarily in a separate file because of PR cta-observatory#1588) with testing this correction for LST pulse shape
The problem with test_data_volume_reducer is that the test assumes that the signal will be a strict sum of the input waveform, but since now with the reference pulse, the integration correction is performed, the value is not exactly that anymore, so it fails. Even with apply_integration_correction turned off, however, I get a different answer than expected. The following config seems to fix it (the tests assumes a really simple integration, so I use FixedWindowSum): {
"TailCutsDataVolumeReducer": {
"TailcutsImageCleaner": {
"picture_threshold_pe": 700.0,
"boundary_threshold_pe": 350.0,
"min_picture_neighbors": 0,
"keep_isolated_pixels": True,
},
"image_extractor_type": "FixedWindowSum",
"FixedWindowSum": {
"apply_integration_correction": False,
},
"n_end_dilates": 1,
"do_boundary_dilation": True,
}
} @Hckjs is this ok? |
Now with integration corrections, it's not clear this test was doing what was expected.
Hi @kosack alternative solution if "NeighborPeakWindowSum" is to be used is to set: this worked for me |
Thanks, yes, we both notice the same thing - in fact I like your fix better, since it still uses the default extractor |
should I commit it (to the other branch where we had the same problem?) |
I also have a suspicion about the problem with concentration. When I run the test on my PC it gives the value of 0.052 with the limits 0.05-0.2, while in the automatic test it gave 0.0477 just below the limit. I'm not sure if the default random generator is set to any specific seed for all the test, but if no this could explain the problem any why it is not reproducable. The cleanest solution I guess would be to define a random number generator inside the toymodel class and pass the seed to it before the test. However there might be more tests that depend on the same image... |
Just add |
sorry, I was actually mistaken, the seed is set inside the create_sample_image, so it must be something different, unless something funny happens with the random number generator (e.g. that the same one is used in parallel to different tests) |
@jsitarek The tests do not run in parallel. I think the change in pixel area is the culprit. That explains the slightly lower value. |
Hi @maxnoe |
@jsitarek I guess because the old file is still in the cache?
The cache only works by filename. |
I'll commit it here - it's best to keep it separate. |
For safety, maybe we should check more than filename, like a checksum. |
Yes, this seems to be the issue - the question is why it changed, when the pixel positions are the same. The algorithm implementation to compute it was refactored, but I checked the version used to make the original, and the formulas are identical, just moved around a bit. |
sorry @maxnoe but I do not understand the possible problem with the pixel sizes EDIT: also the concentration that was triggering the difference is just defined as the brightest pixel to the total light intensity, and this does not depend on the area. What am I missing? |
That would require always downloading at least the catalog of checksums. Currently the download is only implemented as fallback. Simpler would be to store the cache by url and check that the url is the same. |
Pix area is the main difference:
|
So if we think the new pixel areas are correct, we should just update the test values of the concentration test - I don't think the randomness matters too much, it should be within tolerance. But I would like to understand why the area is not the same. A 4% change is quite strange. |
@kosack Could it be that that simply changed between prod2 and prod3? The older data comes from |
The area is not stored in the files, it's computed from the pixel positions (and those are the same between the two files) |
@kosack that is not true, the area is read from the files. ctapipe/ctapipe/io/simteleventsource.py Lines 65 to 88 in b5c90a1
|
Aha, then that must be the difference: before it was guessed from the pixel distances, but of course in reality the area is not exactly that since there is some width to the winston cone. That answers the question: I haven' realized we now read it (though it makes sense now that we use pyeventio). So the new areas are more correct. Therefore, let's just update the test values. In fact, it's not a very good test. It would be better to make an artificial camera image (not a random toy model) |
I just changed the test values. I think we should open an issue to create a better test for that, using an artificial input where the concentration is known a priori, but that can come later. |
Now there is a problem with toymodel.test_intensity, which seems quite strange:
This test checks that a gaussian image centered at 0.2 along the x-axis has the intensity values one would expect. The only thing that has changed here is the pixel area (3% lower than before), but that should only affect the overall scale of the image, not the first-order moments of the distribution. However, I think the issue is a very low image intensity. The "signal" value here is : >>> print(signal[signal>0])
array([1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 4, 2, 1, 2, 1, 1,1, 1, 1, 2, 1, 1, 1, 1, 1]) So clearly not very intense! Increasing the total intensity of the model to 200 PE, it works fine. So I'll do that, I think the test was only passing by chance before. @maxnoe any objection? |
50 PE was too low to get a reasonable image. With 200, the test pass always.
@kosack no, looks good |
Codecov Report
@@ Coverage Diff @@
## master #1588 +/- ##
==========================================
- Coverage 90.81% 90.78% -0.03%
==========================================
Files 192 192
Lines 13966 13966
==========================================
- Hits 12683 12679 -4
- Misses 1283 1287 +4
Continue to review full report at Codecov.
|
@kosack Just to confirm:
|
Yes, the guess method doesn't perfectly reproduce the real areas, since in reality some intensity is lost to gaps/edges of the winston cone. We could add a fudge factor for that to make it more realistic, by comparing the real values to the guessed values for all cameras, and averaging for example. In that case we'd just multiply the guessed area by e.g. 98%. But that should be a separate issue/PR. The areas are mostly only used for plotting, so the effect can also be ignored. The only place so far they are used for computation is in the toy model, but that doesn't need to be perfect. |
Muon intensity fitter. |
- Value changed slightly due to differences in the camera readout definitions (cta-observatory#1588)
* a new signal extractor, slightly slower, but with better accuracy (in particular for weak pulses): SlidingWindowMaxSum It maximizes the sum on "width" consecutive slices * added missing apply_integration_correction variable to SlidingWindowMaxSum class * adding a standard test of the newly added single extractor SlidingWindowMaxSum * added the test for the extract_sliding_window function that is used by SlidingWindowMaxSum extractor * fixing a few small issues from codacy scan * fixing two trailing whitespaces * follow up commit on PR #1568 - improved the calculation of the correction for not full integration of a pulse in SlidingWindowMaxSum extractor - added another test (temporarily in a separate file because of PR #1588) with testing this correction for LST pulse shape * moved the dirty fix of the LST pulse shape to monkeypatch * solving codacy warnings in PR 1588 * resolving codacy issues - swapped imports * follow up of PR 1568 removed a monkeypatch that is unnecessary after PR 1451 * fixed an error left in the previous commit that would fail the test * corrected indentation
* Cache files by full url/path * Fix part file not deleted on ctrl c * Add container for nominal reconstruction of hillas parameters - x,y replaced by lon and lat - units changed to deg from m * Add method to calculate hillas parameters in the nominal frame - Requires pixel positions in the nominal frame instead of a geom object - Most of the code is a duplicate of the reconstruction in the camera frame for now * Remove second hillas parameters function - Decide which container to return based on pixel position unit * Add containers for nominal frame and fix hillas-related parameters * Use image parameters in nominal frame, bump data level version - Save image parameters calculated in the nominal frame - This affects the hillas parameters and the timing slope - The coordinate transformations happen in the image processor * Fix import * Clean up container structure, use telescope frame for image parameters - Stage 1 and the connected tools now calculate the hillas parameters in the telescope frame - Hillas and TimingParametersContainer now store values as deg. Old containers persist as CameraHillas/TimingParametersContainer - In order to keep a single ImageParametersContainer, base containers have been added for hillas and timing parameters - Failing tests adapted: x/y -> lon/lat, reconstruction algorithms use the CameraHillasParametersContainer * Precompute camera geometries * Fix unit test - Value changed slightly due to differences in the camera readout definitions (#1588) * Rename lon/lat to fov_lon/fov_lat * Fix use of ImageParametersContainer - Avoid base containers and thus lacking columns in the output file * Address codacy complaints * Fix default ImageParametersContainer - Sets the Hillas/Timing parameters container in the telescope frame as default values as opposed to the base containers * Change datamodel version - Replace v1.0.4 with v1.1.0 since column names have changed on top of the units * Use fov_lon/lat instead of x/y * Distinguish between CameraHillasParametersContainer and HillasParametersContainer * Adapt hillas intersection to work with hillas parameters in the telescope and camera frame * Remove duplicated tests of the results - Comparing values between both reconstructions should handle all cases - Comparing results in the telescope frame to fixed values was error prone, because the image is generated in the camera frame requiring explicit conversion every time * Remove unused declarations and imports * Fix datamodel version * Fix unit test - The test file gets generated by calling stage1 on a simtel file, so this has to take the current datamodel into account * Fix comparison to nan in unit tests * Fix reading of dl1 files - Add v1.3 to the list of supported datamodel versions - The renaming of the parameter containers changed the default container prefixes (HillasParametersContainer -> CameraHillasParametersContainer leads to the camera_hillas prefix), breaking backwards compatibility - This is fixed by specifying explicit prefixes when reading <v1.3 files * Fix tests for the dl1eventsource - Improper comparison to np.nan lead to tests effectively being skipped - The assertion would have failed actually, because the test file contains nan events (which is expected) - The new test checks if all entries are nan instead. Due to the event loop in the event source, this requires collecting the values in a list first * Write out correct datamodel version * Fix unit test * Try to fix the docs by making the base containers private * Fix codacy complaints * Add base containers to __all__ - This seems to be necessary for the sphinx docs * Add option to choose camera frame instead of telescope frame * Remove unused import * Add missing underscore * Fix selection of camera frame geometry * Fix test converting to wrong unit * Add missing variable name * Use traits for the selection of the frame * Fix unit test Co-authored-by: Maximilian Nöthe <[email protected]>
This is the same as v0.3.1, but with camera readout definitions from prod3b
(the data have been updated on the dataserver)