Skip to content

Commit 94a8aa5

Browse files
committed
Make indentation uniform.
1 parent 9f2a3c3 commit 94a8aa5

File tree

1 file changed

+80
-80
lines changed

1 file changed

+80
-80
lines changed

docs/sbpy/activity/dust.rst

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ The *Afρ* parameter of A'Hearn et al (1984) is based on observations of idealiz
1010

1111
.. math::
1212
13-
Afρ = \frac{4 Δ^2 r_h^2}{ρ}\frac{F_c}{F_⊙}
13+
Afρ = \frac{4 Δ^2 r_h^2}{ρ}\frac{F_c}{F_⊙}
1414
1515
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.
1616

1717
The *εfρ* parameter is the thermal emission counterpart to *Afρ*, replacing albedo with IR emissivity, *ε*, and the solar spectrum with the Planck function, *B*:
1818

1919
.. math::
2020
21-
εfρ = \frac{F_c Δ^2}{π ρ B(T_c)}
21+
εfρ = \frac{F_c Δ^2}{π ρ B(T_c)}
2222
2323
where :math:`T_c` is the spectral temperature of the continuum (Kelley et al. 2013).
2424

@@ -27,21 +27,21 @@ where :math:`T_c` is the spectral temperature of the continuum (Kelley et al. 20
2727

2828
`Afrho` and `Efrho` are subclasses of `astropy`'s `~astropy.units.Quantity` and carry units of length.
2929

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
4040

4141
They may be converted to other units of length just like any `Quantity`:
4242

43-
>>> afrho.to('m') # doctest: +FLOAT_CMP
44-
<Afrho 1. m>
43+
>>> afrho.to('m') # doctest: +FLOAT_CMP
44+
<Afrho 1. m>
4545

4646
.. _afrho-to-from-flux-density:
4747

@@ -58,30 +58,30 @@ The quantities may be initialized from flux densities. Here, we reproduce one o
5858

5959
The solar flux density at 1 au is also needed. We use 1868 W/(m2 μm).
6060

61-
>>> from sbpy.data import Ephem
62-
>>> from sbpy.calib import solar_fluxd
63-
>>>
64-
>>> solar_fluxd.set({
65-
... 'λ5240': 1868 * u.W / u.m**2 / u.um,
66-
... 'λ5240(lambda pivot)': 5240 * u.AA
67-
... }) # doctest: +IGNORE_OUTPUT
68-
>>>
69-
>>> flam = 10**-13.99 * u.Unit('erg/(s cm2 AA)')
70-
>>> aper = 27200 * u.km
71-
>>>
72-
>>> eph = Ephem.from_dict({'rh': 4.785 * u.au, 'delta': 3.822 * u.au})
73-
>>>
74-
>>> afrho = Afrho.from_fluxd('λ5240', flam, aper, eph)
75-
>>> print(afrho) # doctest: +FLOAT_CMP
76-
6029.90248952895 cm
61+
>>> from sbpy.data import Ephem
62+
>>> from sbpy.calib import solar_fluxd
63+
>>>
64+
>>> solar_fluxd.set({
65+
... 'λ5240': 1868 * u.W / u.m**2 / u.um,
66+
... 'λ5240(lambda pivot)': 5240 * u.AA
67+
... }) # doctest: +IGNORE_OUTPUT
68+
>>>
69+
>>> flam = 10**-13.99 * u.Unit('erg/(s cm2 AA)')
70+
>>> aper = 27200 * u.km
71+
>>>
72+
>>> eph = Ephem.from_dict({'rh': 4.785 * u.au, 'delta': 3.822 * u.au})
73+
>>>
74+
>>> afrho = Afrho.from_fluxd('λ5240', flam, aper, eph)
75+
>>> print(afrho) # doctest: +FLOAT_CMP
76+
6029.90248952895 cm
7777

7878
Which is within a few percent of 6160 cm computed by A'Hearn et al.. The difference is likely due to the assumed solar flux density in the bandpass.
7979

8080
The `Afrho` class may be converted to a flux density, and the original value is recovered.
8181

82-
>>> f = afrho.to_fluxd('λ5240', aper, eph).to('erg/(s cm2 AA)')
83-
>>> print(np.log10(f.value)) # doctest: +FLOAT_CMP
84-
-13.99
82+
>>> f = afrho.to_fluxd('λ5240', aper, eph).to('erg/(s cm2 AA)')
83+
>>> print(np.log10(f.value)) # doctest: +FLOAT_CMP
84+
-13.99
8585

8686
`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:
8787

@@ -108,15 +108,15 @@ Reproduce the *εfρ* of 246P/NEAT from Kelley et al. (2013).
108108

109109
.. doctest-requires:: synphot
110110

111-
>>> wave = [15.8, 22.3] * u.um
112-
>>> fluxd = [25.75, 59.2] * u.mJy
113-
>>> aper = 11.1 * u.arcsec
114-
>>> eph = Ephem.from_dict({'rh': 4.28 * u.au, 'delta': 3.71 * u.au})
115-
>>> efrho = Efrho.from_fluxd(wave, fluxd, aper, eph)
116-
>>> for i in range(len(wave)):
117-
... print('{:5.1f} at {:.1f}'.format(efrho[i], wave[i])) # doctest: +FLOAT_CMP
118-
406.2 cm at 15.8 um
119-
427.9 cm at 22.3 um
111+
>>> wave = [15.8, 22.3] * u.um
112+
>>> fluxd = [25.75, 59.2] * u.mJy
113+
>>> aper = 11.1 * u.arcsec
114+
>>> eph = Ephem.from_dict({'rh': 4.28 * u.au, 'delta': 3.71 * u.au})
115+
>>> efrho = Efrho.from_fluxd(wave, fluxd, aper, eph)
116+
>>> for i in range(len(wave)):
117+
... print('{:5.1f} at {:.1f}'.format(efrho[i], wave[i])) # doctest: +FLOAT_CMP
118+
406.2 cm at 15.8 um
119+
427.9 cm at 22.3 um
120120

121121
Compare to 397.0 cm and 424.6 cm listed in Kelley et al. (2013).
122122

@@ -130,67 +130,67 @@ Estimate the *Afρ* of comet C/2012 S1 (ISON) based on Pan-STARRS 1 photometry i
130130

131131
.. doctest-requires:: synphot
132132

133-
>>> w = 0.617 * u.um
134-
>>> m = 16.02 * u.ABmag
135-
>>> aper = 5 * u.arcsec
136-
>>> eph = {'rh': 5.234 * u.au, 'delta': 4.275 * u.au, 'phase': 2.6 * u.deg}
137-
>>> afrho = Afrho.from_fluxd(w, m, aper, eph)
138-
>>> print(afrho) # doctest: +FLOAT_CMP
139-
1948.496075629444 cm
140-
>>> m2 = afrho.to_fluxd(w, aper, eph, unit=u.ABmag) # doctest: +FLOAT_CMP
141-
>>> print(m2)
142-
16.02 mag(AB)
133+
>>> w = 0.617 * u.um
134+
>>> m = 16.02 * u.ABmag
135+
>>> aper = 5 * u.arcsec
136+
>>> eph = {'rh': 5.234 * u.au, 'delta': 4.275 * u.au, 'phase': 2.6 * u.deg}
137+
>>> afrho = Afrho.from_fluxd(w, m, aper, eph)
138+
>>> print(afrho) # doctest: +FLOAT_CMP
139+
1948.496075629444 cm
140+
>>> m2 = afrho.to_fluxd(w, aper, eph, unit=u.ABmag) # doctest: +FLOAT_CMP
141+
>>> print(m2)
142+
16.02 mag(AB)
143143

144144

145145
Phase angles and functions
146146
^^^^^^^^^^^^^^^^^^^^^^^^^^
147147

148148
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:
149149

150-
>>> afrho = Afrho(6029.9 * u.cm)
151-
>>> print(afrho.to_phase(0 * u.deg, 3.3 * u.deg)) # doctest: +FLOAT_CMP
152-
6886.825981017757 cm
150+
>>> afrho = Afrho(6029.9 * u.cm)
151+
>>> print(afrho.to_phase(0 * u.deg, 3.3 * u.deg)) # doctest: +FLOAT_CMP
152+
6886.825981017757 cm
153153

154154
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:
155155

156-
>>> Phi = lambda phase: 10**(-0.016 / u.deg * phase.to('deg'))
157-
>>> print(afrho.to_phase(0 * u.deg, 3.3 * u.deg, Phi=Phi)) # doctest: +FLOAT_CMP
158-
6809.419810008357 cm
156+
>>> Phi = lambda phase: 10**(-0.016 / u.deg * phase.to('deg'))
157+
>>> print(afrho.to_phase(0 * u.deg, 3.3 * u.deg, Phi=Phi)) # doctest: +FLOAT_CMP
158+
6809.419810008357 cm
159159

160160
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:
161161

162-
>>> flam = 10**-13.99 * u.Unit('erg/(s cm2 AA)')
163-
>>> aper = 27200 * u.km
164-
>>> eph = Ephem.from_dict({
165-
... 'rh': 4.785 * u.au,
166-
... 'delta': 3.822 * u.au,
167-
... 'phase': 3.3 * u.deg
168-
... })
169-
>>>
170-
>>> afrho = Afrho.from_fluxd('λ5240', flam, aper, eph, phasecor=True)
171-
>>> print(afrho) # doctest: +FLOAT_CMP
172-
6886.828824340642 cm
162+
>>> flam = 10**-13.99 * u.Unit('erg/(s cm2 AA)')
163+
>>> aper = 27200 * u.km
164+
>>> eph = Ephem.from_dict({
165+
... 'rh': 4.785 * u.au,
166+
... 'delta': 3.822 * u.au,
167+
... 'phase': 3.3 * u.deg
168+
... })
169+
>>>
170+
>>> afrho = Afrho.from_fluxd('λ5240', flam, aper, eph, phasecor=True)
171+
>>> print(afrho) # doctest: +FLOAT_CMP
172+
6886.828824340642 cm
173173

174174

175175
Apertures
176176
^^^^^^^^^
177177

178178
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.
179179

180-
>>> from sbpy.activity import CircularAperture, AnnularAperture, RectangularAperture, GaussianAperture
181-
>>> apertures = (
182-
... ( '10" radius circle', CircularAperture(10 * u.arcsec)),
183-
... ( '5"–10" annulus', AnnularAperture([5, 10] * u.arcsec)),
184-
... ( '2"x10" slit', RectangularAperture([2, 10] * u.arcsec)),
185-
... ('σ=5" Gaussian beam', GaussianAperture(5 * u.arcsec))
186-
... )
187-
>>> for name, aper in apertures:
188-
... afrho = Afrho.from_fluxd('λ5240', flam, aper, eph)
189-
... print('{:18s} = {:5.0f}'.format(name, afrho)) # doctest: +FLOAT_CMP
180+
>>> from sbpy.activity import CircularAperture, AnnularAperture, RectangularAperture, GaussianAperture
181+
>>> apertures = (
182+
... ( '10" radius circle', CircularAperture(10 * u.arcsec)),
183+
... ( '5"–10" annulus', AnnularAperture([5, 10] * u.arcsec)),
184+
... ( '2"x10" slit', RectangularAperture([2, 10] * u.arcsec)),
185+
... ('σ=5" Gaussian beam', GaussianAperture(5 * u.arcsec))
186+
... )
187+
>>> for name, aper in apertures:
188+
... afrho = Afrho.from_fluxd('λ5240', flam, aper, eph)
189+
... print('{:18s} = {:5.0f}'.format(name, afrho)) # doctest: +FLOAT_CMP
190190
10" radius circle = 5917 cm
191191
5"–10" annulus = 11834 cm
192192
2"x10" slit = 28114 cm
193-
σ=5" Gaussian beam = 9442 cm
193+
σ=5" Gaussian beam = 9442 cm
194194

195195

196196
Reference/API

0 commit comments

Comments
 (0)