Exemplo n.º 1
0
sens_step = 1
senses = np.arange(sens_min, sens_max, sens_step)

wint = 1

winf_min = 9
winf_max = 51
winf_step = 20
winfs = np.arange(winf_min, winf_max, winf_step)

times = np.genfromtxt(times_file)

ti = times[2]
tf = times[3]

time, data = sft.ctime2data(data_dir, ti, tf)

subject = data[0] # BE SURE TO LOOK AT THE POL11 STUFF TOO!!

# get rid of cruft below about 30MHz
startf = 300

# show only this freq range in the rfi removed plot and SVD plot
plot_if = 0
plot_ff = 2100

t = 250

logdata = np.log10(subject[:,startf:])

plt.title("logdata")
Exemplo n.º 2
0
    ##ADDING THING TO PLOT THE DATA AS COMPUTED FROM THE OFFLINE CROSS AND AUTOS (APPLES TO APPLES)

    #cary over
    #time_start = "20190720_000000"
    #time_stop = "20190720_235959"
    #data_dir = '/project/s/sievers/mars2019/auto_cross/data_auto_cross'
    #plot_dir = '/project/s/sievers/simont/baseband_plots_snap'

    data_dir = opts.data_dir
    plot_dir = opts.outdir
    #print(data_dir)

    logplot = False

    ctime_start = sft.timestamp2ctime(time_start)
    ctime_stop = sft.timestamp2ctime(time_stop)
    print('In cTime from: ' + str(ctime_start) + '. to: ' + str(ctime_stop))

    data_subdirs = sft.time2fnames(ctime_start, ctime_stop, data_dir)
    #lets figure out how to group them
    time_interval = 0
    data_set_index = 0
    temp_data = []
    data_set = []
    print(data_subdirs)
    for index, val in enumerate(data_subdirs):
        if index == 0:
            prev_val = int(os.path.basename(val))

        if time_interval < opts.readlen:
Exemplo n.º 3
0
        '--dsfac',
        dest='dsfac',
        type='int',
        default=True,
        help=
        'Downsampling factor for # time samples (if True, then all time samples are averaged together [default: %default]'
    )
    opts, args = parser.parse_args(sys.argv[1:])

    if len(args) != 2:
        print 'Please specify start and stop times.  Run with -h for more usage info.'
        exit(0)
    time_start = args[0]
    time_stop = args[1]

    ctime_start = sft.timestamp2ctime(time_start)
    ctime_stop = sft.timestamp2ctime(time_stop)
    fnames = sft.time2fnames(ctime_start, ctime_stop, opts.data_dir)
    if len(fnames) == 0:
        print 'No files found in time range'
        exit(0)

    pol00 = None
    pol11 = None
    pol01_mag = None
    pol01_phase = None
    tstamps = []
    for fname in fnames:
        print 'Reading', fname
        fname_sub = fname.split('/')[-1]
        tstamp = fname_sub.split('.')[0]
Exemplo n.º 4
0
import numpy as nm
import SNAPfiletools as sft
import scio, pylab, datetime, time, os

#============================================================

if __name__ == '__main__':

    time_start = '20190720_030000'
    time_stop = '20190720_123000'
    data_dir = '/home/cynthia/working/arctic/data/data_auto_cross'
    logplot = True

    ctime_start = sft.timestamp2ctime(time_start)
    ctime_stop = sft.timestamp2ctime(time_stop)
    time, dat = sft.ctime2data(data_dir, ctime_start, ctime_stop)
    pol00 = dat[0]
    pol11 = dat[1]
    pol01 = dat[2] + 1J * dat[3]

    freq = nm.linspace(0, 125, 2048)

    axrange = [0, 125, 6.5, 8.5]
    myext = nm.array([0, 125, pol01.shape[0], 0])

    pylab.figure(figsize=(16, 8), dpi=300)

    pylab.subplot(1, 2, 1)
    pylab.imshow(nm.log10(pol00),
                 vmin=8,
                 vmax=9.5,
Exemplo n.º 5
0
    parser.add_option('-c', '--ctime', dest='c_flag', action='store_true',
                    help='Use Ctime instead of real time [default: %default]')
    opts, args = parser.parse_args(sys.argv[1:])

    if len(args) != 2:
        print 'Please specify start and stop times.  Run with -h for more usage info.'
        exit(0)
    time_start = args[0]
    time_stop = args[1]

    if opts.c_flag is True:
        ctime_start = int(time_start)
        ctime_stop = int(time_stop)
    else:
        print("how about this")
        ctime_start = sft.timestamp2ctime(time_start)
        ctime_stop = sft.timestamp2ctime(time_stop)

    fnames = sft.time2fnames(ctime_start, ctime_stop, opts.data_dir)
    if len(fnames) == 0:
        print 'No files found in time range'
        exit(0)

    pol00 = None
    pol11 = None
    pol01_mag = None
    pol01_phase = None
    tstamps = []
    
    for fname in fnames:
        print 'Reading', fname
Exemplo n.º 6
0
from subprocess import call

import SNAPfiletools as sft

global_time_start = "20190720_000000"
global_time_stop = "20190720_235959"
time_step = 1  #time step in hours

global_ctime_start = sft.timestamp2ctime(global_time_start)
global_ctime_stop = sft.timestamp2ctime(global_time_stop)

ctime_step = time_step * 3600

for ctime in range(global_ctime_start, global_ctime_stop, ctime_step):
    somename = sft.time2fnames(
        ctime, ctime + ctime_step,
        '/project/s/sievers/mars2019/MARS1/albatros_north_baseband')
    if len(somename) == 0:
        print("Skipped " + str(ctime))
        continue
    call([
        "python", "coarse_cross.py", "-c",
        str(ctime),
        str(ctime + ctime_step)
    ])
Exemplo n.º 7
0
import SNAPfiletools as sft
import numpy as np
import copy
import matplotlib.pyplot as plt
import datetime
from scipy.interpolate import RectBivariateSpline

data_dir = "/home/wizard/mars/data_auto_cross"
plot_dir = "/home/wizard/mars/plots/rfinder"
name = "spline_10MAD"  # string to identify plots saved with these settings
sensitivity = 10  # anything sensitivity*MAD above/below median flagged
cs_freq = 15  # size of spline chunk along frequency axis
cs_time = 125  # size of spline chunk along time axis

ti = sft.timestamp2ctime('20190710_220700') + 3600 * 5
tf = ti + 3600 * 8

time, data = sft.ctime2data(data_dir, ti, tf)

subject = data[0]  # BE SURE TO LOOK AT THE POL11 STUFF TOO!!

# get rid of cruft below about 30MHz
startf = 300

# show only this freq range in the rfi removed plot and SVD plot
plot_if = 0
plot_ff = 2000

logdata = np.log10(subject[:, startf:])

plt.title("logdata")
Exemplo n.º 8
0
import SNAPfiletools as sft
import numpy as np
import matplotlib.pyplot as plt
import datetime

data_dir = "/home/wizard/mars/data_auto_cross"

start_times = [1562729238, 1562813825, 1563069600, 1563163241, 1563334200]
end_times = [1562761369, 1562847270, 1563109200, 1563191400, 1563364800]

# GET ALL RFI DATA (ONLY GETS POL00)
datas = []
for i in range(len(start_times)):
    _, v = sft.ctime2data(data_dir, start_times[i], end_times[i])
    datas.append(v[0])

# NOW PEEK

full_corrected = np.array([[np.nan] * 2048])
for chunk in datas:
    u, s, v = np.linalg.svd(np.log10(chunk), 0)
    s[2:] = 0
    first_two = np.matmul(u, np.matmul(np.diag(s), v))
    corrected = np.log10(chunk) - first_two
    full_corrected = np.vstack(
        (full_corrected, corrected, [[np.nan] * 2048] * 5))

full_corrected = np.delete(full_corrected, 0, axis=0)
print(np.shape(full_corrected))
plt.imshow(full_corrected, aspect='auto', vmin=-1e-2, vmax=1e-2)
plt.show()