Skip to content

feat: initial commit on getmud module #175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: edited docstring and test comments based on UC1-2
  • Loading branch information
yucongalicechen committed May 2, 2025
commit 0b7a0f0c3aa5c4dae7f698c17f8a9b38e3259b2b
2 changes: 1 addition & 1 deletion news/getmud.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**Added:**

* Functionalities to estimate sample mass density or capillary diameter from muD and related chemical info.
* Functionalities to estimate sample mass density or capillary diameter from target muD and related chemical info.

**Changed:**

Expand Down
7 changes: 4 additions & 3 deletions src/diffpy/labpdfproc/getmud.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@


def estimate_mass_density(mud, diameter, sample_composition, energy):
"""Estimate sample mass density (g/cm^3) from mu*D
using capillary diameter, sample composition, and energy.
"""Estimate sample mass density (g/cm^3) from
muD, capillary diameter, sample composition, and energy.

Parameters
----------
Expand Down Expand Up @@ -46,7 +46,8 @@ def estimate_diameter(
sample_mass_density=None,
packing_fraction=None,
):
"""Estimate capillary diameter (mm) from mu*D and mu.
"""Estimate capillary diameter (mm) from
muD, sample composition, energy, and mass density/packing fraction.

Parameters
----------
Expand Down
12 changes: 6 additions & 6 deletions tests/test_getmud.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"mud": 2.0,
"diameter": 1.5,
"sample_composition": "ZrO2",
"energy": 20,
"energy": 17.45, # Mo K_alpha source
},
0.25,
1.0751,
),
],
)
Expand All @@ -36,16 +36,16 @@ def test_estimate_mass_density(inputs, expected_mass_density):
{
"mud": 2.0,
"sample_composition": "ZrO2",
"energy": 20,
"sample_mass_density": 0.25,
"energy": 17.45,
"sample_mass_density": 1.20,
},
1.5,
1.3439,
),
# ( # C2: user specifies a packing fraction
# {
# "mud": 2.0,
# "sample_composition": "ZrO2",
# "energy": 20,
# "energy": 17.45,
# "packing_fraction": 0.3
# },
# 1.5
Expand Down
Loading