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

removed sample_times arg in .generate_lightcurve definition #82

Open
wants to merge 276 commits into
base: main
Choose a base branch
from

Conversation

tylerbarna
Copy link
Collaborator

@tylerbarna tylerbarna commented Apr 26, 2023

changed behaviour of models doing .generate_lightcurve so they just define sample_times by retrieving it from self.sample_times. So any calls to the models are unaltered. I tried to find all calls to .generate_lightcurve and correct them, but I haven't validated all use cases.

resolves #81

Michael Coughlin and others added 30 commits February 13, 2022 12:43
…constrain_R14_trend

Add documentation to constrain combined EoS analysis
…/main

direction of the file gw_posteriors.txt
numpy warning messages
@mcoughlin
Copy link
Member

@tylerbarna This is a good start. I think to have the best of both worlds, why not allow generate_lightcurves to take an optional sample_times argument? So if you pass it, great, and if not, it defaults to self.sample_times?

@tylerbarna
Copy link
Collaborator Author

@tylerbarna This is a good start. I think to have the best of both worlds, why not allow generate_lightcurves to take an optional sample_times argument? So if you pass it, great, and if not, it defaults to self.sample_times?

That's a good idea, my original thought was to have it so you only had to provide sample_times to generate_lighcurve and/or generate_spectra, but I wasn't sure if other parts of the code outside of models.py require model objects to have sample_times. There were only a handful of generate_* calls in comparison

@mcoughlin
Copy link
Member

@tylerbarna Yeah I am not unsure. I think to be safest you can for now just make it an argument that defaults to None and allows you to pass it for backwards compatability.

can provide sample_times when calling generate_lightcurve but is not required. May still have backward compatibility issues if code that calls generate_lightcurve doesn't have sample_times as a keyed parameter (ie generate_lightcurve(sample_times=sample_times, parameters=parameters) would work, but generate_lightcurve(sample_times, parameters) would break since sample_times is no longer the first parameter)
@tylerbarna
Copy link
Collaborator Author

made the argument optional, but any code that calls generate_lightcurve without passing the sample times as a keyed argument will still break since the original version has sample_times as the first parameter

@mcoughlin
Copy link
Member

@tylerbarna For now, you can still pass samples_times=sample_times in analysis.py and other places to help mitigate behavior changing right?

@tylerbarna
Copy link
Collaborator Author

yes, you should be able to, and looking through analysis.py, most calls to model objects reference the keys already

Copy link
Member

@mcoughlin mcoughlin left a comment

Choose a reason for hiding this comment

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

@tylerbarna A few places where I think you can still pass: sample_times=sample_times.

@@ -679,7 +679,7 @@ def main(args=None):
#########################
# Generate the lightcurve
#########################
_, mag = light_curve_model.generate_lightcurve(sample_times, bestfit_params)
_, mag = light_curve_model.generate_lightcurve(parameters=bestfit_params)
Copy link
Member

Choose a reason for hiding this comment

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

I guess I am thinking of here. shouldn't there be a sample_times=sample_times

@@ -693,7 +693,7 @@ def main(args=None):

if len(models) > 1:
_, mag_all = light_curve_model.generate_lightcurve(
sample_times, bestfit_params, return_all=True
prameters=bestfit_params, return_all=True
Copy link
Member

Choose a reason for hiding this comment

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

Here too.

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.

sample times double call