-
Notifications
You must be signed in to change notification settings - Fork 14
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
Astropy Integration: Model fitting #70
Comments
Going to start responding to the review in full, as I think its the most pressing issue to agree on. We looked at the Here are some of the features we required which (to my knowledge) the astropy modeling system does not support:
The file
https://pyautofit.readthedocs.io/en/latest/features/database.html This is the only way to properly handle the analysis of 100000+ galaxies.
In terms of model-fitting I am not keen on supporting the Astropy modeling and fitting, as it would be extra code to maintain which and splits the API in two.
I am now wondering if I misinterpreted your suggestion... did you simply mean to use the astropy Sersic2d / Gaussian2D models and anything we have in common there? That I would be happy to do (we did actually have it set up this way initially, but I refactored it for some reason). |
This comment was marked as resolved.
This comment was marked as resolved.
Not sure but I definitely do not mean throw all your stuff away and only use astropy. The meaning was more like integrate with astropy where possible. Therefore, for example, you can keep your way of doing things, but maybe have a way to provide astropy mode objects when requested.
What was the reason? I am a little curious... p.s. There are some know performance issues with |
I have read through astropy modeling in more detail. In terms of models (https://docs.astropy.org/en/stable/modeling/models.html) and fitting (https://docs.astropy.org/en/stable/modeling/fitting.html), I don't see a straight forward way to integrate this into PyAutoGalaxy (Although see below for the models themselves). I could write an example script showing how one could fit a model using It may make sense for
I think we were profiling different ways to evaluate light profiles (e.g. pure numpy, numba, astropy) and ended up choosing pure numpy for the sake of the code being more explicit and readable (e.g. a user doesn't then need to go through the astropy docs to understand how the Sersic function is implemented).
I would be happy for any suggestions on where others see room for integration, but as I said above I don't see an obvious pathway! |
I have read through this and I can't say one way or another whether astropy modeling should or shouldn't be used. To summarize the above objections:
I don't see why this excludes use of astropy models. One can do fits and then save the results in any way one wants and one can also visualize the results and save those too. As far as serialization goes, we have means of serializing models to ASDF files, that can be loaded back into Python and evaluated or modified later. Perhaps there is some special API requirement that excludes astropy modeling, but the provided detail doesn't explain that.
Again, I don't see why that can't be done with astropy models. It is unclear how these models are being saved (pickles? specific serialization code?).
Some of the astropy fitters also support this functionality. But even if they didn't, the framework allows adding custom fitters that do whatever one wants. Finally, even if there are good reasons not to use astropy modeling, it shouldn't be difficult to provide conversion tools to convert to and from astropy models (albeit, it may need implementation of custom models in astropy, but if python code exists for such models, it is usually pretty easy to wrap those as instances of astropy models. |
The original question was whether something was preventing us using The suggestion now is that we could have used I feel uncomfortable with the idea of offering support for two model-fitting packages, when there is nearly identical functionality in one package compared to the other. I have tried to find the commonalities between the two projects which I think could help them both (e.g. sharing profile classes like Here are some more examples of
If it is necessary for astropy affiliation, I can add an example script to the |
OK, I think we understand. The essence of the point isn't that it can't be done in astropy modeling, but rather that you already had the additional functionality built on a different modeling package and can't afford to replicate that on top of astropy modeling. |
Yeah, pretty much, we are only two developers and it took me over a month to respond to this issue! 🤣 |
I think that would be a good start to push this forward. For example, once I get a fit from your package, and I have my own model defined in astropy model, how do I use your fit in my astropy model? And vice versa? Basically, some primer on how what you have can talk to astropy. Thanks! |
This packages uses https://github.com/rhayes777/PyAutoFit that adds a new modeling ecosystem that is completely independent of the Astropy modeling library. Was there something preventing you from using
astropy.modeling
? Do you have plans to refactor the code to use it in the future?Perhaps keep your machinery but allow your API to recognize Astropy models in addition to what you already support?
At the very least, there is a need to provide a translation layer between PyAutoFit profiles and Astropy models.
(An independent reviewer and myself share the same sentiment. This is probably the biggest issue in terms of Astropy Affiliated package acceptance in the "Integration with Astropy ecosystem" category.)
astropy/astropy.github.com#491 (comment)
The text was updated successfully, but these errors were encountered: