In [1]:
from nustar_pysolar import planning, io
import astropy.units as u
import warnings
warnings.filterwarnings('ignore')
from astropy.coordinates import SkyCoord
In [2]:
fname = io.download_occultation_times(outdir='../data/')
print(fname)
In [3]:
tlefile = io.download_tle(outdir='../data')
print(tlefile)
times, line1, line2 = io.read_tle_file(tlefile)
In [4]:
tstart = '2019-09-01T22:00:00'
tend = '2019-09-02T24:00:00'
orbits = planning.sunlight_periods(fname, tstart, tend)
We can more or less pick any angle that we want. But this angle has to be specified a little in advance so that the NuSTAR SOC can plan the "slew in" maneuvers. Below puts DET0 in the top left corner (north-east with respect to RA/Dec coordinates).
In [5]:
tcheck = '2019-09-02T04:00:00'
pa = planning.get_nustar_roll(tcheck, 0)
print(tcheck)
print("NuSTAR Roll angle for Det0 in NE quadrant: {}".format(pa))
In [6]:
orbits
Out[6]:
In [7]:
# Pointing locations for solar center:
orbit_ind = 0
for di in range(9):
orbit_ind += 1
this_orbit = orbits[orbit_ind].copy()
offset = [0, 0]*u.arcsec
midTime = (0.5*(this_orbit[1] - this_orbit[0]) + this_orbit[0])
sky_pos = planning.get_skyfield_position(midTime, offset, load_path='../data', parallax_correction=True)
print("Orbit {} start: {} Orbit end: {}".format(orbit_ind, this_orbit[0].isoformat(), this_orbit[1].isoformat()))
print('Aim time: {} RA (deg): {} Dec (deg): {}'.format(midTime.isoformat(), sky_pos[0], sky_pos[1]))
print("")
In [8]:
# Just use the first orbit...or choose one. This may download a ton of deltat.preds, which is a known
# bug to be fixed.
orbit = orbits[4].copy()
print(orbit)
#...adjust the index above to get the correct orbit. Then uncomment below.
planning.make_mosaic(orbit, make_regions=True, outfile='orbit4_mosaic.txt', write_output=True)
In [ ]: