pyrfume.odorants module¶
Classes for odorants, mixtures, chemical orders, etc.
-
class
pyrfume.odorants.
ChemicalOrder
(molecule: pyrfume.odorants.Molecule, vendor: pyrfume.odorants.Vendor, part_id: str, purity: float = 1, known_impurities: list = None)[source]¶ Bases:
object
-
known_impurities
= None¶
-
molecule
= None¶
-
part_id
= ''¶
-
purity
= 1¶
-
vendor
= None¶
-
-
class
pyrfume.odorants.
Compound
(chemical_order: pyrfume.odorants.ChemicalOrder, stock: str = '', date_arrived: datetime.datetime = None, date_opened: datetime.datetime = None, is_solvent: bool = False)[source]¶ Bases:
object
-
chemical_order
= None¶
-
date_arrived
= None¶
-
date_opened
= None¶
-
is_solvent
= False¶
-
stock
= ''¶
-
-
class
pyrfume.odorants.
Molecule
(cid: int, name: str = None, fill: bool = False)[source]¶ Bases:
object
-
cas
= ''¶
-
cid
= 0¶
-
density
= None¶
-
iupac
= ''¶
-
molar_evaporation_rate
¶
-
molarity
¶
-
molecular_weight
= None¶
-
name
= ''¶
-
synonyms
= ''¶
-
vapor_pressure
= None¶
-
-
class
pyrfume.odorants.
Solution
(components: dict, date_created: datetime.datetime = None)[source]¶ Bases:
object
-
components
= None¶
-
compounds
¶
-
date_created
= None¶
-
dilutions
¶
-
molar_evaporation_rates
¶
-
molarities
¶ Returns a dictionary with the molarity of each Molecule
-
mole_fractions
¶ Returns a dictionary with the mole fraction of each Molecule
-
molecules
¶ Returns a dictionary with the moles of each Molecule
-
partial_pressures
¶ Computes partial pressures for each odorant in the mixture using Raoult’s law
-
total_pressure
¶ Computes total pressure of the vapor using Dalton’s law
-
vapor_concentrations
¶ Concentrations of each component in the vapor phase at steady state. Units are fraction of volume. Air is assumed to make up the balance
-
-
pyrfume.odorants.
all_odorants
()[source]¶ All CIDs, SMILES, Names, and Molecular Weights found in the file at ODORANTS_BASIC_INFO_PATH
-
pyrfume.odorants.
all_smiles
()[source]¶ All SMILES found in the file at ODORANTS_BASIC_INFO_PATH. May contain duplicates (if two CIDs give the same SMILES)
-
pyrfume.odorants.
all_sources
()[source]¶ Whether or not each odorant (by CID) is in each of the data sources
-
pyrfume.odorants.
canonical_smiles
(smiles: str, kekulize: bool = False) → str[source]¶ Use rdkit to convert the smiles string to canonical form
-
pyrfume.odorants.
cids_to_smiles
(cids: list) → dict[source]¶ Returns an ordered dictionary of SMILES strings with CIDs as keys
-
pyrfume.odorants.
display_molecules
(molecules: pandas.core.frame.DataFrame, no_of_columns=5, figsize=(15, 15))[source]¶
-
pyrfume.odorants.
get_cid
(identifier: str, kind: str = None, verbose: bool = True, fix_smiles_on_error: bool = True, attempt=0) → int[source]¶ Return data about a molecule from any synonym, including a chemical name or a CAS. change_kind: Whether to try other kinds if the search fails.
-
pyrfume.odorants.
get_cids
(identifiers: list, kind: str = None, verbose: bool = True, wait: float = 0, results: dict = None) → dict[source]¶ Return CIDs for molecule based on any synonym, including a chemical name or a CAS
-
pyrfume.odorants.
get_compound_summary
(cid: int, heading: str)[source]¶ Get summary info about heading from PubChem for the compound given by cid. Example heading: ‘Physical Description’
-
pyrfume.odorants.
smiles_to_image
(smiles, png=True, b64=False, crop=True, padding=10, size=300)[source]¶ png: Whether to convert to .png data (or to leave as a PIL image) b64: Whether to base64 encode (only possible for .png data)