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

new SALT3 model #296

Merged
merged 14 commits into from Apr 12, 2021
Merged

new SALT3 model #296

merged 14 commits into from Apr 12, 2021

Conversation

djones1040
Copy link
Contributor

No description provided.

@benjaminrose
Copy link
Member

The CI failures are for code style and tests. Should be easily fixed.

@djones1040
Copy link
Contributor Author

thanks Ben! Working on this now

@djones1040
Copy link
Contributor Author

this PR goes with sncosmo/sncosmo.github.io#24 for the model files

Copy link
Member

@kbarbary kbarbary left a comment

Choose a reason for hiding this comment

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

Cool. Can you add the class to the API reference docs in docs/reference.rst?

It looks like there's a fair amount of code duplication with SALT2Model, though I haven't taken a close look at the differences. Any thoughts on how we could reduce code duplication here?

if (v is not None and isinstance(v, str)):
names_or_objs[k] = os.path.join(modeldir, v)

# model components are interpolated to 2nd order
Copy link
Member

Choose a reason for hiding this comment

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

I think of "2nd order" as quadratic, but this is using cubic interpolation. Is there a a wording mismatch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is from the original SALT2 - I don't understand it but I'm hesitant to change it, given that it could indicate something about how the model is generated. I removed this from the new code because I realized the only thing I really need to change is how the errors are generated, so I just made SALT3Source an instance of SALT2Source and overwrote the error method.

self._phase = phase
self._wave = wave

# model covariance is interpolated to 1st order
Copy link
Member

Choose a reason for hiding this comment

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

"1st order" but using cubic interpolation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see above

Comment on lines 1280 to 1286
if version == 0:
raise Exception("Salt2ExtinctionLaw.version 0 not supported.")
elif version == 1:
self._colorlaw = SALT2ColorLaw(colorlaw_range, colorlaw_coeffs)
else:
raise Exception('unrecognized Salt2ExtinctionLaw.version: ' +
version)
Copy link
Member

Choose a reason for hiding this comment

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

Minor comment: RuntimeError might be the most appropriate exception here. Also, version = 0 might indicate that the version keyword wasn't found in the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed this code from SALT3Source (see comment above), but changed this in the SALT2Source just for fun

Copy link
Member

Choose a reason for hiding this comment

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

That was probably me who wrote Exception initially! 😄

@djones1040
Copy link
Contributor Author

thanks so much for doing this review Kyle, just to summarize what I said above - I realized the only thing I really need to change for SALT3 in sncosmo is how the errors are generated, so I just made SALT3Source an instance of SALT2Source and overwrote the error method in SALT3Source. Seems to work well.

@djones1040
Copy link
Contributor Author

hey @kbarbary , just sending a reminder - think proposed changes have been made. Thanks!

@kboone
Copy link
Member

kboone commented Apr 9, 2021

The latest version looks good to me. If there are no objections, I'll merge it on Monday.

@djones1040
Copy link
Contributor Author

thanks so much @kboone - note PR sncosmo/sncosmo.github.io#24 is also necessary for the data files to be included in the repo

@kbarbary
Copy link
Member

Looks good, sorry for the delayed re-review!

@djones1040
Copy link
Contributor Author

no problem, thanks so much for taking the time

@djones1040
Copy link
Contributor Author

well crap, merging the new data repository allowed me to catch my error - SALT3 doesn't require an error scaling file, so it's best to not include a "dummy" file as I'd done in the past. I edited the code to fix the code breaks that happened when the salt3 data were downloaded from the online repository and an "errscalefile" was not found. Assuming this passes checks, my hope is everything will be good to go now. Sorry about that!

@kboone
Copy link
Member

kboone commented Apr 12, 2021

I downloaded the final version, and everything seems to work as expected. I'll merge this.

@kboone kboone merged commit 987b688 into sncosmo:master Apr 12, 2021
@djones1040
Copy link
Contributor Author

thanks so much!

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.

None yet

4 participants