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
Carefully document which fields are used by your function or method.
42
42
43
43
* Dictionary-like objects may be allowed for user input, but should be internally converted to a ``DataClass`` object with the `~sbpy.data.dataclass_input` decorator:
44
44
45
-
.. code-block:: python
46
-
47
-
@dataclass_input(eph=Ephem)
48
-
defH11(eph):
49
-
...
45
+
.. code-block:: python
50
46
51
-
The same, but using function annotations:
52
-
53
-
.. code-block:: python
54
-
55
-
@dataclass_input
56
-
defH11(eph: Ephem):
57
-
...
47
+
@dataclass_input(eph=Ephem)
48
+
defH11(eph):
49
+
...
50
+
51
+
The same, but using function annotations:
52
+
53
+
.. code-block:: python
54
+
55
+
@dataclass_input
56
+
defH11(eph: Ephem):
57
+
...
58
58
59
59
* Exceptions are allowed when only one parameter is needed, e.g., ``phase_func(phase)``. But instead consider using the relevant ``DataClass`` object, and decorating the function with `~sbpy.data.quantity_to_dataclass`:
60
60
61
-
.. code-block:: python
61
+
.. code-block:: python
62
62
63
-
@quantity_to_dataclass(eph=(Ephem, 'phase'))
64
-
defphase_func(eph):
65
-
...
63
+
@quantity_to_dataclass(eph=(Ephem, 'phase'))
64
+
defphase_func(eph):
65
+
...
66
66
67
-
The decorator may be stacked with ``dataclass_input`` for maximum
68
-
flexibility:
67
+
The decorator may be stacked with ``dataclass_input`` for maximum
68
+
flexibility:
69
69
70
-
.. code-block:: python
70
+
.. code-block:: python
71
71
72
-
@dataclass_input
73
-
@quantity_to_dataclass(eph=(Ephem, 'phase'))
74
-
defphase_func(eph):
75
-
...
72
+
@dataclass_input
73
+
@quantity_to_dataclass(eph=(Ephem, 'phase'))
74
+
defphase_func(eph):
75
+
...
76
76
77
77
78
78
Append fields to ``DataClass`` at the user's request
@@ -94,11 +94,11 @@ Cite relevant works
94
94
95
95
* Citations may be executed internally with :func:`sbpy.bib.register`, or via the `~sbpy.bib.cite` decorator:
96
96
97
-
.. code-block:: python
97
+
.. code-block:: python
98
98
99
-
@cite({'method': '1687pnpm.book.....N'})
100
-
defforce(mass, acceleration):
101
-
return mass * acceleration
99
+
@cite({'method': '1687pnpm.book.....N'})
100
+
defforce(mass, acceleration):
101
+
return mass * acceleration
102
102
103
103
* Labels describing references (``'method'`` in the above example) are
104
104
required to start with the following strings: ``'method'`` (for
The *Afρ* parameter of A'Hearn et al (1984) is based on observations of idealized cometary dust comae. It is proportional to the observed flux density within a circular aperture. The quantity is the product of dust albedo, dust filling factor, and the radius of the aperture at the distance of the comet. It carries the units of *ρ* (length), and under certain assumptions is proportional to the dust production rate of the comet:
10
10
11
-
.. math::
11
+
.. math::
12
12
13
-
Afρ = \frac{4 Δ^2 r_h^2}{ρ}\frac{F_c}{F_⊙}
13
+
Afρ = \frac{4 Δ^2 r_h^2}{ρ}\frac{F_c}{F_⊙}
14
14
15
15
where *Δ* and *ρ* have the same (linear) units, but :math:`r_h` is in units of au. :math:`F_c` * is the flux density of the comet in the aperture, and :math:`F_⊙` is that of the Sun at 1 au in the same units. See A'Hearn et al. (1984) and Fink & Rubin (2012) for more details.
16
16
17
17
The *εfρ* parameter is the thermal emission counterpart to *Afρ*, replacing albedo with IR emissivity, *ε*, and the solar spectrum with the Planck function, *B*:
18
18
19
-
.. math::
19
+
.. math::
20
20
21
-
εfρ = \frac{F_c Δ^2}{π ρ B(T_c)}
21
+
εfρ = \frac{F_c Δ^2}{π ρ B(T_c)}
22
22
23
23
where :math:`T_c` is the spectral temperature of the continuum (Kelley et al. 2013).
24
24
@@ -27,21 +27,21 @@ where :math:`T_c` is the spectral temperature of the continuum (Kelley et al. 20
27
27
28
28
`Afrho` and `Efrho` are subclasses of `astropy`'s `~astropy.units.Quantity` and carry units of length.
29
29
30
-
>>> import numpy as np
31
-
>>> import astropy.units as u
32
-
>>> from sbpy.activity import Afrho, Efrho
33
-
>>>
34
-
>>> afrho = Afrho(100* u.cm)
35
-
>>> print(afrho) # doctest: +FLOAT_CMP
36
-
100.0 cm
37
-
>>> efrho = Efrho(afrho *3.5)
38
-
>>> print(efrho) # doctest: +FLOAT_CMP
39
-
350.0 cm
30
+
>>> import numpy as np
31
+
>>> import astropy.units as u
32
+
>>> from sbpy.activity import Afrho, Efrho
33
+
>>>
34
+
>>> afrho = Afrho(100* u.cm)
35
+
>>> print(afrho) # doctest: +FLOAT_CMP
36
+
100.0 cm
37
+
>>> efrho = Efrho(afrho *3.5)
38
+
>>> print(efrho) # doctest: +FLOAT_CMP
39
+
350.0 cm
40
40
41
41
They may be converted to other units of length just like any `Quantity`:
42
42
43
-
>>> afrho.to('m') # doctest: +FLOAT_CMP
44
-
<Afrho 1. m>
43
+
>>> afrho.to('m') # doctest: +FLOAT_CMP
44
+
<Afrho 1. m>
45
45
46
46
.. _afrho-to-from-flux-density:
47
47
@@ -58,30 +58,30 @@ The quantities may be initialized from flux densities. Here, we reproduce one o
58
58
59
59
The solar flux density at 1 au is also needed. We use 1868 W/(m2 μm).
`Afrho` works seamlessly with `sbpy`'s spectral calibration framework (:ref:`sbpy-calib`) when the `astropy` affiliated package `synphot` is installed. The solar flux density (via `~sbpy.calib.solar_fluxd`) is not required, but instead the spectral wavelengths or the system transmission of the instrument and filter:
87
87
@@ -108,15 +108,15 @@ Reproduce the *εfρ* of 246P/NEAT from Kelley et al. (2013).
Phase angle was not used in the previous section. In the *Afρ* formalism, "albedo" includes the scattering phase function, and is more precisely written *A(θ)*, where *θ* is the phase angle. The default behavior for `Afrho` is to compute *A(θ)fρ* as opposed to *A(0°)fρ*. Returning to the A'Hearn et al. data, we scale *Afρ* to 0° from 3.3° phase using the :func:`~sbpy.activity.Afrho.to_phase` method:
The default phase function is the Halley-Marcus composite phase function (:func:`~sbpy.activity.phase_HalleyMarcus`). Any function or callable object that accepts an angle as a `~astropy.units.Quantity` and returns a scalar value may be used:
To correct an observed flux density for the phase function, use the ``phasecor`` option of :func:`~sbpy.activity.Afrho.to_fluxd` and :func:`~sbpy.activity.Afrho.from_fluxd` methods:
Other apertures may be used, as long as they can be converted into an equivalent radius, assuming a coma with a *1/ρ* surface brightness distribution. `~sbpy.activity` has a collection of useful geometries.
179
179
180
-
>>> from sbpy.activity import CircularAperture, AnnularAperture, RectangularAperture, GaussianAperture
0 commit comments