<jupyter_start><jupyter_text>Loading a TimeMoc from a fits file<jupyter_code>time_moc = TimeMOC.from_fits('http://alasky.u-strasbg.fr/HST-hips/filter_SDSSr_hips/TMoc.fits')
time_moc.plot(title='HST_SDSSr tmoc')<jupyter_output>Downloading http://alasky.u-strasbg.fr/HST-hips/filter_SDSSr_hips/TMoc.fits [Done]<jupyter_text>Loading a TimeMoc from an astropy table<jupyter_code>from astroquery.vizier import Vizier

viz = Vizier(columns=['*', '_RAJ2000', '_DEJ2000'])
viz.ROW_LIMIT = -1
table = viz.get_catalogs('II/285')[1]

print(table)
%time table_moc = TimeMOC.from_times(Time(table['JD'], format='jd', scale='tdb'))
table_moc.plot(title='2nd table of II/285 tmoc')

# print characteristics such as the time of the first/last observations
print('Time of the first observation:', table_moc.min_time.iso)
print('Time of the last observation:', table_moc.max_time.iso)
# the total duration of the observation times
print('Total duration: {0} jd'.format(table_moc.total_duration.jd))
# the order of the TimeMoc
print('max order:', table_moc.max_order)<jupyter_output>CPU times: user 296 ms, sys: 0 ns, total: 296 ms
Wall time: 300 ms<jupyter_text>Filtering an astropy table with a TimeMoc<jupyter_code># filtering the table through the tmoc created from the HST_SDSSr fits file
rows = time_moc.contains(times=Time(table['JD'], format='jd', scale='tdb'),
                                   keep_inside=True,
                                   delta_t=TimeDelta(3600, format='sec', scale='tdb'))
print(table['JD'][rows])<jupyter_output>JD     
     d      
------------
2453021.3273
2453022.4863
2453022.5731
2453022.4809
2453021.3261
2453021.3419
2453022.5743
2453021.3427
2453021.3405
2453022.5727
         ...
2453022.6020
2453022.4837
2453021.3384
2453022.4842
2453021.3392
2453022.4856
2453022.4807
2453022.6028
2453022.4841
2453022.5714
Length = 129 rows<jupyter_text>TimeMoc operation examples :*  Intersection of 2 tmocs : (HST_SDSSr) INTER (2nd table of II/285)<jupyter_code>result = table_moc.intersection(time_moc, delta_t=TimeMOC.order_to_time_resolution(9))

time_moc.plot(title='HST_SDSSr tmoc')
table_moc.plot(title='2nd table of II/285 tmoc')
result.plot(title='(HST_SDSSr) INTER (2nd table of II/285) tmoc')

# print the max order of all the tmocs. Result tmoc must be of order 9
print('HST_SDSSr max order : ', time_moc.max_order)
print('2nd table of II/285 max order : ', table_moc.max_order)
print('(HST_SDSSr) INTER (2nd table of II/285) max order : ', result.max_order)<jupyter_output><empty_output><jupyter_text>*  Augment and Diminish a tmoc<jupyter_code>result.add_neighbours()
result.plot(title='(HST_SDSSr) INTER (2nd table of II/285) augmented tmoc')

result.remove_neighbours()
result.plot(title='(HST_SDSSr) INTER (2nd table of II/285) diminished tmoc')<jupyter_output><empty_output><jupyter_text>*  Complement of a TimeMoc<jupyter_code>complemented_tmoc = result.complement()
complemented_tmoc.plot(title='Complement of (HST_SDSSr) INTER (2nd table of II/285)',
                       view=(result.min_time, result.max_time))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12366114897760468, 'fraction_numerical': 0.09412528399870172, 'mean_word_length': 5.213709677419355, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '42033', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1372, 'n_tokens_neox': 1187, 'n_words': 246, 'path': 'notebooks/tmoc.ipynb', 'repo_name': 'ajstewart/mocpy', 'size': '3081'}