Skip to content

stretchednmfapp.py #40

Merged
sbillinge merged 7 commits intodiffpy:mainfrom
aajayi-21:mainfunction
Aug 17, 2023
Merged

stretchednmfapp.py #40
sbillinge merged 7 commits intodiffpy:mainfrom
aajayi-21:mainfunction

Conversation

@aajayi-21
Copy link
Copy Markdown
Contributor

stretchednmfapp.py contains the 'main' function of the software.

@aajayi-21 aajayi-21 marked this pull request as draft August 2, 2023 14:12
Copy link
Copy Markdown
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.

bit of persnickerly cleaning suggestions.

Comment thread diffpy/snmf/stretchednmfapp.py Outdated
parser.add_argument('-i', '--input-directory', type=str, default=None,
help="Directory containing experimental data. Defaults to current working directory.")
parser.add_argument('-o', '--output-directory', type=str,
help="The directory where the results will be written. Defaults to '<input_directory/snmf_results>'.")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this should be <input_directory>/snmf_results i.e., replace <input_directory> with the actual input directory, but it will have a folder hanging off it which is actually called "snmf_results" by default

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am a little confused. How should I replace <input_directory> if it's not known. Do you mean that the output_directory will always be <input_directory>/snmf_results?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I just want you to replace <input_directory/snmf_results>, which is exactly what you wrote, with exactly <input_directory>/snmf_results.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I understand. I will do that

Comment thread diffpy/snmf/stretchednmfapp.py Outdated
help="Directory containing experimental data. Defaults to current working directory.")
parser.add_argument('-o', '--output-directory', type=str,
help="The directory where the results will be written. Defaults to '<input_directory/snmf_results>'.")
parser.add_argument('t', '--data-type', type=str, choices=['powder_diffraction', 'pdf'],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

when we write this we often make a global constant at the top of the file
ALLOWED_DATA_TYPES = ['powder_diffraction', 'pd', 'pair_distribution_function', 'pdf'] then use an f-string in the help that lists the allowed choices (they may list by default in which case we don't need that...you can check.)

Comment thread diffpy/snmf/stretchednmfapp.py Outdated
Comment thread diffpy/snmf/stretchednmfapp.py Outdated
Comment thread diffpy/snmf/stretchednmfapp.py Outdated
Fixed typo in line 22, renamed 'lift' to 'lift_factor', made ALLOWED_DATA_TYPES global variable
@sbillinge
Copy link
Copy Markdown
Contributor

sbillinge commented Aug 2, 2023 via email

Copy link
Copy Markdown
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.

👍

Copy link
Copy Markdown
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.

couple of tweaks

Comment thread diffpy/snmf/stretchednmfapp.py Outdated
grid, data_input = load_input_signals(args.input_directory)
lifed_data_input = lift_data(data_input, args.lift_factor)
variables = initialize_variables(lifed_data_input,args.number_of_components,data_type='pdf')
lifted_data_input = lift_data(data_input, args.lift_factor)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please can we change data_input to input_data everywhere (also with lifted_data_input). data_input sounds like a verb (a function name) but I find input_data clearer.

@sbillinge
Copy link
Copy Markdown
Contributor

@aajayi-21 is this ready for merge or still a draft?

@aajayi-21
Copy link
Copy Markdown
Contributor Author

It's ready to merge. The main function isn't final; I'll add on to it once the functions are ready.

@aajayi-21 aajayi-21 marked this pull request as ready for review August 15, 2023 19:07
@sbillinge sbillinge merged commit 3ec3c4d into diffpy:main Aug 17, 2023
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.

2 participants