Skip to content
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

Feature step5 integration #51

Merged
merged 44 commits into from
Jan 29, 2024
Merged

Feature step5 integration #51

merged 44 commits into from
Jan 29, 2024

Conversation

kmilo9999
Copy link
Collaborator

  • Add step5 analysis_db/B04_angle.py
  • Updated ICEsat2_SI_tools/generalized_FT.py and ICEsat2_SI_tools/sliderule_converter_tools.py to fix integration issues
  • Cleaned and formatted files

Copy link
Member

Choose a reason for hiding this comment

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

Modified in #45. Wait for merge?

Copy link
Member

Choose a reason for hiding this comment

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

Modified in #45. Wait for merge?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes!!

Base automatically changed from feat-step4-intg to main January 17, 2024 18:58
@kmilo9999 kmilo9999 requested a review from cpaniaguam January 24, 2024 15:27
@kmilo9999 kmilo9999 requested a review from cpaniaguam January 24, 2024 18:31
Copy link
Member

@cpaniaguam cpaniaguam left a comment

Choose a reason for hiding this comment

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

A couple more cleanups suggested!

.github/workflows/test-B01_SL_load_single_file.yml Outdated Show resolved Hide resolved
@kmilo9999 kmilo9999 requested a review from cpaniaguam January 25, 2024 16:18
Copy link
Member

@cpaniaguam cpaniaguam left a comment

Choose a reason for hiding this comment

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

Happy to see this passing!

I have some general comments and questions, two suggestions for issues I've seen elsewhere in the package, and a couple suggested changes.

Copy link
Member

Choose a reason for hiding this comment

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

What is this file for? Its extension is kind of confusing.

Copy link
Collaborator Author

@kmilo9999 kmilo9999 Jan 26, 2024

Choose a reason for hiding this comment

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

My idea was to patch the angle_optimizer which is the one making step5 crash. This patch file has the instruction that changes the specific line that causes the error. But it seems patching the file didnt work either. I'm removing it, but leaving a comment in the angle_optimizer.py file mentioning how we solved this issue.

Comment on lines +209 to +213
# TODO: this funciton throws an error in CI. The nan_policy='omit' policiy was added to avoid this issue
# according to the guidelines in https://lmfit.github.io/lmfit-py/faq.html#i-get-errors-from-nan-in-my-fit-what-can-i-do
self.fitter = self.LM.minimize(self.objective_func, self.params, method=method,
args=fitting_args, kws=fitting_kargs ,
nwalkers=self.nwalkers, steps=steps, pos= self.seeds, **kargs)
nwalkers=self.nwalkers, steps=steps, pos= self.seeds,nan_policy='omit' , **kargs)
Copy link
Member

Choose a reason for hiding this comment

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

Is there something still left to do here? Otherwise, the 'TODO' part of the comment could be removed if the change is going to be kept.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This line is the one throwing the error. The TODO comment is just to remind us that something needs to be done here

import icesat2_tracks.ICEsat2_SI_tools.spicke_remover as spicke_remover
import datetime
import icesat2_tracks.ICEsat2_SI_tools.generalized_FT as gFT
from scipy.ndimage.measurements import label
Copy link
Member

Choose a reason for hiding this comment

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

I think this import throws a deprecation warning.

Suggested change
from scipy.ndimage.measurements import label
from scipy.ndimage import label

Maybe an issue should be created as I've seen this elsewhere in the package.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done!

@@ -114,10 +118,12 @@ def linear_gap_fill(F, key_lead, key_int):
exit()

# test LS with an even grid where missing values are set to 0
imp.reload(spec)
Copy link
Member

Choose a reason for hiding this comment

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

Lines with imp.reload and its corresponding import statements can be removed. imp or its successor importlib are modules people use during development, not for production code.

There are many instances where imp is used in the package. Maybe for another issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#84

Comment on lines 158 to 160
for k in all_beams:
# print(k) # TODO: add logger
hkey = "heights_c_weighted_mean"
x = Gd[k + "/dist"][:]
# print(x[0], x[-1]) # TODO: add logger
print(k)
hkey = "h_mean"
Copy link
Member

Choose a reason for hiding this comment

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

L160 should go outside (before) of the for loop here.

Copy link
Member

Choose a reason for hiding this comment

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

Clarifying question for me: why the change "heights_c_weighted_mean" => "h_mean"?

Another sliderule breaking change perhaps?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mochell any thoughts ? ☝️

Copy link
Member

Choose a reason for hiding this comment

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

L160 should go outside (before) of the for loop here.

@kmilo9999 What do you think of this change?

If this change is made, the other line, L191, where hkey is redefined with the same value can be deleted.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The hkey is being redefined in line 188 with the same value. I'm removing it from the loop

src/icesat2_tracks/analysis_db/B02_make_spectra_gFT.py Outdated Show resolved Hide resolved
@kmilo9999 kmilo9999 requested a review from cpaniaguam January 26, 2024 16:22
Copy link
Member

@cpaniaguam cpaniaguam left a comment

Choose a reason for hiding this comment

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

I noted a change that was undone (docstring at the top) and I saw a constant being defined in a for loop.

src/icesat2_tracks/analysis_db/B02_make_spectra_gFT.py Outdated Show resolved Hide resolved
src/icesat2_tracks/analysis_db/B02_make_spectra_gFT.py Outdated Show resolved Hide resolved
Comment on lines 158 to 160
for k in all_beams:
# print(k) # TODO: add logger
hkey = "heights_c_weighted_mean"
x = Gd[k + "/dist"][:]
# print(x[0], x[-1]) # TODO: add logger
print(k)
hkey = "h_mean"
Copy link
Member

Choose a reason for hiding this comment

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

L160 should go outside (before) of the for loop here.

@kmilo9999 What do you think of this change?

If this change is made, the other line, L191, where hkey is redefined with the same value can be deleted.

@kmilo9999 kmilo9999 requested a review from cpaniaguam January 26, 2024 18:12
Copy link
Member

@cpaniaguam cpaniaguam left a comment

Choose a reason for hiding this comment

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

🍻

@kmilo9999 kmilo9999 merged commit 068717d into main Jan 29, 2024
1 check passed
@kmilo9999 kmilo9999 deleted the feat-step5-intg branch January 29, 2024 14:27
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.

3 participants