ACID-code-v2 0.2.0a1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.github/workflows/publish.yml +1 -1
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/PKG-INFO +1 -1
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2/ACID.py +64 -14
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2/LSD.py +3 -4
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2/utils.py +0 -1
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2.egg-info/PKG-INFO +1 -1
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2.egg-info/SOURCES.txt +0 -2
- acid_code_v2-0.2.0a1/.github/workflows/python-app.yml +0 -35
- acid_code_v2-0.2.0a1/src/ACID_code_v2/mcmc_utils.py +0 -60
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.gitattributes +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.gitignore +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.other_scripts/5_residual_profiles.py +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.other_scripts/8_master_out_profiles.py +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.readthedocs.yaml +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.vscode/launch.json +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/LICENSE +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/README.md +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/acid.yml +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/ACID.rst +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/conf.py +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/index.rst +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/installation.rst +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/make.bat +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/requirements.txt +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/using_ACID.rst +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/.make_syn_dat.py +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/example_linelist.txt +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/sample_spec_1.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/sample_spec_2.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/sample_spec_3.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/tutorial_code.py +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/pyproject.toml +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/setup.cfg +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2/__init__.py +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2.egg-info/dependency_links.txt +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2.egg-info/requires.txt +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2.egg-info/top_level.txt +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/.DS_Store +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-28T21:11:56.678_blaze_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-28T21:11:56.678_flat_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-28T21:11:56.678_flat_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-28T21:11:56.678_lamp_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-28T21:11:56.678_lamp_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-28T21:11:56.678_order_profile.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_bis_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_bis_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_bis_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_ccf_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_ccf_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_ccf_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_e2ds_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_e2ds_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_s1d_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_s1d_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_bis_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_bis_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_bis_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_ccf_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_ccf_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_ccf_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_e2ds_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_e2ds_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_s1d_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_s1d_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_bis_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_bis_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_bis_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_ccf_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_ccf_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_ccf_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_e2ds_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_e2ds_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_s1d_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_s1d_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_bis_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_bis_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_bis_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_ccf_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_ccf_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_ccf_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_e2ds_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_e2ds_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_s1d_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_s1d_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_bis_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_bis_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_bis_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_ccf_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_ccf_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_ccf_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_e2ds_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_e2ds_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_s1d_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_s1d_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_bis_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_bis_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_bis_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_ccf_G2_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_ccf_G2_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_ccf_K5_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_e2ds_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_e2ds_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_s1d_A.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_s1d_B.fits +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/tests.py +0 -0
- {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/tutorial_test.py +0 -0
|
@@ -8,7 +8,6 @@ from functools import partial
|
|
|
8
8
|
from multiprocessing import Pool
|
|
9
9
|
from . import utils
|
|
10
10
|
from . import LSD
|
|
11
|
-
from . import mcmc_utils
|
|
12
11
|
|
|
13
12
|
warnings.filterwarnings("ignore")
|
|
14
13
|
importlib.reload(LSD)
|
|
@@ -233,11 +232,57 @@ def model_func(inputs, x):
|
|
|
233
232
|
|
|
234
233
|
return mdl
|
|
235
234
|
|
|
235
|
+
def log_likelihood(theta, x, y, yerr):
|
|
236
|
+
## maximum likelihood estimation for the mcmc model.
|
|
237
|
+
model = model_func(theta, x)
|
|
238
|
+
|
|
239
|
+
lnlike = -0.5 * np.sum(((y) - (model)) ** 2 / yerr**2 + np.log(yerr**2)+ np.log(2*np.pi))
|
|
240
|
+
|
|
241
|
+
return lnlike
|
|
242
|
+
|
|
243
|
+
def log_prior(theta):
|
|
244
|
+
## imposes the prior restrictions on the inputs - rejects if profile point is less than -10 or greater than 0.5.
|
|
245
|
+
check = 0
|
|
246
|
+
z = theta[:k_max]
|
|
247
|
+
|
|
248
|
+
for i in range(len(theta)):
|
|
249
|
+
if i < k_max: ## must lie in z
|
|
250
|
+
if -10 <= theta[i] <= 0.5:
|
|
251
|
+
pass
|
|
252
|
+
else:
|
|
253
|
+
check = 1
|
|
254
|
+
|
|
255
|
+
if check == 0:
|
|
256
|
+
|
|
257
|
+
# excluding the continuum points in the profile (in flux)
|
|
258
|
+
z_cont = []
|
|
259
|
+
v_cont = []
|
|
260
|
+
for i in range(0, 5):
|
|
261
|
+
z_cont.append(np.exp(z[len(z)-i-1])-1)
|
|
262
|
+
v_cont.append(velocities[len(velocities)-i-1])
|
|
263
|
+
z_cont.append(np.exp(z[i])-1)
|
|
264
|
+
v_cont.append(velocities[i])
|
|
265
|
+
|
|
266
|
+
z_cont = np.array(z_cont)
|
|
267
|
+
v_cont = np.array(v_cont)
|
|
268
|
+
|
|
269
|
+
p_pent = np.sum((np.log((1/np.sqrt(2*np.pi*0.01**2)))-0.5*(z_cont/0.01)**2))
|
|
270
|
+
|
|
271
|
+
return p_pent
|
|
272
|
+
|
|
273
|
+
return -np.inf
|
|
274
|
+
|
|
275
|
+
def log_probability(theta):
|
|
276
|
+
## calculates log probability - used for mcmc
|
|
277
|
+
lp = log_prior(theta)
|
|
278
|
+
if not np.isfinite(lp):
|
|
279
|
+
return -np.inf
|
|
280
|
+
final = lp + log_likelihood(theta, x, y, yerr)
|
|
281
|
+
return final
|
|
282
|
+
|
|
236
283
|
def residual_mask(wavelengths, data_spec_in, data_err, initial_inputs, poly_ord, linelist,
|
|
237
284
|
velocities=np.arange(-25, 25, 0.82), pix_chunk=20, dev_perc=25,
|
|
238
|
-
tell_lines=
|
|
239
|
-
4861.34, 5183.62, 5270.39, 5889.95, 5895.92, 6562.81,
|
|
240
|
-
7593.70, 8226.96], n_sig=1):
|
|
285
|
+
tell_lines=None, n_sig=1, alpha=None):
|
|
241
286
|
## iterative residual masking - mask continuous areas first - then possibly progress to masking the narrow lines
|
|
242
287
|
|
|
243
288
|
forward = model_func(initial_inputs, wavelengths)
|
|
@@ -568,7 +613,7 @@ def ACID(input_wavelengths, input_spectra, input_spectral_errors, line, frame_sn
|
|
|
568
613
|
yerr, model_inputs_resi, mask_idx = residual_mask(x, y, yerr, model_inputs, poly_ord,
|
|
569
614
|
linelist, pix_chunk=pix_chunk,
|
|
570
615
|
dev_perc=dev_perc, tell_lines=telluric_lines,
|
|
571
|
-
n_sig=n_sig)
|
|
616
|
+
n_sig=n_sig, alpha=alpha)
|
|
572
617
|
|
|
573
618
|
# if verbose:
|
|
574
619
|
# t4 = time.time()
|
|
@@ -593,9 +638,6 @@ def ACID(input_wavelengths, input_spectra, input_spectral_errors, line, frame_sn
|
|
|
593
638
|
pos = np.array(pos)
|
|
594
639
|
pos = np.transpose(pos)
|
|
595
640
|
|
|
596
|
-
# Inistialise MCMC class:
|
|
597
|
-
mcmc_class = mcmc_utils.Model(model_func, x, y, yerr, velocities, k_max)
|
|
598
|
-
|
|
599
641
|
if verbose:
|
|
600
642
|
t5 = time.time()
|
|
601
643
|
# print('MCMC set up takes: %s'%(t5-t4))
|
|
@@ -619,7 +661,7 @@ def ACID(input_wavelengths, input_spectra, input_spectral_errors, line, frame_sn
|
|
|
619
661
|
if sys.platform != "win32":
|
|
620
662
|
ctx = mp.get_context("fork")
|
|
621
663
|
with ctx.Pool(processes = cores) as pool:
|
|
622
|
-
sampler = emcee.EnsembleSampler(nwalkers, ndim,
|
|
664
|
+
sampler = emcee.EnsembleSampler(nwalkers, ndim, log_probability, pool=pool)
|
|
623
665
|
sampler.run_mcmc(pos, nsteps, progress=True, store=True)
|
|
624
666
|
|
|
625
667
|
# with Pool() as pool: # Original code
|
|
@@ -633,7 +675,7 @@ def ACID(input_wavelengths, input_spectra, input_spectral_errors, line, frame_sn
|
|
|
633
675
|
|
|
634
676
|
|
|
635
677
|
else:
|
|
636
|
-
sampler = emcee.EnsembleSampler(nwalkers, ndim,
|
|
678
|
+
sampler = emcee.EnsembleSampler(nwalkers, ndim, log_probability)
|
|
637
679
|
sampler.run_mcmc(pos, nsteps, progress=True)
|
|
638
680
|
|
|
639
681
|
print('MCMC run takes: %s'%(time.time()-t5))
|
|
@@ -799,8 +841,16 @@ def ACID(input_wavelengths, input_spectra, input_spectral_errors, line, frame_sn
|
|
|
799
841
|
|
|
800
842
|
return all_frames
|
|
801
843
|
|
|
802
|
-
def ACID_HARPS(filelist, line, vgrid, order_range=None, save_path = './',
|
|
803
|
-
|
|
844
|
+
def ACID_HARPS(filelist, line, vgrid, order_range=None, save_path = './',
|
|
845
|
+
file_type = 'e2ds', name="test", **kwargs):
|
|
846
|
+
"""Accurate Continuum fItting and Deconvolution for HARPS e2ds and s1d spectra (DRS pipeline 3.5)
|
|
847
|
+
|
|
848
|
+
Fits the continuum of the given spectra and performs LSD on the continuum corrected spectra,
|
|
849
|
+
returning an LSD profile for each file given. Files must all be kept in the same folder as well
|
|
850
|
+
as their corresponding blaze files. If 's1d' are being used their e2ds equivalents must also be
|
|
851
|
+
in this folder. Result files containing profiles and associated errors for each order (or
|
|
852
|
+
corresponding wavelength range in the case of 's1d' files) will be created and saved to a
|
|
853
|
+
specified folder. It is recommended that this folder is seperate to the input files.
|
|
804
854
|
|
|
805
855
|
Parameters
|
|
806
856
|
----------
|
|
@@ -843,6 +893,8 @@ def ACID_HARPS(filelist, line, vgrid, order_range=None, save_path = './', file_t
|
|
|
843
893
|
global frame_wavelengths
|
|
844
894
|
global frame_errors
|
|
845
895
|
global sns
|
|
896
|
+
global run_name
|
|
897
|
+
run_name = name
|
|
846
898
|
|
|
847
899
|
if order_range is None:
|
|
848
900
|
order_range = np.arange(10, 70)
|
|
@@ -886,5 +938,3 @@ def ACID_HARPS(filelist, line, vgrid, order_range=None, save_path = './', file_t
|
|
|
886
938
|
errors.append(result2)
|
|
887
939
|
|
|
888
940
|
return BJDs, profiles, errors
|
|
889
|
-
|
|
890
|
-
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
from scipy import linalg
|
|
3
3
|
from astropy.io import fits
|
|
4
|
-
import glob, time, warnings, sys, psutil
|
|
4
|
+
import glob, time, warnings, sys, psutil, os
|
|
5
5
|
import scipy.constants as const
|
|
6
6
|
import matplotlib.pyplot as plt
|
|
7
7
|
from scipy.signal import find_peaks
|
|
8
8
|
from scipy.interpolate import interp1d, LSQUnivariateSpline
|
|
9
9
|
from tqdm import tqdm
|
|
10
|
-
import os
|
|
11
10
|
ckms = float(const.c/1e3) # speed of light in km/s
|
|
12
11
|
|
|
13
12
|
def LSD(wavelengths, flux_obs, rms, linelist, adjust_continuum, poly_ord, sn,
|
|
@@ -199,9 +198,9 @@ def continuumfit(wavelengths1, fluxes1, poly_ord):
|
|
|
199
198
|
|
|
200
199
|
return flux_obs
|
|
201
200
|
|
|
202
|
-
# from MM-LSD code - give credit if needed
|
|
203
201
|
def upper_envelope(x, y):
|
|
204
|
-
#
|
|
202
|
+
# from MM-LSD code - give credit if needed
|
|
203
|
+
# used to compute the tapas continuum. find peaks then fit spline to it.
|
|
205
204
|
peaks = find_peaks(y, height=0.2, distance=len(x) // 500)[0]
|
|
206
205
|
# t= knot positions
|
|
207
206
|
spl = LSQUnivariateSpline(x=x[peaks], y=y[peaks], t=x[peaks][5::10])
|
|
@@ -6,7 +6,6 @@ README.md
|
|
|
6
6
|
acid.yml
|
|
7
7
|
pyproject.toml
|
|
8
8
|
.github/workflows/publish.yml
|
|
9
|
-
.github/workflows/python-app.yml
|
|
10
9
|
.other_scripts/5_residual_profiles.py
|
|
11
10
|
.other_scripts/8_master_out_profiles.py
|
|
12
11
|
.vscode/launch.json
|
|
@@ -26,7 +25,6 @@ example/tutorial_code.py
|
|
|
26
25
|
src/ACID_code_v2/ACID.py
|
|
27
26
|
src/ACID_code_v2/LSD.py
|
|
28
27
|
src/ACID_code_v2/__init__.py
|
|
29
|
-
src/ACID_code_v2/mcmc_utils.py
|
|
30
28
|
src/ACID_code_v2/utils.py
|
|
31
29
|
src/ACID_code_v2.egg-info/PKG-INFO
|
|
32
30
|
src/ACID_code_v2.egg-info/SOURCES.txt
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
|
|
3
|
-
|
|
4
|
-
name: Python application
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
push:
|
|
8
|
-
branches: [ "main" ]
|
|
9
|
-
pull_request:
|
|
10
|
-
branches: [ "main" ]
|
|
11
|
-
|
|
12
|
-
permissions:
|
|
13
|
-
contents: read
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
build:
|
|
17
|
-
|
|
18
|
-
runs-on: macos-latest
|
|
19
|
-
steps:
|
|
20
|
-
- uses: actions/checkout@v3
|
|
21
|
-
- name: Set up Python 3.7
|
|
22
|
-
uses: actions/setup-python@v3
|
|
23
|
-
with:
|
|
24
|
-
python-version: "3.7"
|
|
25
|
-
- name: Install dependencies
|
|
26
|
-
run: |
|
|
27
|
-
python -m pip install --upgrade pip
|
|
28
|
-
pip install pytest
|
|
29
|
-
git clone https://github.com/ldolan05/ACID.git
|
|
30
|
-
cd ACID
|
|
31
|
-
python -m pip install -e .
|
|
32
|
-
if [ -f docs/requirements.txt ]; then pip install -r docs/requirements.txt; fi
|
|
33
|
-
- name: Test with pytest
|
|
34
|
-
run: |
|
|
35
|
-
pytest tests/*
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
from ACID_code_v2.ACID import model_func
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class Model:
|
|
6
|
-
def __init__(self, model_func, x, y, yerr, velocities, k_max):
|
|
7
|
-
self.model_func = model_func
|
|
8
|
-
self.x = x
|
|
9
|
-
self.y = y
|
|
10
|
-
self.yerr = yerr
|
|
11
|
-
self.velocities = velocities
|
|
12
|
-
self.k_max = k_max
|
|
13
|
-
|
|
14
|
-
def log_likelihood(self, theta, x, y, yerr):
|
|
15
|
-
## maximum likelihood estimation for the mcmc model.
|
|
16
|
-
model = model_func(theta, x)
|
|
17
|
-
|
|
18
|
-
lnlike = -0.5 * np.sum(((y) - (model)) ** 2 / yerr**2 + np.log(yerr**2)+ np.log(2*np.pi))
|
|
19
|
-
|
|
20
|
-
return lnlike
|
|
21
|
-
|
|
22
|
-
def log_prior(self, theta):
|
|
23
|
-
## imposes the prior restrictions on the inputs - rejects if profile point is less than -10 or greater than 0.5.
|
|
24
|
-
check = 0
|
|
25
|
-
z = theta[:self.k_max]
|
|
26
|
-
|
|
27
|
-
for i in range(len(theta)):
|
|
28
|
-
if i < self.k_max: ## must lie in z
|
|
29
|
-
if -10 <= theta[i] <= 0.5:
|
|
30
|
-
pass
|
|
31
|
-
else:
|
|
32
|
-
check = 1
|
|
33
|
-
|
|
34
|
-
if check == 0:
|
|
35
|
-
|
|
36
|
-
# excluding the continuum points in the profile (in flux)
|
|
37
|
-
z_cont = []
|
|
38
|
-
v_cont = []
|
|
39
|
-
for i in range(0, 5):
|
|
40
|
-
z_cont.append(np.exp(z[len(z)-i-1])-1)
|
|
41
|
-
v_cont.append(self.velocities[len(self.velocities)-i-1])
|
|
42
|
-
z_cont.append(np.exp(z[i])-1)
|
|
43
|
-
v_cont.append(self.velocities[i])
|
|
44
|
-
|
|
45
|
-
z_cont = np.array(z_cont)
|
|
46
|
-
v_cont = np.array(v_cont)
|
|
47
|
-
|
|
48
|
-
p_pent = np.sum((np.log((1/np.sqrt(2*np.pi*0.01**2)))-0.5*(z_cont/0.01)**2))
|
|
49
|
-
|
|
50
|
-
return p_pent
|
|
51
|
-
|
|
52
|
-
return -np.inf
|
|
53
|
-
|
|
54
|
-
def log_probability(self, theta):
|
|
55
|
-
## calculates log probability - used for mcmc
|
|
56
|
-
lp = self.log_prior(theta)
|
|
57
|
-
if not np.isfinite(lp):
|
|
58
|
-
return -np.inf
|
|
59
|
-
final = lp + self.log_likelihood(theta, self.x, self.y, self.yerr)
|
|
60
|
-
return final
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-28T21:11:56.678_blaze_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-28T21:11:56.678_flat_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-28T21:11:56.678_flat_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-28T21:11:56.678_lamp_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-28T21:11:56.678_lamp_B.fits
RENAMED
|
File without changes
|
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_bis_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_bis_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_bis_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_ccf_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_ccf_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_ccf_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_e2ds_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_e2ds_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_s1d_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:02:50.897_s1d_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_bis_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_bis_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_bis_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_ccf_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_ccf_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_ccf_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_e2ds_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_e2ds_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_s1d_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:08:22.216_s1d_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_bis_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_bis_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_bis_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_ccf_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_ccf_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_ccf_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_e2ds_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_e2ds_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_s1d_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:13:54.107_s1d_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_bis_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_bis_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_bis_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_ccf_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_ccf_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_ccf_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_e2ds_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_e2ds_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_s1d_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:19:25.377_s1d_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_bis_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_bis_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_bis_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_ccf_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_ccf_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_ccf_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_e2ds_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_e2ds_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_s1d_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:24:57.238_s1d_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_bis_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_bis_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_bis_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_ccf_G2_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_ccf_G2_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_ccf_K5_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_e2ds_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_e2ds_B.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_s1d_A.fits
RENAMED
|
File without changes
|
{acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/HARPS.2007-08-29T00:30:28.617_s1d_B.fits
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|