Skip to content

Commit

Permalink
no var update
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethg60 committed Oct 21, 2024
1 parent 82a39dc commit 42383a7
Show file tree
Hide file tree
Showing 29 changed files with 170 additions and 141 deletions.
Binary file modified eclipse_figures/LD_fit/300/15652.79.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5250.2084.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5250.6453.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5379.5734.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5381.0216.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5382.2562.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5383.368.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5432.546.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5432.947.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5434.5232.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5435.8577.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5436.2945.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5436.5875.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5576.0881.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/5578.718.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/6149.246.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/6151.617.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/6169.042.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/6169.563.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/6170.5056.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/6173.3344.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/6301.5008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified eclipse_figures/LD_fit/300/6302.4932.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions scripts/LD_fitting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ using CSV

Kostogryz_LD_file = DataFrame(CSV.File("data/Kostogryz_LD_300.csv", header = ["wavelength", "0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0"]))

LD_model(x, p) = 1 .- p[1] .* (1 .-x) .- p[2] .* (1 .- x) .^ 2.0

function K_LD_best_fit::T, wavelength::T) where T
"""
limb darkening prescription for optical based on mu angle
Expand All @@ -17,10 +19,10 @@ function K_LD_best_fit(μ::T, wavelength::T) where T
Kostogryz_LD_array = Kostogryz_LD_file[index, ["0.1", "0.2", "0.3", "0.4", "0.5", "0.6", "0.7", "0.8", "0.9", "1.0"]]

p0 = [1.0, 1.0]
fit_K = curve_fit(GRASS.LD_model, [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0], collect(Kostogryz_LD_array), p0)
fit_K = curve_fit(LD_model, [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0], collect(Kostogryz_LD_array), p0)
p_opt_K = fit_K.param

return GRASS.LD_model(μ, p_opt_K), p_opt_K[1], p_opt_K[2]
return LD_model(μ, p_opt_K), p_opt_K[1], p_opt_K[2]
end

# mu array for figures
Expand Down Expand Up @@ -50,14 +52,14 @@ for lambda in 1:length(wavelength)
end

p0 = [1.0, 1.0]
fit_NL = curve_fit(GRASS.LD_model, mu_arr, NL_LD, p0)
fit_NL = curve_fit(LD_model, mu_arr, NL_LD, p0)
p_opt_NL = fit_NL.param
best_u1_NL94[lambda] = p_opt_NL[1]
best_u2_NL94[lambda] = p_opt_NL[2]

for i in 1:length(mu_zero_arr)
Kos_LD_full[i] = GRASS.LD_model(mu_zero_arr[i], [best_u1[lambda], best_u2[lambda]])
NL_LD_full[i] = GRASS.LD_model(mu_zero_arr[i], p_opt_NL)
Kos_LD_full[i] = LD_model(mu_zero_arr[i], [best_u1[lambda], best_u2[lambda]])
NL_LD_full[i] = LD_model(mu_zero_arr[i], p_opt_NL)
end

#figures
Expand Down
24 changes: 12 additions & 12 deletions scripts/NEID_GRASS_all_lines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function neid_all_lines(neid_time, granulation_status, filename, LD_type)

lambdas_cpu, outspec_cpu = GRASS.synthesize_spectra_eclipse(spec, disk, lines, LD_type, zenith_mean,
dA_total_proj, idx1, idx3, mu_grid, z_rot_sub,
stored_μs, stored_ax_codes, stored_dA, "three", ext_toggle = false, verbose=true, use_gpu=false)
stored_μs, stored_ax_codes, stored_dA, "three", ext_toggle = true, verbose=true, use_gpu=false)
wavs_sim, flux_sim = GRASS.convolve_gauss(lambdas_cpu, outspec_cpu, new_res=11e4, oversampling=4.0)

#measure velocities
Expand All @@ -92,22 +92,22 @@ end
neid_october = ["2023-10-14T15:26:45.500000", "2023-10-14T15:28:07.500000", "2023-10-14T15:29:30.500000", "2023-10-14T15:30:53.500000", "2023-10-14T15:32:15.500000", "2023-10-14T15:33:38.500000", "2023-10-14T15:35:01.500000", "2023-10-14T15:36:23.500000", "2023-10-14T15:37:46.500000", "2023-10-14T15:39:09.500000", "2023-10-14T15:40:31.500000", "2023-10-14T15:41:54.500000", "2023-10-14T15:43:17.500000", "2023-10-14T15:44:39.500000", "2023-10-14T15:46:02.500000", "2023-10-14T15:47:25.500000", "2023-10-14T15:48:47.500000", "2023-10-14T15:50:10.500000", "2023-10-14T15:51:33.500000", "2023-10-14T15:52:56.500000", "2023-10-14T15:54:18.500000", "2023-10-14T15:55:41.500000", "2023-10-14T15:57:04.500000", "2023-10-14T15:58:26.500000", "2023-10-14T15:59:49.500000", "2023-10-14T16:01:12.500000", "2023-10-14T16:02:34.500000", "2023-10-14T16:03:57.500000", "2023-10-14T16:05:20.500000", "2023-10-14T16:06:42.500000", "2023-10-14T16:08:05.500000", "2023-10-14T16:09:28.500000", "2023-10-14T16:10:50.500000", "2023-10-14T16:12:13.500000", "2023-10-14T16:13:36.500000", "2023-10-14T16:14:58.500000", "2023-10-14T16:16:21.500000", "2023-10-14T16:17:44.500000", "2023-10-14T16:19:06.500000", "2023-10-14T16:20:29.500000", "2023-10-14T16:21:52.500000", "2023-10-14T16:23:15.500000", "2023-10-14T16:24:37.500000", "2023-10-14T16:26:00.500000", "2023-10-14T16:27:23.500000", "2023-10-14T16:28:45.500000", "2023-10-14T16:30:08.500000", "2023-10-14T16:31:31.500000", "2023-10-14T16:32:53.500000", "2023-10-14T16:34:16.500000", "2023-10-14T16:35:39.500000", "2023-10-14T16:37:01.500000", "2023-10-14T16:38:24.500000", "2023-10-14T16:39:47.500000", "2023-10-14T16:41:09.500000", "2023-10-14T16:42:32.500000", "2023-10-14T16:43:55.500000", "2023-10-14T16:45:17.500000", "2023-10-14T16:46:40.500000", "2023-10-14T16:48:03.500000", "2023-10-14T16:49:25.500000", "2023-10-14T16:50:48.500000", "2023-10-14T16:52:11.500000", "2023-10-14T16:53:33.500000", "2023-10-14T16:54:56.500000", "2023-10-14T16:56:19.500000", "2023-10-14T16:57:42.500000", "2023-10-14T16:59:04.500000", "2023-10-14T17:00:27.500000", "2023-10-14T17:01:50.500000", "2023-10-14T17:03:12.500000", "2023-10-14T17:04:35.500000", "2023-10-14T17:05:58.500000", "2023-10-14T17:07:20.500000", "2023-10-14T17:08:43.500000", "2023-10-14T17:10:06.500000", "2023-10-14T17:11:28.500000", "2023-10-14T17:12:51.500000", "2023-10-14T17:14:14.500000", "2023-10-14T17:15:36.500000", "2023-10-14T17:16:59.500000", "2023-10-14T17:18:22.500000", "2023-10-14T17:19:44.500000", "2023-10-14T17:21:07.500000", "2023-10-14T17:22:30.500000", "2023-10-14T17:23:52.500000", "2023-10-14T17:25:15.500000", "2023-10-14T17:26:38.500000", "2023-10-14T17:28:01.500000", "2023-10-14T17:29:23.500000", "2023-10-14T17:30:46.500000", "2023-10-14T17:32:09.500000", "2023-10-14T17:33:31.500000", "2023-10-14T17:34:54.500000", "2023-10-14T17:36:17.500000", "2023-10-14T17:37:39.500000", "2023-10-14T17:39:02.500000", "2023-10-14T17:40:25.500000", "2023-10-14T17:41:47.500000", "2023-10-14T17:43:10.500000", "2023-10-14T17:44:33.500000", "2023-10-14T17:45:55.500000", "2023-10-14T17:47:18.500000", "2023-10-14T17:48:41.500000", "2023-10-14T17:50:03.500000", "2023-10-14T17:51:26.500000", "2023-10-14T17:52:49.500000", "2023-10-14T17:54:11.500000", "2023-10-14T17:55:34.500000", "2023-10-14T17:56:57.500000", "2023-10-14T17:58:20.500000", "2023-10-14T17:59:42.500000", "2023-10-14T18:01:05.500000", "2023-10-14T18:02:28.500000", "2023-10-14T18:03:50.500000", "2023-10-14T18:05:13.500000", "2023-10-14T18:06:36.500000", "2023-10-14T18:07:58.500000", "2023-10-14T18:09:21.500000", "2023-10-14T18:10:44.500000", "2023-10-14T18:12:06.500000", "2023-10-14T18:13:29.500000", "2023-10-14T18:14:52.500000", "2023-10-14T18:16:14.500000", "2023-10-14T18:17:37.500000", "2023-10-14T18:19:00.500000", "2023-10-14T18:20:22.500000", "2023-10-14T18:21:45.500000", "2023-10-14T18:23:08.500000", "2023-10-14T18:24:30.500000", "2023-10-14T18:25:53.500000", "2023-10-14T18:27:16.500000", "2023-10-14T18:28:38.500000", "2023-10-14T18:30:01.500000", "2023-10-14T18:31:24.500000", "2023-10-14T18:32:47.500000", "2023-10-14T18:34:09.500000", "2023-10-14T18:35:32.500000", "2023-10-14T18:36:55.500000", "2023-10-14T18:38:17.500000", "2023-10-14T18:39:40.500000", "2023-10-14T18:41:03.500000", "2023-10-14T18:42:25.500000", "2023-10-14T18:43:48.500000", "2023-10-14T18:45:11.500000", "2023-10-14T18:46:33.500000", "2023-10-14T18:47:56.500000", "2023-10-14T18:49:19.500000", "2023-10-14T18:50:41.500000", "2023-10-14T18:52:04.500000", "2023-10-14T18:53:27.500000", "2023-10-14T18:54:49.500000", "2023-10-14T18:56:12.500000", "2023-10-14T18:57:35.500000", "2023-10-14T18:58:57.500000", "2023-10-14T19:00:20.500000", "2023-10-14T19:01:43.500000", "2023-10-14T19:03:06.500000"]
neid_april = ["2024-04-08T20:11:26", "2024-04-08T20:10:03", "2024-04-08T20:08:41", "2024-04-08T20:07:18", "2024-04-08T20:05:55", "2024-04-08T20:04:33", "2024-04-08T20:03:10", "2024-04-08T20:01:47", "2024-04-08T20:00:25", "2024-04-08T19:59:02", "2024-04-08T19:57:39", "2024-04-08T19:56:16", "2024-04-08T19:54:54", "2024-04-08T19:53:31", "2024-04-08T19:52:08", "2024-04-08T19:50:46", "2024-04-08T19:49:23", "2024-04-08T19:48:00", "2024-04-08T19:46:38", "2024-04-08T19:45:15", "2024-04-08T19:43:52", "2024-04-08T19:42:30", "2024-04-08T19:41:07", "2024-04-08T19:39:44", "2024-04-08T19:38:22", "2024-04-08T19:36:59", "2024-04-08T19:35:36", "2024-04-08T19:34:14", "2024-04-08T19:32:51", "2024-04-08T19:31:28", "2024-04-08T19:30:06", "2024-04-08T19:28:43", "2024-04-08T19:27:20", "2024-04-08T19:25:57", "2024-04-08T19:24:35", "2024-04-08T19:23:12", "2024-04-08T19:21:49", "2024-04-08T19:20:27", "2024-04-08T19:19:04", "2024-04-08T19:17:41", "2024-04-08T19:16:19", "2024-04-08T19:14:56", "2024-04-08T19:13:33", "2024-04-08T19:12:11", "2024-04-08T19:10:48", "2024-04-08T19:09:25", "2024-04-08T19:08:03", "2024-04-08T19:06:40", "2024-04-08T19:05:17", "2024-04-08T19:03:55", "2024-04-08T19:02:32", "2024-04-08T19:01:09", "2024-04-08T18:59:47", "2024-04-08T18:58:24", "2024-04-08T18:57:01", "2024-04-08T18:55:38", "2024-04-08T18:54:16", "2024-04-08T18:52:53", "2024-04-08T18:51:30", "2024-04-08T18:50:08", "2024-04-08T18:48:45", "2024-04-08T18:47:22", "2024-04-08T18:46:00", "2024-04-08T18:44:37", "2024-04-08T18:43:14", "2024-04-08T18:41:52", "2024-04-08T18:40:29", "2024-04-08T18:39:06", "2024-04-08T18:37:44", "2024-04-08T18:36:21", "2024-04-08T18:34:58", "2024-04-08T18:33:36", "2024-04-08T18:32:13", "2024-04-08T18:30:50", "2024-04-08T18:29:28", "2024-04-08T18:28:05", "2024-04-08T18:26:42", "2024-04-08T18:25:19", "2024-04-08T18:23:57", "2024-04-08T18:22:34", "2024-04-08T18:21:11", "2024-04-08T18:19:49", "2024-04-08T18:18:26", "2024-04-08T18:17:03", "2024-04-08T18:15:41", "2024-04-08T18:14:18", "2024-04-08T18:12:55", "2024-04-08T18:11:33", "2024-04-08T18:10:10", "2024-04-08T18:08:47", "2024-04-08T18:07:25", "2024-04-08T18:06:02", "2024-04-08T18:04:39", "2024-04-08T18:03:17", "2024-04-08T18:01:54", "2024-04-08T18:00:31", "2024-04-08T17:59:09", "2024-04-08T17:57:46", "2024-04-08T17:56:23", "2024-04-08T17:55:01", "2024-04-08T17:53:38", "2024-04-08T17:52:15", "2024-04-08T17:50:52", "2024-04-08T17:49:30", "2024-04-08T17:48:07", "2024-04-08T17:46:44", "2024-04-08T17:45:22", "2024-04-08T17:43:59", "2024-04-08T17:42:36", "2024-04-08T17:41:14", "2024-04-08T17:39:51", "2024-04-08T17:38:28", "2024-04-08T17:37:06", "2024-04-08T17:35:43", "2024-04-08T17:34:20", "2024-04-08T17:32:58", "2024-04-08T17:31:35", "2024-04-08T17:30:12", "2024-04-08T17:28:50", "2024-04-08T17:27:27", "2024-04-08T17:26:04", "2024-04-08T17:24:42", "2024-04-08T17:23:19", "2024-04-08T17:21:56", "2024-04-08T17:20:33", "2024-04-08T17:19:11", "2024-04-08T17:17:48", "2024-04-08T17:16:25", "2024-04-08T17:15:03", "2024-04-08T17:13:40", "2024-04-08T17:12:17", "2024-04-08T17:10:55", "2024-04-08T17:09:32", "2024-04-08T17:08:09", "2024-04-08T17:06:47", "2024-04-08T17:05:24", "2024-04-08T17:04:01", "2024-04-08T17:02:39", "2024-04-08T17:01:16", "2024-04-08T16:59:53", "2024-04-08T16:58:31", "2024-04-08T16:57:08", "2024-04-08T16:55:45", "2024-04-08T16:54:23", "2024-04-08T16:53:00", "2024-04-08T16:51:37", "2024-04-08T16:50:14", "2024-04-08T16:48:52"]

rv, rv_error, λrest = deepcopy(neid_all_lines(neid_october, true, "neid_october_N_50", "KSSD"))
@save "neid_all_lines_rv_regular_KSSD_new.jld2"
jldopen("neid_all_lines_rv_regular_KSSD_new.jld2", "a+") do file
file["name"] = deepcopy(λrest)
file["rv"] = deepcopy(rv)
file["rv_error"] = deepcopy(rv_error)
end

# rv, rv_error, λrest = deepcopy(neid_all_lines(neid_october, false, "neid_october_N_50", "NL94"))
# @save "neid_all_lines_rv_off_NL94.jld2"
# jldopen("neid_all_lines_rv_off_NL94.jld2", "a+") do file
# rv, rv_error, λrest = deepcopy(neid_all_lines(neid_october, true, "neid_october_N_50", "KSSD"))
# @save "neid_all_lines_rv_regular_KSSD.jld2"
# jldopen("neid_all_lines_rv_regular_KSSD.jld2", "a+") do file
# file["name"] = deepcopy(λrest)
# file["rv"] = deepcopy(rv)
# file["rv_error"] = deepcopy(rv_error)
# end

rv, rv_error, λrest = deepcopy(neid_all_lines(neid_october, false, "neid_october_N_50", "KSSD"))
@save "neid_all_lines_rv_off_KSSD_3ext.jld2"
jldopen("neid_all_lines_rv_off_KSSD_3ext.jld2", "a+") do file
file["name"] = deepcopy(λrest)
file["rv"] = deepcopy(rv)
file["rv_error"] = deepcopy(rv_error)
end

# rv, rv_error, λrest = neid_all_lines(neid_april, true)
# @save "neid_all_lines_rv_regular_april_FeI_5383_fullR.jld2"
# jldopen("neid_all_lines_rv_regular_april_FeI_5383_fullR.jld2", "a+") do file
Expand Down
98 changes: 49 additions & 49 deletions scripts/NEID_RV_ccf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function GRASS_comparison(line_names, airwav, vacwav, orders, neid_timestamps, t
chunk_flux_full = itp.(wavs_sim)
chunck_vac_wav = copy(wavs_sim)

v_grid_cpu_neid, ccf_cpu_neid = GRASS.calc_ccf(chunck_vac_wav, chunk_flux_full, lines, [maximum(chunk_flux_full) - minimum(chunk_flux_full)], 11e4)
v_grid_cpu_neid, ccf_cpu_neid = GRASS.calc_ccf(chunck_vac_wav, chunk_flux_full, spec)
v_grid_cpu_sim, ccf_cpu_sim = GRASS.calc_ccf(wavs_sim, flux_sim_j, spec)

# deal with annoying line blend
Expand Down Expand Up @@ -357,7 +357,6 @@ function GRASS_comparison(line_names, airwav, vacwav, orders, neid_timestamps, t
end

function line_rvs_ccf(line_names, vacwav, orders, timestamps, path)

full_pixels = 2048:7168

resolution = 11e4
Expand All @@ -384,50 +383,51 @@ function line_rvs_ccf(line_names, vacwav, orders, timestamps, path)
#find where line is - NEID flux
chunk = NEID.ChunkOfSpectrum(spectrum, order_index, full_pixels)
pixels = NEID.find_pixels_for_line_in_chunk(chunk, min_wav, max_wav)
chunk_flux_full_o = chunk.flux[pixels]
chunk_flux_full = chunk_flux_full_o ./ maximum(chunk_flux_full_o)
chunk_flux_full = chunk.flux[pixels]
chunk_flux_full ./= maximum(chunk_flux_full)
chunck_vac_wav = chunk.λ[pixels]
chunck_var = chunk.var[pixels] ./ maximum(chunk_flux_full)^2

v_grid_cpu, ccf_cpu = GRASS.calc_ccf(chunck_vac_wav, chunk_flux_full, lines, [maximum(chunk_flux_full) - minimum(chunk_flux_full)], resolution)
rvs_cpu, sigs_cpu = GRASS.calc_rvs_from_ccf(v_grid_cpu, ccf_cpu)
v_grid_cpu, ccf_cpu, ccf_var_out = GRASS.calc_ccf(chunck_vac_wav, chunk_flux_full, chunck_var, lines, [maximum(chunk_flux_full) - minimum(chunk_flux_full)], resolution)
rvs_cpu, sigs_cpu = GRASS.calc_rvs_from_ccf(v_grid_cpu, ccf_cpu, ccf_var_out)

RV_list[j] = rvs_cpu
RV_error_list[j] = sigs_cpu

if line_names[i] == "FeI_5383"
fig = plt.figure(figsize=(6.4,4.8))
gs = mpl.gridspec.GridSpec(nrows=1, ncols=2, width_ratios=[2, 1.1], figure=fig, wspace=0.05)
ax1 = fig.add_subplot(gs[1])
ax2 = fig.add_subplot(gs[2])

ax1.plot(chunck_vac_wav ./ ((-bc_ms)/GRASS.c_ms + 1), chunk_flux_full, c=colors[1])
ax1.scatter(chunck_vac_wav ./ ((-bc_ms)/GRASS.c_ms + 1), chunk_flux_full, c=colors[1])
ax1.axvline(x = vacwav[i], c=colors[1])
# find limits
idx_min = argmin(chunk_flux_full)
idx1 = idx_min - findfirst(x -> x .> 0.95, chunk_flux_full[idx_min:-1:1])
idx2 = idx_min + findfirst(x -> x .> 0.95, chunk_flux_full[idx_min:end])
# set limits
ax1.set_xlim(chunck_vac_wav[idx1-20], chunck_vac_wav[idx2+20])
ax1.set_ylim(minimum(chunk_flux_full) - 0.1, 1.1)

# get bisectors
top = 0.9
v_grid_cpu_bc, ccf_cpu_bc = GRASS.calc_ccf(chunck_vac_wav ./ ((-bc_ms)/GRASS.c_ms + 1), chunk_flux_full, lines, [maximum(chunk_flux_full) - minimum(chunk_flux_full)], resolution)
vel_neid, int_neid = GRASS.calc_bisector(v_grid_cpu_bc, ccf_cpu_bc, nflux=50, top=top)
ax2.plot(vel_neid[4:end], int_neid[4:end], c=colors[1])
ax2.scatter(vel_neid[4:end], int_neid[4:end], c=colors[1])
# set limits
ax2.set_ylim(minimum(chunk_flux_full) - 0.05, 1.05)
ax2.set_yticks([])

idx = findfirst('_', line_names[i])
fig.suptitle("$(line_names[i][1:idx-1]) $(round(vacwav[i]; digits = 1))", y=0.95)
ax1.set_ylabel("Normalized Flux")
ax1.set_xlabel("Wavelength (Å)")
ax2.set_xlabel("Radial Velocity (m/s)")
fig.savefig("eclipse_figures/Spectrum/timestamp_$(j).png")
end
# if line_names[i] == "FeI_5383"
# fig = plt.figure(figsize=(6.4,4.8))
# gs = mpl.gridspec.GridSpec(nrows=1, ncols=2, width_ratios=[2, 1.1], figure=fig, wspace=0.05)
# ax1 = fig.add_subplot(gs[1])
# ax2 = fig.add_subplot(gs[2])

# ax1.plot(chunck_vac_wav ./ ((-bc_ms)/GRASS.c_ms + 1), chunk_flux_full, c=colors[1])
# ax1.scatter(chunck_vac_wav ./ ((-bc_ms)/GRASS.c_ms + 1), chunk_flux_full, c=colors[1])
# ax1.axvline(x = vacwav[i], c=colors[1])
# # find limits
# idx_min = argmin(chunk_flux_full)
# idx1 = idx_min - findfirst(x -> x .> 0.95, chunk_flux_full[idx_min:-1:1])
# idx2 = idx_min + findfirst(x -> x .> 0.95, chunk_flux_full[idx_min:end])
# # set limits
# ax1.set_xlim(chunck_vac_wav[idx1-20], chunck_vac_wav[idx2+20])
# ax1.set_ylim(minimum(chunk_flux_full) - 0.1, 1.1)

# # get bisectors
# top = 0.9
# v_grid_cpu_bc, ccf_cpu_bc = GRASS.calc_ccf(chunck_vac_wav ./ ((-bc_ms)/GRASS.c_ms + 1), chunk_flux_full, lines, [maximum(chunk_flux_full) - minimum(chunk_flux_full)], resolution)
# vel_neid, int_neid = GRASS.calc_bisector(v_grid_cpu_bc, ccf_cpu_bc, nflux=50, top=top)
# ax2.plot(vel_neid[4:end], int_neid[4:end], c=colors[1])
# ax2.scatter(vel_neid[4:end], int_neid[4:end], c=colors[1])
# # set limits
# ax2.set_ylim(minimum(chunk_flux_full) - 0.05, 1.05)
# ax2.set_yticks([])

# idx = findfirst('_', line_names[i])
# fig.suptitle("$(line_names[i][1:idx-1]) $(round(vacwav[i]; digits = 1))", y=0.95)
# ax1.set_ylabel("Normalized Flux")
# ax1.set_xlabel("Wavelength (Å)")
# ax2.set_xlabel("Radial Velocity (m/s)")
# fig.savefig("eclipse_figures/Spectrum/timestamp_$(j).png")
# end
end
RV_all_lines[i] = RV_list
RV_error_all_lines[i] = RV_error_list
Expand All @@ -436,16 +436,16 @@ function line_rvs_ccf(line_names, vacwav, orders, timestamps, path)
end

# october
# RV_all_lines, RV_error_all_lines = line_rvs_ccf(line_names, vacwav, orders, timestamps_october, path_october)
# @save "/storage/home/efg5335/work/Eclipse_GRASS/figures/NEID_October/data/neid_RVlinebyline.jld2"
# jldopen("/storage/home/efg5335/work/Eclipse_GRASS/figures/NEID_October/data/neid_RVlinebyline.jld2", "a+") do file
# file["name"] = line_names
# file["rv"] = RV_all_lines
# file["rv_error"] = RV_error_all_lines
# end
RV_all_lines, RV_error_all_lines = line_rvs_ccf(line_names, vacwav, orders, timestamps_october, path_october)
@save "/storage/home/efg5335/work/Eclipse_GRASS/figures/NEID_October/data/neid_RVlinebyline.jld2"
jldopen("/storage/home/efg5335/work/Eclipse_GRASS/figures/NEID_October/data/neid_RVlinebyline.jld2", "a+") do file
file["name"] = line_names
file["rv"] = RV_all_lines
file["rv_error"] = RV_error_all_lines
end

# #for last timestamp (out of transit) of October eclipse, line comparsion between IAG, GRASS, and NEID
# last_timestamp_lines(line_names, airwav, vacwav, orders, neid_timestamps_october, timestamps_october, path_october, "neid_october_N_50", "KSSD")

#for last timestamp (out of transit) of October eclipse, line and bisector comparsion between GRASS and NEID
GRASS_comparison(line_names, airwav, vacwav, orders, neid_timestamps_october, timestamps_october, path_october, "neid_october_N_50", "KSSD")
# #for last timestamp (out of transit) of October eclipse, line and bisector comparsion between GRASS and NEID
# GRASS_comparison(line_names, airwav, vacwav, orders, neid_timestamps_october, timestamps_october, path_october, "neid_october_N_50", "KSSD")
Loading

0 comments on commit 42383a7

Please sign in to comment.