Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add SpectrumSimulation class #647
Very nice, thanks!
Did you remove
I think handling
Without having thought about it much, my recommendation would be: handle
Another option might be to pass
It's hard to say what the best pattern is without having usage examples. In this spirit: my suggestion would be to take the usage example out of the class docstring, move it into a high-level docs page, and there also show an example how one runs several (say 3 or 10, so that it's still fast) simulations for a little study.
I hope this helps a bit.
Superfluous, this was an early attempt at obs stacking.
I had the same doubts. The reasons why I wanted to cache
So maybe there are these options
Ok, if I implement the first option?
In Python, if you want to have "safe" classes and especially if you use caching, you have to make every data member a hidden private member and either prevent setting, or implement getters, setters and do validation in the setters.
I'm -1 on doing this here ... you'll spend a lot of time to figure this out and get it right. And in the end, this is a class that will be used more by experts and there it's good to not be prevented from doing whatever you want.
So my suggestion would be to make
If you prefer something else, fine, do whatever you want here and keep using and changing the class to suit your own spectrum simulation needs.
I would prefer if you include the PNG in gammapy-extra, e.g. here:
Even if this image is just 100k, we will have 10s or 100s of images and many versions over time, and the code repo would grow a lot.
If you can't get the image loaded from the docs build, no worries, I can do it tomorrow.
You have to make another commit to fix the Sphinx build on travis-ci anyways: