Skip to content

Commit

Permalink
Merge pull request #498 from HajimeKawahara/refac
Browse files Browse the repository at this point in the history
Refactoring 2024/7 (1)
  • Loading branch information
HajimeKawahara authored Jul 20, 2024
2 parents 9020bd9 + b165b92 commit 15a1c50
Show file tree
Hide file tree
Showing 16 changed files with 648 additions and 543 deletions.
28 changes: 15 additions & 13 deletions src/exojax/spec/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
"""Molecular database (MDB) class using a common API w/ RADIS = (CAPI), will be renamed.
"""Molecular database API class using a common API w/ RADIS = (CAPI)
* MdbExomol is the MDB for ExoMol
* MdbHit is the MDB for HITRAN or HITEMP
* MdbHitran is the MDB for HITRAN
* MdbHitemp is the MDB for HITEMP
* MdbCommonHitempHitran is the common MDB for HITEMP and HITRAN
"""
from os.path import exists
import numpy as np
Expand Down Expand Up @@ -32,16 +35,15 @@


class MdbExomol(CapiMdbExomol):
"""molecular database of ExoMol.
"""molecular database of ExoMol form.
MdbExomol is a class for ExoMol.
MdbExomol is a class for ExoMol database. It inherits the CAPI class MdbExomol and adds some additional features.
Attributes:
simple_molecule_name: simple molecule name
nurange: nu range [min,max] (cm-1)
nu_lines (nd array): line center (cm-1)
Sij0 (nd array): line strength at T=Tref (cm)
logsij0 (jnp array): log line strength at T=Tref
A (jnp array): Einstein A coeeficient
gamma_natural (DataFrame or jnp array): gamma factor of the natural broadening
Expand Down Expand Up @@ -158,7 +160,7 @@ def set_wavenum(self, nurange):
return wavenum_min, wavenum_max

def activate(self, df, mask=None):
"""activation of moldb,
"""Activates of moldb for Exomol, including making instances, computing broadening parameters, natural width, and transfering instances to gpu arrays when self.gpu_transfer = True
Notes:
activation includes, making instances, computing broadening parameters, natural width,
Expand Down Expand Up @@ -212,7 +214,7 @@ def compute_load_mask(self, df):
return mask

def instances_from_dataframes(self, df_masked):
"""generate instances from (usually masked) data frame
"""Generates instances from (usually masked) data frame for Exomol
Args:
df_masked (DataFrame): (masked) data frame
Expand All @@ -237,7 +239,7 @@ def instances_from_dataframes(self, df_masked):
raise ValueError("Use vaex dataframe as input.")

def apply_mask_mdb(self, mask):
"""apply mask for mdb class
"""Applys mask for mdb class for Exomol
Args:
mask: mask to be applied
Expand Down Expand Up @@ -272,7 +274,7 @@ def Sij0(self):
return self.line_strength_ref

def generate_jnp_arrays(self):
"""(re)generate jnp.arrays.
"""(re)generates jnp.arrays.
Note:
We have nd arrays and jnp arrays. We usually apply the mask to nd arrays and then generate jnp array from the corresponding nd array. For instance, self._A is nd array and self.A is jnp array.
Expand Down Expand Up @@ -486,11 +488,11 @@ def QT_interp(self, isotope, T):
"""interpolated partition function.
Args:
isotope: HITRAN isotope number starting from 1
T: temperature
isotope: HITRAN isotope number starting from 1
T: temperature
Returns:
Q(idx, T) interpolated in jnp.array
Q(idx, T) interpolated in jnp.array
"""
isotope_index = _isotope_index_from_isotope_number(isotope, self.uniqiso)
return _QT_interp(isotope_index, T, self.T_gQT, self.gQT)
Expand Down Expand Up @@ -818,7 +820,7 @@ def __init__(
nonair_broadening=False,
with_error=False,
):
"""Molecular database for HITRAN/HITEMP form.
"""Molecular database for HITRAN/HITEMP form.
Args:
path: path for HITRAN/HITEMP par file
Expand Down
Loading

0 comments on commit 15a1c50

Please sign in to comment.