API#

Classes summary#

pyIBA.main_idf()

Main engime of pyIDF.

pyIBA.IDF([filepath])

If a file path is given, the information is loaded from an existing file (i.e.

pyIBA.codes.NDF.NDF()

Class focusing the NDF part of the IDF.

pyIBA.IDF class#

class pyIBA.IDF.IDF(filepath='')#

If a file path is given, the information is loaded from an existing file (i.e. it calls load_file()). Otherwise, it creates a blank object (i.e. it call new_file()).

Args:

filepath (str, optional, default = ‘’): Path to the IDF file, if ‘’ the IDF object is blank

load_file(filename)#

Loads data from a IDF file into an IDF object.

Parameters:

filename (str) – path to the IDF file.

new_file()#

Creates a new IDF file.

pyIBA.main_idf class#

class pyIBA.main_idf.main_idf#

Main engime of pyIDF. This classes contains all of the methods to edit the fundamental XML schema for the IDF files. Note that the analysis entries have their own distinct classes and XML schemas.

append_simulation_entry(total_simulations, spectra_id=0)#

Change the total number of simulation entries of spectrum = spectra_id.

Parameters:
  • total_simulations (int) – New total number of simulations.

  • spectra_id (int, optional) – Spectrum ID to perform the change. Defaults to 0.

append_spectrum_entry(total_spectra)#

Change the total number of spectra.

Parameters:

total_spectra (int) – New total number of spectra.

change_node_value(value, parent, keyword, attributes={}, append=False)#

Changes the value of the XML node. Not intended to be used directly and the set_ methods should be used instead.

Example

To change the beam the ‘beamenergy’ node on the XML file, including the attributes do:

#get the correct spectrum XML section
spec = idf_file.get_spectrum(spectra_id=1)

#get the beam section of the spectrum entry
beam = idf_file.get_section(spec, 'beam', create_if_not_found = ['beam'])[0]

#define the attributes dictionary
attributes = {
        'units': 'keV'
}

#change the note
idf_file.change_node_value(energy, beam, 'beamenergy', attributes = attributes)

However, is much better and controlled to simply use:

idf_file.set_beam_energy(energy, spectra_id = 1):
Parameters:
  • value (str or float) – Value to insert in the XML node

  • parent (DOM XML Element) – XML parent of the node to be changed

  • keyword (str) – xml keywork of the node to be changed

  • attributes (dict, optional) – Dictionary with the attributes of the node

  • append (bool, optional) – If True it appends the new node to the existing ones on the parent

create_element(parent, keyword)#

Creates a XML node

Parameters:
  • parent (DOM XML Element) – Parent of the node to be added

  • keyword (str) – Keyword of the node to be added

Returns:

DOM XML Element

Return type:

TYPE

create_tree(tree, prefix='')#

Creates a tree of parents in the XML, starting from the ‘sample’ element. See also self.create_tree_on_parent().

tree is a list with the multiple parents of the tree.

Example

For instance, to create the XML structure:

<sample>
        <structure>
                <layeredstructure>
                        <layers>
                                <layer>

we do:

tree = ['structure','layeredstructure', 'layers', 'layer']
idf_file.create_tree(tree)
Parameters:
  • tree (list) – List with the keywords of the parents forming the tree.

  • prefix (str, optional) – A prefix that is added to all of the parents keywords

Returns:

The last element of the tree just created

Return type:

XML Element

create_tree_on_parent(tree, parent, prefix='', replace=False)#

Creates a tree of parents in the XML, starting from the parent element. See also self.create_tree().

tree is a list with the multiple parents of the tree.

Example

For instance, to introduce a NDF analysis on a <simulation> entry of the IDF file, we can do the following:

#get the simulation parent of the IDF file
simulation_entry = self.get_simulation(spectra_id=spectra_id, simulation_id = simulation_id)

#create a parent tree on that parent
data_entry = self.create_tree_on_parent(
                                        ['ndf','fitresults','data', 'simpledata'],
                                        simulation_entry,
                                        prefix = 'ndf:')

Note the use of the prefix = 'ndf:' to indicate that we are introducing a another XML schema (i.e. the NDF one) into the IDF file. The above code will produce:

<...>
        <simulation>
                <ndf:ndf>
                        <ndf:fitresults>
                                <ndf:data>
                                        <ndf:simpledata>
Parameters:
  • tree (list) – List with the keywords of the parents forming the tree.

  • parent (XML Element) – Parent to which the tree is added

  • prefix (str, optional) – A prefix that is added to all of the parents keywords

Returns:

The last element of the tree just created

Return type:

XML Element

delete_spectrum(spectra_id=0)#

Deletes spectrum[spectra_id]

Parameters:

spectra_id (int, optional) – ID of the spectrum to delete.

get_all_spectra_filenames()#

Gets the list with the names of all spectra

Returns:

Entry i contains the name of spectra_id = i

Return type:

array of strings

get_beam_energy(spectra_id=0)#

Gets the beam energy and the FWHM in keV

Parameters:

spectra_id (int, optional) – ID of the spectrum

Returns:

The first and second floats are the energy and FWHM of the beam, respectively

Return type:

float, float

get_beam_particles(spectra_id=0)#

Gets the beam particles of spectrum[spectra_id = 0]

Parameters:

spectra_id (int, optional) – ID of the spectrum to read from

Returns:

Name of the beam particle

Return type:

str

get_charge(spectra_id=0)#

Gets the charge of the experiment

Parameters:

spectra_id (int, optional) – ID of the spectrum

Returns:

The charge

Return type:

float

get_dataxy(spectra_id=0)#

Gets the spectral data regarding spectrum[spectra_id].

Example

A typical use for this command would be:

#load IDF file
idf_file = IDF(file_path)

#get spectrum channels and counts
xx, yy = idf_file.get_dataxy()

#plot using matplotlib
plt.figure()
plt.plot(xx,yy)

where a plot with the spectrum should show up.

Parameters:

spectra_id (int, optional) – Spectrum ID on the IDF file

Returns:

xx (x-values), yy (y-values)

Return type:

Two numpy arrays

get_detector(spectra_id=0)#

Gets the detector solid angle

Parameters:

spectra_id (int, optional) – ID of the spectrum

Returns:

Detector solid angle

Return type:

float

Todo

Add shape, dimension and type of detector

get_elements()#

Gets the elements in the sample (see also self.set_elements())

It returns a dictionary in which the keywords are the name of the elements and the items the information of each element. For a sample of CoPt/SiO2/Si the returned dictionary is:

{'nelements': 3,
 'CoPt':
         {'ele_id': 0,
          'name': 'Co 0.45 Pt 0.55',
          'density': '',
          'concentration': ['0', '5000'],
          'depth': ['0', '1']},
 'Si 1 O 2':
         {'ele_id': 1,
          'name': 'Si 1 O 2',
          'density': '',
          'concentration': ['0', '5000'],
          'depth': ['0', '1']},
 'Si':
         {'ele_id': 2,
          'name': 'Si',
          'density': '',
          'concentration': ['100', '10000000'],
          'depth': ['0', '1']}
}
Returns:

A dictionary of dictionaries, each defining an element

Return type:

dictionary

get_elements_molecules_concentrations(layer_elements)#

Deprecated, will be removed soon

get_energy_calibration(spectra_id=0, reaction_id=0)#

Gets the energy calibration parameters. See also self.set_energy_calibration().

Parameters:

spectra_id (int, optional) – ID of the spectrum

Returns:

Array with the parameters [m, b]

Return type:

array(2)

get_geo_parameters(spectra_id=0)#

Gets the entire set of parameters in a dictionary with the following format:

params = {
        'mode': 19,
        'window': [100, 1500],
        'projectile': 'He',
        'beam_energy': 2000,
        'beam_FWHM': 17,
        'geometry': 'ibm',
        'angles': [0, 160], # [incident, scattering]
        'dect_solid': 7.2,
        'energy_calib': [1, 0], # [m, b], E = m * channel + b,
        'charge': 5
}

Each of these parameters can be obtained individually using the appropriate methods:

params['window']= [self.get_window_min(), self.get_window_max()]
params['projectile'] = self.get_beam_particles()
params['beam_energy'], params['beam_FWHM'] = self.get_beam_energy()
params['geometry'], params['angles'], _ = self.get_geometry_type()
params['dect_solid'] = self.get_detector()
params['energy_calib'] = self.get_energy_calibration()
params['charge'] = self.get_charge()
Parameters:

spectra_id (int, optional) – ID of the spectrum

Returns:

Dictionary with the geometry parameters

Return type:

dictionary or None

Raises:

e – If data is missing

get_geometry_type(spectra_id=0)#

Gets the experiment geometry along with the angles.

Parameters:

spectra_id (int, optional) – Spectrum ID to get the geometry from

Returns:

Name of the geometry, [incident angle, scattering angle], exit angle

Return type:

str, array, float

get_max_concentration(molecule_entry)#

Gets the maximum concentration from the XML molecule entry. To be used internally. Use self.get_elements() instead.

Parameters:

molecule_entry (DOM XML entry) – XML entry of a given molecule

Returns:

Value to the maximum concentration

Return type:

str

get_max_depth(molecule_entry)#

Gets the maximum element depth from the XML molecule entry. To be used internally. Use self.get_elements() instead.

Parameters:

molecule_entry (DOM XML entry) – XML entry of a given molecule

Returns:

Value to the maximum element depth concentration

Return type:

str

get_max_thickness()#

Gets the maximum possible thickness of the sample

Returns:

maximum possible thickness of the sample

Return type:

float

Todo

Change the return format to float!

get_min_concentration(molecule_entry)#

Gets the minimum concentration from the XML molecule entry. To be used internally. Use self.get_elements() instead.

Parameters:

molecule_entry (DOM XML entry) – XML entry of a given molecule

Returns:

Value to the minimum concentration

Return type:

str

get_min_depth(molecule_entry)#

Gets the minimum element depth from the XML molecule entry. To be used internally. Use self.get_elements() instead.

Parameters:

molecule_entry (DOM XML entry) – XML entry of a given molecule

Returns:

Value to the minimum element depth concentration

Return type:

str

get_min_thickness()#

Gets the minimum possible thickness of the sample

Returns:

minimum possible thickness of the sample

Return type:

float

Todo

Change the return format to float!

get_nelements()#

Ĝets the number of elements in the sample

Returns:

The number of elements in the sample

Return type:

int

get_nlayers()#

Gets the number of layers of the sample

Returns:

the number of layers

Return type:

int

get_number_of_simulations(spectra_id=0)#

Gets the total number of simulations in spectrum[spectra_id].

Parameters:
  • (int (spectra_id) – ) Spectrum ID to get the number of simulations from.

  • optional – ) Spectrum ID to get the number of simulations from.

Returns:

Number of simulations.

Return type:

int

get_number_of_spectra()#

Gets the total number of spectra in the IDF file.

Returns:

Number of spectra.

Return type:

int

get_profile()#

Gets the depth profile of the sample.

It returns a profile_dic identical to the input of self.set_profile():

profile_dic = {
                'nlayers': '3',
                'names': ['Co 0.45 Pt 0.55', 'Si 1 O 2', 'Si'],
                0: {'thickness': 390,     'concentrations': [1, 0, 0]},
                1: {'thickness': 700,     'concentrations': [0, 1, 0]},
                2: {'thickness': 4000000, 'concentrations': [0, 0, 1]}
                }

Note

Previous self.get_layers()

Returns:

Dictionary with the data on the depth profile of the sample

Return type:

dictionary

get_reactions(spectra_id=0)#

Gets the reaction list of spectrum[spectra_id]

It returns a list with the reactions dictionaries (see also self.set_reactions()). For instance, a NRA reaction list with two reactions (D(3He, 1H)4He and Be(3He, 1H)11B) the method outputs:

reactions = [
        {'initialtargetparticle': 'D',
          'incidentparticle': '3He',
          'exitparticle': '1H',
          'finaltargetparticle': '4He',
          'reactionQ': '18352',
          'code': 'D(3He, 1H)4He 18.35'},
        {'initialtargetparticle': 'Be',
          'incidentparticle': '3He',
          'exitparticle': '1H',
          'finaltargetparticle': '11B',
          'reactionQ': '10321.90',
          'code': 'Be(3He, 1H)11B 10.32'}
        ]
Parameters:

spectra_id (int, optional) – ID of the spectrum

Returns:

List of dictionaries defining the reactions

Return type:

list

get_section(parent, keyword, create_if_not_found=False)#

For internal use

get_simulation(spectra_id=0, simulation_id=0)#

Gets the XML entry regarding simulation[simulation_id] of spectrum[spectra_ID]. Note that one spectrum can have multiple simulations. For instance:

self.get_simulation(spectra_id = 0, simulation_id = 2)

returns the XML entry of simulation 2 from spectrum 0. Mostly to be used internally.

Parameters:
  • spectra_id (int, optional) – ID of the spectrum, default is 0

  • simulation_id (int, optional) – ID of the simulation in spectrum_id, default is 0

Returns:

The XML entry of simulation[simulation_id]

Return type:

DOM Element or None

get_spectrum(spectra_id=0)#

Gets the XML entry regarding spectrum[spectra_ID]. Mostly to be used internally.

Parameters:

spectra_id (int, optional) – ID of the spectrum, default is 0

Returns:

The XML entry of spectrum[spectra_id].

Return type:

DOM Element or None

get_spectrum_file_name(spectra_id=0)#

Gets the name of the spectrum.

Example

Set the label of the plot corresponding spectrum 1 (see also self.get_data_xy()):

#load xx, yy data
xx, yy = idf_file.get_dataxy(spectra_id = 1)

#get the name
name = idf_file.get_spectrum_file_name(spectra_id = 1)

#plot
plt.plot(xx, yy, label = name)
Parameters:

spectra_id (int, optional) – Description

Returns:

Description

Return type:

TYPE

get_technique(spectra_id=0)#

Gets the experimental technique of spectrum[spectra_id]

Parameters:

spectra_id (int, optional) – ID of the spectrum

Returns:

Name of the technique

Return type:

str

get_user()#

Function to get the user’s name from the IDF object.

Returns:

The user’s name. TYPE: str

print_idf_file(mode='pretty')#

Prints the XML contents of the IDF file. Used mostly to check/debug files.

remove_nodes(parent, keyword)#

Removes a XML node

Parameters:
  • parent (DOM XML Element) – Parent of the node to be removed

  • keyword (str) – Keyword of the node to be removed

remove_simulation_entry(spectra_id, simulation_id)#

Deletes simulation[spectra_id, simulation_id]

Parameters:
  • spectra_id (int) – ID of the spectrum to delete.

  • simulation_id (int) – ID of the simulation to delete.

save_idf(filename)#

Saves the IDF state into a file

This command is what produces the IDF file. Notice that any modification done to the IDF() object is not stored in the file until self.save_idf() is issued.

Example

Load an existing file, perform some changes to the parameters and save it again:

#load a IDF file
idf_file = IDF('path/to/file.idf')

#change some parameters
idf_file.set_charge(5)
idf_file.set_beam_energy(2000)
#....

#save file by overwriting the previous file (i.e. *save*)
idf_file.save_idf('path/to/file.idf')

#or if you want to create a new file (i.e. *save as*)
idf_file.save_idf('path/to/new_file.idf')
Parameters:

filename (str) – Path to save the path. Warning: it overwrites existing files

Returns:

Returns the existing IDF object

Return type:

IDF

set_beam_energy(energy, spectra_id=0)#

Sets the beam energy

Parameters:
  • energy (float) – The energy of the beam in keV

  • spectra_id (int, optional) – ID of the spectrum

set_beam_energy_spread(fwhm, spectra_id=0)#

Sets the FWHM of the beam

Parameters:
  • fwhm (float) – The FWHM of the beam in keV

  • spectra_id (int, optional) – ID of the spectrum

set_beam_particles(particle, spectra_id=0)#

Sets the beam particle of spectrum[spectra_id = 0]

Parameters:
  • particle (str) – Beam particle

  • spectra_id (int, optional) – ID of the spectrum to change

set_charge(charge, spectra_id=0)#

Sets the charge

Parameters:
  • charge (float) – The charge

  • spectra_id (int, optional) – ID of the spectrum

set_detector_solid_angle(angle, spectra_id=0)#

Sets the detector solid angle

Parameters:
  • angle (float) – solid angle in msr

  • spectra_id (int, optional) – ID of the spectrum

set_elements(elements)#

Sets the elements of the sample.

The input elements is a dictionary with dim(number of elements + 1), with one of entries being the number of elements (with keyword “nelements”):

elements['nelements'] = '2'

and the others the the elements parameters. The keyword each element is its ID and the contents of each molecule entry are also a dictionary containing the element’s name, minimum and maximum possible concentrations, minimum and maximum possible depths:

elements[0] = {'name': '1H',
                                'density': '',
                                'concentrationmin': '0',
                                'concentrationmax': '200000',
                                'depthmin': '0',
                                'depthmax': '0.02'}
elements[1] = {'name': 'Mo 2 O 3',
                        'density': '',
                        'concentrationmin': '0',
                        'concentrationmax': '200000',
                        'depthmin': '0',
                        'depthmax': '0.1'}

Note the spaces in the molecular formula.

Note for NDF users: See Section 4.2 of the NDF Manual for a description of each parameter. Moreover, if you want to fit the stoichiometry you need to include ‘?=’ after the element, for instance:

elements[1]['name'] = 'Mo ?=2 O ?=3'

Note

Previous self.set_molecules()

Parameters:

elements (dictionary) – Dictionary with the information about the sample composition.

set_energy_calibration(m, b, append=False, spectra_id=0, reaction_id=0)#

Set energy calibration assuming a linear relation between energy and channels:

E = m * channel + b

Parameters:
  • m (float) – m parameter in keV/channel

  • b (float) – b parameter in keV

  • append (bool, optional, default False) – If True appends the calibration instead of overwriting a previous one

  • spectra_id (int, optional) – ID of the spectrum

set_energy_calibration_file(file_path, append=False, spectra_id=0)#

Adds an energy calibration file to IDF. This is useful for instance in PIXE and SIMS. See also Examples section for more information.

Parameters:
  • file_path (str) – Path to the calibration file

  • spectra_id (int, optional) – ID of the spectrum

set_exit_angle(angle, spectra_id=0)#

Sets the exit angle

Parameters:
  • angle (TYPE) – Exit angle in degrees

  • spectra_id (int, optional) – ID of the spectrum

set_geo_parameters(params, spectra_id=0)#

Sets the entire set of parameters to IDF from a dictioanry params (see also get_geo_parameters())

The input params is a dictionary with the following entries:

pairs = {'beam_energy': self.set_beam_energy,
        'beam_FWHM': self.set_beam_energy_spread,
        'projectile': self.set_beam_particles,
        'charge': self.set_charge,
        'dect_solid': self.set_detector_solid_angle,
        'geometry': self.set_geometry_type,
        'angles': [self.set_incident_angle, self.set_scattering_angle],
        'energy_calib': self.set_energy_calibration
        }

Note that it is acceptable for params to have more entries than the ones above, meaning that the output of get_geo_parameters() can be used as input here.

Parameters:
  • params (dictionary) – A dictionary with the geometry parameters

  • spectra_id (int, optional) – ID of the spectrum to edit

set_geometry_type(geometry_type, spectra_id=0)#

Sets the experiment geometry (IBM, Cornell, General)

Parameters:
  • geometry_type (str) – the geometry

  • spectra_id (int, optional) – Spectrum ID to set the geometry

set_incident_angle(angle, spectra_id=0)#

Sets the incident angle

Parameters:
  • angle (float) – Incident angle in degrees

  • spectra_id (int, optional) – ID of the spectrum

set_max_thickness(value)#

Sets the maximum possible thickness of the sample

Parameters:

value (float) – Maximum possible thickness of the layer

set_min_thickness(value)#

Sets the minimum thickness of the sample

Parameters:

value (float) – Minimum thickness of the layer

set_note(note, append=False)#

Sets a note related to the the IDF file. If append is True the note will be append to the notes add previously.

Parameters:
  • note (str) – A string with the note

  • append (bool, optional) – If True, the note is appended to the existing notes, if False the exiting notes will be overwritten. Defaults to False

set_profile(profile_dic)#

Sets the depth profile of the sample.

The profile_dic is a dictionary with dim(number of layers + 2). One of the entries, profile_dic['nlayers'], contains the number of layers and it is there to simply some parts of the NDF related code. Another entry, profile_dic['nlayers'], is reserved for the names of the elements.

The other dictionary entries have the information of each layer and are themselves dictionaries. Therefore, profile_dic should look like the following:

profile_dic = {
        'nlayers': '3',
        'names': ['Co 0.45 Pt 0.55', 'Si 1 O 2', 'Si'],
        0: {'thickness': 390,     'concentrations': [100, 0,  0]},
        1: {'thickness': 700,     'concentrations': [ 0, 100, 0]},
        2: {'thickness': 4000000, 'concentrations': [ 0,  0, 100]}
}

The concentrations array contains the concentration of each element on the layer. The order of the values follows the names array, i.e. layer 1 is the concentration of element 1 (CoPt), etc…

Note on nested dictionaries: If you want to change, for instance, the concentrations of layer 1 you can do it by:

profile_dic[1]['concentrations'] = [50, 50, 0]

or if you want to change the name of the 1st element:

profile_dic['names'][0] = 'Co 1 Pt 1'
Parameters:

profile_dic (dictionary) – Dictionary with the data on the depth profile of the sample

set_reactions(reactions_dic, append=True, mode='reactionlist', spectra_id=0, linked_calibrations=True)#

Sets the reaction list associated with the chosen technique (see self.set_technique()). Mode defines

The reactions_dic is a dictionary with the information on a given reaction. It can be of two types depending on the mode. When mode = 'reactionlist', used with most techniques, reactions_dic is of type:

reactions_dic = {'initialtargetparticle': 'Be',
                 'incidentparticle': '3He',
                 'exitparticle': '1H',
                 'finaltargetparticle': '11B',
                 'reactionQ': '10321.90'}

The above is a typical NRA reaction in a Be sample. Note that multiple reactions can be added to the same spectrum by leaving append = True.

Note that for RBS one does not need to define reactions_dic.

When mode = 'masslist', mostly used for SIMS, the above dictionary becomes:

reactions_dic = {'detectedparticles': '1H 2H Be 12C Ni Mo W'}
Parameters:
  • reactions_dic (dictionary) – Dictionary with the details of each reaction

  • append (bool, optional) – If True it appends the reaction to the existing reactions

  • mode (str, optional, defaults to 'reactionlist') – Defines the reaction mode, either

  • 'masslist' ('reactionlist' or) –

  • spectra_id (int, optional) – ID of the spectrum

set_reactions_list(reactions, spectra_id=0)#

Sets an entire list of reactions to the specified spectrum.

The method initializes the spectrum with the first reaction from the list without appending (i.e., replacing any existing reactions). Subsequent reactions in the list are appended to the spectrum.

This is a convenience method built atop the base set_reactions method to handle lists of reactions efficiently without requiring multiple explicit calls by the user.

Parameters:
  • reactions (list of dictionaries) – A list of reaction dictionaries. Each dictionary should adhere to the structure expected by the set_reactions method.

  • spectra_id (int, optional) – ID of the spectrum to which the reactions are being added. Defaults to 0.

Examples

To set multiple reactions for a given spectrum:

reactions_list = [

{‘initialtargetparticle’: ‘Be’, …}, {‘initialtargetparticle’: ‘H’, …}, …

] obj.set_reactions_list(reactions_list, spectra_id=5)

set_scattering_angle(angle, spectra_id=0)#

Sets the scattering angle

Parameters:
  • angle (float) – Scattering angle in degrees

  • spectra_id (int, optional) – ID of the spectrum

set_spectrum_data(data_x, data_y, spectra_id=0, simulation=False)#

Sets the xx, yy data of spectrum[spectra_ID]

Parameters:
  • data_x (TYPE) – array with the xx values (e.g. channels)

  • data_y (TYPE) – array with the yy values (e.g. counts)

  • spectra_id (int, optional) – ID of the spectrum to set xx, yy

  • simulation (bool, optional) – Note used as of now

Returns:

The XML entry of spectrum[spectra_id].

Return type:

DOM Element or None

set_spectrum_data_from_file(file_name, save_file_name=True, mode='channels vs yield', spectra_id=0, simulation=False)#

Read the spectrum data from the file and sets it on the IDF file.

Example

Load experimental data from file and plot it (see also self.get_dataxy() and self.get_spectrum_file_name():

#create a blank IDF file
idf_file = IDF()

#set the spectrum data from the txt file
idf_file.set_spectrum_data_from_file(path_to_exp_data.txt)

#load and plot the data using the file name as label
xx, yy = self.get_dataxy()
plt.figure()
plt.plot(xx, yy, label = idf_file.get_spectrum_file_name())
plt.legend()
Parameters:
  • file_name (str) – Path to the file with the data

  • save_file_name (bool, optional, default = True) – If True, saves the original file name

  • mode (str, optional, default = 'channels vs yield') –

    Mode of the data file options:

    mode = ‘channels vs yield’ if txt file has two columns (xx, yy)

    mode = ‘8 columns’ if txt file has 8 columns with yields and assumes linear xx-scale

  • spectra_id (int, optional) – ID of the spectrum to change

  • simulation (bool, optional) – Not used as of now

Returns:

The XML entry of spectrum[spectra_id].

Return type:

DOM Element or None

set_spectrum_file_name(file_name, spectra_id=0)#

Sets the name of the spectrum for identification proposes (e.g plot legends)

Parameters:
  • file_name (str) – Name of the spectrum

  • spectra_id (int, optional) – ID of the spectrum to set the name.

set_technique(technique, spectra_id=0)#

Sets the experimental technique of the spectrum[spectra_id]

Parameters:
  • technique (str) – Name of the technique

  • spectra_id (int, optional) – ID of the spectrum

unify_geo_parameters(master_id=0, target_id='All')#

Copies the geometry parameters from one spectrum (with index master_id) to all other spectra in the IDF file.

Parameters:

master_id (int, optional) – spectra_id of the spectrum with the information to be copied