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

Creating a set of river plots for the paper #26

Open
2 tasks
ericagol opened this issue Jun 24, 2022 · 11 comments
Open
2 tasks

Creating a set of river plots for the paper #26

ericagol opened this issue Jun 24, 2022 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@ericagol
Copy link
Collaborator

  • Write a routine for computing river plots for the flux, as well as for the various derivatives.
  • Create some plots for the paper showing various examples of river plots.
@ericagol ericagol self-assigned this Jun 24, 2022
@ericagol
Copy link
Collaborator Author

ericagol commented Jun 24, 2022

@langfzac If I want to compute an array (jac_tot?) with the derivatives of the flux with respect to each of the initial orbital elements (including mass-ratios), transit depths (radius-ratios squared), limb-darkening params & stellar density (or radius), what is the procedure for doing this?

I think I can call compute_photodynamics(\theta), but what is the syntax for calling it? Would it be:

flux, jac_tot = compute_photodynamics(\theta)

@langfzac langfzac added the enhancement New feature or request label Jun 24, 2022
@langfzac
Copy link
Owner

Do you mean in general? Or in the inference.jl file?

@langfzac
Copy link
Owner

In general, the flux derivatives are contained in the Lightcurve after running the necessary code to compute them. Run the example in README with grad=true, and add the number of nbody parameters (7*n) as an argument to the Lightcurve constructor. The rest is the same.

The fields are defined as below:

struct Lightcurve{T<:Real}
dt::T # Exposure time
tobs::Vector{T} # Observed times
fobs::Vector{T} # Observed flux
eobs::Vector{T} # Measurement errors
nobs::Int64 # number of flux measurements
flux::Vector{T} # Computed model flux
dfdu::Matrix{T} # Derivative of flux wrt limbdark coefficients
dfdk::Matrix{T} # Derivatives wrt the radius ratios
dfdq0::Matrix{T} # Derivatives wrt initial Nbody Cartesian coordinates and masses
dfdr::Vector{T} # Derivatives wrt stellar radius
# Transit parameters
u_n::Vector{T} # Limbdark coefficients
k::Vector{T} # radius ratios
rstar::Vector{T} # Stellar radius

@ericagol
Copy link
Collaborator Author

Do you mean in general? Or in the inference.jl file?

I meant in inference.jl, but the general case is fine too.

@ericagol
Copy link
Collaborator Author

In general, the flux derivatives are contained in the Lightcurve after running the necessary code to compute them. Run the example in README with grad=true, and add the number of nbody parameters (7*n) as an argument to the Lightcurve constructor. The rest is the same.

The fields are defined as below:

struct Lightcurve{T<:Real}
dt::T # Exposure time
tobs::Vector{T} # Observed times
fobs::Vector{T} # Observed flux
eobs::Vector{T} # Measurement errors
nobs::Int64 # number of flux measurements
flux::Vector{T} # Computed model flux
dfdu::Matrix{T} # Derivative of flux wrt limbdark coefficients
dfdk::Matrix{T} # Derivatives wrt the radius ratios
dfdq0::Matrix{T} # Derivatives wrt initial Nbody Cartesian coordinates and masses
dfdr::Vector{T} # Derivatives wrt stellar radius
# Transit parameters
u_n::Vector{T} # Limbdark coefficients
k::Vector{T} # radius ratios
rstar::Vector{T} # Stellar radius

It looks like this contains the initial cartesian coordinate derivatives, not the initial orbital element derivatives.

@langfzac
Copy link
Owner

It looks like this contains the cartesian coordinate derivatives, not the initial orbital elements.

Yes, I haven't included those. Right now, you'd have to do the transformations manually. (There's an example in inference.jl -- see grad_compute_photometry)

@ericagol
Copy link
Collaborator Author

Okay, that gets back to my question about what gets returned by that routine.

@langfzac
Copy link
Owner

Oh right, it returns the flux and jacobian array. Although, that function in inference.jl is optimized for that particular problem/system. There's no generalized function that computes the flux (and/or jacobian) for an arbitrary parameter vector.

@ericagol
Copy link
Collaborator Author

@langfzac I still haven't been able to figure this out, so I could use some help with this.

@ericagol
Copy link
Collaborator Author

@langfzac Thanks to your help, I now have some riverplots of derivatives working. Here is the plot with respect to the radius of the star. The blue is negative, which I think is indicating that the radius of the star increases, then the duration increases, so in ingress & egress the flux becomes smaller (i.e. the transit widens). It's hard to see, but the flux is also negative in the middle of the transits, but goes to zero mid-transit. This confused me at first, but I think this is due to the fact that the radius-ratio is being held constant, so the depth of transit is the same, but the stretching of the transit due to a longer duration means that the transit needs to get slightly deeper.

dfdrstar

@ericagol
Copy link
Collaborator Author

I'm confused about some of the derivatives with respect to the dynamical parameters, which aren't behaving as I would have expected.... but, the model is complicated...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants