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

Refactor instrument module #982

Merged
merged 25 commits into from
Mar 4, 2019
Merged

Conversation

maxnoe
Copy link
Member

@maxnoe maxnoe commented Feb 21, 2019

Working on #971

  • Only guesses telescope names, not full camera geometries or optics
  • Refactoring of the members of TelescopeDescription, OpticsDescription
  • Make those classes hashable, so set operations work and they can be used as dict keys

@dneise
Copy link
Member

dneise commented Feb 25, 2019

Btw, I was curious if one can find the telescope names somewhere in the eventio file, so that guessing (even of the name) could potentially avoided completely. It found them in the "History" part, I think, but only in comments looking like this:

ECHO ************************************************************************
ECHO Configuration for single-reflector SST-1M 5 in Prod-4.
ECHO ************************************************************************
ECHO 
ALTITUDE 2000. % m (Typically replaced on the command line).
ATMOSPHERIC_TRANSMISSION atm_trans_2000_1_10_0_0_2000.dat
TRIGGER_TELESCOPES 1           % Unless an array trigger file sets up more specific triggers.
[.. more configuration ..]

I guess this is not a good way to read the telescope name from the file, but I wanted to mention it anyway.

@maxnoe maxnoe changed the title Only guess telescope names Refactor instrument module Feb 25, 2019
@maxnoe
Copy link
Member Author

maxnoe commented Feb 25, 2019

The tests now failing are due to testing for magic numbers in the old simtel file.

Any advice on how to replace those values?

@kbruegge
Copy link
Member

The tests now failing are due to testing for magic numbers in the old simtel file.

Any advice on how to replace those values?

If we find no other way to check for correct values then these tests can be removed imo.

@kosack
Copy link
Contributor

kosack commented Feb 27, 2019

I guess this is not a good way to read the telescope name from the file, but I wanted to mention it anyway.

I know that I had mentioned that it would be nice to have the names to Konrad, and I think he said he would add that in a future version. It may be there already somewhere. In any case, we still probably want to map names there to "standard" ones we define, so there is no confusion.

@kosack
Copy link
Contributor

kosack commented Feb 27, 2019

If we find no other way to check for correct values then these tests can be removed imo.

was the example file updated? If so, yes we should remove all tests that assume specific values. It's better to give the tests a hand-made dummy event where we know the correct outcome, rather than using a real event (which can be tested at a higher level if necessary). Probably that should be a separate PR.

kosack
kosack previously approved these changes Feb 27, 2019
@kosack
Copy link
Contributor

kosack commented Feb 27, 2019

Maybe not necessary for this PR, but it would be nice to add a "guess" function for the SubarrayDescription itself, so that at least the Prod ID and the array layout could be shown (not sure if that is info directly in the MC headers or not). Right now all subarrays are called "MonteCarloArray", which is not so useful to identify them.

@maxnoe
Copy link
Member Author

maxnoe commented Feb 27, 2019

I know that I had mentioned that it would be nice to have the names to Konrad, and I think he said he would add that in a future version. It may be there already somewhere. In any case, we still probably want to map names there to "standard" ones we define, so there is no confusion.

I just produced small test files using the current developement version of simtel_array (prod4 baselines la palma and paranal) and I found no changes in the containers that describe the telescopes.

@maxnoe
Copy link
Member Author

maxnoe commented Feb 27, 2019

was the example file updated? If so, yes we should remove all tests that assume specific values. It's better to give the tests a hand-made dummy event where we know the correct outcome, rather than using a real event (which can be tested at a higher level if necessary). Probably that should be a separate PR.

Yes, I changed the example_event to come from the prod3 gamma_test_large.simtel.gz

@maxnoe
Copy link
Member Author

maxnoe commented Feb 27, 2019

I removed the magic number tests, test pass now.
I opened an issue here: #988 to get real tests for those features.

@codecov
Copy link

codecov bot commented Feb 27, 2019

Codecov Report

Merging #982 into master will increase coverage by 0.52%.
The diff coverage is 93.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #982      +/-   ##
==========================================
+ Coverage   78.19%   78.71%   +0.52%     
==========================================
  Files         194      197       +3     
  Lines       11313    11334      +21     
==========================================
+ Hits         8846     8922      +76     
+ Misses       2467     2412      -55
Impacted Files Coverage Δ
ctapipe/image/muon/muon_reco_functions.py 66.66% <ø> (ø) ⬆️
ctapipe/tools/display_dl1.py 90.09% <ø> (ø) ⬆️
ctapipe/io/tests/test_targetio_event_source.py 6.5% <0%> (ø) ⬆️
ctapipe/io/tests/test_hessio_event_source.py 100% <100%> (ø) ⬆️
ctapipe/calib/camera/tests/test_dl1.py 100% <100%> (ø) ⬆️
ctapipe/plotting/tests/test_camera.py 100% <100%> (ø) ⬆️
ctapipe/instrument/guess.py 100% <100%> (ø)
ctapipe/io/tests/test_prod2.py 100% <100%> (ø)
ctapipe/instrument/__init__.py 100% <100%> (ø) ⬆️
ctapipe/instrument/tests/test_optics.py 100% <100%> (ø) ⬆️
... and 40 more

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 dcb64d4...7f2c059. Read the comment docs.

@maxnoe
Copy link
Member Author

maxnoe commented Feb 27, 2019

Tests are passing, please review @watsonjj @kosack @dneise @ParsonsRD @mackaiver

kosack
kosack previously approved these changes Feb 28, 2019
@kbruegge
Copy link
Member

kbruegge commented Mar 1, 2019

So the difference between the two test fles is the MC production? Prod2 vs Prod3? Maybe we should rename that test file to something conveying more information.

@maxnoe
Copy link
Member Author

maxnoe commented Mar 1, 2019

Yes, but this would be fore ctapipe-extra. I can also produce more sensible test files not, I got a recent simtel running.

@maxnoe
Copy link
Member Author

maxnoe commented Mar 1, 2019

Please review again, I added @watsonjj comment.

@kosack
Copy link
Contributor

kosack commented Mar 4, 2019

Yes, but this would be fore ctapipe-extra. I can also produce more sensible test files not, I got a recent simtel running.

It would be nice to have some smaller nicer test files and get rid of the old ones in ctapipe_extra which is becoming too large already: at least something like 10+ gamma rays for north and south configurations, and some muon-only files. For deeper/larger test files, we can just make them automatically download from the server, rather than put them in the package. In the future, we will move to selectable configurations as in #738, so this is just a temporary fix.

@maxnoe maxnoe merged commit f6d3792 into cta-observatory:master Mar 4, 2019
@maxnoe maxnoe deleted the less_guessing branch March 4, 2019 13:40
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.

5 participants