Skip to content

Commit

Permalink
Add init print for CifEnsemble
Browse files Browse the repository at this point in the history
  • Loading branch information
bobleesj committed Jul 9, 2024
1 parent 678ead8 commit 45f3c61
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/cifkit/coordination/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ def compute_polyhedron_metrics(polyhedron_points, hull):

return round_dict_values(data)

except Exception as e:
print(f"Error computing polyhedron metrics: {e}")
except Exception:
# print(f"Error computing polyhedron metrics: {e}")
return None


Expand Down
3 changes: 3 additions & 0 deletions src/cifkit/models/cif_ensemble.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from click import secho
from cifkit import Cif
from cifkit.utils.folder import (
move_files,
Expand Down Expand Up @@ -47,6 +48,7 @@ def __init__(
cif_dir_path, add_nested_files=add_nested_files
)
self.file_count = len(self.file_paths)
secho(f"Initializing {self.file_count} Cif objects...", fg="yellow")

if logging_enabled:
self.cifs: list[Cif] = [
Expand All @@ -58,6 +60,7 @@ def __init__(
Cif(file_path, is_formatted=True)
for file_path in self.file_paths
]
secho("Finished initialization!", fg="green")

def _log_info(self, message):
"""Log a formatted message if logging is enabled."""
Expand Down
24 changes: 13 additions & 11 deletions test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 1,
"metadata": {},
"outputs": [
{
Expand All @@ -12,13 +12,14 @@
"\n",
"CIF Preprocessing in tests/data/cif/ErCoIn_test begun...\n",
"\n",
"Preprocessing tests/data/cif/ErCoIn_test/1233938.cif (1/7)\n",
"Preprocessing tests/data/cif/ErCoIn_test/1140826.cif (2/7)\n",
"Preprocessing tests/data/cif/ErCoIn_test/1234749.cif (3/7)\n",
"Preprocessing tests/data/cif/ErCoIn_test/1234747.cif (4/7)\n",
"Preprocessing tests/data/cif/ErCoIn_test/1229705.cif (5/7)\n",
"Preprocessing tests/data/cif/ErCoIn_test/250382.cif (6/7)\n",
"Preprocessing tests/data/cif/ErCoIn_test/1000761.cif (7/7)\n",
"Preprocessing tests/data/cif/ErCoIn_test/1233938.cif (1/8)\n",
"Preprocessing tests/data/cif/ErCoIn_test/1140826.cif (2/8)\n",
"Preprocessing tests/data/cif/ErCoIn_test/1234749.cif (3/8)\n",
"Preprocessing tests/data/cif/ErCoIn_test/1234747.cif (4/8)\n",
"Preprocessing tests/data/cif/ErCoIn_test/1229705.cif (5/8)\n",
"Preprocessing tests/data/cif/ErCoIn_test/250382.cif (6/8)\n",
"Preprocessing tests/data/cif/ErCoIn_test/454035.cif (7/8)\n",
"Preprocessing tests/data/cif/ErCoIn_test/1000761.cif (8/8)\n",
"\n",
"SUMMARY\n",
"# of files moved to 'error_operations' folder: 0\n",
Expand All @@ -28,7 +29,8 @@
"# of files moved to 'error_invalid_label' folder: 0\n",
"# of files moved to 'error_others' folder: 0\n",
"\n",
"{6, 7, 10, 11, 12, 13, 14, 15, 16, 17}\n"
"\u001b[33mInitializing 8 objects...\u001b[0m\n",
"\u001b[32mFinished initialization!\u001b[0m\n"
]
}
],
Expand All @@ -41,7 +43,7 @@
"\n",
"\n",
"ensemble = CifEnsemble(\"tests/data/cif/ErCoIn_test\", logging_enabled=False)\n",
"print(ensemble.CN_unique_values_by_min_dist_method)\n",
"# print(ensemble.CN_unique_values_by_min_dist_method)\n",
"\n"
]
}
Expand All @@ -62,7 +64,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.1.-1"
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 45f3c61

Please sign in to comment.