mariocannistra / radio-astronomy-fftw

fftw3 based radio-astronomy data collection and dissemination (see project on hackster.io website)
https://www.hackster.io/mariocannistra/radio-astronomy-with-rtl-sdr-raspberrypi-and-amazon-aws-iot-45b617
MIT License
32 stars 7 forks source link

Problems using jpredict.py in Australia #1

Closed chrissamuel closed 6 years ago

chrissamuel commented 6 years ago

Hi Mario,

I've been trying to get jpredict.py to work and I'm not sure if the problems I'm having are because of the fact that I'm in Australia or because the underlying ephem library has changed and no longer correctly works with your program.

If I specify the location in radioConfig.py to be:

stationTimezone = "Australia/Melbourne"
stationLat = "37.97252 S"  # enter your station latitude here with this string format "00.00000 X"  where X is either N or S (North or Sud)
stationLon = "145.49552 E"  # enter your station longitude here with this string format "00.00000 X"  where X is either E or W (East or West)
stationElev = 300   # enter your station elevation in meters (above sea level)

Then after they've been set by:

ephempos.lon  = float(radioConfig.stationLon[0:-2])             #Note that lon should be in string format
ephempos.lat  = float(radioConfig.stationLat[0:-2])             #Note that lat should be in string format

I get what looks like nonsensical values if I print ephem.lon and ephem.lat with:

print (ephempos.lat)
print (ephempos.lon)

as it shows me:

2175:39:54.5
8336:16:45.2

I think there are two reasons for this.

  1. The code doesn't convert southerly values to negative (same for westerly I'd guess).
  2. The pyephem code seem to expect string values, so the float() conversion is probably wrong.

If instead I hardwire in my location to jpredict.py with:

# Quick hack
ephempos.lon = "-37.972525"
ephempos.lat = "145.49555"

which results in correct looking values for my lat/lon

145:29:44.0
-37:58:21.1

I instead get an error from pyephem that says:

ephem.NeverUpError: 'Jupiter' transits below the horizon at 2018/5/5 02:47:13

Which is wrong as Jupiter is visible in the nights sky here at the moment.

Any ideas? I'm not a Python programmer so I'm struggling here.. :-(

Thanks! Chris

mariocannistra commented 6 years ago

Hello Chris. Will look into this asap. It's actually a couple of years that I'm using that code and library versions on the R-PI... so probably worth debugging/upgrading/retesting... :-) Will keep you posted... mario

mariocannistra commented 6 years ago

Hi Chris. Thank you for spotting this. I just pushed this commit that also contains some code improvements.

jpredict.py now makes usage of a new file (raforpi.py) so please download again both of them from this repository. It makes usage of latest Skyfield package. Ever since you probably have v 0.6.1, please upgrade it using pip install --upgrade Skyfield

The negative value is now automatically managed for southern longitudes. It could have been done in different ways but I preferred this method for backward compatibility of the radioConfig files of the various users. I checked the prediction values using RJPro and USNO rise and set times for Sun and Jupiter: please find attached some screenshots and text files.

Please let me know if you still meet some issue. Kind regards, Mario

cmliii-iophase-rise-set-comparison rjpro-latlon-config rjpro-may-7-pred rjpro-may-8-pred rjpro-may-9-pred USNO-Sun-Jupiter-ephem-check.txt predict-may-7-8-9.txt

chrissamuel commented 6 years ago

Hi Mario,

Thank you so much for this work! I've been busy with work and preparing for a forthcoming trip so I've not had a chance to check this out properly yet but it looks very promising!.

chris@yoga:~/Code/radio-astronomy-fftw$ python jpredict.py 
[#################################] 100% deltat.data
[#################################] 100% deltat.preds
[#################################] 100% Leap_Second.dat
('pyephem observer position: ', <ephem.Observer date='2018/5/10 11:05:45' epoch='2000/1/1 12:00:00' lon='145:29:43.8' lat='-37:58:21.1' elevation=300.0m horizon=-0:34:00.0 temp=15.0C pressure=0.0mBar>)
('myposition: ', <VectorSum of 3 vectors 0 SOLAR SYSTEM BARYCENTER -> -37deg 58' 21.1" N 145deg 29' 43.8" E>)
local time              CML III         IO phase        Source  Jupiter Rise-Set (local)                        Sun Rise-Set (local)
May 10 17:30:00         163.50          256.70          B       May 10 17:15:19 May 11 07:02:34                 May 11 07:07:49 May 11 17:20:34
May 10 17:45:00         172.57          258.84          B       May 10 17:15:19 May 11 07:02:34                 May 11 07:07:49 May 11 17:20:34
May 10 18:00:00         181.64          260.98          B       May 10 17:15:19 May 11 07:02:34                 May 11 07:07:49 May 11 17:20:34
May 10 18:15:00         190.71          263.11          B       May 10 17:15:19 May 11 07:02:34                 May 11 07:07:49 May 11 17:20:34

Thank you so much for this!

All the best, Chris

mariocannistra commented 6 years ago

Hi Chris. You're welcome! I'm always happy to work on these things and hope to publish soon the new version with improved radio spectrogram plots and support for SoapySDR + LimeSDR. Let me know if you find out any issue. Mario

chrissamuel commented 6 years ago

Thanks! I've got an unrelated suggestion so I'll open a new issue for it now.