Skip Menu |

Preferred bug tracker

Please email the preferred bug tracker to report your issue.

This queue is for tickets about the Astro-satpass CPAN distribution.

Report information
The Basics
Id: 40899
Status: resolved
Priority: 0/
Queue: Astro-satpass

People
Owner: Nobody in particular
Requestors: griscom [...] suitable.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bug in demo Iridium flare script
Date: Thu, 13 Nov 2008 11:47:09 -0500
To: bug-Astro-satpass [...] rt.cpan.org
From: Daniel Griscom <griscom [...] suitable.com>
The Astro::Coord::ECI::TLE documentation includes a demo script to calculate Iridium flares. It has a problem, at least when run right now: it just exits with the error message Error - Sgp4r 1: Mean eccentricity < 0 or > 1, or a < .95 at /Library/Perl/5.8.8/Astro/Coord/ECI/TLE/Set.pm line 430 The error occurs in the first iteration of foreach my $tle (@sats) { push @passes, $tle->pass($loc, $start, $finish); } Investigation showed that the data returned by $st->spaceflight ('-all') includes a group of TLEs for the shuttle, plus a group of TLEs for the ISS. For some reason the shuttle TLEs are giving the algorithm fits. To fix this (currently) I added a shift @sats; right after the data is aggregated into the @sats set objects. This discards the shuttle TLEs, and the ISS TLEs are then successfully used. A better solution would be to enhance the above loop through the @sats array to trap any algorithm errors and continue. Thanks for the code, Dan -- Daniel T. Griscom griscom@suitable.com Suitable Systems http://www.suitable.com/ 1 Centre Street, Suite 204 (781) 665-0053 Wakefield, MA 01880-2400
On Thu Nov 13 11:48:07 2008, griscom@suitable.com wrote: Show quoted text
> The Astro::Coord::ECI::TLE documentation includes a demo script to > calculate Iridium flares. It has a problem, at least when run right > now: it just exits with the error message > > Error - Sgp4r 1: Mean eccentricity < 0 or > 1, or a < .95 at > /Library/Perl/5.8.8/Astro/Coord/ECI/TLE/Set.pm line 430 > > The error occurs in the first iteration of > > foreach my $tle (@sats) { > push @passes, $tle->pass($loc, $start, $finish); > } > > Investigation showed that the data returned by $st->spaceflight > ('-all') includes a group of TLEs for the shuttle, plus a group of > TLEs for the ISS. For some reason the shuttle TLEs are giving the > algorithm fits. >
"Doc, it hurts when I do this." "Then don't DO that." I assume that you're trying to calculate satellite passes rather than iridium flares, title to the contrary notwithstanding. Yes, there are a POT LOAD of modules in this distribution. I have an update in preparation already due to ticket 40113 (another bogus SYNOPSIS -- Astro::Coord::ECI::Moon's example didn't say the latitude and longitude were in radians); I'll just tail-end onto that. I know I have had to solve this problem before, in the satpass script, and under exactly the same circumstances (NASA had the predicted TLEs on line but the shuttle had not yet launched). The idea is that we need to disallow the use of data before its epoch date. The answer _might_ be as simple as inserting $tle->set(backdate => 0); just before the 'push @passes, $tle->pass($loc, $start, $finish);' Without this line I was able to duplicate your error. With it, I was able to get passes for the shuttle next week. The output seems to show it about a minute behind the ISS next Wednesday (Nov 19 2008), but I think it's actually docked, assuming they launch on the 14th. I'll have to run actual data from SpaceTrack once it's available to see if the problem is my code or NASA's data. Both are possible; NASA is the rocket scientists, not me, but the shuttle TLEs are estimated, and I have seen them do some strange things in times past. It would be nice if the backdate attribute would default false, but it's true because that was the behaviour before that attribute was added, and I hate to change default behaviour. I'm working on abandoning Astro-satpass, moving the Astro::Coord::ECI classes into a package of that name, and redoing the satpass script as App::Satpass2. If the latter ever sees the light of day, it may default 'backdate' to false. I regret to say that I will almost certainly NOT have an updated Astro-satpass out before Endeavour launches - but once you've passed the epoch of the first shuttle TLE the problem goes away anyway. There have been a couple under-the hood changes I want to put to bed: getting rid of all uses of UNIVERSAL::isa (as opposed to $object->isa); incorporating Time::y2038 (pretty much done I think), and moving the USGS height query to a separate module (mostly done, but this is probably the critical path).
Subject: Re: [rt.cpan.org #40899] Bug in demo Iridium flare script
Date: Fri, 14 Nov 2008 08:00:20 -0500
To: bug-Astro-satpass [...] rt.cpan.org
From: Daniel Griscom <griscom [...] suitable.com>
At 12:27 AM -0500 11/14/08, Tom Wyant via RT wrote: Show quoted text
><URL: http://rt.cpan.org/Ticket/Display.html?id=40899 > > >On Thu Nov 13 11:48:07 2008, griscom@suitable.com wrote:
>> The Astro::Coord::ECI::TLE documentation includes a demo script to >> calculate Iridium flares. It has a problem, at least when run right >> now: it just exits with the error message >> >> Error - Sgp4r 1: Mean eccentricity < 0 or > 1, or a < .95 at >> /Library/Perl/5.8.8/Astro/Coord/ECI/TLE/Set.pm line 430 >> >> The error occurs in the first iteration of >> >> foreach my $tle (@sats) { >> push @passes, $tle->pass($loc, $start, $finish); >> } >> >> Investigation showed that the data returned by $st->spaceflight >> ('-all') includes a group of TLEs for the shuttle, plus a group of >> TLEs for the ISS. For some reason the shuttle TLEs are giving the >> algorithm fits. >>
> >"Doc, it hurts when I do this." > >"Then don't DO that."
Thanks for your response. My main concern was NOT that the TLEs break the algorithm, but that your demo code fails inscrutably (at the moment), and since that's the way a lot of people will be figuring out how your packages work that failure will be difficult to surmount (it took me an hour or so of trial and error before I figured out that it was the shuttle TLEs). Once I finally got the satellite pass (yes, not Iridium flare) code working I then started looking at the data at various parts of the process in order to figure out just what was going on. I then started modifying it step by step towards my own application. Having the working program made it a LOT easier. So, my suggestion is that you adjust the demo code so that it prints an error (perhaps "Something's wrong with the TLEs for satellite SHUTTLE; continuing") and then continues. Beyond that, it would have helped me if there was more overview information, giving context to exactly what the process should be. Yes, you provide a whole Satpass application that uses the packages, but frankly for us non-Perl-gurus it's really difficult to trace how a Perl program works. More simple demonstrations would also have helped. Looking a gift horse in the mouth, Dan -- Daniel T. Griscom griscom@suitable.com Suitable Systems http://www.suitable.com/ 1 Centre Street, Suite 204 (781) 665-0053 Wakefield, MA 01880-2400
Subject: Bug in demo satellite pass script
On Fri Nov 14 08:00:44 2008, griscom@suitable.com wrote: Show quoted text
> > Thanks for your response. My main concern was NOT that the TLEs break > the algorithm, but that your demo code fails inscrutably (at the > moment), and since that's the way a lot of people will be figuring > out how your packages work that failure will be difficult to surmount > (it took me an hour or so of trial and error before I figured out > that it was the shuttle TLEs). >
I certainly agree with you that sample code should _not_ fail inscrutably, and the patch I sent you is all set to go into the next release. I think it took me about the same amount of time to figure the problem out originally, but problems should not have to be figured out more than once. Show quoted text
> Once I finally got the satellite pass (yes, not Iridium flare) code > working I then started looking at the data at various parts of the > process in order to figure out just what was going on. I then started > modifying it step by step towards my own application. Having the > working program made it a LOT easier. > > So, my suggestion is that you adjust the demo code so that it prints > an error (perhaps "Something's wrong with the TLEs for satellite > SHUTTLE; continuing") and then continues.
I may break down and add some comments about the need for setting 'backdate' false. As my copy of the code now stands, it's commented something like "maybe this should be the default". But in the vast majority of cases there is no problem with using TLEs before their epoch. All TLEs will have problems like this eventually, it's just a question of time, either before _or_ after the epoch of the data. It might be good if objects built from NASA's Human Spaceflight data were set up with backdate => 0 automatically, but I'm not sure I see the best way to carry that information from the Astro::SpaceTrack package into the Astro::Coord::ECI::TLE->parse() method. Right now I can imagine having parse() able to digest an HTTP::Response object (which is what Astro::SpaceTrack returns) and then have Astro::SpaceTrack add a custom response header with the data, which the parse() method reacts to. But I just thought of that 5 minutes ago, and I haven't had time to consider possible problems with it. Show quoted text
> Beyond that, it would have helped me if there was more overview > information, giving context to exactly what the process should be. > Yes, you provide a whole Satpass application that uses the packages, > but frankly for us non-Perl-gurus it's really difficult to trace how > a Perl program works. More simple demonstrations would also have > helped. >
I'm not sure exactly how to respond here. If I expand the SYNOPSIS too much it becomes the DETAILS. Are you asking for a "How to use this class in your own code" section of some sort? Or "quick start" documentation for the satpass script? Or an overview document for the whole package? Would you be willing to answer questions about where you entered the documentation and why? Or do documentation review? In many ways the author of a piece of code is the least qualified to document it. Or test it, for that matter. There are a couple more examples (working, last time I checked) in the eg directory. Did you look there? Unfortunately if you're using ActiveState PPMs you don't get these. And if you're using CPAN or CPANPLUS you have to go looking for them. One way to get there is to go to http://search.cpan.org/dist/Astro-satpass/ and hit the "browse" link near the top of the page. Unfortunately the "browse" link is version-specific, so I can't add it to the documentation. Show quoted text
> Looking a gift horse in the mouth,
Well, maybe I shouldn't have made the crack about the doctor. My apologies. It was late when I responded, and it appears I was a bit punchy. Tom Wyant
Subject: Re: [rt.cpan.org #40899] Bug in demo satellite pass script
Date: Fri, 14 Nov 2008 14:04:42 -0500
To: bug-Astro-satpass [...] rt.cpan.org
From: Daniel Griscom <griscom [...] suitable.com>
At 1:52 PM -0500 11/14/08, Tom Wyant via RT wrote: Show quoted text
><URL: http://rt.cpan.org/Ticket/Display.html?id=40899 > > >On Fri Nov 14 08:00:44 2008, griscom@suitable.com wrote:
> > Beyond that, it would have helped me if there was more overview
>> information, giving context to exactly what the process should be. >> Yes, you provide a whole Satpass application that uses the packages, >> but frankly for us non-Perl-gurus it's really difficult to trace how >> a Perl program works. More simple demonstrations would also have >> helped. >>
> >I'm not sure exactly how to respond here. If I expand the SYNOPSIS too >much it becomes the DETAILS.
I found it difficult to understand the overall work flow for the system. Just what is the "data" that is returned by the Astro::SpaceTrack package? What is returned by Astro::Coord::ECI::TLE->parse()? Why would I want to aggregate it? When do I need to specify login info to the Astro::SpaceTrack package? Where does Astro::SpaceTrack->retrieve() get its info? I think I was missing the forest for the trees. Until I got your demo code working I really had no clue as to how it would all function. After that, I just started stepping through the code and watching the values. FYI, my access route to all this was search.cpan.org. Show quoted text
>Well, maybe I shouldn't have made the crack about the doctor. My >apologies. It was late when I responded, and it appears I was a bit punchy.
Anything I receive you (including cracks) beyond this code is more than I can expect. There's not a lot I can contribute to your code, except for expressing confusion in as clear a manner as possible in order to show you how others are trying to use your package. Thanks, Dan -- Daniel T. Griscom griscom@suitable.com Suitable Systems http://www.suitable.com/ 1 Centre Street, Suite 204 (781) 665-0053 Wakefield, MA 01880-2400
Subject: Bug in demo satellite pass script
On Fri Nov 14 14:05:04 2008, griscom@suitable.com wrote: Show quoted text
> At 1:52 PM -0500 11/14/08, Tom Wyant via RT wrote:
> ><URL: http://rt.cpan.org/Ticket/Display.html?id=40899 > > > > >On Fri Nov 14 08:00:44 2008, griscom@suitable.com wrote:
> > > Beyond that, it would have helped me if there was more overview
> >> information, giving context to exactly what the process should be. > >> Yes, you provide a whole Satpass application that uses the packages, > >> but frankly for us non-Perl-gurus it's really difficult to trace how > >> a Perl program works. More simple demonstrations would also have > >> helped. > >>
> > > >I'm not sure exactly how to respond here. If I expand the SYNOPSIS too > >much it becomes the DETAILS.
> > I found it difficult to understand the overall work flow for the > system. Just what is the "data" that is returned by the > Astro::SpaceTrack package? What is returned by > Astro::Coord::ECI::TLE->parse()? Why would I want to aggregate it? > When do I need to specify login info to the Astro::SpaceTrack > package? Where does Astro::SpaceTrack->retrieve() get its info? > > I think I was missing the forest for the trees. Until I got your demo > code working I really had no clue as to how it would all function. > After that, I just started stepping through the code and watching the > values. > > FYI, my access route to all this was search.cpan.org.
Thanks. It's the old bootstrap problem, plus the problem that trivial examples may not be helpful, and significant examples may not be trivial. I could certainly go into each of the questions you ask, but if I were to go into them in the comments in the sample, maybe you would not be able to see the code for the comments. I have seen SYNOPSIS sections with brief comments and extended notes after the code. How does this strike you? Maybe I should go into the questions now, and we can figure out where the answers go later. Show quoted text
> Just what is the "data" that is returned by the > Astro::SpaceTrack package?
The Astro::Coord::ECI::TLE package implements a model (several models, actually) of a satellite in orbit around the Earth. This is not simply a Keplerian ellipse, because of a number of factors such as oblateness of the Earth, atmospheric drag (believe it or not!) and orbital resonance (for 12- and 24-hour orbits anyway), and possibly more. The net result is that the model needs data on which to work, and the job of the Astro::SpaceTrack package is to retrieve this data from any of a number of possible sources. The standard representation of the data for a given satellite is either two or three lines of text which owe their format to the days of 80-column punched cards. This format is called "TLE" for "Two Line Element". The three-line variant is sometimes called "NASA TLE", though you could simply take the "T" to mean "three" in this case. See http://celestrak.com/NORAD/documentation/tle-fmt.asp if you want the gory details of the format. NORAD (among others) generates this data by observing all the satellites and other stuff (spent boosters, astronauts' lost gloves, and so on), and running a big regression program for each to generate TLE data that, when plugged back into the model, best predicts the observed locations of the satellite. This data is characterized by an "epoch", which is the "as-of" date of the data. The data has (as you discovered) a limited shelf life. How limited depends on the specifics of the individual satellite. Typically it's weeks or even months either side of the epoch (though of course prediction quality suffers). For a space shuttle on its first coasting arc, though, it's a day or so. What I think happens in the specific case of the first coasting arc of the Space Shuttle is that if you run that orbit back in time, you essentially have to run an unusually high atmospheric drag backwards as well, and after a couple days the model thinks the shuttle came in on an escape orbit, which the model can't deal with. The cryptic error message reflects the fact that at the next step in the calculations the model is going to attempt to take the square root of a negative number. Show quoted text
> What is returned by > Astro::Coord::ECI::TLE->parse()?
This is the code that takes the TLE data (returned by Astro::SpaceTrack) and makes it into Astro::Coord::ECI::TLE objects (or Astro::Coord::ECI::TLE::Iridium objects, if that's what the data you fed it actually represents). Show quoted text
> Why would I want to aggregate it?
Well, one answer is because the code "just growed". Most sources of satellite orbit data typically provide a single set of data per satellite. The NASA Human Spaceflight web pages at http://spaceflight.nasa.gov/realdata/elements/ provide multiple sets for the same object. As originally written, the code that used this data simply scraped the web page and picked the "best" element to return. "Best" was defined as "most recent epoch before the current time, or the earliest epoch if the current time was before any of the posted date. This caused the same kind of error you encountered, only at that point the error message was even more cryptic. Once I understood how and why the code was failing, I had to figure out what to do about it. The solution I came up with was a container object (Astro::Coord::ECI::TLE::Set) that would hold any number of individual Astro::Coord::ECI::TLE objects that represent the same satellite at different points in time. The container would expose all the methods of the contained objects, and dispatch any method calls to the "best" one, with "best" being defined pretty much the way it was in the previous paragraph. Any method that set the time, of course, had to be overridden to also select the "best" object. The net result is that Astro::SpaceTrack give you a couple dozen lines of text representing one or two orbiting bodies. The Astro::Coord::ECI::TLE->parse() method turns these into a dozen or so Astro::Coord::ECI::TLE objects representing one or two orbiting bodies. And finally Astro::Coord::ECI::TLE::Set->aggregate() generates one or two Astro::Coord::ECI::TLE::Set objects, each containing the Astro::Coord::ECI::TLE objects for exactly one satellite. When you call pass() on the ::Set object, it uses whichever is the "best" object for whatever time it's working on. If you call 'set(backdate => 0)', it (among other things) tells the pass() method not to do any calculations for times earlier than the earliest data epoch it has access to. Show quoted text
> When do I need to specify login info to the Astro::SpaceTrack > package?
When I document this, the answer will probably be something on the order of "See the Astro::SpaceTrack documentation", though a quick look says that first I'll need to make sure that this is actually documented there. Briefly, one of the sources of data is the Space Track web site at http://www.space-track.org/ The predecessor of this site provided data to anyone who surfed over to it. But in the wake of 9/11/2001, a law was passed saying that you had to register to get the data, and at that point it looked like it was going to be illegal to redistribute it. One of the major redistributors was Dr. Kelso of Celestrak, at http://celestrak.com/. He revamped his web site (which offers TLE data for several groups of satellites of interest) so that all he provided was the object ID of satellites in the group. You found (say) all the Iridium satellites by consulting his web site, then hit SpaceTrack to get the data on them. What eventually happened was that it became possible to register to be a redistributor of the data (thanks in part to Dr. Kelso's lobbying). The Astro::SpaceTrack module has had to track all these shenannigans, so it has become a bit complicated. The current situation is that you must provide a SpaceTrack username and password if you: * Fetch your data directly from SpaceTrack (i.e. use the Astro::SpaceTrack methods that are documented to do this), or * Fetch your data from Celestrak (i.e. use the methods documented to do this, which I think means the celestrak() method), _AND_ you have the 'direct' attribute set false. In this case, Astro::SpaceTrack gets the object ID numbers from Celestrak, and then hits SpaceTrack for the data. If 'direct' is true, it fetches all data from Celestrak, if possible (and it typically is, since Dr. Kelso is registered as a redistributor). Show quoted text
> Where does Astro::SpaceTrack->retrieve() get its info?
This is one of the methods that gets TLE data directly from Space Track, and hence needs a username and password. Show quoted text
> >Well, maybe I shouldn't have made the crack about the doctor. My > >apologies. It was late when I responded, and it appears I was a bit
punchy. Show quoted text
> > Anything I receive you (including cracks) beyond this code is more > than I can expect. There's not a lot I can contribute to your code, > except for expressing confusion in as clear a manner as possible in > order to show you how others are trying to use your package. >
Expressing confusion in a clear manner is a rare talent. I recall a tech writer who was a typical "dumb user" with a twist that made her invaluable. When she got herself balled up in the system, she could tell you afterward what she did to get balled up, and why she did it. There were a number of code changes based on her ways to get tangled in the system. Tom Wyant
Subject: Re: [rt.cpan.org #40899] Bug in demo satellite pass script
Date: Fri, 14 Nov 2008 15:49:32 -0500
To: bug-Astro-satpass [...] rt.cpan.org
From: Daniel Griscom <griscom [...] suitable.com>
At 3:39 PM -0500 11/14/08, Tom Wyant via RT wrote: Show quoted text
><URL: http://rt.cpan.org/Ticket/Display.html?id=40899 > > >On Fri Nov 14 14:05:04 2008, griscom@suitable.com wrote:
>> At 1:52 PM -0500 11/14/08, Tom Wyant via RT wrote:
>> ><URL: http://rt.cpan.org/Ticket/Display.html?id=40899 > >> > >> >On Fri Nov 14 08:00:44 2008, griscom@suitable.com wrote:
>> > > Beyond that, it would have helped me if there was more overview
>> >> information, giving context to exactly what the process should be. >> >> Yes, you provide a whole Satpass application that uses the packages, >> >> but frankly for us non-Perl-gurus it's really difficult to trace how >> >> a Perl program works. More simple demonstrations would also have >> >> helped. >> >>
>> > >> >I'm not sure exactly how to respond here. If I expand the SYNOPSIS too >> >much it becomes the DETAILS.
>> >> I found it difficult to understand the overall work flow for the >> system. Just what is the "data" that is returned by the >> Astro::SpaceTrack package? What is returned by >> Astro::Coord::ECI::TLE->parse()? Why would I want to aggregate it? >> When do I need to specify login info to the Astro::SpaceTrack >> package? Where does Astro::SpaceTrack->retrieve() get its info? >> >> I think I was missing the forest for the trees. Until I got your demo >> code working I really had no clue as to how it would all function. >> After that, I just started stepping through the code and watching the >> values. >> >> FYI, my access route to all this was search.cpan.org.
> >Thanks. It's the old bootstrap problem, plus the problem that trivial >examples may not be helpful, and significant examples may not be trivial. > >I could certainly go into each of the questions you ask, but if I were >to go into them in the comments in the sample, maybe you would not be >able to see the code for the comments. I have seen SYNOPSIS sections >with brief comments and extended notes after the code. How does this >strike you? > >Maybe I should go into the questions now, and we can figure out where >the answers go later.
I'm sorry, I wasn't clear. I've for the most part figured out all of these questions on my own, by trial-and-error and value examination. At the moment I think I'm up to speed on the system (although my opinion may change at any moment depending on what I try next). I was just trying to give you a flavor of what information I wasn't able to find in the documentation. Do you have a website, or somewhere you could post a page with an overview of the system? A document going over how it all hangs together, independent of each package's doc, might have helped me a lot. Again, I'm not looking for more information at this point; I was just trying to give some semi-helpful feedback. Thanks, Dan -- Daniel T. Griscom griscom@suitable.com Suitable Systems http://www.suitable.com/ 1 Centre Street, Suite 204 (781) 665-0053 Wakefield, MA 01880-2400
On Fri Nov 14 15:49:51 2008, griscom@suitable.com wrote: Show quoted text
> > I'm sorry, I wasn't clear. I've for the most part figured out all of > these questions on my own, by trial-and-error and value examination. > At the moment I think I'm up to speed on the system (although my > opinion may change at any moment depending on what I try next). I was > just trying to give you a flavor of what information I wasn't able to > find in the documentation.
Thanks. One of my favorite aphorisms says "The greatest danger of communication is the illusion that it occurred." So maybe I have a tendency to over communicate, as a way to avoid the reverse. Show quoted text
> > Do you have a website, or somewhere you could post a page with an > overview of the system? A document going over how it all hangs > together, independent of each package's doc, might have helped me a > lot.
The only web site I maintain is a fairly sketchy one used for sharing photos with friends. I have tried to put together an overview document (called "Overview") which I hope (if I work CPAN right) to have show up in the "documentation" section on search.cpan.org. Since you said you found this package through search.cpan.org, I'm assuming others will too (that's how _I_ would). And anyway I believe the overview _should_ be with the package. I'll need to refer to it in the other docs so that people who just install and start reading the module docs will find it. Show quoted text
> > Again, I'm not looking for more information at this point; I was just > trying to give some semi-helpful feedback. >
Fine, and I appreciate the feedback. In case you are willing to give more, I have attached the Overview document as it now stands. The recommended way to read it is to download it, change to the directory you downloaded it to, and say perldoc Overview.pod The document _should_ show up as HTML on search.cpan.org. But before I release I need to check the internal links, which I have not done. Thank you very much for your willingness to work with me. Tom Wyant

Message body is not shown because it is too large.

0.020 fixed the Iridium SYNOPSIS bug, and added a (hopefully helpful) Overview.pod.