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

Add option to fit sed with G23 only #124

Merged
merged 3 commits into from
Sep 12, 2024
Merged

Add option to fit sed with G23 only #124

merged 3 commits into from
Sep 12, 2024

Conversation

Chamani8
Copy link

The full pull request includes two commits.

The first commit adds an argument to dust_extinguished_sed() function in model_data.py:212, to take in a keyword that allows the sed to only be fit with G23().

dust_extinguished_sed() is called by lnlike() in fit_model.py:88, which in turn is called by lnprob() in fit_model.py:151
both lnlike() and lnprob() are updated to take in the new keyword "g23" as an optional argument. These were made optional arguments as not to break anything that continues to use these functions without the new argument. The default keyword is set to "all", which executes the original sed fitting in dust_extinguished_sed(), rather than G23 only. The original sed fitting, done using the _curve_F99_method() can be called by excluding the new argument, when calling lnlike(), lnprob(), and/or dust_extinguished_sed().

The second commit adds a warning if mismatched band information is provided, between the model and reddened star data.

Copy link
Owner

@karllark karllark left a comment

Choose a reason for hiding this comment

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

Looks good. A couple of changes needed.

measure_extinction/modeldata.py Show resolved Hide resolved
axav = g23mod(shifted_waves)
ext_sed[cspec] = sed[cspec] * (10 ** (-0.4 * axav * params[0]))

elif fit_range == "all":
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of having this as the "elif", should it be "else"? In other words, what happens if someone passes fit_range = "all_butItypeitwrong"? Or an "else" statement needs to be added to handle the case with fit_range is not "all" or "g23".

@karllark
Copy link
Owner

Codestyle errors need to be fixed. Can run python -I -m pip install flake8 in the base repository directory to find the errors. I use black to format code so that I don't have to manually fix these issues.

@karllark
Copy link
Owner

doc test error is fixed in PR #123

@Chamani8
Copy link
Author

Chamani8 commented Sep 12, 2024

Following updates have been made:
modeldata.py:212 added docstring for the fit_range argument.
modeldata.py:240,246 testing fit_range with all lowercase.
modeldata.py:283 else clause raises ValueError letting users know the correct options for fit_range argument.
both modeldata.py and fit_models.py have been run with black to fix codestyle errors.

Copy link
Owner

@karllark karllark left a comment

Choose a reason for hiding this comment

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

LGTM

@karllark karllark merged commit e79245f into karllark:master Sep 12, 2024
13 of 14 checks passed
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.

2 participants