예제 #1
0
VIDEO = 1     # 0 or 1

# How many data points to train on?  Will be extracted periodically
# from data set.
TRAIN_EVERY = 10

# Fields from "charactercurves.py" extracted from raw data to use for
# training.  Currently: avg, rms, freq, periodicity
inputfields = ['rms', 'periodicity']

########## Load and calculate data

minibees, fields = read_minibees()
mbIds = sort(minibees.keys())

offsets = [find_offsets(minibees[mb]) for mb in mbIds]
ds = [split_data_on_offsets(minibees[mb], o)
      for mb, o in zip(mbIds, offsets)]

curves = [calc_curves((d[VIDEO][:,4]-d[VIDEO][0,4])/30.0,
                      mag(d[VIDEO][:,5:8]), 0.1)
          for d in ds]

tags = read_tags()

frames = curves[1]['time']*30
frametags = [tags.frame_tags(int(ds[1][1][0,3]), f) for f in frames]

def normalized(x):
    return (x - min(x)) / (max(x)-min(x))
예제 #2
0
        'freq': ffreqs,
        'periodicity': periodicity
    }


def plot_curves(t, x):
    curves = calc_curves(t, x, 0.1)
    clf()
    plot(curves['time'], curves['y'], '#DDDDDD')
    plot(curves['time'], curves['avg'], label='running mean')
    plot(curves['time'], curves['rms'], label='running rms')
    plot(curves['time'], curves['freq'], label='avg freq')
    plot(curves['time'], curves['periodicity'] * 200, label='periodicity')
    xlabel('time (min)')
    legend()


if __name__ == "__main__":
    from read_minibees import read_minibees, mag
    minibees, fields = read_minibees()

    for n in {10: minibees[10]}:
        data = minibees[n]
        offsets = find_offsets(data)
        d = split_data_on_offsets(data, offsets)
        # [plot_rms(a[9600:10200,4], a[9600:10200,5])
        #  for a in d if a.shape[0]>10200]
        plot_curves((d[1][:, 4] - d[1][0, 4]) / 30.0, d[1][:, 5])

    show()
예제 #3
0
            'y': fx,
            'avg': avg,
            'rms': rms,
            'freq': ffreqs,
            'periodicity': periodicity}

def plot_curves(t, x):
    curves = calc_curves(t, x, 0.1)
    clf()
    plot(curves['time'], curves['y'], '#DDDDDD')
    plot(curves['time'], curves['avg'], label='running mean')
    plot(curves['time'], curves['rms'], label='running rms')
    plot(curves['time'], curves['freq'], label='avg freq')
    plot(curves['time'], curves['periodicity']*200, label='periodicity')
    xlabel('time (min)')
    legend()

if __name__=="__main__":
    from read_minibees import read_minibees, mag
    minibees, fields = read_minibees()

    for n in {10:minibees[10]}:
        data = minibees[n]
        offsets = find_offsets(data)
        d = split_data_on_offsets(data, offsets)
        # [plot_rms(a[9600:10200,4], a[9600:10200,5])
        #  for a in d if a.shape[0]>10200]
        plot_curves((d[1][:,4]-d[1][0,4])/30.0, d[1][:,5])

    show()