Skip to content

search script NO_JIRA #82

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

Merged
merged 10 commits into from
Jul 21, 2025
Merged

search script NO_JIRA #82

merged 10 commits into from
Jul 21, 2025

Conversation

kback-ccdc
Copy link
Contributor

Adding Chris Kingsbury's Void Search script to the opensource repo for next week's webinar

@kback-ccdc kback-ccdc self-assigned this Jul 18, 2025
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

flake8

🚫 [flake8] <302> reported by reviewdog 🐶
expected 2 blank lines, found 1

def run_search(interface=None):


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


🚫 [flake8] <266> reported by reviewdog 🐶
too many leading '#' for block comment

## open a GUI dialog asking for the search query.


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace

interface.show_script_error('''Nothing was given to search for. Please enter either one number


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


🚫 [flake8] <222> reported by reviewdog 🐶
multiple spaces after operator

query_report += f"Pore Total Surface Area (&#8491;^2) {tsa[0]}-{tsa[1]} <br>"


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


🚫 [flake8] <222> reported by reviewdog 🐶
multiple spaces after operator

query_report += f"Pore Total Geometric Volume (&#8491;^3): {tgv[0]}-{tgv[1]} <br>"


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ','

pld = query_string_to_tuple(void_search_dict["pore_limiting_diameter"],200.0)


🚫 [flake8] <222> reported by reviewdog 🐶
multiple spaces after operator

query_report += f"Pore Limiting Diameter (&#8491;): {pld[0]}-{pld[1]} <br>"


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ','

pmd = query_string_to_tuple(void_search_dict["max_pore_diameter"],200.0)


🚫 [flake8] <222> reported by reviewdog 🐶
multiple spaces after operator

query_report += f"Pore Maximum Diameter (&#8491;): {pmd[0]}-{pmd[1]} <br>"


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ','

npd = query_string_to_tuple(void_search_dict["num_percolated_dimensions"],3.1)


🚫 [flake8] <222> reported by reviewdog 🐶
multiple spaces after operator

query_report += f"Number of Percolated Dimensions: {npd[0]}-{npd[1]} <br>"


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace

"Pore Total Surface Area (\u212b^2)",


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace

tsv_file.write_row([h.identifier,


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace

More information on the pore calculations is available here:


[flake8] <401> reported by reviewdog 🐶
'tkinter.Tk' imported but unused

from tkinter import Tk, Text, TOP, BOTH, X, N, LEFT, RIGHT


[flake8] <401> reported by reviewdog 🐶
'tkinter.Text' imported but unused

from tkinter import Tk, Text, TOP, BOTH, X, N, LEFT, RIGHT


[flake8] <401> reported by reviewdog 🐶
'tkinter.TOP' imported but unused

from tkinter import Tk, Text, TOP, BOTH, X, N, LEFT, RIGHT


[flake8] <401> reported by reviewdog 🐶
'tkinter.N' imported but unused

from tkinter import Tk, Text, TOP, BOTH, X, N, LEFT, RIGHT


[flake8] <401> reported by reviewdog 🐶
'tkinter.RIGHT' imported but unused

from tkinter import Tk, Text, TOP, BOTH, X, N, LEFT, RIGHT


🚫 [flake8] <128> reported by reviewdog 🐶
continuation line under-indented for visual indent

"total_geometric_volume": "Pore Total Geometric Volume (Å^3)",


🚫 [flake8] <128> reported by reviewdog 🐶
continuation line under-indented for visual indent

"pore_limiting_diameter": "Pore Limiting Diameter (Å)",


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace

"pore_limiting_diameter": "Pore Limiting Diameter (Å)",


🚫 [flake8] <128> reported by reviewdog 🐶
continuation line under-indented for visual indent

"max_pore_diameter":"Pore Maximum Diameter (Å)",


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ':'

"max_pore_diameter":"Pore Maximum Diameter (Å)",


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace

"max_pore_diameter":"Pore Maximum Diameter (Å)",


🚫 [flake8] <128> reported by reviewdog 🐶
continuation line under-indented for visual indent

"num_percolated_dimensions":"Number of Percolated Dimensions"}


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ':'

"num_percolated_dimensions":"Number of Percolated Dimensions"}


🚫 [flake8] <302> reported by reviewdog 🐶
expected 2 blank lines, found 1


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ','

[self.generate_entry(text, output) for text,output in zip(pore_query_dict.values(), self.outputs)]


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ':'

vars = {k:v for k,v in zip(pore_query_dict.keys(), app.outputs)}


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ','

vars = {k:v for k,v in zip(pore_query_dict.keys(), app.outputs)}


🚫 [flake8] <722> reported by reviewdog 🐶
do not use bare 'except'


🚫 [flake8] <251> reported by reviewdog 🐶
unexpected spaces around keyword / parameter equals

def query_string_to_tuple(query_string, default_upper_limit = 9999.9):


🚫 [flake8] <251> reported by reviewdog 🐶
unexpected spaces around keyword / parameter equals

def query_string_to_tuple(query_string, default_upper_limit = 9999.9):


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ','

elif query_string in ("0","0.0"):


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


🚫 [flake8] <225> reported by reviewdog 🐶
missing whitespace around operator


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace


🚫 [flake8] <225> reported by reviewdog 🐶
missing whitespace around operator


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


🚫 [flake8] <302> reported by reviewdog 🐶
expected 2 blank lines, found 1


🚫 [flake8] <302> reported by reviewdog 🐶
expected 2 blank lines, found 1

def run_search(interface=None):


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


🚫 [flake8] <266> reported by reviewdog 🐶
too many leading '#' for block comment

## open a GUI dialog asking for the search query.


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace

interface.show_script_error('''Nothing was given to search for. Please enter either one number


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


🚫 [flake8] <222> reported by reviewdog 🐶
multiple spaces after operator

query_report += f"Pore Total Surface Area (&#8491;^2) {tsa[0]}-{tsa[1]} <br>"


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


🚫 [flake8] <222> reported by reviewdog 🐶
multiple spaces after operator

query_report += f"Pore Total Geometric Volume (&#8491;^3): {tgv[0]}-{tgv[1]} <br>"


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ','

pld = query_string_to_tuple(void_search_dict["pore_limiting_diameter"],200.0)


🚫 [flake8] <222> reported by reviewdog 🐶
multiple spaces after operator

query_report += f"Pore Limiting Diameter (&#8491;): {pld[0]}-{pld[1]} <br>"


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ','

pmd = query_string_to_tuple(void_search_dict["max_pore_diameter"],200.0)


🚫 [flake8] <222> reported by reviewdog 🐶
multiple spaces after operator

query_report += f"Pore Maximum Diameter (&#8491;): {pmd[0]}-{pmd[1]} <br>"


🚫 [flake8] <231> reported by reviewdog 🐶
missing whitespace after ','

npd = query_string_to_tuple(void_search_dict["num_percolated_dimensions"],3.1)


🚫 [flake8] <222> reported by reviewdog 🐶
multiple spaces after operator

query_report += f"Number of Percolated Dimensions: {npd[0]}-{npd[1]} <br>"


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace

"Pore Total Surface Area (\u212b^2)",


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace

tsv_file.write_row([h.identifier,


⚠️ [flake8] <293> reported by reviewdog 🐶
blank line contains whitespace


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace


⚠️ [flake8] <291> reported by reviewdog 🐶
trailing whitespace

More information on the pore calculations is available here:

@pmbulit
Copy link
Member

pmbulit commented Jul 18, 2025

@kback-ccdc could you add a ReadMe.md to this folder so it follows the same requirements as the rest of the scripts on this repo and then also edit https://github.com/ccdc-opensource/csd-python-api-scripts/blob/main/scripts/ReadMe.md with a short description please?

elif query_string in ("0","0.0"):
ll, ul = 0.0, 0.1
else:
ll, ul = float(query_string)*0.95, float(query_string)*1.05
Copy link
Member

Choose a reason for hiding this comment

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

image I think this shouldn't apply to percolated dimensions

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree - I'll add something. It's still going to be that way under the hood - just makes it easier than figuring out inclusive / exclusive ranges in sql, but the report will be clean

Copy link
Member

@pmbulit pmbulit left a comment

Choose a reason for hiding this comment

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

One minor request for now. If the ReadMe has additional info on expected behaviour I might have more comments

@IsaacSugden IsaacSugden dismissed pmbulit’s stale review July 18, 2025 16:34

basic Readme added, Pablo, please have a look and feel free to raise request again

ckingsbury-ccdc and others added 2 commits July 20, 2025 23:18
lines 201 - 204 , searches the right field now, and all have rounding included
Copy link

Copy link
Contributor

@IsaacSugden IsaacSugden left a comment

Choose a reason for hiding this comment

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

Looks good and fairly well tested by me. CK says he wants to add something for percolated dimensions at Pablo's request, but I'd be happy to merge before the webinar and add stuff like that later

@kback-ccdc kback-ccdc merged commit 741178f into main Jul 21, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants