sandlerprops.properties module

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