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

Move mpfit to its own subpackage. #16

Closed
wtbarnes opened this issue Sep 5, 2021 · 6 comments · Fixed by #68
Closed

Move mpfit to its own subpackage. #16

wtbarnes opened this issue Sep 5, 2021 · 6 comments · Fixed by #68

Comments

@wtbarnes
Copy link
Contributor

wtbarnes commented Sep 5, 2021

Currently, mpfit is part of the core subpackage. Given the discussion in #10 as well as the fact that this dependency is being vendored (i.e. it is a third-party piece of software being absorbed into the package), I think every effort should be made to disentangle it from the core functionality of the package.

I would recommend either creating an mpfit subpackage or, even better, creating a more generic fitting subpackage with the thinking being that the fitting "engine" could be swapped out for something else later down the line.

Additionally, because this software is being included in eispac, eispac must also include the LICENSE file for astrolibpy, per the terms of the GPL v3 license: https://github.com/segasai/astrolibpy/blob/master/LICENSE.

@kdere
Copy link

kdere commented Sep 6, 2021 via email

@PaulJWright
Copy link

PaulJWright commented Nov 7, 2022

Hi @MJWeberg. I agree with @wtbarnes here, and would ideally like this addressed as part of the open review: openjournals/joss-reviews#4914, and please include the LICENSE file for astrolibpy

@MJWeberg
Copy link
Collaborator

Hello @PaulJWright. We debated moving MPFIT to its own subpackage a while back, but decided to wait until we could also add support for other fitting backends. Fitting is a core component of EISPAC, so the fit_spectra() function will most likely remain in the top-level namespace. Since users don't actually ever call MPFIT directly, moving it to a separate directory would primarily be an internal restructure anyways. Nevertheless, we are happy to go ahead and move it now, if you think it is best.

It was not clear what open license mpfit.py actually fell under, since the GPL v3 license of astrolibpy is only for the other components of the package. I thought it was public domain, but apparently it is slight more complicated than that. I have added an MPFIT-LICENSE file that contains the required information to the best of my knowledge.

Unfortunately, we have not had the opportunity to extend the fitting backend options yet. Since some of this conversation took place off-line, I am including a summary below for more complete records.

When we first wrote EISPAC, none of the other fitting packages were quite sufficient for our needs. In particular,

  • scipy.optimize.leastsq does not allow for tying parameters (as discussed in mpfit.py #10)
  • lmfit does not provided a generalized Gaussian function (e.g. it scales all the amplitudes). This is inconsistent with all previous EIS analysis software and would likely cause confusion.
  • Astropy.modeling was close but (a) was very slow, (b) not easily parallelized, (c) would sometimes inexplicably fail to converge.

I understand there may have been some improvements to the Astropy subpackages since then, so I will try to take another look at it sometime in the next month or two.

@PaulJWright
Copy link

PaulJWright commented Nov 13, 2022

As @wtbarnes opened this particular issue, I'll let Will have the final say, but it seems quite odd that a third-party piece of software is incorporated into the core subpackage (@nabobalis is more experienced here, and may have a different opinion). Personally, I would restructure (not asking you to create a bunch of additional fitting functionality), but happy to hear @wtbarnes and @nabobalis opinions on this!

@nabobalis
Copy link

I am not sure what the license and/or legal implications of adding mpfit directly to the core folder as it doesn't seem to be actually licensed.

When it comes to adding external code, "normally" it is kept in a separate folder that makes it clear that this code was not written by the original authors.
This is done in sunpy and astropy for example which bundle both extra Python libraries and C code.

How wide spread this practice is, I am unsure.

@MJWeberg
Copy link
Collaborator

Moving mpfit to a more general extern subpackage makes a lot of sense! It removes the confusion, allows for the inclusion of other third-party code (although I don't foresee us adding anything else at the moment), and gives us more flexibility for how to handle additional fitting backends somewhere down the line. Thanks for the suggestion, @nabobalis (and sorry @wtbarnes, for not understanding this was part of what you were originally suggesting).

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 a pull request may close this issue.

5 participants