<jupyter_start><jupyter_text>Let's see if we detected anything this time?<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
import astropy.io.fits as fits
import os
import glob
from astropy.table import Table
from astropy.io import ascii
import astropy.units as u
import astropy.constants as const

#matplotlib set up
%matplotlib inline
from matplotlib import rcParams
rcParams["figure.figsize"] = (14, 5)
rcParams["font.size"] = 20
path = '/media/david/5tb_storage1/muscles/ltt1445/hst/redo_data/'
x1ds = glob.glob(path+'*x1d.fits')
print(x1ds)
sx1s = glob.glob(path+'sx1.fits')
print(sx1s)<jupyter_output>['/media/david/5tb_storage1/muscles/ltt1445/hst/redo_data/oe83h3020_x1d.fits', '/media/david/5tb_storage1/muscles/ltt1445/hst/redo_data/oe83h3030_x1d.fits']
[]<jupyter_text>No sx1 - no sign of any flux in the ccd raw images. Huh? There should at least be something at longer wavelengths?<jupyter_code>for x in x1ds:
    hdul = fits.open(x)
    print(hdul[0].header['OPT_ELEM'])
    data = hdul[1].data[0]
    hdul.close()
    #plt.step(data['WAVELENGTH'][data['DQ']==0], data['FLUX'][data['DQ']==0])
    plt.step(data['WAVELENGTH'], data['DQ'])
    plt.show()
    
hdul[1].header<jupyter_output><empty_output><jupyter_text>DQ filters out everything! No Mg ii lines- check raw data... Mucking around with the Swift data to do a gif...<jupyter_code>spath = '/media/david/5tb_storage1/muscles/ltt1445/swift/'
sobs = glob.glob(spath+'00*')
sobs
from matplotlib.colors import LogNorm
from pylab import cm  
for sob in sobs:
    dpath = glob.glob('{}/uvot/event/clean*'.format(sob))[0]
    data = fits.getdata(dpath, 1)
    plt.figure(figsize=(5, 5))
    
    NBINS = (500,500)
    img_zero_mpl = plt.hist2d(data['RAWX'], data['RAWY'], NBINS, cmap='gray', norm=LogNorm())
    lims = [1000, 1300]
    plt.xlim(lims)
    plt.ylim(lims)

    #cbar = plt.colorbar(ticks=[1.0,3.0,6.0])
 #   cbar.ax.set_yticklabels(['1','3','6'])

   # plt.xlabel('x')
   #plt.ylabel('y')

   # plt.hist2d(data['RAWX'], data['RAWY'], bins=100)
    plt.show()
                      
from astropy.time import Time
from astropy.coordinates import SkyCoord, Distance

c = SkyCoord(ra='03h01m51.39s', dec='-16d35m36.1s', distance = Distance(parallax=0.1455e3*u.mas), frame='icrs', pm_ra_cosdec = -369.2*u.mas/u.yr, pm_dec= -268.3*u.mas/u.yr, obstime=Time(2015.05, format='decimalyear'))
c
c2 = c.apply_space_motion(new_obstime=Time('2020-06-17 10:13:11'))
c2.ra.hms
c2.dec.dms
1/0.1455
c3 = SkyCoord(ra=45.46247805566359*u.degree, dec=-16.594495614724412*u.degree, distance = Distance(parallax=0.1455e3*u.mas), frame='icrs', pm_ra_cosdec = -369.2*u.mas/u.yr, pm_dec= -268.3*u.mas/u.yr, obstime=Time(2015.05, format='decimalyear'))

c4 = c3.apply_space_motion(new_obstime=Time('2020-06-17 10:13:11'))
c4.ra.hms
c4.dec.dms
c3.ra.hms
c3.dec.dms
c5 = c.apply_space_motion(new_obstime=Time('2003-06-18 23:52:38'))
print(c5.ra.hms, c5.dec.hms)
hdul = fits.open(path +'oe83h3010_flt.fits')
#hdul[1].header
lc100 = fits.getdata('/media/david/5tb_storage1/muscles/ltt1445/swift/00012837002/uvot/event/ltt1445A_1800slc_002.fits', 1)
#plt.errorbar(lc100['TIME'][2:], lc100['AB_MAG'][2:], lc100['AB_MAG_ERR'][2:], ls='none', marker='o')
mask = ((lc100['AB_MAG']/lc100['AB_MAG_ERR']) > 10)
lc100 = lc100[mask]
plt.errorbar(lc100['TIME'], lc100['AB_MAG'], lc100['AB_MAG_ERR'], ls='none', marker='o')
plt.ylim(0, 30)
len(lc100['AB_MAG'])
print (lc100['AB_MAG'], lc100['AB_MAG_ERR'])
mf = np.median(lc100['AB_MAG'])
me = mf*np.sum((lc100['AB_MAG_ERR']/lc100['AB_MAG'])**2)**0.5
print(mf, me)
mf = np.median(lc100['AB_FLUX_AA'])
me = mf*np.sum((lc100['AB_FLUX_AA_ERR']/lc100['AB_FLUX_AA'])**2)**0.5
print(mf, me)
mf = np.mean(lc100['MAG'])
me = mf*np.sum((lc100['MAG_ERR']/lc100['MAG'])**2)**0.5
print(mf, me)
mf = np.mean(lc100['FLUX_AA'])
me = mf*np.sum((lc100['FLUX_AA_ERR']/lc100['FLUX_AA'])**2)**0.5
print(mf, me)
lc100.names
(614067120.916038-614048228.21956)/60<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19173595364071555, 'fraction_numerical': 0.10279667422524566, 'mean_word_length': 5.403225806451613, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 13, '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': '497273', 'license': 'MIT', 'n_tokens_mistral': 2003, 'n_tokens_neox': 1755, 'n_words': 270, 'path': 'ltt1445a_redo.ipynb', 'repo_name': 'davidjwilson/ltt1445', 'size': '3969'}