Skip to content
Snippets Groups Projects
Select Git revision
  • 6b44e1c18aa30e56692841b546588f3e702f509c
  • master default protected
  • feature-spike-check-202407
  • submodule_migration
  • feature-add-test-vars
  • feature-replace-wrappers
  • spike_check
  • marco_tmp
  • update_checks
  • m64_r20241211
  • m64_r20230815
  • m64_r20230710
  • m64_r20220321
  • m64_r20211220
  • m64_r20211123
  • m64_r20210927
  • m64_r20210722
  • m64_r20210719
  • m64_r20210623
  • m64_r20210524
  • m64_r20210518
  • m64_r20210428
  • m64_r20210408
  • m64_r20200820
  • m64_r20200713
  • m64_r20200630
26 results

testing_bst.py

Blame
  • user avatar
    Coda Phillips authored
    6b44e1c1
    History
    testing_bst.py 3.22 KiB
    import os
    import argparse
    
    import pandas as pd
    import matplotlib.pyplot as plt
    from scipy import arange
    
    from aeri_tools.io.dmv import housekeeping
    
    def main(path, bounds = None):
    
        #plt.rcParams['figure.figsize'] = [25, 15]
        data = housekeeping.get_all_housekeeping(path)
        if bounds != None:
            data = data[(data['Time'] > bounds[0]) & (data['Time'] < bounds[1])]
        variables = ['BBsupportStructureTemp', 'HBBapexTemp', 'HBBbottomTemp', 
                    'HBBtopTemp', 'ABBapexTemp', 'ABBbottomTemp', 'ABBtopTemp',
                    'airNearBBsTemp', 'SCEtemp', 'sceneMirrorPosition']
        fig, ax = plt.subplots(len(variables),figsize=(25,15),sharex=True)
        for x,v in enumerate(variables):
            name = v + ' '*30
            plt.sca(ax[x])
            plt.grid()
            #ax = plt.subplot(len(vars), 1, x+1)
            plt.xticks(arange(0,25))
            #ax.grid(True)
            plt.ylabel(name, rotation=0)
            plt.plot(data['Time'], data[v])
        '''
        plt.sca(ax[0])
        plt.plot(data['Time'], data['BBsupportStructureTemp'])
        plt.sca(ax[1])
        plt.plot(dmv['Time'], data['sceneMirrorPosition'])
        '''
        plt.savefig('/Users/adiebold/aeri_quality_control/testing/testing_bst/graphs/sgp_' + path[-12:-6] + '.png')
        # plt.savefig('/Users/adiebold/aeri_quality_control/testing/bst_' + path[-12:-6] + '.png')
        # print('/Users/adiebold/aeri_quality_control/testing/testing_bst/graphs/HBB' + path[-12:-6] + '.png')
        # plt.show()
        plt.clf()
    
    
    if __name__ == '__main__':
        '''
        files = (['151130', (9, 13)], ['151201', (18, 20)], ['151202', (7, 11)],
                ['151205', (9, 11)], ['151207', (9, 11)])
    
        for f in files:
            f[0] = 'awr/AE' + f[0] + '/' + f[0] + 'B1.CXS'
            main(f[0], f[1])
    
        '''
        parser = argparse.ArgumentParser()
        parser.add_argument('filepath')
        args = parser.parse_args()
        print(args.filepath)
    
        #amount of files to skip
        skip_num = 85
        curr_num = 0
        print('skip_num = ', skip_num, '\n')
        if os.path.isdir(args.filepath):
            for filename_1 in os.listdir(args.filepath):
                filename_1 = args.filepath + '/' + filename_1
                filename_1 = filename_1.replace('//', '/')
                if os.path.isdir(filename_1):
                    for filename_2 in os.listdir(filename_1):
                        filename_2 = filename_1 + '/' + filename_2
                        filename_2 = filename_2.replace('//', '/')
                        if (os.path.isfile(filename_2)
                        and filename_2.endswith('B1.CXS')):
                            curr_num += 1
                            if curr_num >= skip_num:
                                print(curr_num, ': ', filename_2)
                                main(filename_2)
                            else:
                                print(curr_num, ': ', filename_2, ' -- SKIPPED')
                elif os.path.isfile(filename_1) and filename_1.endswith('B1.CXS'):
                    curr_num += 1
                    if curr_num >= skip_num:
                        print(curr_num, ': ', filename_1)
                        main(filename_1)
                    else:
                        print(curr_num, ': ', filename_1, ' -- SKIPPED')
        elif os.path.isfile(args.filepath):
            if args.filepath.endswith('B1.CXS'):
                print(args.filepath)
                main(args.filepath)