|
1 | | -# Licensed under a 3-clause BSD style license - see LICENSE.rst |
| 1 | +# # Licensed under a 3-clause BSD style license - see LICENSE.rst |
2 | 2 |
|
3 | | -import numpy as np |
| 3 | +# from abc import ABC, abstractmethod |
4 | 4 |
|
5 | | -import astropy.units as u |
| 5 | +# import numpy as np |
6 | 6 |
|
7 | | -from .surface import Surface |
8 | | -from .lambertian import LambertianSurface |
9 | | -from ..calib import Sun |
10 | | -from ..units.typing import SpectralQuantity, SpectralFluxDensityQuantity, UnitLike |
| 7 | +# import astropy.units as u |
11 | 8 |
|
| 9 | +# from .surface import Surface |
| 10 | +# from .lambertian import LambertianSurface |
| 11 | +# from ..calib import Sun |
| 12 | +# from ..units.typing import SpectralQuantity, SpectralFluxDensityQuantity, UnitLike |
12 | 13 |
|
13 | | -class ScatteredSunlight(Surface): |
14 | | - """Abstract base class to observe sunlight scattered by a surface.""" |
15 | 14 |
|
16 | | - @u.quantity_input |
17 | | - def scattered_sunlight( |
18 | | - self, |
19 | | - wave_freq: SpectralQuantity, |
20 | | - rh: u.physical.length, |
21 | | - i: u.physical.angle, |
22 | | - e: u.physical.angle, |
23 | | - phi: u.physical.angle, |
24 | | - unit: UnitLike = "W/(m2 sr um)", |
25 | | - ) -> u.Quantity: |
26 | | - """Radiance from sunlight scattered by a surface. |
| 15 | +# class ScatteredLight(ABC): |
| 16 | +# """Abstract base class to observe light scattered by a surface.""" |
27 | 17 |
|
| 18 | +# @u.quantity_input |
| 19 | +# def scattered_light( |
| 20 | +# self, |
| 21 | +# wave_freq: SpectralQuantity, |
| 22 | +# i: u.physical.angle, |
| 23 | +# e: u.physical.angle, |
| 24 | +# phi: u.physical.angle, |
| 25 | +# unit: UnitLike = "W/(m2 sr um)", |
| 26 | +# ) -> u.Quantity: |
| 27 | +# """Radiance from light scattered by a surface. |
28 | 28 |
|
29 | | - Parameters |
30 | | - ---------- |
31 | | - wave_freq : `astropy.units.Quantity` |
32 | | - Wavelength or frequency at which to evaluate the Sun. Arrays are |
33 | | - evaluated with `sbpy.calib.core.Sun.observe()`. |
34 | 29 |
|
35 | | - rh : `~astropy.units.Quantity` |
36 | | - Heliocentric distance. |
| 30 | +# Parameters |
| 31 | +# ---------- |
37 | 32 |
|
38 | | - i : `~astropy.units.Quantity` |
39 | | - Angle from normal of incident light. |
| 33 | +# wave_freq : `astropy.units.Quantity` |
| 34 | +# Wavelength or frequency at which to evaluate the light source. |
40 | 35 |
|
41 | | - e : `~astropy.units.Quantity` |
42 | | - Angle from normal of emitted light. |
| 36 | +# i : `~astropy.units.Quantity` |
| 37 | +# Angle from normal of incident light. |
43 | 38 |
|
44 | | - phi : `~astropy.units.Quantity` |
45 | | - Source-target-observer (phase) angle. |
| 39 | +# e : `~astropy.units.Quantity` |
| 40 | +# Angle from normal of emitted light. |
46 | 41 |
|
47 | | - unit : `~astropy.units.Unit`, optional |
48 | | - Unit of the return value. |
| 42 | +# phi : `~astropy.units.Quantity` |
| 43 | +# Source-target-observer (phase) angle. |
49 | 44 |
|
| 45 | +# unit : `~astropy.units.Unit`, optional |
| 46 | +# Unit of the return value. |
50 | 47 |
|
51 | | - Returns |
52 | | - ------- |
53 | | - radiance : `~astropy.units.Quantity` |
54 | | - Observed radiance. |
55 | 48 |
|
56 | | - """ |
| 49 | +# Returns |
| 50 | +# ------- |
57 | 51 |
|
58 | | - sun = Sun.from_default() |
59 | | - flux_density_unit = u.Unit(unit) * u.sr |
60 | | - if wave_freq.size == 1: |
61 | | - F_i = sun(wave_freq, unit=flux_density_unit) |
62 | | - else: |
63 | | - F_i = sun.observe(wave_freq, unit=flux_density_unit) |
| 52 | +# radiance : `~astropy.units.Quantity` |
| 53 | +# Observed radiance. |
64 | 54 |
|
65 | | - F_i /= rh.to_value("au") ** 2 |
66 | | - return self.reflectance(F_i, i, e, phi).to(unit) |
| 55 | +# """ |
67 | 56 |
|
68 | | - @u.quantity_input |
69 | | - def scattered_sunlight_from_vectors( |
70 | | - self, |
71 | | - wave_freq: SpectralQuantity, |
72 | | - n: np.ndarray, |
73 | | - rs: u.physical.length, |
74 | | - ro: u.physical.length, |
75 | | - unit: UnitLike = "W/(m2 sr um)", |
76 | | - ) -> u.Quantity: |
77 | | - """Observed sunlight reflected from a surface. |
| 57 | +# @u.quantity_input |
| 58 | +# def scattered_light_from_vectors( |
| 59 | +# self, |
| 60 | +# wave_freq: SpectralQuantity, |
| 61 | +# n: np.ndarray, |
| 62 | +# rs: u.physical.length, |
| 63 | +# ro: u.physical.length, |
| 64 | +# unit: UnitLike = "W/(m2 sr um)", |
| 65 | +# ) -> u.Quantity: |
| 66 | +# """Observed light reflected from a surface. |
78 | 67 |
|
79 | 68 |
|
80 | | - Parameters |
81 | | - ---------- |
82 | | - wave_freq : `astropy.units.Quantity` |
83 | | - Wavelength or frequency at which to evaluate the Sun. Arrays are |
84 | | - evaluated with `sbpy.calib.core.Sun.observe()`. |
| 69 | +# Parameters |
| 70 | +# ---------- |
85 | 71 |
|
86 | | - n : `numpy.ndarray` |
87 | | - Surface normal vector. |
| 72 | +# wave_freq : `astropy.units.Quantity` |
| 73 | +# Wavelength or frequency at which to evaluate the light source. |
88 | 74 |
|
89 | | - rs : `~astropy.units.Quantity` |
90 | | - Radial vector from the surface to the light source. |
| 75 | +# n : `numpy.ndarray` |
| 76 | +# Surface normal vector. |
91 | 77 |
|
92 | | - ro : `~astropy.units.Quantity` |
93 | | - Radial vector from the surface to the observer. |
| 78 | +# rs : `~astropy.units.Quantity` |
| 79 | +# Radial vector from the surface to the light source. |
94 | 80 |
|
95 | | - unit : `~astropy.units.Unit`, optional |
96 | | - Unit of the return value. |
| 81 | +# ro : `~astropy.units.Quantity` |
| 82 | +# Radial vector from the surface to the observer. |
97 | 83 |
|
| 84 | +# unit : `~astropy.units.Unit`, optional |
| 85 | +# Unit of the return value. |
98 | 86 |
|
99 | | - Returns |
100 | | - ------- |
101 | | - radiance : `~astropy.units.Quantity` |
102 | | - Observed radiance. |
103 | 87 |
|
104 | | - """ |
105 | | - rh = np.linalg.norm(rs).to("au") |
106 | | - i, e, phi = self._vectors_to_angles(n, rs, ro) |
107 | | - return self.scattered_sunlight(wave_freq, rh, i, e, phi, unit=unit) |
| 88 | +# Returns |
| 89 | +# ------- |
108 | 90 |
|
109 | | - __doc__ += Surface.__doc__[Surface.__doc__.index("\n") + 1 :] # noqa: E203 |
| 91 | +# radiance : `~astropy.units.Quantity` |
| 92 | +# Observed radiance. |
110 | 93 |
|
| 94 | +# """ |
111 | 95 |
|
112 | | -class LambertianSurfaceScatteredSunlight(LambertianSurface, ScatteredSunlight): |
113 | | - """Sunlight scattered from a Lambertian surface. |
114 | 96 |
|
115 | | - The surface is assumed to be illuminated by the Sun. |
| 97 | +# class ScatteredSunlight(ScatteredLight): |
| 98 | +# """Observe sunlight scattered by a surface.""" |
116 | 99 |
|
117 | | - """ |
| 100 | +# @u.quantity_input |
| 101 | +# def scattered_light( |
| 102 | +# self, |
| 103 | +# wave_freq: SpectralQuantity, |
| 104 | +# i: u.physical.angle, |
| 105 | +# e: u.physical.angle, |
| 106 | +# phi: u.physical.angle, |
| 107 | +# rh: u.physical.length = 1 * u.au, |
| 108 | +# unit: UnitLike = "W/(m2 sr um)", |
| 109 | +# ) -> u.Quantity: |
| 110 | +# """Radiance from sunlight scattered by a surface. |
118 | 111 |
|
119 | | - __doc__ += Surface.__doc__[Surface.__doc__.index("\n") :] # noqa: E203 |
| 112 | + |
| 113 | +# Parameters |
| 114 | +# ---------- |
| 115 | + |
| 116 | +# wave_freq : `astropy.units.Quantity` |
| 117 | +# Wavelength or frequency at which to evaluate the Sun. Arrays are |
| 118 | +# evaluated with `sbpy.calib.core.Sun.observe()`. |
| 119 | + |
| 120 | +# i : `~astropy.units.Quantity` |
| 121 | +# Angle from normal of incident light. |
| 122 | + |
| 123 | +# e : `~astropy.units.Quantity` |
| 124 | +# Angle from normal of emitted light. |
| 125 | + |
| 126 | +# phi : `~astropy.units.Quantity` |
| 127 | +# Source-target-observer (phase) angle. |
| 128 | + |
| 129 | +# rh : `~astropy.units.Quantity` |
| 130 | +# Heliocentric distance, default = 1 au. |
| 131 | + |
| 132 | +# unit : `~astropy.units.Unit`, optional |
| 133 | +# Unit of the return value. |
| 134 | + |
| 135 | + |
| 136 | +# Returns |
| 137 | +# ------- |
| 138 | +# radiance : `~astropy.units.Quantity` |
| 139 | +# Observed radiance. |
| 140 | + |
| 141 | +# """ |
| 142 | + |
| 143 | +# sun = Sun.from_default() |
| 144 | +# flux_density_unit = u.Unit(unit) * u.sr |
| 145 | +# if wave_freq.size == 1: |
| 146 | +# F_i = sun(wave_freq, unit=flux_density_unit) |
| 147 | +# else: |
| 148 | +# F_i = sun.observe(wave_freq, unit=flux_density_unit) |
| 149 | + |
| 150 | +# F_i /= rh.to_value("au") ** 2 |
| 151 | +# return self.reflectance(F_i, i, e, phi).to(unit) |
| 152 | + |
| 153 | +# @u.quantity_input |
| 154 | +# def scattered_light_from_vectors( |
| 155 | +# self, |
| 156 | +# wave_freq: SpectralQuantity, |
| 157 | +# n: np.ndarray, |
| 158 | +# rs: u.physical.length, |
| 159 | +# ro: u.physical.length, |
| 160 | +# unit: UnitLike = "W/(m2 sr um)", |
| 161 | +# ) -> u.Quantity: |
| 162 | +# """Observed sunlight reflected from a surface. |
| 163 | + |
| 164 | + |
| 165 | +# Parameters |
| 166 | +# ---------- |
| 167 | + |
| 168 | +# wave_freq : `astropy.units.Quantity` |
| 169 | +# Wavelength or frequency at which to evaluate the Sun. Arrays are |
| 170 | +# evaluated with `sbpy.calib.core.Sun.observe()`. |
| 171 | + |
| 172 | +# n : `numpy.ndarray` |
| 173 | +# Surface normal vector. |
| 174 | + |
| 175 | +# rs : `~astropy.units.Quantity` |
| 176 | +# Radial vector from the surface to the light source. |
| 177 | + |
| 178 | +# ro : `~astropy.units.Quantity` |
| 179 | +# Radial vector from the surface to the observer. |
| 180 | + |
| 181 | +# unit : `~astropy.units.Unit`, optional |
| 182 | +# Unit of the return value. |
| 183 | + |
| 184 | + |
| 185 | +# Returns |
| 186 | +# ------- |
| 187 | + |
| 188 | +# radiance : `~astropy.units.Quantity` |
| 189 | +# Observed radiance. |
| 190 | + |
| 191 | +# """ |
| 192 | + |
| 193 | +# rh = np.linalg.norm(rs).to("au") |
| 194 | +# i, e, phi = self._vectors_to_angles(n, rs, ro) |
| 195 | +# return self.scattered_sunlight(wave_freq, i, e, phi, rh=rh, unit=unit) |
| 196 | + |
| 197 | + |
| 198 | +# class LambertianSurfaceScatteredSunlight(LambertianSurface, ScatteredSunlight): |
| 199 | +# """Sunlight scattered from a Lambertian surface.""" |
0 commit comments