The API Reference

class neutronbraggedge.braggedge.BraggEdge(material=None, new_material=None, number_of_bragg_edges=10, use_local_metadata_table=True)[source]

This is from where the user will retrieve all metadata and calculation

Variables:

From python, first you need to import the package
>>> from braggedge.braggedge import BraggEdge
For a particular element you can retrieve:
  • lattice parameter
  • h, k and l values
  • Crystal structure
  • bragg edges values

For this example, we are retrieving the data for Fe and we are only interested by the first 4 crystal orientation.

>>> _handler = BraggEdge(material = 'Fe', number_of_bragg_edges = 4)
>>> print("Crystal Structure is: %s" %_handler.metadata['cyrstal_structure]))
'BCC'
>>> print("Lattice is %.2f" %_handler.metadata['lattice'])
2.87
>>> print("hkl are: " , _handler.hkl)
hkl are: [][1,1,0],[2,0,0],[2,1,1],[2,2,0]]
>>> print("bragg edges are: ", _handler.bragg_edges)
bragg edges are: [2.0268, 1.4332, 1.1702, 1.0134]

It is also possible to display all metadata at once

>>> print(_handler)
===================================
Material: Fe
Lattice: 2.8664A
Crystal Structure: BCC
Using local metadata Table: True
===================================
 h | k | l |   d(A)  |    BraggEdge
===================================
 1 | 1 | 0 |  2.0269 |    4.0537
 2 | 0 | 0 |  1.4332 |    2.8664
 2 | 1 | 1 |  1.1702 |    2.3404
 2 | 2 | 0 |  1.0134 |    2.0269
===================================

Then you can export the resulting metadata into a CSV file

>>> _handler.export(filename = 'my_file_name.txt')
export(filename=None, file_type='csv')[source]

Export the metadata into various file format

Arguments:

filename: output file name to create file_type: format of the file to create

only ‘csv’ (simple comma separated format) is supported for now
Exception:
IOError: if no file name is provided
get_experimental_lattice_parameter(experimental_bragg_edge_values=None, experimental_bragg_edge_error=None)[source]

calculates the experimental lattice parameter values given an array of bragg edge values