Ejemplo n.º 1
0
def hrc_dose_make_data_html(indir='NA', outdir='NA'):
    """
    read hrc database, and create html page: 
    input:  indir   --- data directory
            outdir  --- output direcotry
    """
    if indir == 'NA':
        indir = data_out

    if outdir == 'NA':
        outdir = data_out

    for hrc in ('hrci', 'hrcs'):
        #
        #--- just in a case, clear up the files before reading them
        #
        expf.clean_data(indir)
        #
        #--- read HRC histrical data
        #
        data = expf.readExpData(indir, hrc)
        #
        #--- create a HTML page to display histrical data
        #
        print_html_page(indir, outdir, hrc, data)
Ejemplo n.º 2
0
def acis_dose_plot_exposure_stat(indir='NA',
                                 outdir='NA',
                                 clean='NA',
                                 comp_test='NA'):

    'read acis database, and plot history of exposure. input: data directory path, output directory path '
    #
    #--- setting indir and outdir if not given
    #
    if indir == 'NA':
        indir = data_out

    if outdir == 'NA':
        outdir = plot_dir
#
#--- clean up the data sets before reading
#
    if clean != 'NA':
        expf.clean_data(indir)

#
#--- start plotting data
#
    for ccd in ('i_2', 'i_3', 's_2', 's_3'):
        for sec in range(0, 4):

            inst = ccd + '_n_' + str(sec)

            [date, mean_dff, min_dff, max_dff, s1_dff, s2_dff,
             s3_dff] = read_data(indir, inst, 'dff')
            [date, mean_acc, min_acc, max_acc, s1_acc, s2_acc,
             s3_acc] = read_data(indir, inst, 'acc')

            #
            #--- plot data
            #
            plot_acis_dose(date, mean_acc, min_acc, max_acc, s1_acc, s2_acc,
                           s3_acc, mean_dff, min_dff, max_dff, s1_dff, s2_dff,
                           s3_dff)

            #
            #--- move to the plot directory
            #
            outfile = inst + '.png'
            #            cmd     = 'mv acis.png ' + plot_dir +  outfile
            #            os.system(cmd)
            if comp_test == 'test':
                cmd = 'convert acis.png -trim ' + test_plot_dir + outfile
            else:
                cmd = 'convert acis.png -trim ' + plot_dir + outfile

            os.system(cmd)
            os.system('rm acis.png')
Ejemplo n.º 3
0
def hrc_dose_plot_exposure_stat(indir='NA', outdir='NA', clean='NA'):
    """
    read hrc database, and plot history of exposure. 
    input:  indir   --- data directory path 
            outdir  --- output directory path 
    output: outdir/<hrc>.png
    """
    #
    #--- setting indir and outdir if not given
    #
    if indir == 'NA':
        indir = data_out

    if outdir == 'NA':
        outdir = plot_dir
#
#--- clean up the data sets before reading
#
    if clean != 'NA':
        expf.clean_data(indir)
#
#--- start plotting data
#
    for detector in ('hrci', 'hrcs'):
        #
        #--- read data
        #
        idata = expf.readExpData(indir, detector)
        #
        #--- plot data
        #
        try:
            plot_hrc_dose(idata)
            #
            #--- trim the edge of the plot and move to the plot directory
            #
            outfile = detector + '.png'
            cmd = 'convert hrc.png -trim ' + plot_dir + detector + '.png'
            os.system(cmd)

            mcf.rm_files('hrc.png')
        except:
            pass
def acis_dose_plot_exposure_stat(indir = 'NA', outdir = 'NA', clean = 'NA', comp_test = 'NA'):

    'read acis database, and plot history of exposure. input: data directory path, output directory path '
#
#--- setting indir and outdir if not given
#
    if indir   == 'NA':
        indir   = data_out

    if outdir  == 'NA':
        outdir  = plot_dir
#
#--- clean up the data sets before reading
#
    if clean != 'NA':
        expf.clean_data(indir)

#
#--- start plotting data
#
    for ccd in ('i_2', 'i_3', 's_2', 's_3'):
        for sec in range(0, 4):

            inst = ccd + '_n_' + str(sec)
        
            [date,  mean_dff, min_dff, max_dff, s1_dff, s2_dff, s3_dff] =  read_data(indir, inst, 'dff')
            [date,  mean_acc, min_acc, max_acc, s1_acc, s2_acc, s3_acc] =  read_data(indir, inst, 'acc')

#
#--- plot data
#
            plot_acis_dose(date, mean_acc, min_acc, max_acc, s1_acc, s2_acc, s3_acc, mean_dff, min_dff, max_dff, s1_dff, s2_dff, s3_dff)

#
#--- move to the plot directory
#
            outfile = inst + '.png'
            cmd     = 'mv acis.png ' + plot_dir +  outfile
            os.system(cmd)
def acis_dose_plot_exposure_stat(indir='NA', outdir='NA', clean='NA'):
    """
    read acis database, and plot history of exposure. 
    input:  indir   --- input directory
            outdir  --- output directory
            clean   --- if not 'NA', clean up the data sets before plotting the data
    output: <outdir>/<inst>.png
    """
#
#--- setting indir and outdir if not given
#
    if indir   == 'NA':
        indir   = data_out

    if outdir  == 'NA':
        outdir  = plot_dir
#
#--- clean up the data sets before reading
#
    if clean != 'NA':
        expf.clean_data(indir)
#
#--- start plotting data
#
    for ccd in ('i_2', 'i_3', 's_2', 's_3'):
        for sec in range(0, 4):
            inst = ccd + '_n_' + str(sec)
            idata = expf.readExpData(indir, inst)
#
#--- plot data
#
            plot_acis_dose(idata)
#
#--- trim the edge and move to the plot directory
#
            cmd = 'convert acis.png -trim ' + outdir + inst + '.png' 
            os.system(cmd)
            mcf.rm_files('rm acis.png')
Ejemplo n.º 6
0
def hrc_dose_make_data_html(indir = 'NA', outdir = 'NA', indir2 = 'NA', outdir2 = 'NA', comp_test = 'NA'):

    'read hrc database, and create html page: input: indir (data directory)'

#
#--- setting indir and outdir if not given
#
    if comp_test == 'test':
        indir   = test_data_out
        outdir  = test_data_out
        indir2  = test_data_out_hrc
        outdir2 = test_data_out_hrc
    else:
        if indir   == 'NA':
            indir   = data_out
    
        if outdir  == 'NA':
            outdir  = data_out
    
        if indir2  == 'NA':
            indir2  = data_out_hrc
    
        if outdir2 == 'NA':
            outdir2 = data_out_hrc

    for hrc in ('hrci', 'hrcs'):

#
#--- center exposure map --------
#

#
#--- just in a case, clear up the files before reading them
#
        expf.clean_data(indir)

#
#--- read HRC histrical data
#
        [date,year,month,mean_acc,std_acc,min_acc,min_apos, max_acc,max_apos,asig1, asig2, asig3, mean_dff,std_dff, \
                      min_dff, min_dpos,max_dff,max_dpos,dsig1, dsig2, dsig3] = expf.readExpData(indir,hrc)
        
#
#--- create a HTML page to display histrical data
#
        printHtml(indir, outdir,  hrc, date, year,month,mean_acc,std_acc,min_acc,min_apos,max_acc,max_apos, asig1, asig2, asig3, \
                           mean_dff,std_dff,min_dff,min_dpos,max_dff,max_dpos, dsig1, dsig2, dsig3)

#
#--- full exposure map --------
#

#
#--- just in a case, clear up the files before reading them
#
#        expf.clean_data(indir2)


        for i in range(0,10):
            if hrc == 'hrci' and i == 9:
                break

            hrc2 = hrc + '_' + str(i)           #--- naming is slightly different from the center exposure maps
#
#--- read HRC histrical data --- sec='full' indicating reading full exposure maps
#
            [date,year,month,mean_acc,std_acc,min_acc,min_apos, max_acc,max_apos,asig1, asig2, asig3, mean_dff,std_dff, \
                      min_dff, min_dpos,max_dff,max_dpos,dsig1, dsig2, dsig3] = expf.readExpData(indir2, hrc2)
#
#--- create a HTML page to display histrical data
#
            printHtml(indir2, outdir2, hrc2, date, year,month,mean_acc,std_acc,min_acc,min_apos,max_acc,max_apos, asig1, asig2, asig3, \
                           mean_dff,std_dff,min_dff,min_dpos,max_dff,max_dpos, dsig1, dsig2, dsig3)
def acis_dose_plot_exposure_stat(indir='NA',
                                 outdir='NA',
                                 indir2='NA',
                                 outdir2='NA',
                                 clean='NA'):

    'read acis database, and plot history of exposure. input: data directory path, output directory path '
    #
    #--- setting indir and outdir if not given
    #
    if indir == 'NA':
        indir = data_out

    if outdir == 'NA':
        outdir = plot_dir
#
#--- clean up the data sets before reading
#
    if clean != 'NA':
        expf.clean_data(indir)

#
#--- start plotting data
#
    for ccd in ('i_2', 'i_3', 's_2', 's_3'):
        for sec in range(0, 4):

            inst = ccd + '_n_' + str(sec)

            date = []
            year = []
            month = []
            mean_acc = []
            std_acc = []
            min_acc = []
            min_apos = []
            max_acc = []
            max_apos = []
            m10_acc = []
            m10_apos = []
            mean_dff = []
            std_dff = []
            min_dff = []
            min_dpos = []
            max_dff = []
            max_dpos = []
            m10_dff = []
            m10_dpos = []

            expf.readExpData(indir, inst, date, year,month,mean_acc,std_acc,min_acc,min_apos,  max_acc,max_apos,m10_acc, \
                      m10_apos,mean_dff,std_dff,min_dff, min_dpos,max_dff,max_dpos,m10_dff,m10_dpos)

            #
            #--- plot data
            #
            plot_acis_dose(date, mean_dff, max_dff, m10_dff, mean_acc, max_acc,
                           m10_acc)

            #
            #--- move to the plot directory
            #
            outfile = inst + '.gif'
            cmd = 'convert acis.png ' + plot_dir + outfile
            os.system(cmd)
            os.system('rm acis.png')
Ejemplo n.º 8
0
def hrc_dose_plot_exposure_stat(indir='NA',
                                indir2='NA',
                                outdir='NA',
                                clean='NA',
                                comp_test='NA'):

    'read hrc database, and plot history of exposure. input: data directory path, output directory path '
    #
    #--- setting indir and outdir if not given
    #
    if indir == 'NA':
        indir = data_out  #---- data for the central part

    if indir2 == 'NA':
        indir2 = data_out_hrc  #---- data for the full exposure

    if outdir == 'NA':
        outdir = plot_dir
#
#--- clean up the data sets before reading
#
    if clean != 'NA':
        expf.clean_data(indir)

#
#--- start plotting data
#
    for detector in ('hrci', 'hrcs'):
        #
        #--- full data plot-------------
        #
        for section in range(0, 10):
            if detector == 'hrci' and section == 9:
                continue

            inst = detector + '_' + str(section)

            [date, mean_dff, min_dff, max_dff, s1_dff, s2_dff,
             s3_dff] = read_data(indir2, inst, 'dff')
            [date, mean_acc, min_acc, max_acc, s1_acc, s2_acc,
             s3_acc] = read_data(indir2, inst, 'acc')
            #
            #--- plot data
            #
            plot_hrc_dose(date, mean_acc, min_acc, max_acc, s1_acc, s2_acc,
                          s3_acc, mean_dff, min_dff, max_dff, s1_dff, s2_dff,
                          s3_dff)

            #
            #--- move to the plot directory
            #
            outfile = inst + '.png'
            cmd = 'mv hrc.png ' + plot_dir_full + outfile
            os.system(cmd)
#
#--- central part of the data---------
#

        [date, mean_dff, min_dff, max_dff, s1_dff, s2_dff,
         s3_dff] = read_data(indir, detector, 'dff')
        [date, mean_acc, min_acc, max_acc, s1_acc, s2_acc,
         s3_acc] = read_data(indir, detector, 'acc')
        #
        #--- plot data
        #
        plot_hrc_dose(date, mean_acc, min_acc, max_acc, s1_acc, s2_acc, s3_acc,
                      mean_dff, min_dff, max_dff, s1_dff, s2_dff, s3_dff)

        #
        #--- move to the plot directory
        #
        outfile = detector + '.png'
        cmd = 'mv hrc.png ' + plot_dir + outfile
        os.system(cmd)
def hrc_dose_plot_exposure_stat(indir = 'NA', indir2 = 'NA', outdir = 'NA', clean = 'NA', comp_test = 'NA'):

    'read hrc database, and plot history of exposure. input: data directory path, output directory path '
#
#--- setting indir and outdir if not given
#
    if indir   == 'NA':
        indir   = data_out                      #---- data for the central part

    if indir2  == 'NA':
        indir2  = data_out_hrc                  #---- data for the full exposure

    if outdir  == 'NA':
        outdir  = plot_dir
#
#--- clean up the data sets before reading
#
    if clean != 'NA':
        expf.clean_data(indir)

#
#--- start plotting data
#
    for detector in ('hrci', 'hrcs'):
#
#--- full data plot-------------
#
        for section in range(0, 10):
            if detector == 'hrci' and section == 9:
                continue

            inst = detector + '_' + str(section)
        
            [date,  mean_dff, min_dff, max_dff, s1_dff, s2_dff, s3_dff] =  read_data(indir2, inst, 'dff')
            [date,  mean_acc, min_acc, max_acc, s1_acc, s2_acc, s3_acc] =  read_data(indir2, inst, 'acc')
#
#--- plot data
#
            try:
                plot_hrc_dose(date, mean_acc, min_acc, max_acc, s1_acc, s2_acc, s3_acc, mean_dff, min_dff, max_dff, s1_dff, s2_dff, s3_dff)

#
#--- move to the plot directory
#
                outfile = inst + '.png'
                cmd     = 'mv hrc.png ' + plot_dir_full +  outfile
                os.system(cmd)
            except:
                pass
#
#--- central part of the data---------
#
        
        [date,  mean_dff, min_dff, max_dff, s1_dff, s2_dff, s3_dff] =  read_data(indir, detector, 'dff')
        [date,  mean_acc, min_acc, max_acc, s1_acc, s2_acc, s3_acc] =  read_data(indir, detector, 'acc')
#
#--- plot data
#
        try:
            plot_hrc_dose(date, mean_acc, min_acc, max_acc, s1_acc, s2_acc, s3_acc, mean_dff, min_dff, max_dff, s1_dff, s2_dff, s3_dff)

#
#--- move to the plot directory
#
            outfile = detector + '.png'
            cmd     = 'mv hrc.png ' + plot_dir +  outfile
            os.system(cmd)
        except:
            pass
Ejemplo n.º 10
0
def hrc_dose_make_data_html(indir='NA',
                            outdir='NA',
                            indir2='NA',
                            outdir2='NA',
                            comp_test='NA'):

    'read hrc database, and create html page: input: indir (data directory)'

    #
    #--- setting indir and outdir if not given
    #
    if comp_test == 'test':
        indir = test_data_out
        outdir = test_data_out
        indir2 = test_data_out_hrc
        outdir2 = test_data_out_hrc
    else:
        if indir == 'NA':
            indir = data_out

        if outdir == 'NA':
            outdir = data_out

        if indir2 == 'NA':
            indir2 = data_out_hrc

        if outdir2 == 'NA':
            outdir2 = data_out_hrc

    for hrc in ('hrci', 'hrcs'):

        #
        #--- center exposure map --------
        #

        #
        #--- just in a case, clear up the files before reading them
        #
        expf.clean_data(indir)

        #
        #--- read HRC histrical data
        #
        [date,year,month,mean_acc,std_acc,min_acc,min_apos, max_acc,max_apos,asig1, asig2, asig3, mean_dff,std_dff, \
                      min_dff, min_dpos,max_dff,max_dpos,dsig1, dsig2, dsig3] = expf.readExpData(indir,hrc)

        #
        #--- create a HTML page to display histrical data
        #
        printHtml(indir, outdir,  hrc, date, year,month,mean_acc,std_acc,min_acc,min_apos,max_acc,max_apos, asig1, asig2, asig3, \
                           mean_dff,std_dff,min_dff,min_dpos,max_dff,max_dpos, dsig1, dsig2, dsig3)

        #
        #--- full exposure map --------
        #

        #
        #--- just in a case, clear up the files before reading them
        #
        #        expf.clean_data(indir2)

        for i in range(0, 10):
            if hrc == 'hrci' and i == 9:
                break

            hrc2 = hrc + '_' + str(
                i
            )  #--- naming is slightly different from the center exposure maps
            #
            #--- read HRC histrical data --- sec='full' indicating reading full exposure maps
            #
            [date,year,month,mean_acc,std_acc,min_acc,min_apos, max_acc,max_apos,asig1, asig2, asig3, mean_dff,std_dff, \
                      min_dff, min_dpos,max_dff,max_dpos,dsig1, dsig2, dsig3] = expf.readExpData(indir2, hrc2)
            #
            #--- create a HTML page to display histrical data
            #
            printHtml(indir2, outdir2, hrc2, date, year,month,mean_acc,std_acc,min_acc,min_apos,max_acc,max_apos, asig1, asig2, asig3, \
                           mean_dff,std_dff,min_dff,min_dpos,max_dff,max_dpos, dsig1, dsig2, dsig3)
def acis_dose_plot_exposure_stat(indir = 'NA', outdir = 'NA', indir2 = 'NA', outdir2 = 'NA', clean = 'NA'):

    'read acis database, and plot history of exposure. input: data directory path, output directory path '
#
#--- setting indir and outdir if not given
#
    if indir   == 'NA':
        indir   = data_out

    if outdir  == 'NA':
        outdir  = plot_dir
#
#--- clean up the data sets before reading
#
    if clean != 'NA':
        expf.clean_data(indir)

#
#--- start plotting data
#
    for ccd in ('i_2', 'i_3', 's_2', 's_3'):
        for sec in range(0, 4):

            inst = ccd + '_n_' + str(sec)


            date     = []
            year     = []
            month    = []
            mean_acc = []
            std_acc  = []
            min_acc  = []
            min_apos = []
            max_acc  = []
            max_apos = []
            m10_acc  = []
            m10_apos = []
            mean_dff = []
            std_dff  = []
            min_dff  = []
            min_dpos = []
            max_dff  = []
            max_dpos = []
            m10_dff  = []
            m10_dpos = []
        
            expf.readExpData(indir, inst, date, year,month,mean_acc,std_acc,min_acc,min_apos,  max_acc,max_apos,m10_acc, \
                      m10_apos,mean_dff,std_dff,min_dff, min_dpos,max_dff,max_dpos,m10_dff,m10_dpos)

#
#--- plot data
#
            plot_acis_dose(date, mean_dff, max_dff, m10_dff,  mean_acc, max_acc, m10_acc)

#
#--- move to the plot directory
#
            outfile = inst + '.gif'
            cmd = 'convert acis.png ' + plot_dir +  outfile
            os.system(cmd)
            os.system('rm acis.png')