Example #1
0
def checkOAfile(afile, verbose=0):
    """ Return pointer to array file
    Automatically check for compressed array files
    """
    af = oapackage.arrayfile_t(afile, verbose)
    nm = af.filename
    if af.isopen():
        return nm
    else:
        return None
Example #2
0
def checkOAfile(afile, verbose=0):
    """ Return pointer to array file

    Automatically check for compressed array files

    Args:
        afile (str): location of array file
    Returns:
        arrayfile_t or None
    """
    af = oapackage.arrayfile_t(afile, verbose)
    nm = af.filename
    if af.isopen():
        return nm
    else:
        return None
Example #3
0
def oaIsBinary(afile):
    """ Return true if array file is in binary format """
    af = oapackage.arrayfile_t(afile)
    ret = af.isbinary()
    af.closefile()
    return ret
Example #4
0
def oainfo(afile, verbose=1):
    """ Print information about a file containing arrays """
    af = oapackage.arrayfile_t(afile, verbose)
    print(af.showstr())
    af.closefile()
Example #5
0
def oaIsBinary(filename):
    """ Return true if array file is in binary format """
    af = oapackage.arrayfile_t(filename)
    ret = af.isbinary()
    af.closefile()
    return ret
Example #6
0
def oainfo(filename, verbose=1):
    """ Print information about a file containing arrays """
    af = oapackage.arrayfile_t(filename, verbose)
    print(af.showstr())
    af.closefile()
Example #7
0
oaformat=args.format
inputfile=args.inputfile
outputfile=args.outputfile

#%%
if __name__=='__main__' and 0: 
    # testing           
    inputfile='/home/eendebakpt/tmp/mee3.oa'
    outputfile='/home/eendebakpt/tmp/test.oa'
    fname='eoc'
    oaformat='T'    
    verbose=2       
#%% Load file

fmode=oapackage.arrayfile_t.parseModeString(oaformat)
infile = oapackage.arrayfile_t(inputfile)
narrays=infile.narrays
#outfile = oapackage.arrayfile_t(outputfile, infile.nrows, infile.ncols, -1, fmode )

if not infile.isopen():
    raise Exception('could not open file %s' % inputfile)

print('oaselect: reading %d arrays from %s' % (infile.narrays, inputfile) )

#%% Loop over the arrays
outlist=[]

if narrays==-1:
    narrays=oapackage.arrayfile_t.NARRAYS_MAX
for ii in range(narrays):
    oapackage.tprint('oaselect: parse array %d/%d'  % (ii, narrays) )