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

Conversation

yucongalicechen
Copy link
Collaborator

closes #166
Initial commit. Probably needs a bit more discussion on what's the most useful here.

Copy link

codecov bot commented Apr 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.33%. Comparing base (89de7c2) to head (0b7a0f0).
Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #175      +/-   ##
==========================================
+ Coverage   99.31%   99.33%   +0.02%     
==========================================
  Files           5        6       +1     
  Lines         292      302      +10     
==========================================
+ Hits          290      300      +10     
  Misses          2        2              
Files with missing lines Coverage Δ
tests/test_getmud.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 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.

please see comments. I am a little confused what is going on here. Do we have UCs for these functionalities? What is the user wanting to do? Once we know that we can design what the functions should do and capture that in tests. Only then do we write any functions.

"mud": 2.0,
"diameter": 1.5,
"sample_composition": "ZrO2",
"energy": 20,
Copy link
Contributor

Choose a reason for hiding this comment

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

it is probably a better test if we use reasonable energies. These would be Cu Kalpha, Mo Kalpha, Ag Kalpha. They don't have to be exact but ballpark,

mu = compute_mu_using_xraydb(
sample_composition, energy, sample_mass_density, packing_fraction
)
return mud / mu
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't mud/ mu = d?

diameter : float
The given diameter of the sample capillary in mm.
"""
mu = compute_mu_using_xraydb(
Copy link
Contributor

Choose a reason for hiding this comment

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

comment out and replace with pass. Let's just work on tests to begin with, until we learn what we want the function to do.

mud : float
The given product of attenuation coefficient mu
in mm^{-1} and capillary diameter in mm.
sample_composition : str
Copy link
Contributor

Choose a reason for hiding this comment

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

These are not needed presumably. If I know mud and I know mu then nothing else matters.

@yucongalicechen
Copy link
Collaborator Author

@sbillinge ready for review - I edited the docstrings and tests based on our UC1-2.
For UC2 I kept it for now but I will send a message to @till-schertenleib to see if it makes sense.
I moved UC3-4 to #181 for the next release since we do not have our density database now.

@sbillinge
Copy link
Contributor

@sbillinge ready for review - I edited the docstrings and tests based on our UC1-2. For UC2 I kept it for now but I will send a message to @till-schertenleib to see if it makes sense. I moved UC3-4 to #181 for the next release since we do not have our density database now.

where can I find the UCs? Please can you put a link here?

@yucongalicechen
Copy link
Collaborator Author

@sbillinge ready for review - I edited the docstrings and tests based on our UC1-2. For UC2 I kept it for now but I will send a message to @till-schertenleib to see if it makes sense. I moved UC3-4 to #181 for the next release since we do not have our density database now.

where can I find the UCs? Please can you put a link here?

It's here: #166.

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.

OK, this is great now we have the UCs. I think we are doing UC1 and UC3 and UC4.

UC1 is composition+energy+rho -> diameter
UC3 is comp + E -> mu (fully dense and 50% packing fraction)

I think that we probably want:
F1: comp + E + density -> mu
F2: comp + E -> estimated mu after looking up a CIF

Then we can satisfy
UC1 as muD/F1(comp,E,density)
UC4 as muD/F2(comp,E)
F2 satisfies UC3

Please could you close this and make one PR for each of those functions?

Do we also need a command line app that the user runs to get this info? Let's put that on a separate PR, with the docs too.

It is already 3:20 so I guess we won't get this merged by 5. Shall we push off that meeting until tomorrow?

Parameters
----------
mud : float
The given product of attenuation coefficient mu
Copy link
Contributor

Choose a reason for hiding this comment

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

"The given muD of the sample"

The rest you wrote just makes it more confusing I thank.

diameter : float
The given diameter of the sample capillary in mm.
sample_composition : str
The chemical formula of the material.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would give a few example to illustreate what form it must be in to be valid. I think we will use that help text in multiple places, so maybe define it in a variable and reuse? We may have already written it somewere in a docstring or the docs, so just copy paste from there if possible....

The given diameter of the sample capillary in mm.
sample_composition : str
The chemical formula of the material.
energy : float
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe call this xray_energy?


Returns
-------
estimated_density : float
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the density is "estimated", it is calculated, given the other parameters

@yucongalicechen
Copy link
Collaborator Author

OK, this is great now we have the UCs. I think we are doing UC1 and UC3 and UC4.

UC1 is composition+energy+rho -> diameter UC3 is comp + E -> mu (fully dense and 50% packing fraction)

I think that we probably want: F1: comp + E + density -> mu F2: comp + E -> estimated mu after looking up a CIF

Then we can satisfy UC1 as muD/F1(comp,E,density) UC4 as muD/F2(comp,E) F2 satisfies UC3

Please could you close this and make one PR for each of those functions?

Do we also need a command line app that the user runs to get this info? Let's put that on a separate PR, with the docs too.

It is already 3:20 so I guess we won't get this merged by 5. Shall we push off that meeting until tomorrow?

Gotcha yeah I will make one PR for each function! Will find a spot for meeting tomorrow :)

@yucongalicechen
Copy link
Collaborator Author

yucongalicechen commented May 5, 2025

@sbillinge Just to clarify before I make any new PRs, I will do the following:

  1. Make a PR for F1 which addresses UC1 => this is needed for tomorrow's release
  2. Make a PR for F2 which addresses UC3 + 4 (feat: getmuD UC3-4 #181)
  3. Make an issue and PR for CLI app (USE CASES - get mud #183)
  4. (Done) Make an issue for docs (this is in docs: getmuD module #182)

@sbillinge
Copy link
Contributor

That looks about right, but I think there needs to be a CLI app for UC1 also, no?

We should maybe discuss what the CLI should look like. Are they separate apps that do those tasks, or do we want one entry point but give different behavior if different command line switches are used? For example, for UC1 should the user type get_diameter <composition> <energy> <mass-density> or do we want them to type something like labpdfproc --get-d <composition> <energy> <mass-density> or sthg else?

@yucongalicechen
Copy link
Collaborator Author

That looks about right, but I think there needs to be a CLI app for UC1 also, no?

We should maybe discuss what the CLI should look like. Are they separate apps that do those tasks, or do we want one entry point but give different behavior if different command line switches are used? For example, for UC1 should the user type get_diameter <composition> <energy> <mass-density> or do we want them to type something like labpdfproc --get-d <composition> <energy> <mass-density> or sthg else?

Gotcha gotcha I think I'm on the same page now. I've created a PR for this (#184), so I'm closing this 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.

feat: getmud UC1
2 participants