pyemaps.fileutils module

Fileutils is a helper module in assisting pyemaps file i/o functions. Its methods include reading crystal data files and writing simulation output files.

It also detects pyemaps data home environment variables and directs file i/o accoridng to the rule set in Environment Variables.

pyemaps.fileutils.find_datahome()
pyemaps.fileutils.auto_fn(cn)

Auto-generate file name based on crystal name and time stamp when file is generated from pyemaps simulations.

This can be modified to tune the output to any other specific needs.

Parameters:

cn (string, required) – A crystal name.

Returns:

file name composed of crytsal name and time stamp in yyyymmddmmss format

rtype: string

pyemaps.fileutils.find_pyemaps_datahome(home_type='crystals')

Detects enviroment variable set by PYEMAPS_DATA and return the diretcory set by the variable or return current working directory.

Parameters:

home_type (string, optional) – Type of home directory

Returns:

data home path.

Return type:

string

Folder names depending by home_type input:

  1. crystals: all crystal data files.

  2. bloch: all dynamic simulation output files.

  3. mxtal: all .xyz files saved from crystal constructor.

  4. stereo: all .png files saved from stereodiagram plotting methods

pyemaps.fileutils.compose_ofn(fn, name, ty='diffraction')

Compose output file name based file name and file type.

pyemaps.fileutils.loadCrystalCIFData(fn)

Reads a .cif file for crystal data.

Parameters:

fn – cif file name

Type:

string, required

Returns:

tuple of crystal name and crystal data as dict object

Return type:

dict

Note

This method is still in active development.

pyemaps.fileutils.loadCrystalData(fn, cn=None)

Reading built-in datbase or a .xtl file for crystal data.

Parameters:
  • fn – XTL formatted Crystal file name

  • cn – Crystal name

Type:

string, required

Type:

string, optional

Returns:

tuple of crystal name and crystal data as dict object

Return type:

dict