You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: measure_extinction/extdata.py
+35-38Lines changed: 35 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,6 @@
7
7
fromastropy.ioimportfits
8
8
fromscipy.optimizeimportcurve_fit
9
9
10
-
fromdust_extinction.parameter_averagesimportF04
11
10
fromastropy.modeling.powerlawsimportPowerLaw1D
12
11
fromastropy.modelingimportParameter
13
12
fromastropy.modeling.fittingimportLevMarLSQFitter
@@ -98,7 +97,7 @@ def _get_column_val(column):
98
97
returnfloat(column)
99
98
100
99
101
-
defAverageExtData(extdatas):
100
+
defAverageExtData(extdatas, min_number=3):
102
101
"""
103
102
Generate the average extinction curve from a list of ExtData objects
104
103
@@ -107,6 +106,9 @@ def AverageExtData(extdatas):
107
106
extdatas : list of ExtData objects
108
107
list of extinction curves to average
109
108
109
+
min_number : int [default=3]
110
+
minimum number of extinction curves that are required to measure the average extinction; if less than min_number of curves are available at certain wavelengths, the average extinction will still be calculated, but the number of points (npts) at those wavelengths will be set to zero (e.g. used in the plotting)
111
+
110
112
Returns
111
113
-------
112
114
aveext: ExtData object
@@ -117,7 +119,8 @@ def AverageExtData(extdatas):
117
119
names= []
118
120
bwaves= []
119
121
forextdatainextdatas:
120
-
# check the data type of the extinction curves, and convert if needed
122
+
# check the data type of the extinction curve, and convert if needed
123
+
# the average curve must be calculated from the A(lambda)/A(V) curves
# calculation of the standard error of the average (the standard error of the sample mean is an estimate of how far the sample mean is likely to be from the population mean)
# take out the data points where less than a certain number of values was averaged, and give a warning
179
+
ifmin_number>1:
180
+
aveext.npts[src][aveext.npts[src] <min_number] =0
181
+
warnings.warn(
182
+
"The minimum number of "
183
+
+str(min_number)
184
+
+" extinction curves was not reached for certain wavelengths, and the number of points (npts) for those wavelengths was set to 0.",
185
+
UserWarning,
186
+
)
187
+
173
188
returnaveext
174
189
175
190
@@ -490,14 +505,12 @@ def calc_RV(self):
490
505
491
506
deftrans_elv_alav(self, av=None, akav=0.112):
492
507
"""
493
-
Transform E(lambda-V) to A(lambda)/A(V) by normalizing to
494
-
A(V) and adding 1. Default is to calculate A(V) from the
495
-
input elx curve. If A(V) value is passed, use that one instead.
508
+
Transform E(lambda-V) to A(lambda)/A(V) by normalizing to A(V) and adding 1. If A(V) is in the columns of the extdata object, use that value. If A(V) is passed explicitly, use that value instead. If no A(V) is available, calculate A(V) from the input elx curve.
496
509
497
510
Parameters
498
511
----------
499
512
av : float [default = None]
500
-
value of A(V) to use - otherwise calculate it
513
+
value of A(V) to use - otherwise take it from the columns of the object or calculate it
501
514
502
515
akav : float [default = 0.112]
503
516
Value of A(K)/A(V), only needed if A(V) has to be calculated from the K-band extinction
0 commit comments