defdap.file_readers module

class defdap.file_readers.EBSDDataLoader[source]

Bases: ABC

Class containing methods for loading and checking EBSD data

static get_loader(data_type, file_name)[source]
Return type:

Type[EBSDDataLoader]

check_metadata()[source]

Checks that the number of phases from metadata matches the amount of phases loaded.

Return type:

None

check_data()[source]
Return type:

None

abstract load(file_name)[source]
Return type:

None

class defdap.file_readers.OxfordTextLoader[source]

Bases: EBSDDataLoader

load(file_name)[source]

Read an Oxford Instruments .ctf file, which is a HKL single orientation file.

Parameters:

file_name (Path) – Path to file

Return type:

None

class defdap.file_readers.EdaxAngLoader[source]

Bases: EBSDDataLoader

load(file_name)[source]

Read an EDAX .ang file.

Parameters:

file_name (Path) – Path to file

Return type:

None

static parse_phase(lines)[source]
Return type:

Phase

class defdap.file_readers.OxfordBinaryLoader[source]

Bases: EBSDDataLoader

load(file_name)[source]

Read Oxford Instruments .cpr/.crc file pair.

Parameters:

file_name (Path) – Path to file

Return type:

None

load_oxford_cpr(file_name)[source]

Read an Oxford Instruments .cpr file, which is a metadata file describing EBSD data.

Parameters:

file_name (Path) – Path to file

Return type:

None

load_oxford_crc(file_name)[source]

Read binary EBSD data from an Oxford Instruments .crc file

Parameters:

file_name (Path) – Path to file

Return type:

None

class defdap.file_readers.PythonDictLoader[source]

Bases: EBSDDataLoader

load(data_dict)[source]

Construct EBSD data from a python dictionary.

Parameters:

data_dict (Dict[str, Any]) –

Dictionary with keys:

’step_size’ ‘phases’ ‘phase’ ‘euler_angle’ ‘band_contrast’

Return type:

None

class defdap.file_readers.DICDataLoader[source]

Bases: ABC

Class containing methods for loading and checking HRDIC data

static get_loader(data_type)[source]
Return type:

Type[DICDataLoader]

checkMetadata()[source]
Return type:

None

check_data()[source]

Calculate size of map from loaded data and check it matches values from metadata.

Return type:

None

abstract load(file_name)[source]
Return type:

None

class defdap.file_readers.DavisLoader[source]

Bases: DICDataLoader

load(file_name)[source]

Load from Davis .txt file.

Parameters:

file_name (Path) – Path to file

Return type:

None

static load_davis_image_data(file_name)[source]

A .txt file from DaVis containing a 2D image

Parameters:

file_name (Path) – Path to file

Returns:

Array of data.

Return type:

np.ndarray

class defdap.file_readers.OpenPivLoader[source]

Bases: DICDataLoader

load(file_name)[source]

Load from Open PIV .txt file.

Parameters:

file_name (Path) – Path to file

Return type:

None

defdap.file_readers.read_until_string(file, term_string, comment_char='*', line_process=None, exact=False)[source]

Read lines in a file until a line starting with the termString is encountered. The file position is returned before the line starting with the termString when found. Comment and empty lines are ignored.

Parameters:
  • file (TextIO) – An open python text file object.

  • term_string (str) – String to terminate reading.

  • comment_char (str) – Character at start of a comment line to ignore.

  • line_process (Optional[Callable[[str], Any], None]) – Function to apply to each line when loaded.

  • exact (bool) – A line must exactly match termString to stop.

Returns:

List of processed lines loaded from file.

Return type:

list