Merge lp:~alexwolf/stellarium/apparent-magnitude-algorithm into lp:stellarium
- apparent-magnitude-algorithm
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 7113 |
Proposed branch: | lp:~alexwolf/stellarium/apparent-magnitude-algorithm |
Merge into: | lp:stellarium |
Diff against target: |
411 lines (+196/-104) 4 files modified
src/core/modules/Planet.cpp (+144/-100) src/core/modules/Planet.hpp (+19/-4) src/core/modules/SolarSystem.cpp (+15/-0) src/core/modules/SolarSystem.hpp (+18/-0) |
To merge this branch: | bzr merge lp:~alexwolf/stellarium/apparent-magnitude-algorithm |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
gzotti | Approve | ||
Fabien Chéreau | Pending | ||
Stellarium | Pending | ||
Review via email: mp+240359@code.launchpad.net |
Commit message
Description of the change
This branch extends customization for computation of apparent magnitudes.
I introduced the new option in config.ini "astro/
Possible values for it:
* Planesas (algorithm provided by Pere Planesas (Observatorio Astronomico Nacional))
* Mueller (G. Mueller, based on visual observations 1877-91. [Expl.Suppl.1961])
* Harris (Astronomical Almanac 1984 and later. These give V (instrumental) magnitudes)
I activated Harris's algorithm by default because users asks about "wrong magnitudes for planets", plus all modern astronomical almanacs and websites like JPL's HORIZONS and IMCCE uses this algorithm by default.
I don't added new option to GUI and I think it's shouldn't be added because GUI of the Stellarium are bloated already and this option is proposed for advanced users, who can yourself edit config.ini and know what they are doing.
Alexander Wolf (alexwolf) wrote : | # |
> In principle the idea is very good, given that historical research from early
> 20th century was based on Mueller, and many people nowadays seem to prefer
> comparing instrumental magnitudes. I'd lke to know Planesa's original sources,
> was that some original contribution to Stellarium? (Fabien?)
Sorry, I don't have Planesas original sources (this algorithm was in the code and I just uncommented it).
> However, currently it seems to me this is a property of each planet, which
> seems confusing.
Yes, but I don't know how to avoid crash without applied of this property for all planets.
> I assume users will want a global algorithm setting for all planets.
Huh? It's problematic, because we don't have empirical algorithms for each other planets. Or I just wrongly understood you?
> It should either go into SolarSystem or be a static property of the
> Planet class.
Are you mean the line 121 in Planet.cpp?
> There could be a selector combo in the Config/Information panel:
> Planesas (Stellarium original)
> Mueller (visual mag, [Expl.Suppl. 1961])
> Harris (V mag [Astron. Almanach 1984])
>
> with details in the README. But I don't insist on that.
I'm agree with proposal for README (who read it - maybe we should add it into Help?). But I disagree with proposal for GUI because this feature in really required for little group of the advanced peoples, who make research in archaeoastronomy (or history of astronomy). I hope those peoples can change settings without GUI and we can use the simple GUI yet.
gzotti (georg-zotti) wrote : | # |
> Planesas
I think Fabien may know more on this history. Private communication on known sources (which?), original work, or where is this from?
> Are you mean the line 121 in Planet.cpp?
Ah sorry, I had overlooked this. Yes, then it's fine for me.
At least the wiki manual must be updated to notify users of the possibility to change values, and of possible values for this setting.
- 7113. By Alexander Wolf
-
a tiny fixation
Preview Diff
1 | === modified file 'src/core/modules/Planet.cpp' |
2 | --- src/core/modules/Planet.cpp 2014-10-27 16:19:19 +0000 |
3 | +++ src/core/modules/Planet.cpp 2014-11-01 17:59:05 +0000 |
4 | @@ -55,6 +55,9 @@ |
5 | Planet::RingPlanetShaderVars Planet::ringPlanetShaderVars; |
6 | QOpenGLShaderProgram* Planet::moonShaderProgram=NULL; |
7 | Planet::MoonShaderVars Planet::moonShaderVars; |
8 | + |
9 | +QMap<Planet::PlanetType, QString> Planet::pTypeMap; |
10 | +QMap<Planet::ApparentMagnitudeAlgorithm, QString> Planet::vMagAlgorithmMap; |
11 | |
12 | Planet::Planet(const QString& englishName, |
13 | int flagLighting, |
14 | @@ -101,9 +104,10 @@ |
15 | |
16 | // Initialize pType with the key found in pTypeMap, or mark planet type as undefined. |
17 | // The latter condition should obviously never happen. |
18 | - pType=pTypeMap.key(pTypeStr, Planet::isUNDEFINED); |
19 | + pType = pTypeMap.key(pTypeStr, Planet::isUNDEFINED); |
20 | + vMagAlgorithm = Planet::UndefinedAlgorithm; |
21 | |
22 | - eclipticPos=Vec3d(0.,0.,0.); |
23 | + eclipticPos = Vec3d(0.,0.,0.); |
24 | rotLocalToParent = Mat4d::identity(); |
25 | texMap = StelApp::getInstance().getTextureManager().createTextureThread(StelFileMgr::getInstallationDir()+"/textures/"+texMapName, StelTexture::StelTextureParams(true, GL_LINEAR, GL_REPEAT)); |
26 | normalMap = StelApp::getInstance().getTextureManager().createTextureThread(StelFileMgr::getInstallationDir()+"/textures/"+normalMapName, StelTexture::StelTextureParams(true, GL_LINEAR, GL_REPEAT)); |
27 | @@ -116,8 +120,6 @@ |
28 | flagLabels = true; |
29 | } |
30 | |
31 | -QMap<Planet::PlanetType, QString> Planet::pTypeMap; |
32 | - |
33 | // called in SolarSystem::init() before first planet is created. Loads pTypeMap. |
34 | void Planet::init() |
35 | { |
36 | @@ -133,7 +135,17 @@ |
37 | pTypeMap.insert(Planet::isAsteroid, "asteroid"); |
38 | pTypeMap.insert(Planet::isPlutoid, "plutoid"); |
39 | pTypeMap.insert(Planet::isComet, "comet"); |
40 | - pTypeMap.insert(Planet::isUNDEFINED, "UNDEFINED"); // something must be broken before we ever see this! |
41 | + pTypeMap.insert(Planet::isUNDEFINED,"UNDEFINED"); // something must be broken before we ever see this! |
42 | + |
43 | + if (vMagAlgorithmMap.count() > 0) |
44 | + { |
45 | + qDebug() << "Planet::init(): Non-empty static map. This is a programming error, but we can fix that."; |
46 | + vMagAlgorithmMap.clear(); |
47 | + } |
48 | + vMagAlgorithmMap.insert(Planet::Planesas, "planesas"); |
49 | + vMagAlgorithmMap.insert(Planet::Mueller, "mueller"); |
50 | + vMagAlgorithmMap.insert(Planet::Harris, "harris"); |
51 | + vMagAlgorithmMap.insert(Planet::UndefinedAlgorithm, ""); |
52 | } |
53 | |
54 | Planet::~Planet() |
55 | @@ -760,108 +772,135 @@ |
56 | { |
57 | const double phaseDeg=phase*180./M_PI; |
58 | const double d = 5. * log10(sqrt(observerPlanetRq*planetRq)); |
59 | - //double f1 = phaseDeg/100.; |
60 | |
61 | - /* |
62 | - // Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional) |
63 | - if (englishName=="Mercury") |
64 | - { |
65 | - if ( phaseDeg > 150. ) f1 = 1.5; |
66 | - return -0.36 + d + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1; |
67 | - } |
68 | - if (englishName=="Venus") |
69 | - return -4.29 + d + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1; |
70 | - if (englishName=="Mars") |
71 | - return -1.52 + d + 0.016*phaseDeg; |
72 | - if (englishName=="Jupiter") |
73 | - return -9.25 + d + 0.005*phaseDeg; |
74 | - if (englishName=="Saturn") |
75 | - { |
76 | - // TODO re-add rings computation |
77 | - // double rings = -2.6*sinx + 1.25*sinx*sinx; |
78 | - return -8.88 + d + 0.044*phaseDeg;// + rings; |
79 | - } |
80 | - if (englishName=="Uranus") |
81 | - return -7.19 + d + 0.0028*phaseDeg; |
82 | - if (englishName=="Neptune") |
83 | - return -6.87 + d; |
84 | - if (englishName=="Pluto") |
85 | - return -1.01 + d + 0.041*phaseDeg; |
86 | - */ |
87 | // GZ: I prefer the values given by Meeus, Astronomical Algorithms (1992). |
88 | // There are two solutions: |
89 | // (1) G. Mueller, based on visual observations 1877-91. [Expl.Suppl.1961] |
90 | // (2) Astronomical Almanac 1984 and later. These give V (instrumental) magnitudes. |
91 | // The structure is almost identical, just the numbers are different! |
92 | // I activate (1) for now, because we want to simulate the eye's impression. (Esp. Venus!) |
93 | - // (1) |
94 | - if (englishName=="Mercury") |
95 | - { |
96 | - double ph50=phaseDeg-50.0; |
97 | - return 1.16 + d + 0.02838*ph50 + 0.0001023*ph50*ph50; |
98 | - } |
99 | - if (englishName=="Venus") |
100 | - return -4.0 + d + 0.01322*phaseDeg + 0.0000004247*phaseDeg*phaseDeg*phaseDeg; |
101 | - if (englishName=="Mars") |
102 | - return -1.3 + d + 0.01486*phaseDeg; |
103 | - if (englishName=="Jupiter") |
104 | - return -8.93 + d; |
105 | - if (englishName=="Saturn") |
106 | - { |
107 | - // add rings computation |
108 | - // GZ: implemented from Meeus, Astr.Alg.1992 |
109 | - const double jd=core->getJDay(); |
110 | - const double T=(jd-2451545.0)/36525.0; |
111 | - const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0; |
112 | - const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0; |
113 | - SolarSystem *ssystem=GETSTELMODULE(SolarSystem); |
114 | - const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos(); |
115 | - double lambda=atan2(saturnEarth[1], saturnEarth[0]); |
116 | - double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1])); |
117 | - const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta); |
118 | - double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus. |
119 | - return -8.68 + d + 0.044*phaseDeg + rings; |
120 | - } |
121 | - if (englishName=="Uranus") |
122 | - return -6.85 + d; |
123 | - if (englishName=="Neptune") |
124 | - return -7.05 + d; |
125 | - if (englishName=="Pluto") |
126 | - return -1.0 + d; |
127 | - /* |
128 | - // (2) |
129 | - if (englishName=="Mercury") |
130 | - return 0.42 + d + .038*phaseDeg - 0.000273*phaseDeg*phaseDeg + 0.000002*phaseDeg*phaseDeg*phaseDeg; |
131 | - if (englishName=="Venus") |
132 | - return -4.40 + d + 0.0009*phaseDeg + 0.000239*phaseDeg*phaseDeg - 0.00000065*phaseDeg*phaseDeg*phaseDeg; |
133 | - if (englishName=="Mars") |
134 | - return -1.52 + d + 0.016*phaseDeg; |
135 | - if (englishName=="Jupiter") |
136 | - return -9.40 + d + 0.005*phaseDeg; |
137 | - if (englishName=="Saturn") |
138 | - { |
139 | - // add rings computation |
140 | - // GZ: implemented from Meeus, Astr.Alg.1992 |
141 | - const double jd=core->getJDay(); |
142 | - const double T=(jd-2451545.0)/36525.0; |
143 | - const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0; |
144 | - const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0; |
145 | - static SolarSystem *ssystem=GETSTELMODULE(SolarSystem); |
146 | - const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos(); |
147 | - double lambda=atan2(saturnEarth[1], saturnEarth[0]); |
148 | - double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1])); |
149 | - const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta); |
150 | - double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus. |
151 | - return -8.88 + d + 0.044*phaseDeg + rings; |
152 | - } |
153 | - if (englishName=="Uranus") |
154 | - return -7.19f + d; |
155 | - if (englishName=="Neptune") |
156 | - return -6.87f + d; |
157 | - if (englishName=="Pluto") |
158 | - return -1.00f + d; |
159 | - */ |
160 | - // TODO: decide which set of formulae is best? |
161 | + // AW: (2) activated by default |
162 | + |
163 | + switch (core->getCurrentPlanet()->getApparentMagnitudeAlgorithm()) |
164 | + { |
165 | + case Planesas: |
166 | + { |
167 | + // Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional) |
168 | + double f1 = phaseDeg/100.; |
169 | + |
170 | + if (englishName=="Mercury") |
171 | + { |
172 | + if ( phaseDeg > 150. ) f1 = 1.5; |
173 | + return -0.36 + d + 3.8*f1 - 2.73*f1*f1 + 2*f1*f1*f1; |
174 | + } |
175 | + if (englishName=="Venus") |
176 | + return -4.29 + d + 0.09*f1 + 2.39*f1*f1 - 0.65*f1*f1*f1; |
177 | + if (englishName=="Mars") |
178 | + return -1.52 + d + 0.016*phaseDeg; |
179 | + if (englishName=="Jupiter") |
180 | + return -9.25 + d + 0.005*phaseDeg; |
181 | + if (englishName=="Saturn") |
182 | + { |
183 | + // add rings computation |
184 | + // implemented from Meeus, Astr.Alg.1992 |
185 | + const double jd=core->getJDay(); |
186 | + const double T=(jd-2451545.0)/36525.0; |
187 | + const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0; |
188 | + const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0; |
189 | + static SolarSystem *ssystem=GETSTELMODULE(SolarSystem); |
190 | + const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos(); |
191 | + double lambda=atan2(saturnEarth[1], saturnEarth[0]); |
192 | + double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1])); |
193 | + const double sinx=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta); |
194 | + double rings = -2.6*sinx + 1.25*sinx*sinx; |
195 | + return -8.88 + d + 0.044*phaseDeg + rings; |
196 | + } |
197 | + if (englishName=="Uranus") |
198 | + return -7.19 + d + 0.0028*phaseDeg; |
199 | + if (englishName=="Neptune") |
200 | + return -6.87 + d; |
201 | + if (englishName=="Pluto") |
202 | + return -1.01 + d + 0.041*phaseDeg; |
203 | + |
204 | + break; |
205 | + } |
206 | + case Mueller: |
207 | + { |
208 | + // (1) |
209 | + if (englishName=="Mercury") |
210 | + { |
211 | + double ph50=phaseDeg-50.0; |
212 | + return 1.16 + d + 0.02838*ph50 + 0.0001023*ph50*ph50; |
213 | + } |
214 | + if (englishName=="Venus") |
215 | + return -4.0 + d + 0.01322*phaseDeg + 0.0000004247*phaseDeg*phaseDeg*phaseDeg; |
216 | + if (englishName=="Mars") |
217 | + return -1.3 + d + 0.01486*phaseDeg; |
218 | + if (englishName=="Jupiter") |
219 | + return -8.93 + d; |
220 | + if (englishName=="Saturn") |
221 | + { |
222 | + // add rings computation |
223 | + // implemented from Meeus, Astr.Alg.1992 |
224 | + const double jd=core->getJDay(); |
225 | + const double T=(jd-2451545.0)/36525.0; |
226 | + const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0; |
227 | + const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0; |
228 | + SolarSystem *ssystem=GETSTELMODULE(SolarSystem); |
229 | + const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos(); |
230 | + double lambda=atan2(saturnEarth[1], saturnEarth[0]); |
231 | + double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1])); |
232 | + const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta); |
233 | + double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus. |
234 | + return -8.68 + d + 0.044*phaseDeg + rings; |
235 | + } |
236 | + if (englishName=="Uranus") |
237 | + return -6.85 + d; |
238 | + if (englishName=="Neptune") |
239 | + return -7.05 + d; |
240 | + if (englishName=="Pluto") |
241 | + return -1.0 + d; |
242 | + |
243 | + break; |
244 | + } |
245 | + case Harris: |
246 | + case UndefinedAlgorithm: // activated by default |
247 | + { |
248 | + // (2) |
249 | + if (englishName=="Mercury") |
250 | + return 0.42 + d + .038*phaseDeg - 0.000273*phaseDeg*phaseDeg + 0.000002*phaseDeg*phaseDeg*phaseDeg; |
251 | + if (englishName=="Venus") |
252 | + return -4.40 + d + 0.0009*phaseDeg + 0.000239*phaseDeg*phaseDeg - 0.00000065*phaseDeg*phaseDeg*phaseDeg; |
253 | + if (englishName=="Mars") |
254 | + return -1.52 + d + 0.016*phaseDeg; |
255 | + if (englishName=="Jupiter") |
256 | + return -9.40 + d + 0.005*phaseDeg; |
257 | + if (englishName=="Saturn") |
258 | + { |
259 | + // add rings computation |
260 | + // implemented from Meeus, Astr.Alg.1992 |
261 | + const double jd=core->getJDay(); |
262 | + const double T=(jd-2451545.0)/36525.0; |
263 | + const double i=((0.000004*T-0.012998)*T+28.075216)*M_PI/180.0; |
264 | + const double Omega=((0.000412*T+1.394681)*T+169.508470)*M_PI/180.0; |
265 | + static SolarSystem *ssystem=GETSTELMODULE(SolarSystem); |
266 | + const Vec3d saturnEarth=getHeliocentricEclipticPos() - ssystem->getEarth()->getHeliocentricEclipticPos(); |
267 | + double lambda=atan2(saturnEarth[1], saturnEarth[0]); |
268 | + double beta=atan2(saturnEarth[2], sqrt(saturnEarth[0]*saturnEarth[0]+saturnEarth[1]*saturnEarth[1])); |
269 | + const double sinB=sin(i)*cos(beta)*sin(lambda-Omega)-cos(i)*sin(beta); |
270 | + double rings = -2.6*fabs(sinB) + 1.25*sinB*sinB; // sinx=sinB, saturnicentric latitude of earth. longish, see Meeus. |
271 | + return -8.88 + d + 0.044*phaseDeg + rings; |
272 | + } |
273 | + if (englishName=="Uranus") |
274 | + return -7.19f + d; |
275 | + if (englishName=="Neptune") |
276 | + return -6.87f + d; |
277 | + if (englishName=="Pluto") |
278 | + return -1.00f + d; |
279 | + |
280 | + break; |
281 | + } |
282 | + } |
283 | } |
284 | |
285 | // This formula seems to give wrong results |
286 | @@ -1707,3 +1746,8 @@ |
287 | labelsFader.update(deltaTime); |
288 | orbitFader.update(deltaTime); |
289 | } |
290 | + |
291 | +void Planet::setApparentMagnitudeAlgorithm(QString algorithm) |
292 | +{ |
293 | + vMagAlgorithm = vMagAlgorithmMap.key(algorithm.toLower(), Planet::UndefinedAlgorithm); |
294 | +} |
295 | |
296 | === modified file 'src/core/modules/Planet.hpp' |
297 | --- src/core/modules/Planet.hpp 2014-08-31 10:34:41 +0000 |
298 | +++ src/core/modules/Planet.hpp 2014-11-01 17:59:05 +0000 |
299 | @@ -76,6 +76,7 @@ |
300 | friend class SolarSystem; |
301 | |
302 | Q_ENUMS(PlanetType) |
303 | + Q_ENUMS(ApparentMagnitudeAlgorithm) |
304 | //! numeric typecodes for the type descriptions in ssystem.ini |
305 | // GZ: Until 0.13 QStrings were used for types. |
306 | // GZ: Enums are slightly faster than string comparisons in time-critical comparisons. |
307 | @@ -91,6 +92,14 @@ |
308 | isUNDEFINED // ssystem.ini: type=<anything else> |
309 | }; |
310 | |
311 | + enum ApparentMagnitudeAlgorithm |
312 | + { |
313 | + Planesas, // Algorithm provided by Pere Planesas (Observatorio Astronomico Nacional) |
314 | + Mueller, // G. Mueller, based on visual observations 1877-91. [Expl.Suppl.1961] |
315 | + Harris, // Astronomical Almanac 1984 and later. These give V (instrumental) magnitudes (D.L. Harris) |
316 | + UndefinedAlgorithm |
317 | + }; |
318 | + |
319 | Planet(const QString& englishName, |
320 | int flagLighting, |
321 | double radius, |
322 | @@ -170,6 +179,10 @@ |
323 | const QString getPlanetTypeString() const {return pTypeMap.value(pType);} |
324 | PlanetType getPlanetType() const {return pType;} |
325 | |
326 | + ApparentMagnitudeAlgorithm getApparentMagnitudeAlgorithm() const { return vMagAlgorithm; } |
327 | + const QString getApparentMagnitudeAlgorithmString() const { return vMagAlgorithmMap.value(vMagAlgorithm); } |
328 | + void setApparentMagnitudeAlgorithm(QString algorithm); |
329 | + |
330 | // Compute the z rotation to use from equatorial to geographic coordinates |
331 | double getSiderealTime(double jd) const; |
332 | Mat4d getRotEquatorialToVsop87(void) const; |
333 | @@ -313,13 +326,15 @@ |
334 | bool flagLabels; // Define whether labels should be displayed |
335 | bool hidden; // useful for fake planets used as observation positions - not drawn or labeled |
336 | bool atmosphere; // Does the planet have an atmosphere? |
337 | - bool halo; // Does the planet have a halo? |
338 | - // QString pTypeStr; // Type of body, old version just had a string here. |
339 | - PlanetType pType; // GZ this is now a proper type... |
340 | + bool halo; // Does the planet have a halo? |
341 | + PlanetType pType; // Type of body |
342 | + |
343 | + ApparentMagnitudeAlgorithm vMagAlgorithm; |
344 | |
345 | static Vec3f labelColor; |
346 | static StelTextureSP hintCircleTex; |
347 | - static QMap<PlanetType, QString> pTypeMap; // GZ: maps fast type to english name. |
348 | + static QMap<PlanetType, QString> pTypeMap; // Maps fast type to english name. |
349 | + static QMap<ApparentMagnitudeAlgorithm, QString> vMagAlgorithmMap; |
350 | |
351 | // Shader-related variables |
352 | struct PlanetShaderVars { |
353 | |
354 | === modified file 'src/core/modules/SolarSystem.cpp' |
355 | --- src/core/modules/SolarSystem.cpp 2014-08-31 10:34:41 +0000 |
356 | +++ src/core/modules/SolarSystem.cpp 2014-11-01 17:59:05 +0000 |
357 | @@ -136,6 +136,9 @@ |
358 | setFlagOrbits(conf->value("astro/flag_planets_orbits").toBool()); |
359 | setFlagLightTravelTime(conf->value("astro/flag_light_travel_time", false).toBool()); |
360 | setFlagMarkers(conf->value("astro/flag_planets_markers", true).toBool()); |
361 | + // Set the algorithm from Astronomical Almanac for computation of apparent magnitudes for |
362 | + // planets in case observer on the Earth by default |
363 | + setApparentMagnitudeAlgorithmOnEarth(conf->value("astro/apparent_magnitude_algorithm", "Harris").toString()); |
364 | |
365 | recreateTrails(); |
366 | |
367 | @@ -1520,3 +1523,15 @@ |
368 | // Restore translations |
369 | updateI18n(); |
370 | } |
371 | + |
372 | +// Set the algorithm for computation of apparent magnitudes for planets in case observer on the Earth |
373 | +void SolarSystem::setApparentMagnitudeAlgorithmOnEarth(QString algorithm) |
374 | +{ |
375 | + getEarth()->setApparentMagnitudeAlgorithm(algorithm); |
376 | +} |
377 | + |
378 | +// Get the algorithm used for computation of apparent magnitudes for planets in case observer on the Earth |
379 | +QString SolarSystem::getApparentMagnitudeAlgorithmOnEarth() const |
380 | +{ |
381 | + return getEarth()->getApparentMagnitudeAlgorithmString(); |
382 | +} |
383 | |
384 | === modified file 'src/core/modules/SolarSystem.hpp' |
385 | --- src/core/modules/SolarSystem.hpp 2014-08-30 16:58:25 +0000 |
386 | +++ src/core/modules/SolarSystem.hpp 2014-11-01 17:59:05 +0000 |
387 | @@ -261,6 +261,24 @@ |
388 | //! @return a phase |
389 | float getPhaseForPlanet(QString planetName) const; |
390 | |
391 | + //! Set the algorithm for computation of apparent magnitudes for planets in case observer on the Earth. |
392 | + //! Possible values: |
393 | + //! * Planesas (algorithm provided by Pere Planesas (Observatorio Astronomico Nacional)) |
394 | + //! * Mueller (G. Mueller, based on visual observations 1877-91. [Expl.Suppl.1961]) |
395 | + //! * Harris (Astronomical Almanac 1984 and later. These give V (instrumental) magnitudes) |
396 | + //! Details: |
397 | + //! J. Meeus "Astronomical Algorithms" (2nd ed., with corrections as of August 10, 2009) p.283-286. |
398 | + //! O. Montenbruck, T. Pfleger "Astronomy on the Personal Computer" (4th ed.) p.143-145. |
399 | + //! Daniel L. Harris "Photometry and Colorimetry of Planets and Satellites" http://adsabs.harvard.edu/abs/1961plsa.book..272H |
400 | + //! Hint: Default option in config.ini: astro/apparent_magnitude_algorithm = Harris |
401 | + //! @param algorithm the case in-sensitive algorithm name |
402 | + //! @note: The structure of algorithms is almost identical, just the numbers are different! You should activate |
403 | + //! Mueller's algorithm for simulate the eye's impression. (Esp. Venus!) |
404 | + void setApparentMagnitudeAlgorithmOnEarth(QString algorithm); |
405 | + |
406 | + //! Get the algorithm used for computation of apparent magnitudes for planets in case observer on the Earth |
407 | + QString getApparentMagnitudeAlgorithmOnEarth() const; |
408 | + |
409 | public: |
410 | /////////////////////////////////////////////////////////////////////////// |
411 | // Other public methods |
In principle the idea is very good, given that historical research from early 20th century was based on Mueller, and many people nowadays seem to prefer comparing instrumental magnitudes. I'd lke to know Planesa's original sources, was that some original contribution to Stellarium? (Fabien?)
However, currently it seems to me this is a property of each planet, which seems confusing. I assume users will want a global algorithm setting for all planets. It should either go into SolarSystem or be a static property of the Planet class. There is also a small typo, see below (lowercasing - ah, it's auto-corrected ...).
There could be a selector combo in the Config/Information panel:
Planesas (Stellarium original)
Mueller (visual mag, [Expl.Suppl. 1961])
Harris (V mag [Astron. Almanach 1984])
with details in the README. But I don't insist on that.