-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculating apparent magnitude for comets and minor planets #416
Comments
Thanks for providing this sample code! I will probably not have time to look today, but likely will have time to try it out tomorrow and see about the difference in results between this code and the other library. |
I contact Elwood Downey of XEphem fame and described the issue of differences between values for apparent magnitude of comets. His response:
So maybe my implementation is flawed from the outset...might have to go back to looking for the latest model(s)! |
@Bernmeister — Looking at this with fresh eyes after a few months, here’s my guess:
|
@brandon-rhodes Very confused now...I looked at
Also I checked the MPC website and all I could find in regards to format for comets was here which is also present in Yes, might drop the MPC a note to dig a little deeper... |
Did a debug of the test code above. In the function If I inspect the comet/body I see that _g = 11.0, _k = 6.0 and for _G and _H:
Still digging and more confused! |
Those were simply my own guesses, which I am now suspecting were, alas, incorrect.
What in that text suggests HG? I don't myself see any mention of HG.
Could you elaborate on the source of confusion? Thanks to Elwood’s excellent data file design, the data file explicitly declares that the magnitude parameters are "g/k" parameters. Look for the little letter "g" right before the 11 and 6:
The data format is documented here, including the fact that the http://www.clearskyinstitute.com/xephem/help/xephem.html#mozTocId564354 I think the only problem here is that |
@brandon-rhodes Think I've nailed it... I currently use the following data files from the MPC within PyEphem (one for comets and four for various minor planets):
Ditto for Skyfield:
For PyEphem, in section 7.1.2.2 there is Field 12 (for when Field 2 is 'e'). This field either starts with 'g' or 'H' representing the model to be used. If we take In As for the minor planet data files, things check out, so no issues there. I have modified the test code to now account for misunderstanding that comet data for Skyfield is in H, G format, whereas it should have been g, k. Code is below...
|
I am glad we are now in agreement — and that your magnitude predictions come out correctly when the data file is interpreted as containing g/k parameters. I have just landed a commit (see the link right above this comment) to rename those two columns, so those should change with the next release of Skyfield (which will probably come within the next two weeks). I am trying to think of a way to also support code using the old names but I'm not sure there are many good options, and hopefully the columns are not widely used since they are not yet documented. But if I think of a good way to support legacy code, I'll follow up with a further commit. |
As a result of lots of testing and revisiting, partly initiated by my discussion, I contacted the MPC to clarify the magnitude parameters for comets and minor planets:
MPC's response:
For minor planets, the For comets, there is a match for I have gone down a rabbit hole (several actually) in calculating apparent magnitude for comets / minor planets, using both In short, @brandon-rhodes , the fields you have defined for comets might need to be looked at (is it |
@Bernmeister
The g an k parameters in the MPC files are usually way off and the predictions out of those parameters are not the best. You can also download the MPC file (in 1-line or ephem format) from cobs.si, but i would need to check if the g and k parameters in the output file are beeing substituted for the ones calculated by cobs. Clear skies |
(have edited this ticket to enhance the test program, update results and give a better explanation)
I have created a test program (see the end) to display the magnitude for a comet / minor planet both in PyEphem and Skyfield. Magnitude can be either absolute or apparent. I would like the apparent magnitude as, I believe, that is what one uses to determine whether an object is within viewing distance.
Running the test program yields:
PyEphem uses different data formats for comets versus minor planets. Looking at each of the data formats, it appears the gk model is used for comets, whereas the HG model is used for minor planets. Both models are described here. I have have taken the formulae specified and put together two functions, one for each model (see test code below). Using Skyfield to load comet / minor planet data and compute their position, I then use my two functions to compute apparent magnitude. Using PyEphem, each object loaded, computed and the magnitude determined, but I also calculate my own absolute magnitude using the data.
Looking at the results:
For PyEphem for the comet 88P/Howell, the magnitude from PyEphem is 14.89 whereas what I have calculated (gk model) is 14.89285058374846. Suggest we have apparent magnitude and the values match.
For Skyfield for the comet 88P/Howell, the absolute magnitude is present in the data file (11.0). What I have calculated (HG model) is 11.987619922504665 which "feels right" as the comet is only a little more than 1AU away. Unfortunately this flies in the face of the PyEphem result! Not sure if this is a discrepancy between models, the data, my coding or what...
For PyEphem and Skyfield for the minor planet Ceres, whereas they use different data formats, each format contains the absolute magnitude 3.34. I suspect PyEphem uses the HG model (as does my Skyfield test) because both yield the same apparent magnitude of 8.97. Same formulae and same data values unsurprisingly yields same result...just cannot confirm the correctness!
In short, there is a discrepancy in the apparent magnitude for the comet between PyEphem and Skyfield, but the numbers match exactly (as expected) for the minor planet apparent magnitude between PyEphem and Skyfield.
Would like some feedback please if the calculation and logic is sound and I am more than happy for the code to be reused if anyone finds it useful.
The test program, adjust for the current date and ensure you obtain the latest data for the comet and minor planet. See the comments in the code.
The text was updated successfully, but these errors were encountered: