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.
Files changed (106) hide show
  1. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.github/workflows/publish.yml +1 -1
  2. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/PKG-INFO +1 -1
  3. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2/ACID.py +64 -14
  4. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2/LSD.py +3 -4
  5. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2/utils.py +0 -1
  6. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2.egg-info/PKG-INFO +1 -1
  7. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2.egg-info/SOURCES.txt +0 -2
  8. acid_code_v2-0.2.0a1/.github/workflows/python-app.yml +0 -35
  9. acid_code_v2-0.2.0a1/src/ACID_code_v2/mcmc_utils.py +0 -60
  10. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.gitattributes +0 -0
  11. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.gitignore +0 -0
  12. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.other_scripts/5_residual_profiles.py +0 -0
  13. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.other_scripts/8_master_out_profiles.py +0 -0
  14. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.readthedocs.yaml +0 -0
  15. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/.vscode/launch.json +0 -0
  16. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/LICENSE +0 -0
  17. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/README.md +0 -0
  18. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/acid.yml +0 -0
  19. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/ACID.rst +0 -0
  20. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/conf.py +0 -0
  21. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/index.rst +0 -0
  22. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/installation.rst +0 -0
  23. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/make.bat +0 -0
  24. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/requirements.txt +0 -0
  25. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/docs/using_ACID.rst +0 -0
  26. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/.make_syn_dat.py +0 -0
  27. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/example_linelist.txt +0 -0
  28. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/sample_spec_1.fits +0 -0
  29. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/sample_spec_2.fits +0 -0
  30. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/sample_spec_3.fits +0 -0
  31. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/example/tutorial_code.py +0 -0
  32. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/pyproject.toml +0 -0
  33. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/setup.cfg +0 -0
  34. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2/__init__.py +0 -0
  35. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2.egg-info/dependency_links.txt +0 -0
  36. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2.egg-info/requires.txt +0 -0
  37. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/src/ACID_code_v2.egg-info/top_level.txt +0 -0
  38. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/data/.DS_Store +0 -0
  39. {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
  40. {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
  41. {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
  42. {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
  43. {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
  44. {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
  45. {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
  46. {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
  47. {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
  48. {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
  49. {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
  50. {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
  51. {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
  52. {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
  53. {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
  54. {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
  55. {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
  56. {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
  57. {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
  58. {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
  59. {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
  60. {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
  61. {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
  62. {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
  63. {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
  64. {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
  65. {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
  66. {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
  67. {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
  68. {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
  69. {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
  70. {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
  71. {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
  72. {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
  73. {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
  74. {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
  75. {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
  76. {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
  77. {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
  78. {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
  79. {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
  80. {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
  81. {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
  82. {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
  83. {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
  84. {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
  85. {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
  86. {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
  87. {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
  88. {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
  89. {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
  90. {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
  91. {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
  92. {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
  93. {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
  94. {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
  95. {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
  96. {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
  97. {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
  98. {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
  99. {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
  100. {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
  101. {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
  102. {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
  103. {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
  104. {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
  105. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/tests.py +0 -0
  106. {acid_code_v2-0.2.0a1 → acid_code_v2-0.2.2}/tests/tutorial_test.py +0 -0
@@ -5,7 +5,7 @@ on:
5
5
  - 'v*'
6
6
  jobs:
7
7
  build:
8
- runs-on: ubuntu-latest
8
+ runs-on: macos-latest
9
9
  steps:
10
10
  - uses: actions/checkout@v3
11
11
  - uses: actions/setup-python@v4
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ACID_code_v2
3
- Version: 0.2.0a1
3
+ Version: 0.2.2
4
4
  Summary: Returns line profiles from input spectra by fitting the stellar continuum and performing LSD
5
5
  Author: Lucy Dolan
6
6
  Author-email: Benjamin Cadell <bcadell01@qub.ac.uk>
@@ -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=[3820.33, 3933.66, 3968.47, 4327.74, 4307.90, 4383.55,
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, mcmc_class.log_probability, pool=pool)
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, mcmc_class.log_probability)
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 = './', file_type = 'e2ds', **kwargs):
803
- """_summary_
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
- #used to compute the tapas continuum. find peaks then fit spline to it.
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])
@@ -21,7 +21,6 @@ def ensure_list(x, allow_none=False):
21
21
  else:
22
22
  raise TypeError("Input must be a list or numpy array")
23
23
 
24
-
25
24
  def round_sig(x1, sig):
26
25
  return round(x1, sig-int(floor(log10(abs(x1))))-1)
27
26
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ACID_code_v2
3
- Version: 0.2.0a1
3
+ Version: 0.2.2
4
4
  Summary: Returns line profiles from input spectra by fitting the stellar continuum and performing LSD
5
5
  Author: Lucy Dolan
6
6
  Author-email: Benjamin Cadell <bcadell01@qub.ac.uk>
@@ -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