Skip to content

Updated notebooks#1361

Open
tobyallwood wants to merge 6 commits into
mainfrom
tobyallwood/update-notebooks
Open

Updated notebooks#1361
tobyallwood wants to merge 6 commits into
mainfrom
tobyallwood/update-notebooks

Conversation

@tobyallwood

@tobyallwood tobyallwood commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Notebooks have been updated to run with the current version of Topostats (v2.4.x)

The overall objective of each notebook (introduce TopoStats's processing steps, statistics and plots) have not changed but the actual code has a large amount of changes due to how much TopoStats has changed.

Note: The issue with notebook 01 not displaying plots inline has not been fixed, but the cause of it is topoly and an issue has been created in the repo to address this.

@ubdbra001 ubdbra001 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Had a look through this and I have a couple of comments:

  1. The formatting of the text in the notebooks needs to be reviewed. Specifically, the lines are broken at seemingly random places which makes following the prose a bit harder than it needs to be.
  2. Plotting in Notebook 1 is not working/not showing. May be related to some of the other issues discussed around plotting.
  3. The Load section in Notebook 3 is not working for me. The file it's trying to load minicircle.topostats doesn't exist. minicircle_small.topostats does but it is seeing it as a directory and skipping over it.

@tobyallwood

tobyallwood commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @ubdbra001

  1. Could you give me an example sorry?

  1. This was something I looked into and it's due to topoly. Imports can be followed from notebook 1 to a topoly import and for some reason topoly messes with matplotlib's configuration when imported (removing this topoly references fixes notebook 1).
    Trying to reset config options in the notebook doesn't cleanly overwrite them either; it seems to fight with topoly causing plots to still not appear inline and windows displaying them to rapidly open and close.
    I think the proposed solution to this (along with other topoly issues) is to put the import in an if statement checking a config option for enabling/ disabling topoly, but this hasn't been implemented yet.

  1. If I've understood correctly minicircle.topostats does not originally exist in the repo, running topostats process and processing tests/resources/minicircle.spm creates this file (in the chosen output dir) which this notebook then accesses.
    I'll add some text at the top of the notebook explaining this for users

@ubdbra001

Copy link
Copy Markdown
Collaborator
  1. It looks like this was a temporary thing for me. I opened up the notebooks today and the formatting is fine. Disregard.
  2. Maybe worth making a note in the text if you haven't already? Just so a user will know that this is (sort of) expected behaviour
  3. I didn't do that, so including this explicitly is good idea. Might be worth fleshing it out a little (i.e. making sure they are in the right directory, I ran topostats process in the root of the Topostats repo and it tried to process some of the files in the .venv directory. Presumably because it's looking for file extensions recursively)

I'll note any other things I find in subsequent comments.

@ubdbra001

Copy link
Copy Markdown
Collaborator

MatplotlibDeprecationWarning: Passing 'N' to ListedColormap is deprecated since 3.11 and will be removed in 3.13. Please ensure the list of passed colors is the required length instead.

Occurs anywhere the plot_and_save method is used - This should probably be added as an issue to the repo.

@ubdbra001

Copy link
Copy Markdown
Collaborator

FileNotFoundError: [Errno 2] No such file or directory: '/home/daniel/Projects/Topostats/TopoStats/output/processed/minicircle.spm/dnatracing/ordered/minicircle.spm_grain_0_ordered_traces.png'

Occurs in the first cell in the Plotting Individual Grains section of notebook 1. Should it be trying to use minicircle.spm as a directory name?

@ubdbra001

Copy link
Copy Markdown
Collaborator
Traceback (most recent call last):
  File "/home/daniel/Projects/Topostats/TopoStats/.venv/bin/topostats", line 10, in <module>
    sys.exit(entry_point())
             ^^^^^^^^^^^^^
  File "/home/daniel/Projects/Topostats/TopoStats/topostats/entry_point.py", line 1263, in entry_point
    args.func(args)
  File "/home/daniel/Projects/Topostats/TopoStats/topostats/run_modules.py", line 365, in process
    extract_height_profiles(
  File "/home/daniel/Projects/Topostats/TopoStats/topostats/io.py", line 1275, in extract_height_profiles
    for grain_number, grain_crop in topostats_object.require_grain_crops().items():
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/daniel/Projects/Topostats/TopoStats/topostats/classes.py", line 846, in require_grain_crops
    raise RuntimeError("grain_crops is None")
RuntimeError: grain_crops is None

Possibly not related to this PR directly, but I get this error when running topostats process from the tests directory

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