PyMcaIO Package

APSMEDFileParser Module

class PyMca5.PyMcaIO.APSMEDFileParser.APSMEDFileParser(filename, sum_all=False)[source]

Bases: object

allmotors()[source]
list()[source]
scanno()[source]

Gives back the number of scans in the file

select(key)[source]

key is of the from s.o scan number, scan order

class PyMca5.PyMcaIO.APSMEDFileParser.APSMEDScan(data, scantype='MCA', identification='1.1', scanheader=None, labels=None, motor_values=None)[source]

Bases: PyMca5.PyMcaIO.SpecFileAbstractClass.SpecFileAbstractScan

allmotorpos()[source]
PyMca5.PyMcaIO.APSMEDFileParser.isAPSMEDFile(filename)[source]
PyMca5.PyMcaIO.APSMEDFileParser.test(filename)[source]

AifiraMap Module

class PyMca5.PyMcaIO.AifiraMap.AifiraMap(filename)[source]

Bases: PyMca5.PyMcaCore.DataObject.DataObject

PyMca5.PyMcaIO.AifiraMap.main()[source]

ArraySave Module

PyMca5.PyMcaIO.ArraySave.getDate()[source]
PyMca5.PyMcaIO.ArraySave.getHDF5FileInstanceAndBuffer(filename, shape, buffername='data', dtype=<type 'numpy.float32'>, interpretation=None, compression=None)[source]
PyMca5.PyMcaIO.ArraySave.main()[source]
PyMca5.PyMcaIO.ArraySave.openHDF5File(name, mode='a', **kwargs)[source]

Open an HDF5 file.

Valid modes (like Python’s file() modes) are: - r Readonly, file must exist - r+ Read/write, file must exist - w Create file, truncate if exists - w- Create file, fail if exists - a Read/write if exists, create otherwise (default)

sorted_with is a callable function like python’s builtin sorted, or None.

PyMca5.PyMcaIO.ArraySave.save2DArrayListAsASCII(datalist, filename, labels=None, csv=False, csvseparator=';')[source]
PyMca5.PyMcaIO.ArraySave.save2DArrayListAsEDF(datalist, filename, labels=None, dtype=None)[source]
PyMca5.PyMcaIO.ArraySave.save2DArrayListAsMonochromaticTiff(datalist, filename, labels=None, dtype=None)[source]
PyMca5.PyMcaIO.ArraySave.save3DArrayAsHDF5(data, filename, axes=None, labels=None, dtype=None, mode='nexus', mcaindex=-1, interpretation=None, compression=None)[source]
PyMca5.PyMcaIO.ArraySave.save3DArrayAsMonochromaticTiff(data, filename, labels=None, dtype=None, mcaindex=-1)[source]

BAXSCSVFileParser Module

class PyMca5.PyMcaIO.BAXSCSVFileParser.BAXSCSVFileParser(filename)[source]

Bases: object

allmotors()[source]
list()[source]
scanno()[source]

Gives back the number of scans in the file

select(key)[source]

key is of the from s.o scan number, scan order

class PyMca5.PyMcaIO.BAXSCSVFileParser.BAXSCSVScan(data, scantype='MCA', identification='1.1', scanheader=None, labels=None, motor_values=None, point=False)[source]

Bases: PyMca5.PyMcaIO.SpecFileAbstractClass.SpecFileAbstractScan

header(key)[source]
mca(number)[source]
nbmca()[source]
class PyMca5.PyMcaIO.BAXSCSVFileParser.BufferedFile(filename)[source]

Bases: object

close()[source]
readline()[source]
PyMca5.PyMcaIO.BAXSCSVFileParser.isBAXSCSVFile(filename)[source]
PyMca5.PyMcaIO.BAXSCSVFileParser.test(filename)[source]

ConfigDict Module

class PyMca5.PyMcaIO.ConfigDict.ConfigDict(defaultdict=None, initdict=None, filelist=None)[source]

Bases: dict

clear()[source]

Clear dictionnary

getfiles()[source]
getlastfile()[source]
read(filelist, sections=None)[source]

read the input filename into the internal dictionary

reset()[source]

Revert to default values

tostring(sections=None)[source]
write(filename, sections=None)[source]

Write the current dictionary to the given filename

PyMca5.PyMcaIO.ConfigDict.main()[source]
PyMca5.PyMcaIO.ConfigDict.prtdict(ddict, lvl=0)[source]

EDFStack Module

class PyMca5.PyMcaIO.EDFStack.EDFStack(filelist=None, imagestack=None, dtype=None)[source]

Bases: PyMca5.PyMcaCore.DataObject.DataObject

getKeyInfo(key)[source]
getSourceInfo()[source]
getXYSelectionArray(coord=(0, 0))[source]
getZSelectionArray(z=0)[source]
isIndexedStack()[source]
loadFileList(filelist, fileindex=0)[source]
loadIndexedStack(filename, begin=None, end=None, skip=None, fileindex=0)[source]
onBegin(n)[source]
onEnd()[source]
onProgress(n)[source]

EdfFile Module

class PyMca5.PyMcaIO.EdfFile.EdfFile(FileName, access=None, fastedf=None)[source]

Bases: object

GetData(*var, **kw)[source]
GetDefaultNumpyType(EdfType, index=None)[source]

Returns NumPy type according Edf type

GetHeader(Index)[source]

Returns dictionary with image header fields. Does not include the basic fields (static) defined by data shape, type and file position. These are get with GetStaticHeader method. Index: The zero-based index of the image in the file

GetNumImages()[source]

Returns number of images of the object (and associated file)

GetPixel(Index, Position)[source]

Returns double value of the pixel, regardless the format of the array Index: The zero-based index of the image in the file Position: Tuple with the coordinete (x), (x,y) or (x,y,z)

GetStaticHeader(Index)[source]

Returns dictionary with static parameters Data format and file position dependent information (dim1,dim2,size,datatype,byteorder,headerId,Image) Index: The zero-based index of the image in the file

WriteImage(*var, **kw)[source]
PyMca5.PyMcaIO.EdfFile.GetDefaultNumpyType(EdfType)[source]

Returns NumPy type according Edf type

PyMca5.PyMcaIO.EdfFile.GetRegion(Arr, Pos, Size)[source]

Returns array with refion of Arr. Arr must be 1d, 2d or 3d Pos and Size are tuples in the format (x) or (x,y) or (x,y,z) Both parameters must have the same size as the dimention of Arr

class PyMca5.PyMcaIO.EdfFile.Image[source]

Bases: object

PyMca5.PyMcaIO.EdfFile.SetDictCase(Dict, Case, Flag)[source]

Returns dictionary with keys and/or values converted into upper or lowercase Dict: input dictionary Case: LOWER_CASE, UPPER_CASE Flag: KEYS, VALUES or KEYS | VALUES

Fit2DChiFileParser Module

class PyMca5.PyMcaIO.Fit2DChiFileParser.Fit2DChiFileParser(filename)[source]

Bases: PyMca5.PyMcaIO.SpecFileAbstractClass.SpecFileAbstractClass

list()[source]
PyMca5.PyMcaIO.Fit2DChiFileParser.isFit2DChiFile(filename)[source]
PyMca5.PyMcaIO.Fit2DChiFileParser.test(filename)[source]

HDF5Stack1D Module

LuciaMap Module

class PyMca5.PyMcaIO.LuciaMap.LuciaMap(filename, infofile=None)[source]

Bases: PyMca5.PyMcaCore.DataObject.DataObject

PyMca5.PyMcaIO.LuciaMap.main()[source]

MEDFile Module

class PyMca5.PyMcaIO.MEDFile.MCA(data=None)[source]

Bases: object

basic MCA spectra

chan2energy(i)[source]

get energy from a channel number

get_calibration()[source]

return calibration constants

get_energy()[source]

return full energy array

class PyMca5.PyMcaIO.MEDFile.MEDFile(filename=None)[source]

Bases: object

MultiElement XRF Data File Format

chan2energy(i, detector=None)[source]

get energy from a channel number

get_calibration(detector=None)[source]

get calibration constants

get_data(detector=None, sum_all=True)[source]

get detector data, if sum_all == False, just the 1 array is returned if sum_all == True, the sum of all detectors is returned, aligned

to the energy of the specified detector
get_energy(detector=None)[source]

get energy array

mca_read_file(fname)[source]

read MCA data file

write_ascii(fname, elem=None, sum_all=True)[source]

write data to ASCII column file

class PyMca5.PyMcaIO.MEDFile.ROI(index=0, left=-1, right=-1, name=None, spectra=None)[source]

Bases: object

simple Region of Interest

counts()[source]

total counts in roi

PyMca5.PyMcaIO.MEDFile.str2float(strin, delim=None)[source]

string of floats to array of floats

PyMca5.PyMcaIO.MEDFile.str2int(strin, delim=None)[source]

string of integers to array of ints

PyMca5.PyMcaIO.MEDFile.str2str(strin, delim=None)[source]

string to array of strings

PyMca5.PyMcaIO.MEDFile.str_converter(strin, delim=None, converter=None)[source]

convert a string of a delimited array to a list

MRCMap Module

class PyMca5.PyMcaIO.MRCMap.MRCMap(filename)[source]

Bases: PyMca5.PyMcaCore.DataObject.DataObject

Class to read MRC files

It reads the spectra into a DataObject instance. This class info member contains all the parsed information. This class data member contains the map itself as a 3D array.

PyMca5.PyMcaIO.MRCMap.isMRCFile(filename)[source]

MarCCD Module

class PyMca5.PyMcaIO.MarCCD.MarCCD(filename)[source]

Bases: object

getData(*var, **kw)[source]
getInfo(*var, **kw)[source]
class PyMca5.PyMcaIO.MarCCD.MccdHeader(fd)[source]

Bases: object

detectorHead = ['detector_type', 'pixelsize_x', 'pixelsize_y']
fileHead = [('filetitle', 128), ('filepath', 128), ('filename', 64), ('acquire_timestamp', 32), ('header_timestamp', 32), ('save_timestamp', 32), ('file_comments', 512)]
formatHead = ['nfast', 'nslow', 'depth']
getDataset()[source]
getDetector()[source]
getFile()[source]
getFormat()[source]
getGonio()[source]
gonioHead = ['xtal_to_detector', 'beam_x', 'beam_y', 'integration_time', 'exposure_time', 'readout_time', 'nreads', 'start_twotheta', 'start_omega', 'start_chi', 'start_kappa', 'start_phi', 'start_delta', 'start_gamma', 'start_xtal_to_detector', 'end_twotheta', 'end_omega', 'end_chi', 'end_kappa', 'end_phi', 'end_delta', 'end_gamma', 'end_xtal_to_detector', 'rotation_axis', 'rotation_range', 'detector_rotx', 'detector_roty', 'detector_rotz']

OlympusCSVFileParser Module

class PyMca5.PyMcaIO.OlympusCSVFileParser.BufferedFile(filename)[source]

Bases: object

close()[source]
readline()[source]
class PyMca5.PyMcaIO.OlympusCSVFileParser.OlympusCSVFileParser(filename)[source]

Bases: object

allmotors()[source]
list()[source]
scanno()[source]

Gives back the number of scans in the file

select(key)[source]

key is of the from s.o scan number, scan order

class PyMca5.PyMcaIO.OlympusCSVFileParser.OlympusCSVScan(data, number, motorValues=None)[source]

Bases: object

alllabels()[source]
allmotorpos()[source]
command()[source]
date()[source]
fileheader()[source]
header(key)[source]
lines()[source]
mca(number)[source]
nbmca()[source]
number()[source]
order()[source]
PyMca5.PyMcaIO.OlympusCSVFileParser.isOlympusCSVFile(filename)[source]
PyMca5.PyMcaIO.OlympusCSVFileParser.test(filename)[source]

OmnicMap Module

class PyMca5.PyMcaIO.OmnicMap.OmnicMap(filename)[source]

Bases: PyMca5.PyMcaCore.DataObject.DataObject

Class to read OMNIC .map files

It reads the spectra into a DataObject instance. This class info member contains all the parsed information. This class data member contains the map itself as a 3D array.

getMapInformation(data)[source]

Internal method to help finding spectra coordinates Parameters: ———–

data : Contents of the .map file
Dictionnary with map gemoetrical acquisition parameters
getOmnicInfo()[source]

Returns a dictionnary with the parsed OMNIC information

getPositionFromIndexAndInfo(index, info=None)[source]

Internal method to obtain the position at which a spectrum was acquired Parameters: ———– index : int

Index of spectrum
info : Dictionnary
Information recovered with _getOmnicInfo
x, y : floats
Position at which the spectrum was acquired.

OpusDPTMap Module

class PyMca5.PyMcaIO.OpusDPTMap.OpusDPTMap(filename)[source]

Bases: PyMca5.PyMcaCore.DataObject.DataObject

PyMca5.PyMcaIO.OpusDPTMap.main()[source]

PilatusCBF Module

Authors: Jerome Kieffer, ESRF
email:jerome.kieffer@esrf.fr

Cif Binary Files images are 2D images written by the Pilatus detector and others. They use a modified (simplified) byte-offset algorithm.

class PyMca5.PyMcaIO.PilatusCBF.CIF(_strFilename=None)[source]

Bases: dict

This is the CIF class, it represents the CIF dictionnary as a a python dictionnary thus inherits from the dict built in class.

BINARY_MARKER = '--CIF-BINARY-FORMAT-SECTION--'
BLANK = [' ', '\t', '\r', '\n', '\r\n', '\n\r']
EOL = ['\r', '\n', '\r\n', '\n\r']
static LoopHasKey(loop, key)[source]

Returns True if the key (string) existe in the array called loop

START_COMMENT = ['"', "'"]
exists(sKey)[source]

Check if the key exists in the CIF and is non empty. @param sKey: CIF key @type sKey: string @param cif: CIF dictionnary @return: True if the key exists in the CIF dictionnary and is non empty @rtype: boolean

existsInLoop(sKey)[source]

Check if the key exists in the CIF dictionnary. @param sKey: CIF key @type sKey: string @param cif: CIF dictionnary @return: True if the key exists in the CIF dictionnary and is non empty @rtype: boolean

static isAscii(_strIn)[source]

Check if all characters in a string are ascii,

@param _strIn: input string @type _strIn: python string @return: boolean @rtype: boolean

loadCHIPLOT(_strFilename)[source]

Load the powder diffraction CHIPLOT file and returns the pd_CIF dictionnary in the object @param _strFilename: the name of the file to open @type _strFilename: string @return: the CIF object corresponding to the powder diffraction @rtype: dictionnary

loadCIF(_strFilename, _bKeepComment=False)[source]

Load the CIF file and returns the CIF dictionnary into the object @param _strFilename: the name of the file to open @type _strFilename: string @param _strFilename: the name of the file to open @type _strFilename: string @return the

readCIF(_strFilename)[source]

Just call loadCIF: Load the CIF file and sets the CIF dictionnary into the object

@param _strFilename: the name of the file to open @type _strFilename: string

saveCIF(_strFilename='test.cif')[source]

Transforms the CIF object in string then write it into the given file @param _strFilename: the of the file to be written @type param: string

class PyMca5.PyMcaIO.PilatusCBF.PilatusCBF(filename)[source]

Bases: object

getData(*var, **kw)[source]
getInfo(*var, **kw)[source]
read(fname)[source]

RTXMap Module

class PyMca5.PyMcaIO.RTXMap.RTXMap(filename)[source]

Bases: PyMca5.PyMcaCore.DataObject.DataObject

Class to read ARTAX .rtx files

PyMca5.PyMcaIO.RTXMap.myFloat(x)[source]
PyMca5.PyMcaIO.RTXMap.test(filename)[source]

SPXFileParser Module

class PyMca5.PyMcaIO.SPXFileParser.SPXFileParser(filename)[source]

Bases: PyMca5.PyMcaIO.SpecFileAbstractClass.SpecFileAbstractClass

PyMca5.PyMcaIO.SPXFileParser.myFloat(x)[source]
PyMca5.PyMcaIO.SPXFileParser.test(filename)[source]

SRSFileParser Module

class PyMca5.PyMcaIO.SRSFileParser.BufferedFile(filename)[source]

Bases: object

close()[source]
readline()[source]
class PyMca5.PyMcaIO.SRSFileParser.SRSFileParser(filename, sum_all=False)[source]

Bases: object

allmotors()[source]
list()[source]
scanno()[source]

Gives back the number of scans in the file

select(key)[source]

key is of the from s.o scan number, scan order

class PyMca5.PyMcaIO.SRSFileParser.SRSScan(data, scantype='MCA', identification='1.1', scanheader=None, labels=None, motor_values=None, point=False)[source]

Bases: PyMca5.PyMcaIO.SpecFileAbstractClass.SpecFileAbstractScan

allmotorpos()[source]
PyMca5.PyMcaIO.SRSFileParser.isSRSFile(filename)[source]
PyMca5.PyMcaIO.SRSFileParser.test(filename)[source]

SpecFileAbstractClass Module

class PyMca5.PyMcaIO.SpecFileAbstractClass.SpecFileAbstractClass(filename)[source]

Bases: object

allmotors()[source]
list()[source]

If there is only one scan returns 1:1 with two scans returns 1:2

scanno()[source]

Gives back the number of scans in the file

select(key)[source]

key is of the from s.o scan number, scan order

class PyMca5.PyMcaIO.SpecFileAbstractClass.SpecFileAbstractScan(data, scantype=None, identification=None, scanheader=None, labels=None, point=True)[source]

Bases: object

alllabels()[source]

These are the labels associated to the counters

allmotorpos()[source]
cols()[source]
command()[source]
data()[source]
datacol(col)[source]
dataline(line)[source]
date()[source]
fileheader()[source]
header(key)[source]
lines()[source]
mca(number)[source]
nbmca()[source]
number()[source]
order()[source]
PyMca5.PyMcaIO.SpecFileAbstractClass.test()[source]

SpecFileStack Module

class PyMca5.PyMcaIO.SpecFileStack.SpecFileStack(filelist=None)[source]

Bases: PyMca5.PyMcaCore.DataObject.DataObject

getKeyInfo(key)[source]
getSourceInfo()[source]
getXYSelectionArray(coord=(0, 0))[source]
getZSelectionArray(z=0)[source]
isIndexedStack()[source]
loadFileList(filelist, fileindex=0, shape=None)[source]
loadIndexedStack(filename, begin=None, end=None, skip=None, fileindex=0)[source]
onBegin(n)[source]
onEnd()[source]
onProgress(n)[source]

SupaVisioMap Module

class PyMca5.PyMcaIO.SupaVisioMap.SupaVisioMap(filename)[source]

Bases: PyMca5.PyMcaCore.DataObject.DataObject

TextImageStack Module

class PyMca5.PyMcaIO.TextImageStack.TextImageStack(filelist=None, imagestack=None, dtype=None)[source]

Bases: PyMca5.PyMcaCore.DataObject.DataObject

getKeyInfo(key)[source]
getSourceInfo()[source]
getXYSelectionArray(coord=(0, 0))[source]
getZSelectionArray(z=0)[source]
isIndexedStack()[source]
loadFileList(filelist, fileindex=0)[source]
loadIndexedStack(filename, begin=None, end=None, skip=None, fileindex=0)[source]
onBegin(n)[source]
onEnd()[source]
onProgress(n)[source]

ThermoEMSFileParser Module

class PyMca5.PyMcaIO.ThermoEMSFileParser.BufferedFile(filename)[source]

Bases: object

close()[source]
readline()[source]
class PyMca5.PyMcaIO.ThermoEMSFileParser.ThermoEMSFileParser(filename)[source]

Bases: object

allmotors()[source]
list()[source]
scanno()[source]

Gives back the number of scans in the file

select(key)[source]

key is of the from s.o scan number, scan order

class PyMca5.PyMcaIO.ThermoEMSFileParser.ThermoEMSScan(data, number, motorValues=None)[source]

Bases: object

alllabels()[source]
allmotorpos()[source]
command()[source]
date()[source]
fileheader()[source]
header(key)[source]
lines()[source]
mca(number)[source]
nbmca()[source]
number()[source]
order()[source]
PyMca5.PyMcaIO.ThermoEMSFileParser.isThermoEMSFile(filename)[source]
PyMca5.PyMcaIO.ThermoEMSFileParser.test(filename)[source]

TiffIO Module

class PyMca5.PyMcaIO.TiffIO.TiffIO(filename, mode=None, cache_length=20, mono_output=False)[source]

Bases: object

close()[source]
getData(nImage, **kw)[source]
getImage(nImage)[source]
getImageFileDirectories(fd=None)[source]
getInfo(nImage, **kw)[source]
getNumberOfImages()[source]
writeImage(image0, info=None, software=None, date=None)[source]

TiffStack Module

class PyMca5.PyMcaIO.TiffStack.TiffArray(filelist, shape, dtype, imagestack=True)[source]

Bases: object

dtype
getDtype()[source]
getShape()[source]
getSize()[source]
shape
size
class PyMca5.PyMcaIO.TiffStack.TiffStack(filelist=None, imagestack=None, dtype=None)[source]

Bases: PyMca5.PyMcaCore.DataObject.DataObject

loadFileList(filelist, dynamic=False, fileindex=0)[source]
loadIndexedStack(filename, begin=None, end=None, skip=None, fileindex=0)[source]
onBegin(n)[source]
onEnd()[source]
onProgress(n)[source]
PyMca5.PyMcaIO.TiffStack.test()[source]

specfilewrapper Module

class PyMca5.PyMcaIO.specfilewrapper.BufferedFile(filename)[source]

Bases: object

close()[source]
readline()[source]
PyMca5.PyMcaIO.specfilewrapper.Specfile(filename)[source]
class PyMca5.PyMcaIO.specfilewrapper.myscandata(data, scantype=None, identification=None, scanheader=None, qxas=None, labels=None, fileheader=None)[source]

Bases: object

alllabels()[source]
allmotorpos()[source]
cols()[source]
command()[source]
data()[source]
datacol(col)[source]
dataline(line)[source]
date()[source]
fileheader(key='')[source]
header(key)[source]
lines()[source]
mca(number)[source]
nbmca()[source]
number()[source]
order()[source]
PyMca5.PyMcaIO.specfilewrapper.safe_str(bytesObject)[source]
class PyMca5.PyMcaIO.specfilewrapper.specfilewrapper(filename, amptek=None, qxas=None, dta=None)[source]

Bases: object

list()[source]
scanno()[source]
select(i)[source]

spswrap Module

PyMca5.PyMcaIO.spswrap.getarrayinfo(spec, shm)[source]
PyMca5.PyMcaIO.spswrap.getarraylist(spec)[source]
PyMca5.PyMcaIO.spswrap.getdata(spec, shm)[source]
PyMca5.PyMcaIO.spswrap.getdatacol(spec, shm, idx)[source]
PyMca5.PyMcaIO.spswrap.getdatarow(spec, shm, idx)[source]
PyMca5.PyMcaIO.spswrap.getenv(spec, shmenv, key)[source]
PyMca5.PyMcaIO.spswrap.getinfo(spec, shm)[source]
PyMca5.PyMcaIO.spswrap.getkeylist(spec, shmenv)[source]
PyMca5.PyMcaIO.spswrap.getmetadata(spec, shm)[source]
PyMca5.PyMcaIO.spswrap.getspeclist()[source]
PyMca5.PyMcaIO.spswrap.isupdated(spec, shmenv)[source]
PyMca5.PyMcaIO.spswrap.putenv(spec, shmenv, cmd, outp)[source]
PyMca5.PyMcaIO.spswrap.specrunning(spec)[source]
PyMca5.PyMcaIO.spswrap.updatedone(spec, shmenv)[source]