pycalphad.io package

Submodules

pycalphad.io.cs_dat module

Support for reading ChemSage DAT files.

class pycalphad.io.cs_dat.AdditionalCoefficientPair(coefficient: float, exponent: float)[source]

Bases: object

coefficient: float
exponent: float
expr()[source]
class pycalphad.io.cs_dat.Endmember(species_name: str, gibbs_eq_type: str, stoichiometry_pure_elements: List[float], intervals: List[pycalphad.io.cs_dat.IntervalBase])[source]

Bases: object

constituent_array() List[List[str]][source]
constituents(pure_elements: List[str]) Dict[str, float][source]
expr(indices)[source]

Return a Piecewise (in temperature) energy expression for this endmember (i.e. only the data from the energy intervals)

gibbs_eq_type: str
insert(dbf: Database, phase_name: str, constituent_array: List[List[str]], gibbs_coefficient_idxs: List[int])[source]
intervals: List[IntervalBase]
species(pure_elements) List[Species][source]

Return an unordered list of Species objects detected in this endmember

species_name: str
stoichiometry_pure_elements: List[float]
class pycalphad.io.cs_dat.EndmemberAqueous(species_name: str, gibbs_eq_type: str, stoichiometry_pure_elements: List[float], intervals: List[pycalphad.io.cs_dat.IntervalBase], charge: float)[source]

Bases: Endmember

charge: float
insert(**kwargs)[source]
class pycalphad.io.cs_dat.EndmemberMagnetic(species_name: str, gibbs_eq_type: str, stoichiometry_pure_elements: List[float], intervals: List[pycalphad.io.cs_dat.IntervalBase], curie_temperature: float, magnetic_moment: float)[source]

Bases: Endmember

curie_temperature: float
insert(dbf: Database, phase_name: str, pure_elements: List[str], gibbs_coefficient_idxs: List[int])[source]
magnetic_moment: float
class pycalphad.io.cs_dat.EndmemberQKTO(species_name: str, gibbs_eq_type: str, stoichiometry_pure_elements: List[float], intervals: List[pycalphad.io.cs_dat.IntervalBase], stoichiometric_factor: float, chemical_group: int)[source]

Bases: Endmember

chemical_group: int
insert(dbf: Database, phase_name: str, constituent_array: List[List[str]], gibbs_coefficient_idxs: List[int])[source]
stoichiometric_factor: float
class pycalphad.io.cs_dat.EndmemberRealGas(species_name: str, gibbs_eq_type: str, stoichiometry_pure_elements: List[float], intervals: List[pycalphad.io.cs_dat.IntervalBase], Tc: float, Pc: float, Vc: float, acentric_factor: float, dipole_moment: float)[source]

Bases: Endmember

Pc: float
Tc: float
Vc: float
acentric_factor: float
dipole_moment: float
insert(**kwargs)[source]
class pycalphad.io.cs_dat.ExcessBase(interacting_species_idxs: List[int])[source]

Bases: object

constituent_array(phase_constituents: List[List[str]]) List[List[str]][source]

Return the constituent array of this interaction using the entire phase sublattice model.

This doesn’t take into account any re-ordering of the phase_constituents or interacting_species_idxs. All mapping on to proper v.Species objects occurs in Database.add_parameter.

Examples

>>> phase_constituents = [['A'], ['A', 'B'], ['A', 'B', 'C']]
>>> ex = ExcessBase([1, 2, 4, 6])
>>> ix_const_arr = ex.constituent_array(phase_constituents)
>>> assert ix_const_arr == [['A'], ['A'], ['A', 'C']]
insert(dbf: Database, phase_name: str, phase_constituents: List[List[str]], excess_coefficient_idxs: List[int])[source]
interacting_species_idxs: List[int]
class pycalphad.io.cs_dat.ExcessQKTO(interacting_species_idxs: List[int], exponents: List[int], coefficients: List[float])[source]

Bases: ExcessBase

coefficients: List[float]
exponents: List[int]
expr(indices)[source]

Return an expression for the energy in this temperature interval

insert(dbf: Database, phase_name: str, phase_constituents: List[str], excess_coefficient_idxs: List[int])[source]
class pycalphad.io.cs_dat.ExcessRKM(interacting_species_idxs: List[int], parameter_order: int, coefficients: List[float])[source]

Bases: ExcessBase

Examples

>>> assert ExcessRKM([1, 2, 3, 4], 0, [0])._map_const_idxs_to_subl_idxs([2, 3]) == [[0, 1], [0, 1]]
>>> assert ExcessRKM([1, 3, 4], 0, [0])._map_const_idxs_to_subl_idxs([2, 3]) == [[0], [0, 1]]
>>> assert ExcessRKM([1, 2], 0, [0])._map_const_idxs_to_subl_idxs([4]) == [[0, 1]]
>>> assert ExcessRKM([1, 2, 3], 0, [0])._map_const_idxs_to_subl_idxs([3]) == [[0, 1, 2]]
>>> assert ExcessRKM([1, 2, 3, 4], 0, [0])._map_const_idxs_to_subl_idxs([1, 1, 2]) == [[0], [0], [0, 1]]
coefficients: List[float]
expr(indices)[source]

Return an expression for the energy in this temperature interval

insert(dbf: Database, phase_name: str, phase_constituents: List[List[str]], excess_coefficient_idxs: List[int])[source]

Requires all Species in dbf.species to be defined.

parameter_order: int
class pycalphad.io.cs_dat.ExcessRKMMagnetic(interacting_species_idxs: List[int], parameter_order: int, curie_temperature: float, magnetic_moment: float)[source]

Bases: ExcessBase

curie_temperature: float
insert(dbf: Database, phase_name: str, phase_constituents: List[List[str]], excess_coefficient_idxs: List[int])[source]

Requires all Species in dbf.species to be defined.

magnetic_moment: float
parameter_order: int
class pycalphad.io.cs_dat.Header(list_soln_species_count: List[int], num_stoich_phases: int, pure_elements: List[str], pure_elements_mass: List[float], gibbs_coefficient_idxs: List[int], excess_coefficient_idxs: List[int])[source]

Bases: object

excess_coefficient_idxs: List[int]
gibbs_coefficient_idxs: List[int]
list_soln_species_count: List[int]
num_stoich_phases: int
pure_elements: List[str]
pure_elements_mass: List[float]
class pycalphad.io.cs_dat.IntervalBase(T_max: float)[source]

Bases: object

T_max: float
cond(T_min=0.01)[source]
expr()[source]
expr_cond_pair(*args, T_min=0.01, **kwargs)[source]

Return an (expr, cond) tuple used to construct Piecewise expressions

class pycalphad.io.cs_dat.IntervalCP(T_max: float, H298: float, S298: float, CP_coefficients: float, H_trans: float, additional_coeff_pairs: List[pycalphad.io.cs_dat.AdditionalCoefficientPair], PTVm_terms: List[pycalphad.io.cs_dat.PTVmTerms])[source]

Bases: IntervalBase

CP_coefficients: float
H298: float
H_trans: float
PTVm_terms: List[PTVmTerms]
S298: float
additional_coeff_pairs: List[AdditionalCoefficientPair]
expr(indices, T_min=0.01)[source]

Return an expression for the energy in this temperature interval

class pycalphad.io.cs_dat.IntervalG(T_max: float, coefficients: List[float], additional_coeff_pairs: List[pycalphad.io.cs_dat.AdditionalCoefficientPair], PTVm_terms: List[pycalphad.io.cs_dat.PTVmTerms])[source]

Bases: IntervalBase

PTVm_terms: List[PTVmTerms]
additional_coeff_pairs: List[AdditionalCoefficientPair]
coefficients: List[float]
expr(indices)[source]

Return an expression for the energy in this temperature interval

class pycalphad.io.cs_dat.PTVmTerms(terms: List[float])[source]

Bases: object

terms: List[float]
class pycalphad.io.cs_dat.PhaseBase(phase_name: str, phase_type: str, endmembers: List[pycalphad.io.cs_dat.Endmember])[source]

Bases: object

endmembers: List[Endmember]
insert(dbf: Database, pure_elements: List[str], gibbs_coefficient_idxs: List[int], excess_coefficient_idxs: List[int])[source]

Enter this phase and its parameters into the Database.

This method should call:

  • dbf.add_phase

  • dbf.structure_entry

  • dbf.add_phase_constituents

  • dbf.add_parameter for all parameters

phase_name: str
phase_type: str
class pycalphad.io.cs_dat.Phase_Aqueous(phase_name: str, phase_type: str, endmembers: List[pycalphad.io.cs_dat.EndmemberAqueous])[source]

Bases: PhaseBase

endmembers: List[EndmemberAqueous]
class pycalphad.io.cs_dat.Phase_CEF(phase_name: str, phase_type: str, endmembers: List[pycalphad.io.cs_dat.Endmember], subl_ratios: List[float], constituent_array: List[List[str]], endmember_constituent_idxs: List[List[int]], excess_parameters: List[pycalphad.io.cs_dat.ExcessBase], magnetic_afm_factor: float | None, magnetic_structure_factor: float | None)[source]

Bases: PhaseBase

constituent_array: List[List[str]]
endmember_constituent_idxs: List[List[int]]
excess_parameters: List[ExcessBase]
insert(dbf: Database, pure_elements: List[str], gibbs_coefficient_idxs: List[int], excess_coefficient_idxs: List[int])[source]

Enter this phase and its parameters into the Database.

This method should call:

  • dbf.add_phase

  • dbf.structure_entry

  • dbf.add_phase_constituents

  • dbf.add_parameter for all parameters

magnetic_afm_factor: float | None
magnetic_structure_factor: float | None
subl_ratios: List[float]
class pycalphad.io.cs_dat.Phase_RealGas(phase_name: str, phase_type: str, endmembers: List[pycalphad.io.cs_dat.EndmemberRealGas])[source]

Bases: PhaseBase

endmembers: List[EndmemberRealGas]
class pycalphad.io.cs_dat.Phase_SUBQ(phase_name: str, phase_type: str, endmembers: List[pycalphad.io.cs_dat.Endmember], num_pairs: int, num_quadruplets: int, num_subl_1_const: int, num_subl_2_const: int, subl_1_const: List[str], subl_2_const: List[str], subl_1_charges: List[float], subl_1_chemical_groups: List[int], subl_2_charges: List[float], subl_2_chemical_groups: List[int], subl_const_idx_pairs: List[Tuple[int, int]], quadruplets: List[pycalphad.io.cs_dat.SUBQQuadrupletCoordinations], excess_parameters: List[pycalphad.io.cs_dat.SUBQExcessQuadruplet], chemical_group_overrides: List[str])[source]

Bases: PhaseBase

chemical_group_overrides: List[str]
excess_parameters: List[SUBQExcessQuadruplet]
insert(dbf: Database, pure_elements: List[str], gibbs_coefficient_idxs: List[int], excess_coefficient_idxs: List[int])[source]

Enter this phase and its parameters into the Database.

This method should call:

  • dbf.add_phase

  • dbf.structure_entry

  • dbf.add_phase_constituents

  • dbf.add_parameter for all parameters

num_pairs: int
num_quadruplets: int
num_subl_1_const: int
num_subl_2_const: int
quadruplets: List[SUBQQuadrupletCoordinations]
subl_1_charges: List[float]
subl_1_chemical_groups: List[int]
subl_1_const: List[str]
subl_2_charges: List[float]
subl_2_chemical_groups: List[int]
subl_2_const: List[str]
subl_const_idx_pairs: List[Tuple[int, int]]
class pycalphad.io.cs_dat.Phase_Stoichiometric(phase_name: str, phase_type: str, endmembers: List[pycalphad.io.cs_dat.Endmember], magnetic_afm_factor: float | None, magnetic_structure_factor: float | None)[source]

Bases: PhaseBase

insert(dbf: Database, pure_elements: List[str], gibbs_coefficient_idxs: List[int], excess_coefficient_idxs: List[int])[source]

Enter this phase and its parameters into the Database.

This method should call:

  • dbf.add_phase

  • dbf.structure_entry

  • dbf.add_phase_constituents

  • dbf.add_parameter for all parameters

magnetic_afm_factor: float | None
magnetic_structure_factor: float | None
class pycalphad.io.cs_dat.SUBQExcessQuadruplet(mixing_type: int, mixing_code: str, mixing_const: List[int], mixing_exponents: List[int], metadata: List[float], additional_cation_mixing_const: int, additional_anion_mixing_const: int, excess_coeffs: List[float])[source]

Bases: object

additional_anion_mixing_const: int
additional_cation_mixing_const: int
excess_coeffs: List[float]
expr(indices)[source]

Return an expression for the energy in this temperature interval

insert(dbf: Database, phase_name: str, As: List[str], Xs: List[str], excess_coeff_indices: List[int])[source]
metadata: List[float]
mixing_code: str
mixing_const: List[int]
mixing_exponents: List[int]
mixing_type: int
class pycalphad.io.cs_dat.SUBQPair(species_name: str, gibbs_eq_type: str, stoichiometry_pure_elements: List[float], intervals: List[pycalphad.io.cs_dat.IntervalBase], stoichiometry_quadruplet: List[float], zeta: float)[source]

Bases: Endmember

insert(dbf: Database, phase_name: str, constituent_array: List[str], gibbs_coefficient_idxs: List[int])[source]
stoichiometry_quadruplet: List[float]
zeta: float
class pycalphad.io.cs_dat.SUBQQuadrupletCoordinations(quadruplet_idxs: List[int], quadruplet_coordinations: List[float])[source]

Bases: object

insert(dbf: Database, phase_name: str, As: List[str], Xs: List[str])[source]

Add a Z_i_AB:XY parameter for each species defined in the quadruplet

quadruplet_coordinations: List[float]
quadruplet_idxs: List[int]
class pycalphad.io.cs_dat.TokenParser(string)[source]

Bases: object

parse(cls: type)[source]
parseN(N: int, cls: type)[source]
exception pycalphad.io.cs_dat.TokenParserError[source]

Bases: Exception

Exception raised when the TokenParser hits a parsing error.

pycalphad.io.cs_dat.parse_PTVm_terms(toks: TokenParser) PTVmTerms[source]
pycalphad.io.cs_dat.parse_additional_terms(toks: TokenParser) List[AdditionalCoefficientPair][source]
pycalphad.io.cs_dat.parse_cs_dat(instring)[source]
pycalphad.io.cs_dat.parse_endmember(toks: TokenParser, num_pure_elements, num_gibbs_coeffs, is_stoichiometric=False)[source]
pycalphad.io.cs_dat.parse_endmember_aqueous(toks: TokenParser, num_pure_elements: int, num_gibbs_coeffs: int)[source]
pycalphad.io.cs_dat.parse_endmember_qkto(toks: TokenParser, num_pure_elements: int, num_gibbs_coeffs: int)[source]
pycalphad.io.cs_dat.parse_endmember_subq(toks: TokenParser, num_pure_elements, num_gibbs_coeffs, zeta=None)[source]
pycalphad.io.cs_dat.parse_excess_magnetic_parameters(toks)[source]
pycalphad.io.cs_dat.parse_excess_parameters(toks, num_excess_coeffs)[source]
pycalphad.io.cs_dat.parse_excess_parameters_pitz(toks, num_excess_coeffs)[source]
pycalphad.io.cs_dat.parse_excess_qkto(toks, num_excess_coeffs)[source]
pycalphad.io.cs_dat.parse_header(toks: TokenParser) Header[source]
pycalphad.io.cs_dat.parse_interval_Gibbs(toks: TokenParser, num_gibbs_coeffs, has_additional_terms, has_PTVm_terms) IntervalG[source]
pycalphad.io.cs_dat.parse_interval_heat_capacity(toks: TokenParser, num_gibbs_coeffs, H298, S298, has_H_trans, has_additional_terms, has_PTVm_terms) IntervalCP[source]
pycalphad.io.cs_dat.parse_phase(toks, num_pure_elements, num_gibbs_coeffs, num_excess_coeffs, num_const)[source]

Dispatches to the correct parser depending on the phase type

pycalphad.io.cs_dat.parse_phase_aqueous(toks, phase_name, phase_type, num_pure_elements, num_gibbs_coeffs, num_const)[source]
pycalphad.io.cs_dat.parse_phase_cef(toks, phase_name, phase_type, num_pure_elements, num_gibbs_coeffs, num_excess_coeffs, num_const)[source]
pycalphad.io.cs_dat.parse_phase_real_gas(toks, phase_name, phase_type, num_pure_elements, num_gibbs_coeffs, num_const)[source]
pycalphad.io.cs_dat.parse_phase_subq(toks, phase_name, phase_type, num_pure_elements, num_gibbs_coeffs, num_excess_coeffs)[source]
pycalphad.io.cs_dat.parse_quadruplet(toks)[source]
pycalphad.io.cs_dat.parse_stoich_phase(toks, num_pure_elements, num_gibbs_coeffs)[source]
pycalphad.io.cs_dat.parse_subq_excess(toks, mixing_type, num_excess_coeffs)[source]
pycalphad.io.cs_dat.read_cs_dat(dbf: Database, fd)[source]

Parse a ChemSage DAT file into a pycalphad Database object.

Parameters:
  • dbf (Database) – A pycalphad Database.

  • fd (file-like) – File descriptor.

pycalphad.io.cs_dat.rename_element_charge(element, charge)[source]

We use the _ to separate so we have something to split on.

pycalphad.io.cs_dat.tokenize(instring, startline=0, force_upper=False)[source]

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(*args)[source]

Bases: object

Structured thermodynamic and/or kinetic data.

elements

Set of elements in database.

Type:

set

species

Set of species in database.

Type:

set

phases

Phase objects indexed by their system-local name.

Type:

dict

symbols

SymEngine objects indexed by their name (FUNCTIONs in Thermo-Calc).

Type:

dict

references

Reference objects indexed by their system-local identifier.

Type:

dict

Examples

>>> mydb = Database(open('crfeni_mie.tdb'))
>>> mydb = Database('crfeni_mie.tdb')
>>> f = StringIO(u'$a complete TDB file as a string\n')
>>> mydb = Database(f)
add_parameter(param_type, phase_name, constituent_array, param_order, param, ref=None, diffusing_species=None, force_insert=True, **kwargs)[source]

Add a parameter.

Parameters:
  • param_type (str) – Type name of the parameter, e.g., G, L, BMAGN.

  • phase_name (str) – Name of the phase.

  • constituent_array (list) – Configuration of the sublattices (elements and/or species).

  • param_order (int) – Polynomial order of the parameter.

  • param (object) – Abstract representation of the parameter, e.g., in SymEngine format.

  • ref (str, optional) – Reference for the parameter.

  • diffusing_species (str, optional) – (If kinetic parameter) Diffusing species for this parameter.

  • force_insert (bool, optional) – If True, inserts into the database immediately. False is a delayed insert (for performance).

  • kwargs (Any) – Additional metadata to insert into the parameter dictionary

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 (dict) – 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 SymEngine format.

Examples

None yet.

classmethod cast_from(val)[source]
static from_file(fname, fmt=None)[source]

Create a Database from a file.

Parameters:
  • fname (str or file-like) – File name/descriptor to read.

  • fmt (str, optional) – File format. If not specified, an attempt at auto-detection is made.

Returns:

dbf – Database from file.

Return type:

Database

Examples

None yet.

classmethod from_string(data, **kwargs)[source]

Returns Database from a string in the specified format. This function is a wrapper for calling from_file with StringIO.

Parameters:
  • data (str) – Raw database string in the specified format.

  • kwargs (optional) – See keyword arguments for from_file.

Returns:

dbf

Return type:

Database

process_parameter_queue()[source]

Process the queue of parameters so they are added to the TinyDB in one transaction. This avoids repeated (expensive) calls to insert().

static register_format(fmt, read=None, write=None)[source]

Add support for reading and/or writing the specified format.

Parameters:
  • fmt (str) – Format.

  • read (callable, optional) – Read function with arguments (Database, file_descriptor)

  • write (callable, optional) – Write function with arguments (Database, file_descriptor)

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)

to_file(fname, fmt=None, if_exists='raise', **write_kwargs)[source]

Write the Database to a file.

Parameters:
  • fname (str or file-like) – File name/descriptor to write.

  • fmt (str, optional) – File format. If not specified, an attempt at auto-detection is made.

  • if_exists (string, optional ['raise', 'rename', 'overwrite']) – Strategy if ‘fname’ already exists. The ‘raise’ option (default) will raise a FileExistsError. The ‘rename’ option will append the date/time to the filename. The ‘overwrite’ option will overwrite the file. This argument is ignored if ‘fname’ is file-like.

  • write_kwargs (optional) – Keyword arguments to pass to write function.

Examples

None yet.

to_string(**kwargs)[source]

Returns Database as a string. This function is a wrapper for calling to_file with StringIO.

Parameters:

kwargs (optional) – See keyword arguments for to_file.

Returns:

result

Return type:

str

exception pycalphad.io.database.DatabaseExportError[source]

Bases: Exception

Raised when a database cannot be written.

class pycalphad.io.database.DatabaseFormat(read, write)

Bases: tuple

read

Alias for field number 0

write

Alias for field number 1

class pycalphad.io.database.Phase[source]

Bases: object

Phase in the database.

name

System-local name of the phase.

Type:

string

constituents

Possible sublattice constituents (elements and/or species).

Type:

tuple of frozenset

sublattices

Site ratios of sublattices.

Type:

list

model_hints

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

Type:

dict

pycalphad.io.grammar module

“Common pyparsing grammar patterns.

pycalphad.io.grammar.parse_chemical_formula(formula)[source]

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: CaselessKeyword

Parser element for dealing with Thermo-Calc command abbreviations.

parseImpl(instring, loc, doActions=True)[source]
class pycalphad.io.tdb.TCPrinter(if_incompatible='warn')[source]

Bases: object

Prints Thermo-Calc style function expressions.

doprint(expr)[source]
pycalphad.io.tdb.add_phase_symmetry_ordering_parameters(dbf)[source]
pycalphad.io.tdb.get_supported_variables()[source]

When loading databases, these symbols should be replaced by their IndependentPotential counterparts

pycalphad.io.tdb.read_tdb(dbf, fd)[source]

Parse a TDB file into a pycalphad Database object.

Parameters:
  • dbf (Database) – A pycalphad Database.

  • fd (file-like) – File descriptor.

pycalphad.io.tdb.reflow_text(text, linewidth=80)[source]

Add line breaks to ensure text doesn’t exceed a certain line width.

Parameters:
  • text (str)

  • linewidth (int, optional)

Returns:

reflowed_text

Return type:

str

pycalphad.io.tdb.to_interval(relational)[source]
pycalphad.io.tdb.write_tdb(dbf, fd, groupby='subsystem', if_incompatible='warn')[source]

Write a TDB file from a pycalphad Database object.

The goal is to produce TDBs that conform to the most restrictive subset of database specifications. Some of these can be adjusted for automatically, such as the Thermo-Calc line length limit of 78. Others require changing the database in non-trivial ways, such as the maximum length of function names (8). The default is to warn the user when attempting to write an incompatible database and the user must choose whether to warn and write the file anyway or to fix the incompatibility.

Currently the supported compatibility fixes are: - Line length <= 78 characters (Thermo-Calc) - Function names <= 8 characters (Thermo-Calc)

The current unsupported fixes include: - Keyword length <= 2000 characters (Thermo-Calc) - Element names <= 2 characters (Thermo-Calc) - Phase names <= 24 characters (Thermo-Calc)

Other TDB compatibility issues required by Thermo-Calc or other software should be reported to the issue tracker.

Parameters:
  • dbf (Database) – A pycalphad Database.

  • fd (file-like) – File descriptor.

  • groupby (['subsystem', 'phase'], optional) – Desired grouping of parameters in the file.

  • if_incompatible (string, optional ['raise', 'warn', 'fix']) – Strategy if the database does not conform to the most restrictive database specification. The ‘warn’ option (default) will write out the incompatible database with a warning. The ‘raise’ option will raise a DatabaseExportError. The ‘ignore’ option will write out the incompatible database silently. The ‘fix’ option will rectify the incompatibilities e.g. through name mangling.

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.

Return type:

list of str of matching expanded keywords

Examples

None yet.

Module contents