Dev#214
Conversation
- Fall back to shutil.copy when os.symlink fails (requires elevated privileges on Windows without Developer Mode enabled) - Use Path.replace() instead of Path.rename() when renaming downloaded sample video, since os.rename() raises FileExistsError on Windows if the target already exists Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add tests/test_* to .gitignore so project directories created during test runs are not tracked. Also removes a stale generated NWB file that was previously committed but is not referenced by any test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The tests/test_*/ glob incorrectly excluded the test_project_sample_nwb/ directory. Add a negation exception so the NWB sample file is tracked while dynamically-generated test project directories remain ignored. The NWB file is used by test_init_project_from_nwb in 02_initialize_project_test.py to verify project initialisation from an NWB pose file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…terface Replaces the deprecated movement per-format loaders with the new unified load_dataset() function (movement >= 0.16.0), adding source_software='auto' auto-detection. Removes the NWB series data path parameter which is no longer needed with the new interface. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fall back to shutil.copy when os.symlink fails (requires elevated privileges on Windows without Developer Mode enabled) - Use Path.replace() instead of Path.rename() when renaming downloaded sample video, since os.rename() raises FileExistsError on Windows if the target already exists Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add tests/test_* to .gitignore so project directories created during test runs are not tracked. Also removes a stale generated NWB file that was previously committed but is not referenced by any test. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The tests/test_*/ glob incorrectly excluded the test_project_sample_nwb/ directory. Add a negation exception so the NWB sample file is tracked while dynamically-generated test project directories remain ignored. The NWB file is used by test_init_project_from_nwb in 02_initialize_project_test.py to verify project initialisation from an NWB pose file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
movement >= 0.16.0 requires Python >= 3.12. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… for cross-platform reliability - Replace silent OSError fallback-to-copy with a descriptive error in new.py and video.py, instructing users to enable Developer Mode or pass copy_videos=True - Use copy_videos=True in all test fixtures and test_existing_project to avoid symlink privilege issues on Windows CI runners - Rename tests/test_project_sample_nwb -> tests/tests_project_sample_nwb to match the existing tests_project_sample_data naming convention; removes need for .gitignore negation exception - Pass show_figure=False in test_report to suppress matplotlib windows during test runs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
.gitignore will come in cleanly once #209 is merged into dev. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pipeline.py used bare str; new.py docstring said str. Both now match load_pose_estimation with Literal["DeepLabCut", "SLEAP", "LightningPose", "NWB", "auto"]. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feat: update pose loader to movement 0.16 unified loader interface
Fix Windows compatibility in project init and sample data download
extra features
|
@roaldarbol all changes from the last contributions are now coalesced here. Once you're done with your local tests, we can merge and make a new release |
|
Alright, we're almost there. One thing that seems to be blocking is that I cannot convert the data to egocentric with a single data point, and import vame
config_path, config = vame.init_new_project(
project_name="vame_aniframe_demo",
poses_estimations=["short_aniframe.nc"],
source_software="movement",
)Preprocessing is where one needs to specify something extra. This fails: vame.preprocessing(
config,
centered_reference_keypoint="centroid",
orientation_reference_keypoint="centroid",
)So a few more need to be set to vame.preprocessing(
config,
centered_reference_keypoint="centroid",
orientation_reference_keypoint="centroid",
run_egocentric_alignment=False,
run_savgol_filtering=False,
)config["extra_features"] = ["area", "eccentricity", "orientation", "solidity"]
vame.util.auxiliary.write_config(config_path, config)
vame.validate_extra_features(config)The following doesn't work. vame.create_trainset(config)It errors out with: ...
KeyError: 'centered_reference_keypoint'And we need to add the reference points manually despite not really using them. import os
from pathlib import Path
import xarray as xr
proc = (
Path(config["project_path"])
/ "data"
/ "processed"
/ f"{config['session_names'][0]}_processed.nc"
)
with xr.open_dataset(proc) as src:
ds = src.load()
ds.attrs["centered_reference_keypoint"] = "centroid"
ds.attrs["orientation_reference_keypoint"] = "centroid"
ds.to_netcdf(str(proc) + ".tmp", engine="netcdf4")
os.replace(str(proc) + ".tmp", proc)We should now be able to continue. vame.create_trainset(config)vame.train_model(config)
vame.segment_session(config) |
|
Another thing related to the updated unified reader is that we still perform strict input validation although The blocking parts are in the I think the best way to fix this depends on Maybe worth a separate issue. |
|
Actually, it is possible to set vame.preprocessing(
config,
centered_reference_keypoint="centroid",
orientation_reference_keypoint="centroid",
run_egocentric_alignment=True,
run_savgol_filtering=False,
)it just creates only EDIT: YAY, managed to train a model, do segmentation and plot it all! This was of course just on this single snippet of a file, so next test will be to see how it scales to massive data sets (maybe #184 will need tackling). @luiztauffer I might reach out for a few pointers in the Discussions if that is okay? |
|
@roaldarbol that sounds great! Where are the NaNs created? VAME excludes the centralized data array from model training, so that's probably why it still works. I will wait for your larger tests before we merge this to main, feel free to open any Issues or Discussions. |
|
I think the NaN's get produced when making it egocentric, because no angle can be made between the two chosen points - because they are the same. And I think VAME is alright with having only NaN's, but then savgol filtering fails. As an aside, does VAME have a way of handling a variable where all values are identical or they are NaN's? Let's say a keypoint happened to be at |
|
Just for clarity, here is what the processed nc file looks like: |
|
@roaldarbol if you only have one keypoint, you could safely skip egocentric alignment |
can you confirm this will work for you? If so, I think we could go ahead and merge this for the new release |
|
Sorry I didn't manage to get around to doing final tests for this. Could busy with other things. I'll see if I can give it a spin next week. :-) |
@roaldarbol