pycalphad.io package

Submodules

pycalphad.io.database module

The database module provides support for reading and writing data types associated with structured thermodynamic/kinetic data.

class pycalphad.io.database.Database(*dbf)[source]

Bases: object

Structured thermodynamic and/or kinetic data. Databases are usually filled by Parsers and read by Models.

elements

list – List of elements in database.

species

list – List of species in database.

phases

dict – Phase objects indexed by their system-local name.

symbols

dict – SymPy objects indexed by their name (FUNCTIONs in Thermo-Calc).

references

dict – Reference objects indexed by their system-local identifier.

None yet.
add_parameter(param_type, phase_name, constituent_array, param_order, param, ref=None)[source]

Add a parameter.

Parameters:
  • param_type (str) – Type name of the parameter, e.g., G, L, BMAGN.
  • phase_name (string) – Name of the phase.
  • constituent_array (list) – Configuration of the sublattices (elements and/or species).
  • symbol (object) – Abstract representation of the parameter, e.g., in SymPy format.

Examples

None yet.

add_phase(phase_name, model_hints, sublattices)[source]

Add a phase.

Parameters:
  • phase_name (string) – System-local name of the phase.
  • model_hints (list) – Structured “hints” for a Model trying to read this phase. Hints for major constituents and typedefs (Thermo-Calc) go here.
  • sublattices (list) – Site ratios of sublattices.

Examples

None yet.

add_phase_constituents(phase_name, constituents)[source]

Add a phase.

Parameters:
  • phase_name (string) – System-local name of the phase.
  • constituents (list) – Possible phase constituents (elements and/or species).

Examples

None yet.

add_structure_entry(local_name, global_name)[source]

Define a relation between the system-local name of a phase and a “global” identifier. This is used to link crystallographically similar phases known by different colloquial names.

Parameters:
  • local_name (string) – System-local name of the phase.
  • global_name (object) – Abstract representation of symbol, e.g., in SymPy format.

Examples

None yet.

search(query)[source]

Search for parameters matching the specified query.

Parameters:query (object) – Structured database query in TinyDB format.

Examples

>>>> from tinydb import where >>>> db = Database() >>>> eid = db.add_parameter(...) #TODO >>>> db.search(where(‘eid’) == eid)

class pycalphad.io.database.Phase[source]

Bases: object

Phase in the database.

name

string – System-local name of the phase.

constituents

list of lists – Possible sublattice constituents (elements and/or species).

sublattices

list – Site ratios of sublattices.

model_hints

dict – Structured “hints” for a Model trying to read this phase. Hints for major constituents and typedefs (Thermo-Calc) go here.

pycalphad.io.tdb module

The tdb module provides support for reading and writing databases in Thermo-Calc TDB format.

class pycalphad.io.tdb.TCCommand(matchString, identChars=None)[source]

Bases: pyparsing.CaselessKeyword

Parser element for dealing with Thermo-Calc command abbreviations.

parseImpl(instring, loc, doActions=True)[source]
pycalphad.io.tdb.tdbread(targetdb, lines)[source]

Parse a TDB file into a pycalphad Database object.

Parameters:
  • targetdb (Database) – A pypycalphad Database.
  • lines (string) – A raw TDB file.

pycalphad.io.tdb_keywords module

This module defines valid Thermo-Calc TDB keywords and handles abbreviations. Note that not all of these keywords are fully supported yet.

pycalphad.io.tdb_keywords.expand_keyword(possible, candidate)[source]

Expand an abbreviated keyword based on the provided list.

Parameters:
  • possible (list of str) – Possible keywords for ‘candidate’ to be matched against.
  • candidate (str) – Abbreviated keyword to expand.
Returns:

Return type:

list of str of matching expanded keywords

Examples

None yet.

Module contents