<jupyter_start><jupyter_text>Download the list of occultation periods from the MOC at Berkeley. Note that the occultation periods typically only are stored at Berkeley for the *future* and not for the past. So this is only really useful for observation planning.<jupyter_code>fname = io.download_occultation_times(outdir='../data/')
print(fname)<jupyter_output>../data/NUSTAR.2018_268.SHADOW_ANALYSIS.txt<jupyter_text>Download the NuSTAR TLE archive.This contains every two-line element (TLE) that we've received for the whole mission. We'll expand on how to use this later.The `times`, `line1`, and `line2` elements are now the TLE elements for each epoch.<jupyter_code>tlefile = io.download_tle(outdir='../data')
print(tlefile)
times, line1, line2 = io.read_tle_file(tlefile)<jupyter_output>../data/NuSTAR.tle<jupyter_text>Here is where we define the observing window that we want to use.Note that tstart and tend must be in the future otherwise you won't find any occultation times and sunlight_periods will return an error.<jupyter_code>tstart = '2018-09-27T12:00:00'
tend = '2018-09-29T12:10:00'
orbits = planning.sunlight_periods(fname, tstart, tend)<jupyter_output><empty_output><jupyter_text>We want to know how to orient NuSTAR for the Sun.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). This is what you tell the SOC you want the "Sky PA angle" to be.<jupyter_code>pa = planning.get_nustar_roll(tstart, 0)
print("NuSTAR Roll angle for Det0 in NE quadrant: {}".format(pa))<jupyter_output><empty_output><jupyter_text>Set up the offset you want to use here:The first element is the direction +WEST of the center of the Sun, the second is the offset +NORTH of the center of the Sun.If you want multiple pointing locations you can either specify an array of offsets or do this "by hand" below.<jupyter_code>offset = [0., 0.]*u.arcsec<jupyter_output><empty_output><jupyter_text>Loop over each orbit and correct the pointing for the same heliocentric pointing position.Note that you may want to update the pointing for solar rotation. That's up to the user to decide and is not done here.<jupyter_code>for ind, orbit in enumerate(orbits):
    midTime = (0.5*(orbit[1] - orbit[0]) + orbit[0])
    sky_pos = planning.get_skyfield_position(midTime, offset, parallax_correction=True)
    print("Orbit: {}".format(ind))
    print("Orbit start: {} Orbit end: {}".format(orbit[0].isoformat(), orbit[1].isoformat()))
    print('Aim time: {} RA (deg): {} Dec (deg): {}'.format(midTime.isoformat(), sky_pos[0], sky_pos[1]))
    print("")<jupyter_output>[#################################] 100% deltat.data
[#################################] 100% Leap_Second.dat<jupyter_text>This is where you actually make the Mosaic<jupyter_code># 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[20]
planning.make_mosaic(orbit, write_output=True, make_regions=True)<jupyter_output>('Step PA', <Quantity 115.78189166 deg>)
Orbit start: 2018-09-28T20:00:40 Orbit end: 2018-09-28T21:02:00
('Dwell per position:', datetime.timedelta(0, 147, 200000))

NuSTAR Roll Angle to get DET0 in top right 25.78 deg
{'fraction_non_alphanumeric': 0.1193941193941194, 'fraction_numerical': 0.03415503415503415, 'mean_word_length': 5.539805825242718, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '142442', 'license': 'MIT', 'n_tokens_mistral': 1174, 'n_tokens_neox': 1056, 'n_words': 391, 'path': 'notebooks/20180928/Mosaic 20180928.ipynb', 'repo_name': 'bwgref/nustar_pysolar', 'size': '3367'}