ACID-code 2.0.0a1__py3-none-any.whl → 2.0.0a2__py3-none-any.whl
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/result.py +9 -3
- ACID_code/utils.py +26 -3
- {acid_code-2.0.0a1.dist-info → acid_code-2.0.0a2.dist-info}/METADATA +1 -1
- {acid_code-2.0.0a1.dist-info → acid_code-2.0.0a2.dist-info}/RECORD +7 -7
- {acid_code-2.0.0a1.dist-info → acid_code-2.0.0a2.dist-info}/WHEEL +0 -0
- {acid_code-2.0.0a1.dist-info → acid_code-2.0.0a2.dist-info}/licenses/LICENSE +0 -0
- {acid_code-2.0.0a1.dist-info → acid_code-2.0.0a2.dist-info}/top_level.txt +0 -0
ACID_code/result.py
CHANGED
|
@@ -544,15 +544,21 @@ class Result:
|
|
|
544
544
|
|
|
545
545
|
# Get flat_samples which are the same samples used to calculate the final profile, alpha is OD,
|
|
546
546
|
# so convert profile back to OD and reconvert to flux for forward model
|
|
547
|
-
profile = utils.flux_to_od(self
|
|
547
|
+
profile = utils.flux_to_od(self[0])
|
|
548
548
|
model_flux = utils.od_to_flux(self.data.alpha @ profile) * self.data.continuum_model
|
|
549
549
|
|
|
550
|
+
# Due to distortion at the edges of the profile, we drop the last 2 pixels
|
|
551
|
+
wavelengths = utils.drop_edges(wavelengths)
|
|
552
|
+
flux = utils.drop_edges(flux)
|
|
553
|
+
model_flux = utils.drop_edges(model_flux)
|
|
554
|
+
continuum_model = utils.drop_edges(self.data.continuum_model)
|
|
555
|
+
|
|
550
556
|
# Plotting
|
|
551
557
|
fig, ax = plt.subplots(2, 1, **subplot_kwargs)
|
|
552
558
|
ax[0].plot(wavelengths, flux, color='black', linewidth=1, label='Observed Spectrum')
|
|
553
559
|
ax[0].plot(wavelengths, model_flux, color='C0', linewidth=1, label='Forward Model Fit')
|
|
554
|
-
ax[0].plot(wavelengths,
|
|
555
|
-
ax[1].plot(wavelengths, model_flux
|
|
560
|
+
ax[0].plot(wavelengths, continuum_model, color='C1', linewidth=1, label='Fitted Continuum', linestyle='--')
|
|
561
|
+
ax[1].plot(wavelengths, model_flux-flux, color='C0', linewidth=1, label='Residuals')
|
|
556
562
|
ax[1].axhline(0, color='black', linestyle='--', linewidth=1)
|
|
557
563
|
ax[0].set_title(labels["title"])
|
|
558
564
|
ax[1].set_xlabel(labels["xlabel"])
|
ACID_code/utils.py
CHANGED
|
@@ -153,8 +153,11 @@ def drop_invalid(wavelengths, flux, errors=None, return_mask=False, verbose=2):
|
|
|
153
153
|
output = output + (mask,) if return_mask else output
|
|
154
154
|
return output
|
|
155
155
|
|
|
156
|
-
def clip_wavelengths(wavelengths, wavelengths_linelist, depths_linelist):
|
|
157
|
-
"""
|
|
156
|
+
def clip_wavelengths(wavelengths, wavelengths_linelist, depths_linelist, pad=5):
|
|
157
|
+
"""
|
|
158
|
+
Clips the linelist to only include lines within the wavelength range of the observed spectrum.
|
|
159
|
+
Includes a pad either side of the wavelength range so that the wings of lines outside
|
|
160
|
+
the range can also contribute to the fit.
|
|
158
161
|
|
|
159
162
|
Parameters
|
|
160
163
|
----------
|
|
@@ -164,6 +167,8 @@ def clip_wavelengths(wavelengths, wavelengths_linelist, depths_linelist):
|
|
|
164
167
|
Wavelengths from the linelist
|
|
165
168
|
depths_linelist : np.ndarray
|
|
166
169
|
Depths from the linelist
|
|
170
|
+
pad : float, optional
|
|
171
|
+
Number of angstroms to pad on either side of the wavelength range. By default, 5.
|
|
167
172
|
|
|
168
173
|
Returns
|
|
169
174
|
-------
|
|
@@ -172,10 +177,28 @@ def clip_wavelengths(wavelengths, wavelengths_linelist, depths_linelist):
|
|
|
172
177
|
depths_linelist : np.ndarray
|
|
173
178
|
Clipped depths from the linelist
|
|
174
179
|
"""
|
|
175
|
-
lower, upper = np.nanmin(wavelengths), np.nanmax(wavelengths)
|
|
180
|
+
lower, upper = np.nanmin(wavelengths)-pad, np.nanmax(wavelengths)+pad
|
|
176
181
|
idx = (wavelengths_linelist >= lower) & (wavelengths_linelist <= upper)
|
|
177
182
|
return wavelengths_linelist[idx], depths_linelist[idx]
|
|
178
183
|
|
|
184
|
+
def drop_edges(array, n_pix=2):
|
|
185
|
+
"""
|
|
186
|
+
Drops the edges of an array by a specified number of pixels.
|
|
187
|
+
|
|
188
|
+
Parameters
|
|
189
|
+
----------
|
|
190
|
+
array : np.ndarray
|
|
191
|
+
The input array.
|
|
192
|
+
n_pix : int, optional
|
|
193
|
+
Number of pixels to drop from each edge. Default is 2.
|
|
194
|
+
|
|
195
|
+
Returns
|
|
196
|
+
-------
|
|
197
|
+
np.ndarray
|
|
198
|
+
The array with edges dropped.
|
|
199
|
+
"""
|
|
200
|
+
return array[n_pix:-n_pix]
|
|
201
|
+
|
|
179
202
|
@beartype
|
|
180
203
|
def calc_deltav(wavelengths:Array1D)->Scalar:
|
|
181
204
|
"""Calculates velocity pixel size
|
|
@@ -6,10 +6,10 @@ ACID_code/load.py,sha256=3gzIZpAv7flgX5ekWdRDI95hkPTxvtp2F1liygpivOQ,5453
|
|
|
6
6
|
ACID_code/lsd.py,sha256=iSNjxga-ic1tDCEpEOr5ISSxOsg6GLL_BYqTJi58MTA,20814
|
|
7
7
|
ACID_code/mcmc.py,sha256=kNW1Aj5jfWb5xa95yKJU4NBOp1hnGV3KzHV5DrCtKU8,11434
|
|
8
8
|
ACID_code/profiles.py,sha256=KkVsJjCLXx_wjRBialfmnlGwjWsROy0GkggdPPYLelc,17103
|
|
9
|
-
ACID_code/result.py,sha256=
|
|
10
|
-
ACID_code/utils.py,sha256=
|
|
11
|
-
acid_code-2.0.
|
|
12
|
-
acid_code-2.0.
|
|
13
|
-
acid_code-2.0.
|
|
14
|
-
acid_code-2.0.
|
|
15
|
-
acid_code-2.0.
|
|
9
|
+
ACID_code/result.py,sha256=9VXQkovQflDSUIYjwHCAo_cFMs7981IOuKDwlFv8_9w,39819
|
|
10
|
+
ACID_code/utils.py,sha256=SY7qlIM15h8yYz7G_-DqXpYhralFbE0ycpOPvnw6DZw,27323
|
|
11
|
+
acid_code-2.0.0a2.dist-info/licenses/LICENSE,sha256=L6dUgqjvHmRoobrBCPSHKC4UtRM5Ldp1DJBC4bnLk3w,1070
|
|
12
|
+
acid_code-2.0.0a2.dist-info/METADATA,sha256=qVMgFV_XyFpmUQgGZ6zG3gSZXZR4aT7Lbhfdp6mIabA,2999
|
|
13
|
+
acid_code-2.0.0a2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
14
|
+
acid_code-2.0.0a2.dist-info/top_level.txt,sha256=O4OaSabv1ebFYQmHgftr1PGAv6BvC2l81Y3HjgNehQI,10
|
|
15
|
+
acid_code-2.0.0a2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|