Skip to content

fix: theoretical muD estimation #189

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

yucongalicechen
Copy link
Collaborator

closes #188, closes #187

  • Removed packing fraction option for theoretical muD estimation
  • Fixed issues where mu was incorrectly treated as muD
  • Updated related docs

@sbillinge ready for review. I've fixed a few issues related to the theoretical muD estimation and this should be the last issue before you check the docs in more detail. I'll do the recookiecut next.

Copy link

codecov bot commented May 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.31%. Comparing base (83ad2ec) to head (c9ee818).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #189   +/-   ##
=======================================
  Coverage   99.31%   99.31%           
=======================================
  Files           5        5           
  Lines         292      292           
=======================================
  Hits          290      290           
  Misses          2        2           
Files with missing lines Coverage Δ
tests/test_tools.py 98.84% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@sbillinge sbillinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this following the new pattern that we worked out in #181? It doesn't look like it is. Shouldn't the CLI look like
labpdfproc getmud -c ZrO ... ?

@yucongalicechen
Copy link
Collaborator Author

is this following the new pattern that we worked out in #181? It doesn't look like it is. Shouldn't the CLI look like labpdfproc getmud -c ZrO ... ?

No this is separate from getmuD. I think we also allow users to compute muD and apply corrections at the same step (e.g. using labpdfproc not labpdfproc getmud)? This change is for the labpdfproc command.

# Option 4: Using packing fraction
labpdfproc zro2_mo.xy -p ZrO2,17.45,0.2
# Option 3: Theoretical estimation
labpdfproc zro2_mo.xy -t ZrO2,17.45,1.2,1.0
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Just realized that I forgot to write comments for where I changed, sorry) Here I removed the packing fraction option example

# Option 4: Using packing fraction
args = Namespace(theoretical_from_packing="ZrO2,17.45,0.3")
# Option 3: Theoretical estimation
args = Namespace(theoretical_estimation="ZrO2,17.45,1.2,1.0")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove packing fraction

"Specify the chemical formula, incident x-ray energy (in keV), "
"and packing fraction (0 to 1), " + theoretical_mud_hmsg_suffix
"sample mass density (in g/cm^3), "
"and capillary diameter (in mm) "
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a requirement for specifying capillary diameter

return sample_composition, energy, mass_density_or_packing_fraction
sample_mass_density = float(parts[2])
diameter = float(parts[3])
return sample_composition, energy, sample_mass_density, diameter
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again add capillary diameter

args.energy,
sample_mass_density=args.sample_mass_density,
)
* args.diameter
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

muD = mu * D

@sbillinge
Copy link
Contributor

I can merge this if you want (it is conflicted so that needs to be fixed) but my concern is that the CLI is not the way we want it so we can't release this way. Do you want to fix things on this PR or another one?

@yucongalicechen
Copy link
Collaborator Author

I can merge this if you want (it is conflicted so that needs to be fixed) but my concern is that the CLI is not the way we want it so we can't release this way. Do you want to fix things on this PR or another one?

I can resolve the conflicts here so we can merge this PR, and address the CLI issue in a separate PR. Do you prefer to keep the different muD computation methods within getmuD only (as we discussed in #181)? I think it is also helpful to give users the option to compute muD during the correction.

@yucongalicechen
Copy link
Collaborator Author

@sbillinge ready for review.

@sbillinge
Copy link
Contributor

I can merge this if you want (it is conflicted so that needs to be fixed) but my concern is that the CLI is not the way we want it so we can't release this way. Do you want to fix things on this PR or another one?

I can resolve the conflicts here so we can merge this PR, and address the CLI issue in a separate PR. Do you prefer to keep the different muD computation methods within getmuD only (as we discussed in #181)? I think it is also helpful to give users the option to compute muD during the correction.

yes, I am working off the understanding that we are being guided by the discussion in #181. However, if we have this structure for getmud it kind of implies that there will be a similar construction for something with a name like getcorr or applymud, unless you can think of a better way of doing it.
labprdfproc getmud -c NaCl -e 25
labpdfproc applymud [file1.xy, file2.xy] --mud 1.8
labprdfproc applymud [file1.xy, file2.xy] -c NaCl -e 25 -d 1.5
something like that (this is not a complete list but just examples).

@sbillinge
Copy link
Contributor

Honestly I am inclined to just close this issue as it is a bunch of small fixes to a CLI that we are about to rip up and throw away. there may be a few lines of code that we can save, but when we make the new CLE I think how we handle the functions will change a bit too so I am not sure it makes any sense to keep any of this?

@yucongalicechen
Copy link
Collaborator Author

I can merge this if you want (it is conflicted so that needs to be fixed) but my concern is that the CLI is not the way we want it so we can't release this way. Do you want to fix things on this PR or another one?

I can resolve the conflicts here so we can merge this PR, and address the CLI issue in a separate PR. Do you prefer to keep the different muD computation methods within getmuD only (as we discussed in #181)? I think it is also helpful to give users the option to compute muD during the correction.

yes, I am working off the understanding that we are being guided by the discussion in #181. However, if we have this structure for getmud it kind of implies that there will be a similar construction for something with a name like getcorr or applymud, unless you can think of a better way of doing it. labprdfproc getmud -c NaCl -e 25 labpdfproc applymud [file1.xy, file2.xy] --mud 1.8 labprdfproc applymud [file1.xy, file2.xy] -c NaCl -e 25 -d 1.5 something like that (this is not a complete list but just examples).

Got it. Yeah I like this idea - I created a new issue (#191) for this because I feel like this is a separate problem from the getmud CLI. I'll close this PR once I've replaced it with a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: missing multiplication by capillary diameter in set_mud feat: Remove --theoretical-from-packing argument option for muD computation
2 participants