Skip to content
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

Correct filling of photo_electron_image container in SimtelEventSource #943

Merged
merged 2 commits into from
Jan 30, 2019

Conversation

watsonjj
Copy link
Contributor

@watsonjj watsonjj commented Jan 30, 2019

The data.mc.tel[tel_id].photo_electron_image container is not correctly filled. This is a difficult task to test, because for some reason the test files do not contain an array_event['photoelectrons'] table. This has been an issue with these test files for a long time.

This PR fixes the accessing of the photoelectron information from the simtel file. It is important to also note that the array_event['photoelectron'] keys correspond to telescope index, NOT telescope id.

@codecov
Copy link

codecov bot commented Jan 30, 2019

Codecov Report

Merging #943 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #943      +/-   ##
=========================================
- Coverage    78.6%   78.6%   -0.01%     
=========================================
  Files         191     191              
  Lines       10910   10909       -1     
=========================================
- Hits         8576    8575       -1     
  Misses       2334    2334
Impacted Files Coverage Δ
ctapipe/io/simteleventsource.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bcee2ff...e9184e6. Read the comment docs.

@kosack
Copy link
Contributor

kosack commented Jan 30, 2019

thanks for catching that! It definitely would have broken some benchmarks. Yes, this points to a strong need to clean up the testing data. It will eventually be completely removed from ctapipe-extra, and be downloaded on-the-fly instead similar to gammapy. Right now I'm a bit afraid to remove gamma_test.simtel.gz, even though it's so outdated (prod2!), since a lot of the calibration tests seem to rely on specific values from it. Once those are make more general (e..g. with dummy inputs rather than a specific event), we can migrate.

data.mc.tel[tel_id].photo_electron_image = (
array_event.get('photoelectrons', {})
.get(tel_index, {})
.get('photoelectrons', np.zeros(n_pixel, dtype='float32'))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is np.zeros correct here? or should it be np.nans since we have no idea what the values are ... instead of being sure they were zeros.

Copy link
Member

@dneise dneise Jan 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it was also np.zeros before this PR .. so this PR is in principle not responsible for adressing this .. but still.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np.zeros was what was returned in the case of HESSIOEventSource, but I don't have a strong opinion about what to return...

For normal simtel files (prod3+), the np.zeros will never be returned anyway. Only in the case of the prod2 test files

@watsonjj watsonjj merged commit 2b7d914 into cta-observatory:master Jan 30, 2019
@watsonjj watsonjj deleted the photo_electron_image branch January 30, 2019 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants