NMRData¶
petrophys.interpretation.nmr.NMRData
- class NMRData(
- depth,
- mphi,
- mffi=None,
- mbvi=None,
- bins=None,
- t2lm_stored=None,
- t2_cutoff_curve=None,
- t2_centers=<factory>,
- t2_cutoff=33.0,
- stored_permeability=<factory>,
- extra_curves=<factory>,
- metadata=<factory>,
NMR log data container.
- Parameters:
depth (np.ndarray) – Measured depth (ft or m).
mphi (np.ndarray) – Total NMR porosity — sum of all T2 bins (porosity units, pu).
mffi (np.ndarray, optional) – Free Fluid Index (pu). If absent, computed from bins.
mbvi (np.ndarray, optional) – Bulk Volume Irreducible (pu). If absent, computed from bins.
bins (np.ndarray, optional) – Shape
(n_depth, n_bins)— porosity contribution (pu) per T2 bin.t2lm_stored (np.ndarray, optional) – Pre-computed T2 log mean (ms) loaded directly from the LAS file. Used by
t2_lm()when bin data are not available.t2_cutoff_curve (np.ndarray, optional) – T2 cutoff at each depth (ms). When set, the bin-based BVI and FFI use it in place of
t2_cutoffunless a cutoff is passed to them.t2_centers (np.ndarray) – T2 bin centre times (ms). Default: [4, 8, 16, 32, 64, 128, 256, 512] ms.
t2_cutoff (float) – T2 cutoff separating MBVI from MFFI (ms). Default: 33 ms.
stored_permeability (dict, optional) – Permeability curves delivered with the log (mD), keyed
"KSDR"and"KTIM".permeability_sdr()andpermeability_coates()return them when called with their default coefficients andprefer_stored.extra_curves (dict, optional) – Other curves of the source file, by mnemonic, one value per depth; kept with the data and included in its table.
metadata (dict) – Source file info, well name, etc.
Examples
>>> import petrophys >>> nmr = NMRData.from_las(petrophys.sample("daydream1_cmr"), ... mphi_mnemonic="TCMR", mffi_mnemonic="CMFF") >>> k_tc = nmr.permeability_coates()
This scalar CMR sample has no T2 bins or T2LM curve. Coates permeability can use its free/bound-fluid volumes, but T2 log mean and SDR cannot be reconstructed from them. With a different file containing T2 data, check
nmr.has_t2lmbefore callingt2_lm()orpermeability_sdr().Attributes
True if T2lm is available either from bins or a stored curve.
Methods
Cumulative T2 distribution per depth, normalised to the sum of the bins.
Bulk Volume Irreducible from T2 bins (the bins below the cutoff).
Calibrate Timur-Coates parameters against core permeability.
Calibrate the SDR constant
cagainst core permeability.Free Fluid Index from T2 bins (the bins above the cutoff).
Return a new NMRData filtered to [top, bottom].
Load a processed Schlumberger CMR LAS summary log.
Load NMR data from a CSV file.
Create NMRData from a pandas DataFrame.
Load NMR data from a LAS file.
Timur-Coates NMR permeability.
SDR (Schlumberger-Doll Research) NMR permeability.
Estimate a characteristic pore body radius from T2lm.
NMR irreducible water saturation: MBVI / MPHI.
Return (t2_centers, bin_porosities) at one depth index.
Logarithmic mean T2 (T2lm) in ms.
Export to a pandas DataFrame.
- classmethod from_csv(
- filepath,
- depth_col='Depth',
- mphi_col='MPHI',
- mffi_col='MFFI',
- mbvi_col='MBVI',
- bin_cols=None,
- t2lm_col=None,
- t2_centers=None,
- t2_cutoff=T2_CUTOFF_CLASTIC,
- null_value=-999.25,
- porosity_unit=None,
- **read_csv_kwargs,
Load NMR data from a CSV file.
Default column layout matches the standard MRIL-style CSV export:
Depth, MPHI, P1, P2, P3, P4, P5, P6, P7, P8, MFFI, MBVI
- Parameters:
filepath (str or Path)
depth_col (str)
mphi_col (str)
mffi_col (str, optional)
mbvi_col (str, optional)
bin_cols (list of str, optional) – T2 bin columns in T2-ascending order. Default: [“P1”…”P8”] when present.
t2lm_col (str, optional) – Column containing a pre-computed T2 log mean (ms).
t2_centers (np.ndarray, optional) – T2 bin centre values (ms).
t2_cutoff (float)
null_value (float)
porosity_unit ({"v/v", "pu"}, optional) – Unit of the porosity columns; see
from_dataframe().
- Return type:
- classmethod from_dataframe(
- df,
- depth_col='Depth',
- mphi_col='MPHI',
- mffi_col='MFFI',
- mbvi_col='MBVI',
- bin_cols=None,
- t2lm_col=None,
- t2_centers=None,
- t2_cutoff=T2_CUTOFF_CLASTIC,
- null_value=-999.25,
- porosity_unit=None,
Create NMRData from a pandas DataFrame.
Column names match without regard to case. The NMR calculations take porosity in porosity units (pu, percent):
porosity_unit="v/v"multiplies the porosity and bin columns by 100,"pu"keeps them. Unset, a total porosity of at most 1.5 everywhere is read as v/v and converted, with a warning.
- classmethod from_las(
- filepath,
- mphi_mnemonic='MPHI',
- mffi_mnemonic='MFFI',
- mbvi_mnemonic='MBVI',
- t2lm_mnemonic='T2LM',
- t2_cutoff_mnemonic='T2CUTOFF',
- ksdr_mnemonic='KSDR',
- ktim_mnemonic='KTIM',
- bin_mnemonics=None,
- t2_centers=None,
- t2_cutoff=None,
- null_value=-999.25,
- derive_mbvi=True,
Load NMR data from a LAS file.
Depth is read via
lasio’slas.indexproperty, which always returns the first column regardless of its mnemonic name.- Parameters:
filepath (str or Path)
mphi_mnemonic (str)
mffi_mnemonic (str, optional)
mbvi_mnemonic (str, optional)
t2lm_mnemonic (str, optional) – Mnemonic for a pre-computed T2 log mean curve (e.g.
"T2LM"from Halliburton MRIL output). Used when bin curves are absent.t2_cutoff_mnemonic (str, optional) – Mnemonic of a T2 cutoff curve (ms); None reads no such curve.
ksdr_mnemonic (str, optional) – Mnemonics of delivered SDR and Timur-Coates permeability curves (mD), kept in
stored_permeability; None reads no such curve.ktim_mnemonic (str, optional) – Mnemonics of delivered SDR and Timur-Coates permeability curves (mD), kept in
stored_permeability; None reads no such curve.bin_mnemonics (list of str, optional) – Ordered T2 bin curve mnemonics (e.g.
["T2B01",…,"T2B08"]).t2_centers (np.ndarray, optional)
t2_cutoff (float, optional) – T2 cutoff, ms. Set, it is used at every depth and a T2CUTOFF curve in the file is kept as an extra curve only. Default: the T2CUTOFF curve where the file has one (its median as the scalar cutoff), else 33 ms (clastic).
null_value (float)
derive_mbvi (bool, default True) – When the file has no bound-fluid curve but has a free-fluid curve, take MBVI as MPHI - MFFI (NaN where that is negative). False leaves MBVI unset.
- Return type:
- classmethod from_cmr_las(filepath, **kwargs)[source]¶
Load a processed Schlumberger CMR LAS summary log.
- t2_lm(min_bin_coverage=1.0)[source]¶
Logarithmic mean T2 (T2lm) in ms.
Computed from T2 bins when available (preferred); falls back to the
t2lm_storedcurve loaded from LAS. RaisesValueErrorif neither is present.\[T2_{lm} = \exp\!\left( \frac{\sum_i \phi_i \ln T2_i}{\sum_i \phi_i} \right)\]
- bvi_from_bins(cutoff_ms=None, min_bin_coverage=1.0, partial_bins=True)[source]¶
Bulk Volume Irreducible from T2 bins (the bins below the cutoff).
The bin that straddles the cutoff counts with the part of its log-T2 width below it (
t2_fraction_below_cutoff).- Parameters:
cutoff_ms (float, optional) – T2 cutoff (ms). Defaults to
self.t2_cutoff.min_bin_coverage (float) – Share of the summed bins that must have a value at a depth, 0 to 1 (default 1: all of them); below it the result is NaN there.
partial_bins (bool) –
Falsecounts whole bins with centre < cutoff, the split some vendor summaries use.
- Return type:
- ffi_from_bins(cutoff_ms=None, min_bin_coverage=1.0, partial_bins=True)[source]¶
Free Fluid Index from T2 bins (the bins above the cutoff).
The complement of
bvi_from_bins();partial_bins=Falsecounts whole bins with centre >= cutoff.- Parameters:
- Return type:
- permeability_sdr(c=None, calibration=None, prefer_stored=True)[source]¶
SDR (Schlumberger-Doll Research) NMR permeability.
\[k_{SDR} = C \cdot \phi_{NMR}^{4} \cdot T2_{lm}^{2}\]where φ is in fraction (0–1) and T2lm in ms.
- Parameters:
c (float, optional) – Empirical constant in mD/ms² (default 4.0, the value commonly used for sandstones). Ignored when
calibrationis supplied.calibration (NMRCalibration, optional) – Result of
calibrate_sdr(). When provided, the fitted constant overridesc.prefer_stored (bool) – Return the stored vendor
KSDRcurve, when one was loaded, instead of computing it. Applies only when neithercnorcalibrationis given.
- Returns:
Permeability (mD).
- Return type:
np.ndarray
- permeability_coates(
- c=None,
- a=None,
- b=None,
- calibration=None,
- prefer_stored=True,
Timur-Coates NMR permeability.
\[k_{TC} = \left(\frac{\phi_{NMR}}{C}\right)^{a} \cdot \left(\frac{FFI}{BVI}\right)^{b}\]- Parameters:
c (float, optional) – Coates parameters (defaults 10, 4, 2). Ignored when
calibrationis supplied.a (float, optional) – Coates parameters (defaults 10, 4, 2). Ignored when
calibrationis supplied.b (float, optional) – Coates parameters (defaults 10, 4, 2). Ignored when
calibrationis supplied.calibration (NMRCalibration, optional) – Result of
calibrate_coates(). When provided, fitted parameters overridec,a,b.prefer_stored (bool) – Return the stored vendor
KTIMcurve, when one was loaded, instead of computing it. Applies only when none ofc,a,borcalibrationis given.
- Returns:
Permeability (mD). NaN where BVI = 0.
- Return type:
np.ndarray
- calibrate_sdr(core_depth, core_perm)[source]¶
Calibrate the SDR constant
cagainst core permeability.Finds
cthat minimises the mean squared error between log10(k_SDR) and log10(k_core). The empirical porosity and T2lm exponents stay at 4 and 2.- Parameters:
core_depth (array-like) – Depths of core plug measurements (same units as
self.depth).core_perm (array-like) – Core air/Klinkenberg permeability (mD).
- Return type:
- calibrate_coates(core_depth, core_perm, fit_exponents=False)[source]¶
Calibrate Timur-Coates parameters against core permeability.
- Parameters:
core_depth (array-like)
core_perm (array-like) – Core permeability (mD).
fit_exponents (bool) – If False (default), only
cis fitted (a=4, b=2 fixed). If True,a,b, andcare all fitted via linear regression in log space.
- Return type:
- pore_size(surface_relaxivity=10.0, geometry='sphere')[source]¶
Estimate a characteristic pore body radius from T2lm.
\[r = F \cdot \rho_2 \cdot T2_{lm}\]where F = 3 (sphere), 2 (cylinder), or 1 (slit), ρ₂ is surface relaxivity (µm/s), and T2lm is in s.
- Parameters:
surface_relaxivity (float) – ρ₂ (µm/s). Typical: 10–30 µm/s clastics, 1–10 µm/s carbonates.
geometry ({"sphere", "cylinder", "slit"})
- Returns:
Pore body radius (µm).
- Return type:
np.ndarray
- swirr_nmr()[source]¶
NMR irreducible water saturation: MBVI / MPHI.
- Returns:
Swirr (0–1). NaN where MPHI = 0.
- Return type:
np.ndarray
- bin_cumulative()[source]¶
Cumulative T2 distribution per depth, normalised to the sum of the bins.
- Returns:
Shape (n_depth, n_bins). Each row ends at 1 where the bins sum to more than 0; NaN bins are skipped (they add nothing); NaN rows where the depth has no bin data.
- Return type:
np.ndarray