Stoner.formats.instruments.XRDFile¶
- class Stoner.formats.instruments.XRDFile(*args)[source]¶
Loads Files from a Brucker D8 Discovery X-Ray Diffractometer.
Methods
__init__
(*args, **kargs)Add a public attribute to XRD File.
add_column
(column_data[, header, index, ...])Append a column of data or inserts a column to a datafile instance.
append
(value)S.append(value) -- append value to the end of the sequence
asarray
()Provide a consistent way to get at the underlying array data.
clear
()closest
(value[, xcol])Return the row in a data file which has an x-column value closest to the given value.
column
(col)Extract one or more columns of data from the datafile.
columns
([not_masked, reset])Iterate over the columns of data int he datafile.
count
([value, axis, col])Count the number of un-masked elements in the
DataFile
.del_column
([col, duplicates])Delete a column from the current
DataFile
object.del_nan
([col, clone])Remove rows that have nan in them.
del_rows
([col, val, invert])Search in the numerica data for the lines that match and deletes the corresponding rows.
dir
([pattern])Return a list of keys in the metadata, filtering wiht a regular expression if necessary.
extend
(values)S.extend(iterable) -- extend sequence by appending elements from the iterable
filter
([func, cols, reset])Set the mask on rows of data by evaluating a function for each row.
find_col
(col[, force_list])Indexes the column headers in order to locate a column of data.shape.
find_duplicates
([xcol, delta])Find rows with duplicated values of the search column(s).
get
(k[,d])get_filename
(mode)Force the user to choose a new filename using a system dialog box.
index
(value, [start, [stop]])Raises ValueError if the value is not present.
insert
(index, obj)Implement the insert method.
insert_rows
(row, new_data)Insert new_data into the data array at position row.
items
()Make sure we implement an items that doesn't just iterate over self.
keys
()Return the keys of the metadata dictionary.
load
(*args, **kargs)Create a new
DataFile
from a file on disc guessing a better subclass if necessary.pop
(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised.
popitem
()as a 2-tuple; but raise KeyError if D is empty.
remove
(value)S.remove(value) -- remove first occurrence of value.
remove_duplicates
([xcol, delta, strategy, ...])Find and remove rows with duplicated values of the search column(s).
rename
(old_col, new_col)Rename columns without changing the underlying data.
reorder_columns
(cols[, headers_too, setas_too])Construct a new data array from the original data by assembling the columns in the order given.
reverse
()S.reverse() -- reverse IN PLACE
rolling_window
([window, wrap, exclude_centre])Iterate with a rolling window section of the data.
rows
([not_masked, reset])Iterate over rows of data.
save
([filename])Save a string representation of the current DataFile object into the file 'filename'.
search
([xcol, value, columns, accuracy])Search the numerica data part of the file for lines that match and returns the corresponding rows.
section
(**kargs)Assuming data has x,y or x,y,z co-ordinates, return data from a section of the parameter space.
select
(*args, **kargs)Produce a copy of the DataFile with only data rows that match a criteria.
setdefault
(k[,d])sort
(*order, **kargs)Sort the data by column name.
split
(*args[, final])Recursively splits the current DataFile into a
Stoner.Forlders.DataFolder
.swap_column
(*swp, **kargs)Swap pairs of columns in the data.
to_Q
([l])Add an additional function to covert an angualr scale to momentum transfer.
Create a pandas DataFrame from a
Stoner.Data
object.unique
(col[, return_index, return_inverse])Return the unique values from the specified column - pass through for numpy.unique.
update
([E, ]**F)If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
values
()Return the values of the metadata dictionary.
Attributes
T
Get the current data transposed.
basename
Return the basename of the current filename.
clone
Get a deep copy of the current DataFile.
column_headers
Pass through to the setas attribute.
data
Property Accessors for the main numerical data.
dict_records
Return the data as a dictionary of single columns with column headers for the keys.
dims
Alias for self.data.axes.
dtype
Return the np dtype attribute of the data.
filename
Return DataFile filename, or make one up.
filepath
Return DataFile filename, or make one up, returning as a pathlib.Path.
header
Make a pretty header string that looks like the tabular representation.
mask
Return the mask of the data array.
metadata
Read the metadata dictionary.
mime_type
patterns
priority
records
Return the data as a np structured data array.
setas
Get the list of column assignments.
shape
Pass through the numpy shape attribute of the data.