ImageD11.columnfile module#

class ImageD11.columnfile.NewPandasColumnfile(titles)#

Bases: PandasColumnfile

Just like a columnfile, but for creating new files

class ImageD11.columnfile.PandasColumnfile(filename=None, new=False)#

Bases: columnfile

addcolumn(col, name)#

Add a new column col to the object with name “name” Overwrites in the case that the column already exists

copy()#

Returns a (deep) copy of the columnfile

copyrows(rows)#

Returns a copy of select rows of the columnfile

filter(mask)#

mask is an nrows long array of true/false

getcolumn(name)#

Gets data, if column exists

property ncols#
property nrows#
readfile(filename)#

Reads in an ascii columned file

removerows(column_name, values, tol=0)#

removes rows where self.column_name == values values is a list of values to remove column name should be in self.titles tol is for floating point (fuzzy) comparisons versus integer

reorder(indices)#

Put array into the order given by indices … normally indices would come from np.argsort of something

setcolumn(col, name)#

Add a new column col to the object with name “name” Overwrites in the case that the column already exists

sortby(name)#

Sort arrays according to column named “name”

property titles#
writefile(filename)#

write an ascii columned file

ImageD11.columnfile.add_nexus_attributes(group)#
ImageD11.columnfile.bench()#

Compares the timing for reading with columfile versus np.loadtxt

ImageD11.columnfile.clean(str_lst)#

trim whitespace from titles

ImageD11.columnfile.colfile2db(colfilename, dbname)#

Read the columnfile into a database Ignores parameter metadata (not used yet)

ImageD11.columnfile.colfile_from_dict(c)#

convert from a dictonary of numpy arrays

ImageD11.columnfile.colfile_from_hdf(hdffile, name=None, obj=None)#

Read a columnfile from a hdf file FIXME TODO - add the parameters somewhere (attributes??)

ImageD11.columnfile.colfile_to_hdf(colfile, hdffile, name=None, compression=None, compression_opts=None)#

Copy a columnfile into hdf file FIXME TODO - add the parameters somewhere (attributes??)

ImageD11.columnfile.colfileobj_to_hdf(cf, hdffile, name=None)#

Save a columnfile into hdf file format FIXME TODO - add the parameters somewhere (attributes??)

class ImageD11.columnfile.columnfile(filename=None, new=False)#

Bases: object

Class to represent an ascii file containing multiple named columns

addcolumn(col, name)#

Add a new column col to the object with name “name” Overwrites in the case that the column already exists

property bigarray#
chkarray()#

Ensure self.bigarray holds our attributes

copy()#

Returns a (deep) copy of the columnfile

copyrows(rows)#

Returns a copy of select rows of the columnfile

copyrows_cols(rows, cols)#

Returns a copy of select rows AND select columns of the columnfile. rows : bool mask or integer index array over rows cols : list of column names to keep (others are dropped, saving memory) Like copyrows, but narrows to cols so unwanted columns are never copied.

filter(mask)#

mask is an nrows long array of true/false

get_bigarray()#
getcolumn(name)#

Gets data, if column exists

keys()#
readfile(filename)#

Reads in an ascii columned file

removerows(column_name, values, tol=0)#

removes rows where self.column_name == values values is a list of values to remove column name should be in self.titles tol is for floating point (fuzzy) comparisons versus integer

reorder(indices)#

Put array into the order given by indices … normally indices would come from np.argsort of something

set_attributes()#

Set object vars to point into the big array

set_bigarray(ar)#
setcolumn(col, name)#
setparameters(pars)#

update the parameters

sortby(name)#

Sort arrays according to column named “name”

updateGV(pars=None, translation=None, fast=True)#

This only computes gvectors

updateGeometry(pars=None, translation=None, fast=True)#
changing or not the parameters it (re)-computes:

xl,yl,zl = ImageD11.transform.compute_xyz_lab tth, eta = ImageD11.transform.compute_tth_eta gx,gy,gz = ImageD11.transform.compute_g_vectors ds = length of scattering vectors

The option “fast=True” means using the newer C code from ImageD11.transform.Ctransform rather than the older python ImageD11.transform code. We keep it for testing.

writefile(filename)#

write an ascii columned file

ImageD11.columnfile.fillcols(lines, cols)#
ImageD11.columnfile.mmap_h5colf(fname, path='peaks', mode='r')#

From: https://gist.github.com/anonymous/19814198398da86b8f98

The columnfile must have non-compressed data

Memory maps the underlying array for read only data. You will need to use something like copyrows on the result.

class ImageD11.columnfile.newcolumnfile(titles)#

Bases: columnfile

Just like a columnfile, but for creating new files