-
Notifications
You must be signed in to change notification settings - Fork 45
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
Issue 1316: Adding fortuitous variable stars to EXOTIC #1339
base: develop
Are you sure you want to change the base?
Conversation
…, calculating photometry values for fortuitous stars.
…als and measured.
def calculate_airmass_model(norm_flux, comparison_star_params): | ||
transformed_norm_flux = np.log(norm_flux) | ||
|
||
X = sm.add_constant(comparison_star_params['airmass']) | ||
|
||
model = sm.OLS(transformed_norm_flux, X).fit() | ||
|
||
a1 = model.params[1] | ||
a2 = model.params[0] | ||
|
||
airmass_model = np.exp(a1) * np.exp(a2 * comparison_star_params['airmass']) | ||
|
||
return airmass_model, a2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to highlight this function on calculating the airmass model with its coefficients.
def detrend_and_calculate_magnitude(norm_flux, airmass_model, comparison_star_params, a2): | ||
oot_scatter = np.std((norm_flux / airmass_model)) | ||
norm_flux_unc = oot_scatter * airmass_model | ||
norm_flux_unc /= np.nanmedian(norm_flux) | ||
|
||
model = np.exp(a2 * airmass_model) | ||
detrended = norm_flux / model | ||
|
||
Mt = comparison_star_params['Mc'] - (2.5 * np.log10(detrended)) | ||
Mt_err = (comparison_star_params['Mc_err'] ** 2 + (-2.5 * norm_flux_unc / (detrended * np.log(10))) ** 2) ** 0.5 | ||
|
||
return Mt, Mt_err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function calculates the target magnitude.
norm_flux = target_flux[mask] / comparison_star_params['flux'] | ||
|
||
norm_flux /= np.nanmedian(norm_flux) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This portion calculate the normalized flux.
Can you also show the relative flux on those plots? It's not clear to me what you're fitting. The airmass model should be compared to the relative flux after dividing out the transit (or on the out of transit baseline) not the actual airmass. The airmass is just used as an input. |
Leaving this as draft for now as I am running into some issues that I'd like some advice on. Here is the thought process of the code:
Here are the issue I am running into:
After calculating the airmass model, it seems like the residuals are quite large and needs altering.
Here are the airmass plots for a variable star in the field:
Here it the predicted mag for the star (VSX=14.86 - 15.67 V):
I thought the airmass plot code was off due to the model looking like the inverse. However, on a separate star from a different dataset, I got the following:
where the magnitude was calculated as shown here (VSX=14.43+/-0.42 CV):
Both are pretty off in their calculations of the magnitude. Any ideas what I could do differently?