<jupyter_start><jupyter_text>TARGETS<jupyter_code>#from astroquery.ned import Ned
#result_table = Ned.query_refcode('2013ApJ...772...82H ')
#print(result_table)
target_table = pd.read_csv('./globs2.csv')
table_values = target_table.as_matrix()
table_values
targets = [FixedTarget(coord=SkyCoord(ra = ra*u.hourangle, dec = dec*u.deg), name=name)
            for name, ra, dec in table_values]
#target = [FixedTarget(coord=SkyCoord(ra = 0.712313889*u.hourangle, dec = 41.26875*u.deg), name='M31')]
#         for Name, RA, DEC in table_values]
targets
reference_time = Time("2018-3-31 12:00:00")
end_time = Time("2018-04-01 12:00:00")

twilight_apache = apache.twilight_evening_astronomical(reference_time, which='nearest')
twilight_end_apache = apache.twilight_morning_astronomical(reference_time, which='next')
apache_observing_length = (twilight_end_apache - twilight_apache).to(u.h)
apache_observing_length
reference12_time = Time("2018-12-31 12:00:00")
end12_time = Time("2019-01-01 12:00:00")

window_range = [reference12_time, end12_time]
window_time_grid = time_grid_from_range(window_range)

twilight_12apache = apache.twilight_evening_astronomical(reference12_time, which='nearest')
twilight_end_12apache = apache.twilight_morning_astronomical(reference12_time, which='next')
apache_12observing_length = (twilight_end_12apache - twilight_12apache).to(u.h)
print(apache_12observing_length)

apache.moon_phase(reference12_time) #phase = 2*pi is new moon. phase = 0 is full
apache_observing_range = [twilight_12apache, twilight_end_12apache]
apache_observing_range
print(apache_observing_range[0])
constraints = [AirmassConstraint(2), MoonSeparationConstraint(35*u.deg)]

apache_observing_table = observability_table(constraints, apache, target, time_range=apache_observing_range)

print(apache_observing_table) #Passes moon separation constraint. 
fig,ax = plt.subplots(1,1)
fig.set_size_inches(10,5)

fig.tight_layout()

print(twilight_12apache.datetime)
print(twilight_end_12apache.datetime)

for i, my_object in enumerate(target):

    if apache_observing_table['ever observable'][i]:  # Sees true or false
        ax = plot_airmass(my_object, apache, window_time_grid, max_airmass=2.0)
        name = apache_observing_table['target name'][i]
        obj_frac = apache_observing_table['fraction of time observable'][i]
        obj_time = obj_frac * apache_observing_length
        output = "You can observe {0:s} for {1:.2f}".format(name, obj_time.to(u.h))
        print(output)

ax.vlines(twilight_12apache.datetime, 1,3, color='r', linewidth=5)
ax.vlines(twilight_end_12apache.datetime, 1,3, color='r', linewidth=5)

ax.legend(loc=0,shadow=True);<jupyter_output><empty_output><jupyter_text>Planetary Nebula<jupyter_code>ctio = Observer(longitude = 70.804 * u.deg,
                    latitude = -30.169 * u.deg,
                    timezone = 'Etc/GMT+3',
                    name = 'CTIO')
ic418 = [FixedTarget(coord=SkyCoord(ra = 5.45783436*u.hourangle, dec = -12.68811111*u.deg), name='IC 418')]
ctioreference_time = Time("2018-03-31 12:00:00")
ctioend_time = Time("2018-04-01 12:00:00")

twilight_ctio = ctio.twilight_evening_astronomical(ctioreference_time, which='nearest')
twilight_end_ctio = ctio.twilight_morning_astronomical(ctioreference_time, which='next')
ctio_observing_length = (twilight_end_ctio - twilight_ctio).to(u.h)
ctio_observing_length
ctioreference12_time = Time("2018-12-31 12:00:00")
ctioend12_time = Time("2019-01-01 12:00:00")

window_range = [ctioreference12_time, ctioend12_time]
window_time_grid = time_grid_from_range(window_range)

twilight_12ctio = apache.twilight_evening_astronomical(ctioreference12_time, which='nearest')
twilight_end_12ctio = apache.twilight_morning_astronomical(ctioreference12_time, which='next')
ctio_12observing_length = (twilight_end_12ctio - twilight_12ctio).to(u.h)
print(ctio_12observing_length)

ctio.moon_phase(ctioreference12_time) #phase = 2*pi is new moon. phase = 0 is full
ctio_observing_range = [twilight_12ctio, twilight_end_12ctio]
ctio_observing_range
print(ctio_observing_range[0])
constraints = [AirmassConstraint(2), MoonSeparationConstraint(35*u.deg)]

ctio_observing_table = observability_table(constraints, ctio, ic418, time_range=apache_observing_range)

print(ctio_observing_table) #Passes moon separation constraint. 
fig,ax = plt.subplots(1,1)
fig.set_size_inches(10,5)

fig.tight_layout()

print(twilight_12ctio.datetime)
print(twilight_end_12ctio.datetime)

for i, my_object in enumerate(ic418):

    if ctio_observing_table['ever observable'][i]:  # Sees true or false
        ax = plot_airmass(my_object, ctio, window_time_grid, max_airmass=2.0)
        name = ctio_observing_table['target name'][i]
        obj_frac = ctio_observing_table['fraction of time observable'][i]
        obj_time = obj_frac * ctio_observing_length
        output = "You can observe {0:s} for {1:.2f}".format(name, obj_time.to(u.h))
        print(output)

ax.vlines(twilight_12ctio.datetime, 1,3, color='r', linewidth=5)
ax.vlines(twilight_end_12ctio.datetime, 1,3, color='r', linewidth=5)

ax.legend(loc=0,shadow=True);<jupyter_output>2018-12-31 11:28:24.331666
2018-12-31 22:31:04.312103
You can observe IC 418 for 7.06 h<jupyter_text>La Silla Globular Clusters<jupyter_code>target_table = pd.read_csv('./globs2.csv')
table_values = target_table.as_matrix()
table_values
globs = [FixedTarget(coord=SkyCoord(ra = ra*u.hourangle, dec = dec*u.deg), name=name)
            for name, ra, dec in table_values]
lasilla = Observer(longitude = -29.25 * u.deg,
                    latitude = 70.7333 * u.deg,
                    timezone = 'Etc/GMT+3',
                    name = 'Apache Point')
reference_time = Time("2018-10-15 12:00:00")
end_time = Time("2018-10-31 12:00:00")

window_range = [reference_time, end_time]
window_time_grid = time_grid_from_range(window_range)

twilight_lasilla = lasilla.twilight_evening_astronomical(reference_time, which='nearest')
twilight_end_lasilla = lasilla.twilight_morning_astronomical(reference_time, which='next')
lasilla_observing_length = (twilight_end_lasilla - twilight_lasilla).to(u.h)
lasilla_observing_length

lasilla.moon_phase(reference_time) #phase = 2*pi is new moon. phase = 0 is full

lasilla_observing_range = [twilight_lasilla, twilight_end_lasilla]
lasilla_observing_range
print(lasilla_observing_range)

constraints = [AirmassConstraint(2), MoonSeparationConstraint(35*u.deg)]

lasilla_observing_table = observability_table(constraints, lasilla, globs, time_range=lasilla_observing_range)

print(lasilla_observing_table) #Passes moon separation constraint. 
print(lasilla_observing_range)
        
#observe_time = reference_time + np.linspace(0, 336, 24)*u.hour
delta_t = end_time - reference_time
observe_time = reference_time + delta_t*np.linspace(0, 1, 75)
globs[0].name
newlist = sorted(globs, key=lambda x: x.name, reverse=False)
some_globs = newlist[0:20]
some_globs
small_lasilla_observing_table = observability_table(constraints, lasilla, some_globs, time_range=lasilla_observing_range)
print(small_lasilla_observing_table)
def find_october_observe(october_day):
    fig,ax = plt.subplots(1,1)
    fig.set_size_inches(10,5)

    fig.tight_layout()

    observe_time = Time("2018-10-" + october_day + " 23:00:00")
    
    twilight_lasilla = lasilla.twilight_evening_astronomical(Time("2018-10-" + october_day + " 12:00:00"), which='nearest')
    twilight_end_lasilla = lasilla.twilight_morning_astronomical(Time("2018-10-" + october_day + " 12:00:00"), which='next')
    
    observing_range = [twilight_lasilla, twilight_end_lasilla]
    
    # CONSTRAINTS: If object appears within range on graph, but is not observable, this means that the moon is too close to the object.
    constraints = [AirmassConstraint(2), MoonSeparationConstraint(35*u.deg)]

    small_lasilla_observing_table = observability_table(constraints, lasilla, some_globs, time_range=observing_range)
    
    print(small_lasilla_observing_table)
    
    for i, my_object in enumerate(some_globs):
        if small_lasilla_observing_table['ever observable'][i]:  # Sees true or false
            name = small_lasilla_observing_table['target name'][i]
            obj_frac = small_lasilla_observing_table['fraction of time observable'][i]
            obj_time = obj_frac * lasilla_observing_length
            output = "You can observe {0:s} for {1:.2f}".format(name, obj_time.to(u.h))
            print(output)

    print(lasilla.moon_phase(observe_time)) # 2*pi = new moon. 0 = full moon.
    # Moon brightness must be taken into consideration. However, we do not quantify its effect here, only the effect of separation distance
    
    plot_airmass(some_globs, lasilla, observe_time, max_airmass = 2)
    
    ax.vlines(twilight_lasilla.datetime, 1,3, color='r', linewidth=5)
    ax.vlines(twilight_end_lasilla.datetime, 1,3, color='r', linewidth=5)

    ax.legend(loc=0,shadow=True);
find_october_observe("15")
find_october_observe("30")
def find_november_observe(november_day):
    fig,ax = plt.subplots(1,1)
    fig.set_size_inches(10,5)

    fig.tight_layout()

    observe_time = Time("2018-11-" + november_day + " 23:00:00")
    
    twilight_lasilla = lasilla.twilight_evening_astronomical(Time("2018-11-" + november_day + " 12:00:00"), which='nearest')
    twilight_end_lasilla = lasilla.twilight_morning_astronomical(Time("2018-11-" + november_day + " 12:00:00"), which='next')
    
    observing_range = [twilight_lasilla, twilight_end_lasilla]
    
    # CONSTRAINTS: If object appears within range on graph, but is not observable, this means that the moon is too close to the object.
    constraints = [AirmassConstraint(2), MoonSeparationConstraint(35*u.deg)]

    small_lasilla_observing_table = observability_table(constraints, lasilla, some_globs, time_range=observing_range)
    
    print(small_lasilla_observing_table)
    
    for i, my_object in enumerate(some_globs):
        if small_lasilla_observing_table['ever observable'][i]:  # Sees true or false
            name = small_lasilla_observing_table['target name'][i]
            obj_frac = small_lasilla_observing_table['fraction of time observable'][i]
            obj_time = obj_frac * lasilla_observing_length
            output = "You can observe {0:s} for {1:.2f}".format(name, obj_time.to(u.h))
            print(output)

    print(lasilla.moon_phase(observe_time)) # 2*pi = new moon. 0 = full moon.
    # Moon brightness must be taken into consideration. However, we do not quantify its effect here, only the effect of separation distance
    
    plot_airmass(some_globs, lasilla, observe_time, max_airmass = 2)
    
    ax.vlines(twilight_lasilla.datetime, 1,3, color='r', linewidth=5)
    ax.vlines(twilight_end_lasilla.datetime, 1,3, color='r', linewidth=5)

    ax.legend(loc=0,shadow=True);
find_november_observe("15")
find_november_observe("30")<jupyter_output>target name  ever observable always observable fraction of time observable
------------- --------------- ----------------- ---------------------------
      A1644 1           False             False                         0.0
    A1689 BCG           False             False                         0.0
      A2124 1            True             False              0.259259259259
      A2147 1           False             False                         0.0
      A2152 1           False             False                         0.0
      A2152 2           False             False                         0.0
       A754 1           False             False                         0.0
       A754 2           False             False                         0.0
 CGCG 065-015           False             False                         0.0
 CGCG 421-019           False             False                         0.0
       DDO 52            True             False              0.814814814815
   ESO 059-0[...]
{'fraction_non_alphanumeric': 0.11064295946743069, 'fraction_numerical': 0.05308839639335974, 'mean_word_length': 3.9429404414827154, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '241188', 'license': 'MIT', 'n_tokens_mistral': 4533, 'n_tokens_neox': 4056, 'n_words': 738, 'path': 'Astroplan Practice.ipynb', 'repo_name': 'kp1997/ASTR480', 'size': '11867'}