sandlerprops package

class PropertiesDatabase[source]

Bases: object

Properties database for thermophysical data.

Class Attributes

resources_rootPath

Root directory: files('sandlerprops') / 'resources'

data_dirPath

Data directory: resources_root / 'data'

datafile_pathPath

Database CSV path: data_dir / 'properties_database.csv'

resources_root: Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/sandlerprops/checkouts/latest/src/sandlerprops/resources')
data_dir: Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/sandlerprops/checkouts/latest/src/sandlerprops/resources/data')
datafile_path: Path = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/sandlerprops/checkouts/latest/src/sandlerprops/resources/data/properties_database.csv')
__init__()[source]
show_properties(args=None)[source]

Subcommand handler that displays the list of available properties with their units.

Parameters:

args (argparse.Namespace, optional) – Not used; present for compatibility since this is a subcommand handler.

find_compound(args)[source]

Subcommand handler that looks for a compound by name and displays if found.

Parameters:

args (argparse.Namespace) – Must contain attribute ‘compound_name’ with the name of the compound to find.

show_compound_properties(args)[source]

Display all properties of a specified compound.

Parameters:

args (Namespace)

get_property(compound_id, property_name, with_units=True)[source]

Get a property value for a compound.

Parameters:
  • compound_id (str or int) – Compound name or number

  • property_name (str) – Property column name

  • with_units (bool) – If True, return as Pint Quantity with units

Returns:

Property value

Return type:

float or pint.Quantity

get_compound(name, near_matches=10)[source]

Retrieves a Compound by name. If not found, suggests similar names and returns an unpopulated Compound object with name and Formula set to input name.

Parameters:
  • name (str) – Name of the compound to retrieve

  • near_matches (int) – Number of similar names to suggest if exact match not found

Returns:

The Compound object if found, else an empty Compound with name and Formula set.

Return type:

Compound

get_database()[source]

Get or create the singleton database instance.

Returns:

The singleton instance of the PropertiesDatabase.

Return type:

PropertiesDatabase

class Compound[source]

Bases: object

Chemical compound with thermophysical properties.

No: int = 0

Unique compound number

Formula: str = ''

Empirical formula

Name: str = ''

Unique compound name

Molwt: Quantity

Molecular weight

Tfp: Quantity

Triple point temperature

Tb: Quantity

Boiling point temperature

Tc: Quantity

Critical temperature

Pc: Quantity

Critical pressure

Vc: Quantity

Critical volume

Zc: float = 0.0

Critical compressibility

Omega: float = 0.0

Acentric factor

Dipm: Quantity

Dipole moment

CpA: float = 0.0

Ideal gas heat capacity coeff (J/(mol*K))

CpB: float = 0.0

Ideal gas heat capacity coeff (J/(mol*K^2))

CpC: float = 0.0

Ideal gas heat capacity coeff (J/(mol*K^3))

CpD: float = 0.0

Ideal gas heat capacity coeff (J/(mol*K^4))

dHf: Quantity

Ideal gas enthalpy of formation at 298.15 K

dGf: Quantity

Ideal gas Gibbs energy of formation at 298.15 K

Eq: int = 0

Vapor pressure equation type number

VpA: float = 0.0

Vapor pressure coeff 1

VpB: float = 0.0

Vapor pressure coeff 2

VpC: float = 0.0

Vapor pressure coeff 3

VpD: float = 0.0

Vapor pressure coeff 4

__init__(No=0, Formula='', Name='', Molwt=<factory>, Tfp=<factory>, Tb=<factory>, Tc=<factory>, Pc=<factory>, Vc=<factory>, Zc=0.0, Omega=0.0, Dipm=<factory>, CpA=0.0, CpB=0.0, CpC=0.0, CpD=0.0, dHf=<factory>, dGf=<factory>, Eq=0, VpA=0.0, VpB=0.0, VpC=0.0, VpD=0.0, Tmin=<factory>, Tmax=<factory>, Lden=0.0, Tden=<factory>, charge=0, atomset=<factory>, atomdict=<factory>, metadata=<factory>)
Parameters:
Return type:

None

Tmin: Quantity

Vapor pressure temperature range min

Tmax: Quantity

Vapor pressure temperature range max

Lden: float = 0.0

Liquid density at Tden

Tden: Quantity

Temperature at which liquid density is measured

charge: int = 0

Net charge of the compound (not in input properties set unless encoded in Formula)

atomset: set

Set of unique atom names in empirical formula

atomdict: dict

count items representing empirical formula

Type:

Dictionary of atomname

metadata: dict

Dictionary for storing any additional metadata passed from the database

get_Cp_coeffs()[source]

Get ideal gas heat capacity coefficients as dict.

Returns coefficients for: Cp = a + b*T + c*T^2 + d*T^3 where Cp is in J/(mol*K) and T is in K (dimensionless values).

Return type:

dict[str, float]

__post_init__()[source]

dictionary of atomname:count items representing empirical formula

property Cp

Returns ideal gas heat capacity coefficients as a numpy array

Cp_ideal_gas(T)[source]

Calculate ideal gas heat capacity at temperature T.

Parameters:

T (Quantity) – Temperature

Returns:

Heat capacity in J/(mol-K)

Return type:

Quantity

Cp_mean(T1, T2)[source]

Calculate mean ideal gas heat capacity between temperatures T1 and T2.

Parameters:
  • T1 (Quantity) – Lower temperature limit

  • T2 (Quantity) – Upper temperature limit

Returns:

Mean heat capacity in J/(mol-K)

Return type:

Quantity

property Pvap_est: Quantity

Submodules