Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ra = ra2
dec = dec2
else:
print '\t\tUsing the coordinates found in the image header.'
iers = GLOBALutils.JPLiers( baryc_dir, mjd-999.0, mjd+999.0 )
obsradius, R0 = GLOBALutils.JPLR0( latitude, altitude)
obpos = GLOBALutils.obspos( longitude, obsradius, R0 )
jplephem.set_ephemeris_dir( baryc_dir , ephemeris )
jplephem.set_observer_coordinates( obpos[0], obpos[1], obpos[2] )
res = jplephem.doppler_fraction(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
lbary_ltopo = 1.0 + res['frac'][0]
bcvel_baryc = ( lbary_ltopo - 1.0 ) * 2.99792458E5
print '\t\tBarycentric velocity:', bcvel_baryc
res = jplephem.pulse_delay(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
mbjd = mjd + res['delay'][0] / (3600.0 * 24.0)
# Moon Phase Calculations
gobs = ephem.Observer()
gobs.name='APO3.5'
gobs.lat=rad(latitude) # lat/long in decimal degrees
gobs.long=rad(longitude)
DDATE = h[0].header['DATE-OBS'].split('T')[0]
HHOUR = h[0].header['DATE-OBS'].split('T')[1]
Mho = HHOUR[:2]
Mmi = HHOUR[3:5]
Mse = HHOUR[6:]
gobs.date = str(DDATE[:4]) + '-' + str(DDATE[5:7]) + '-' + str(DDATE[8:]) + ' ' + Mho + ':' + Mmi +':' + Mse
mephem = ephem.Moon()
mephem.compute(gobs)
if ra2 !=0 and dec2 != 0:
ra = ra2
dec = dec2
else:
print '\t\tUsing the coordinates found in the image header.'
iers = GLOBALutils.JPLiers( baryc_dir, mjd-999.0, mjd+999.0 )
obsradius, R0 = GLOBALutils.JPLR0( latitude, altitude)
obpos = GLOBALutils.obspos( longitude, obsradius, R0 )
jplephem.set_ephemeris_dir( baryc_dir , ephemeris )
jplephem.set_observer_coordinates( float(obpos[0]), float(obpos[1]), float(obpos[2]) )
res = jplephem.doppler_fraction(float(ra/15.0), float(dec), long(mjd), float(mjd%1), 1, 0.0)
lbary_ltopo = 1.0 + res['frac'][0]
bcvel_baryc = ( lbary_ltopo - 1.0 ) * 2.99792458E5
print "\t\tBarycentric velocity:", bcvel_baryc
res = jplephem.pulse_delay(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
mbjd = mjd + res['delay'][0] / (3600.0 * 24.0)
gobs = ephem.Observer()
gobs.name = h[0].header['TELESCOP']
gobs.lat = rad(latitude) # lat/long in decimal degrees
gobs.long = rad(longitude)
timeT = h[0].header['UTC-OBS'].split(':')
if len(timeT[0]) == 1:
gobs.date = h[0].header['DATE-OBS'][:10] + ' 0' + h[0].header['UTC-OBS']
else:
gobs.date = h[0].header['DATE-OBS'][:10] + ' ' + h[0].header['UTC-OBS']
mephem = ephem.Moon()
mephem.compute(gobs)
Mcoo = jplephem.object_track("Moon", int(mjd), float(mjd%1), 1, 0.0)
Mp = jplephem.barycentric_object_track("Moon", int(mjd), float(mjd%1), 1, 0.0)
airmass = fideosutils.get_airmass(ra,dec,latitude,longitude,altitude,hd['DATE-OBS'].replace('T',' '))
iers = GLOBALutils.JPLiers( baryc_dir, mjd-999.0, mjd+999.0 )
obsradius, R0 = GLOBALutils.JPLR0( latitude, altitude)
obpos = GLOBALutils.obspos( longitude, obsradius, R0 )
jplephem.set_ephemeris_dir( baryc_dir , ephemeris )
jplephem.set_observer_coordinates( float(obpos[0]), float(obpos[1]), float(obpos[2]) )
res = jplephem.doppler_fraction(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
lbary_ltopo = 1.0 + res['frac'][0]
bcvel_baryc = ( lbary_ltopo - 1.0 ) * 2.99792458E5
print "\t\tBarycentric velocity:", bcvel_baryc
res = jplephem.pulse_delay(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
mbjd = mjd + res['delay'][0] / (3600.0 * 24.0)
# Moon Phase Calculations
gobs = ephem.Observer()
gobs.name = 'ESO1.0'
gobs.lat = rad(latitude) # lat/long in decimal degrees
gobs.long = rad(longitude)
#date = hd['DATE-OBS']
#date = datetime.datetime(int(date[:4]),int(date[5:7]),int(date[8:10]),int(date[11:13]),int(date[14:16]),int(date[17:19]))
#new_date = date
#OJO aquiiiiii
#print 'Warning!!! adding 5 hrs to comute MJD due to problem in header! CHECK in future!!'
#new_date = date + datetime.timedelta(hours=5)
#gobs.date = new_date.strftime('%Y-%m-%d %H:%M:%S')
print '\t\tUsing the coordinates found in the image header.'
iers = GLOBALutils.JPLiers( baryc_dir, mjd-999.0, mjd+999.0 )
obsradius, R0 = GLOBALutils.JPLR0( latitude, altitude)
obpos = GLOBALutils.obspos( longitude, obsradius, R0 )
jplephem.set_ephemeris_dir( baryc_dir , ephemeris )
jplephem.set_observer_coordinates( obpos[0], obpos[1], obpos[2] )
res = jplephem.doppler_fraction(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
lbary_ltopo = 1.0 + res['frac'][0]
bcvel_baryc = ( lbary_ltopo - 1.0 ) * 2.99792458E5
print "\t\tBarycentric velocity:", bcvel_baryc
res = jplephem.pulse_delay(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
mbjd = mjd + res['delay'][0] / (3600.0 * 24.0)
# Moon Phase Calculations
gobs = ephem.Observer()
gobs.name='Clay_Mag_2'
gobs.lat=rad(latitude) # lat/long in decimal degrees
gobs.long=rad(longitude)
DDATE = h[ih].header['UT-DATE']
HHOUR = mikeutils.get_hour(float(h[ih].header['UT-TIME']))
Mho = HHOUR[:2]
Mmi = HHOUR[3:5]
Mse = HHOUR[6:]
gobs.date = str(DDATE[:4]) + '-' + str(DDATE[5:6]) + '-' + str(DDATE[7:]) + ' ' + Mho + ':' + Mmi +':' +Mse
mephem = ephem.Moon()
mephem.compute(gobs)
print '\t\tUsing the coordinates found in the image header.'
iers = GLOBALutils.JPLiers( baryc_dir, mjd-999.0, mjd+999.0 )
obsradius, R0 = GLOBALutils.JPLR0( latitude, altitude)
obpos = GLOBALutils.obspos( longitude, obsradius, R0 )
jplephem.set_ephemeris_dir( baryc_dir , ephemeris )
jplephem.set_observer_coordinates( obpos[0], obpos[1], obpos[2] )
res = jplephem.doppler_fraction(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
lbary_ltopo = 1.0 + res['frac'][0]
bcvel_baryc = ( lbary_ltopo - 1.0 ) * 2.99792458E5
print "\t\tBarycentric velocity:", bcvel_baryc
res = jplephem.pulse_delay(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
mbjd = mjd + res['delay'][0] / (3600.0 * 24.0)
# Moon Phase Calculations
gobs = ephem.Observer()
gobs.name='Clay_Mag_2'
gobs.lat=rad(latitude) # lat/long in decimal degrees
gobs.long=rad(longitude)
DDATE = h[0].header['UT-DATE']
HHOUR = h[0].header['UT-TIME']
Mho = HHOUR[:2]
Mmi = HHOUR[3:5]
Mse = HHOUR[6:]
gobs.date = str(DDATE[:4]) + '-' + str(DDATE[5:6]) + '-' + str(DDATE[7:]) + ' ' + Mho + ':' + Mmi +':' +Mse
mephem = ephem.Moon()
mephem.compute(gobs)
Mcoo = jplephem.object_track("Moon", int(mjd), float(mjd%1), 1, 0.0)
#print gfd
iers = GLOBALutils.JPLiers( baryc_dir, mjd-999.0, mjd+999.0 )
obsradius, R0 = GLOBALutils.JPLR0( latitude, altitude)
obpos = GLOBALutils.obspos( longitude, obsradius, R0 )
jplephem.set_ephemeris_dir( baryc_dir , ephemeris )
jplephem.set_observer_coordinates( float(obpos[0]), float(obpos[1]), float(obpos[2]) )
res = jplephem.doppler_fraction(float(ra/15.0), float(dec), long(mjd), float(mjd%1), 1, 0.0)
lbary_ltopo = 1.0 + res['frac'][0]
bcvel_baryc = ( lbary_ltopo - 1.0 ) * 2.99792458E5
#lbary_ltopo = bcvel_baryc / 2.99792458E5 + 1.
print "\t\tBarycentric velocity:", bcvel_baryc
res = jplephem.pulse_delay(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
mbjd = mjd + res['delay'][0] / (3600.0 * 24.0)
# Moon Phase Calculations
gobs = ephem.Observer()
gobs.name = 'Eso2.2'
gobs.lat = rad(latitude) # lat/long in decimal degrees
gobs.long = rad(longitude)
gobs.date = h[0].header['DATE-OBS'][:10] + ' ' + h[0].header['DATE-OBS'][11:]
mephem = ephem.Moon()
mephem.compute(gobs)
Mcoo = jplephem.object_track("Moon", int(mjd), float(mjd%1), 1, 0.0)
Mp = jplephem.barycentric_object_track("Moon", int(mjd), float(mjd%1), 1, 0.0)
Sp = jplephem.barycentric_object_track("Sun", int(mjd), float(mjd%1), 1, 0.0)
res = jplephem.object_doppler("Moon", int(mjd), mjd%1, 1, 0.0)
lunation,moon_state,moonsep,moonvel = GLOBALutils.get_lunar_props(ephem,gobs,Mcoo,Mp,Sp,res,ra,dec)
epoch = 2000.
iers = GLOBALutils.JPLiers( baryc_dir, mjd-999.0, mjd+999.0 )
obsradius, R0 = GLOBALutils.JPLR0( latitude, altitude)
obpos = GLOBALutils.obspos( longitude, obsradius, R0 )
jplephem.set_ephemeris_dir( baryc_dir , ephemeris )
jplephem.set_observer_coordinates( float(obpos[0]), float(obpos[1]), float(obpos[2]) )
res = jplephem.doppler_fraction(float(ra/15.0), float(dec), long(mjd), float(mjd%1), 1, 0.0)
lbary_ltopo = 1.0 + res['frac'][0]
bcvel_baryc = ( lbary_ltopo - 1.0 ) * 2.99792458E5
print "\t\tBarycentric velocity:", bcvel_baryc
res = jplephem.pulse_delay(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
mbjd = mjd + res['delay'][0] / (3600.0 * 24.0)
# Moon Phase Calculations
gobs = ephem.Observer()
gobs.name = 'VLT'
gobs.lat = rad(latitude) # lat/long in decimal degrees
gobs.long = rad(longitude)
gobs.date = h[0].header['DATE-OBS'].replace('T',' ')
mephem = ephem.Moon()
mephem.compute(gobs)
Mcoo = jplephem.object_track("Moon", int(mjd), float(mjd%1), 1, 0.0)
Mp = jplephem.barycentric_object_track("Moon", int(mjd), float(mjd%1), 1, 0.0)
Sp = jplephem.barycentric_object_track("Sun", int(mjd), float(mjd%1), 1, 0.0)
res = jplephem.object_doppler("Moon", int(mjd), mjd%1, 1, 0.0)
lunation,moon_state,moonsep,moonvel = GLOBALutils.get_lunar_props(ephem,gobs,Mcoo,Mp,Sp,res,ra,dec)
refvel = bcvel_baryc + moonvel
if ra2 !=0 and dec2 != 0:
ra = ra2
dec = dec2
else:
print '\t\tUsing the coordinates found in the image header.'
iers = GLOBALutils.JPLiers( baryc_dir, mjd-999.0, mjd+999.0 )
obsradius, R0 = GLOBALutils.JPLR0( latitude, altitude)
obpos = GLOBALutils.obspos( longitude, obsradius, R0 )
jplephem.set_ephemeris_dir( baryc_dir , ephemeris )
jplephem.set_observer_coordinates( float(obpos[0]), float(obpos[1]), float(obpos[2]) )
res = jplephem.doppler_fraction(float(ra/15.0), float(dec), long(mjd), float(mjd%1), 1, 0.0)
lbary_ltopo = 1.0 + res['frac'][0]
bcvel_baryc = ( lbary_ltopo - 1.0 ) * 2.99792458E5
print "\t\tBarycentric velocity:", bcvel_baryc
res = jplephem.pulse_delay(ra/15.0, dec, int(mjd), mjd%1, 1, 0.0)
mbjd = mjd + res['delay'][0] / (3600.0 * 24.0)
gobs = ephem.Observer()
gobs.name = h[0].header['TELESCOP']
gobs.lat = rad(latitude) # lat/long in decimal degrees
gobs.long = rad(longitude)
gobs.date = h[0].header['DATE'][:10] + ' ' + h[0].header['DATE'][11:]
mephem = ephem.Moon()
mephem.compute(gobs)
Mcoo = jplephem.object_track("Moon", int(mjd), float(mjd%1), 1, 0.0)
Mp = jplephem.barycentric_object_track("Moon", int(mjd), float(mjd%1), 1, 0.0)
Sp = jplephem.barycentric_object_track("Sun", int(mjd), float(mjd%1), 1, 0.0)
res = jplephem.object_doppler("Moon", int(mjd), mjd%1, 1, 0.0)
lunation,moon_state,moonsep,moonvel = GLOBALutils.get_lunar_props(ephem,gobs,Mcoo,Mp,Sp,res,ra,dec)
refvel = bcvel_baryc + moonvel