Skip to content
This repository was archived by the owner on Jun 27, 2025. It is now read-only.

Conversation

@nocturnalastro
Copy link
Collaborator

@nocturnalastro nocturnalastro commented Feb 13, 2017

So with the units being integrated into astropy.modeling, I so implemented some stuff. This uses the PR#4855

@hamogu
Copy link
Member

hamogu commented Feb 18, 2017

@astrofrog : You know best what exactly is going to happen to models in astropy, so please have a short look here. I'm wondering if there is any astropy effort that could be used here.


def test_basic(self):
self.fitter(self.model_micron, self.x, self.y)

Copy link
Member

Choose a reason for hiding this comment

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

Does it makes sense to actually run a fitter here, so you can look at the return value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just trying to check that no exceptions are thrown at the moment.
I was planning extending the tests over this weekend to test the values make sense.

saba/main.py Outdated

tie_list = []

_models, _x, _y, _z, _xbinsize, _ybinsize, _err, _bkg = self.remove_units(models, x, y, z, xbinsize, ybinsize, err, bkg, equivalencies)
Copy link
Member

Choose a reason for hiding this comment

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

Where are these _XXX quantities used? I'm sure they are, but I cannot find the line where that happens.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I though I had removed the _'s I'll sort that out :)

saba/main.py Outdated

def remove_units(self, models, x, y, z=None, xbinsize=None, ybinsize=None, err=None, bkg=None, equivalencies=None):
"""
This stripts data of there units so they can be fit.
Copy link
Member

Choose a reason for hiding this comment

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

there -> their

saba/main.py Outdated
try:
n_data = x.ndim
if z is None:
assert x.ndim == y.ndim, AstropyUserWarning("x and y dimensions don't match")
Copy link
Member

Choose a reason for hiding this comment

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

Why not just raise a ValueError here? Is there a use case where we should just proceed with a warning?

@hamogu
Copy link
Member

hamogu commented Feb 18, 2017

I do not understand what's going on in this code. That's fine. I do not understand what's going on in the astropy PRs that add quantities to models either.
I think I understand quantities just fine for simple algebraic expressions, but using them in arbitrary models is beyond my skills. I just convert everything to cgs by hand and then use floats. I'll be cool to have quantity models, no doubt, I'm just saying that I leave that for cleverer people than me to implement. That's why I just left a few simple inline comments, but I don't call that a "review".

@nocturnalastro
Copy link
Collaborator Author

@hamogu @astrofrog the new methods are based off the astropy's fitter_unit_support decorator however as we have to take lists of dataset/models as well as errs/binsized meant that heavy modifying it.

@nocturnalastro
Copy link
Collaborator Author

nocturnalastro commented Feb 18, 2017

I've found a fairly major problem which comes up in the dataset creation brought about by the unit stripping code, so no point in looking at it till I fix that. @hamogu thanks for spotting that I hadn't removed the _'s

@nocturnalastro
Copy link
Collaborator Author

Also @hamogu this is pretty much doing as you describe converting all the inputs and parameters into common units, running the fit on floats then adding the units back afterwards.

@taldcroft taldcroft removed their request for review July 22, 2019 10:26
Base automatically changed from master to main March 11, 2021 11:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants