Skip to content
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

Python 2 compatibility #19

Merged
merged 2 commits into from
Jul 24, 2019
Merged

Conversation

w-k-jones
Copy link
Member

Small change to formatting allows python 2 compatibility. Example notebooks only work in python 3 due to changes to urllib

@mheikenfeld
Copy link
Member

That's great, I was not aware that it only required such small changes to make things work in python 2. If you find a good way to make the example notebooks work in Python 2, go ahead, we could also add a hint to download the data manually when using Python 2 for now...

@mheikenfeld mheikenfeld merged commit b15c3ae into tobac-project:master Jul 24, 2019
@w-k-jones
Copy link
Member Author

w-k-jones commented Jul 24, 2019 via email

freemansw1 added a commit to galexsky/tobac that referenced this pull request May 2, 2022
* Update feature_detection.py

Added new optimized functions for 3D and periodic boundary condition (PBC) feature detection. Includes treatments for no PBCs (original tobac boundary approach), single-boundary PBC for either of hdim_1 or hdim_2, and doubly periodic boundaries

* Updated docstring on some of the feature detection functions

* Updated docstrings

Continuing to update docstrings to be more clear and to be in numpy format where needed.

* Added some new tests and updated dockerfile for testing

I added a test for get_label_props_in_dict as part of adding new tests for tobac. I also updated the dockerfile to improve execution order and build/test times.

* Updated test assertions for number of labels

* cleaned up new code and removed redundant functions

* Added 2D and 3D compatibility with get_indices_of_labels_from_dict.

I also added the associated tests to test_feature_detection.py.

* Renamed feature_position_3D for cleanup.

* Addition of 3D/PBC segmentation functions

Added 2 new versions of the segmentation and segmentation_timestep functions that improve the 3D segmentation and also include a first-pass doubly periodic boundary condition (which will need improvement before being pushed out to the world at large). Whereas the previous 3D segmentation approach simply seeded the entire vertical column at the integer x,y position of a feature, we now seed a 5x5x5 box around the position of the feature, which ought to reduce the chance of artificially segmenting unconnected fields (e.g. cirrus overlying a discrete convective cloud).

* Update segmentation.py

Fixed a call to an old test function "watershed_PBC" to just call the regular skimage.segmentation watershed function. Also updated the original segmentation function to use skimage.segmentation watershed rather than the deprecated skimage.morphology watershed

* Added linking_trackpy_3D function

Added linking_trackpy_3D to module, which is an updated, 3D version of the linking_trackpy function. This function is basically identical to the non-3D version, but includes vdim as an additional function argument and positional argument for the tp.link call that is really the guts of tobac's tracking code. Longer term, probably a good idea to integrate this with the 2D tracking function and use a user-set flag or something to determine whether to do 2D or 3D tracking - all this really comes down to is whether or not to include vdim in pos_columns.

* Added new functions, corrected error in old one

Corrected issue in 'feature_position_3D' where the coordinate re-transform at the end of the function still used the old integer PBC_flag values instead of the new string values. Also added 3D versions of feature_detection_multithreshold(_3D) and feature_detection_multithreshold_timestep(_3D) just for temporary continuity with feature_detection_threshold_3D so we can smoothly integrate 2D and 3D feature detection functions.

* Fixing a docker bug and continuing to combine feature detection

* Updated feature detection for 3D to call the new overarching feature_position function

* Updated 3D feature detection stuff

* Fixed some bugs with 3D feature detection.

* At a working state, but the new combined feature_detection_threshold does not exactly match what we had earlier, so fixing that is the next step.

* Fixed feature_detection_threshold to be in line with what Alex had (and ~2x faster)

* Removing a 3D function to clean things up

* Added 3D capability to feature_detection_multithreshold_timestep and it matches.

* Removed extraneous 3D code

* Continued consolidation of 2D and 3D functions.

* Combined the last of the 2D/3D feature detection functions.

* Fixed a bug with the 2D case label_bbox.

* Ignoring the .vscode files, whoops

* Deleted my personal vscode settings.

* first go at improving remove_parents, switching to numpy comparisons.

* trying out the v2 trunk from the tobac github

* Attempt at our own remove_parents function

* improving speeds

* Attempt at speeding up further

* fixing a bug

* fixing some bugs here?

* Fixing the edge case with no initial features.

* Combined 2D and 3D tracking

* Starting to add in more testing in anticipation of PBC tracking

* Starting to add into the PBC coordinates function

* Added in hdim_2 to PBC_flag both

* get_pbc_coordinates now working throughout

* Cleaned up make_feature_blob and added the docstring for a new generate_single_feature function

* New testing utilities, building to PBC tracking

* Added more tests for our new generate_single_feature function.

* Updated testing code to include times and starting updates to PBC code

* Tracking testing working well now.

* Now have a PBC test that correctly fails.

* Starting to clean up documentation and prep for 3D PBC tracking

* Added in new distance calculation functions for trackpy

* Added in PBC tracking and added scikit-learn as a requirement

To add in PBC tracking, we need to use the BTree neighbor_strategy, which requires scikit-learn.

* Fixed tracking to produce correct results, huzzah!

* Added new tests for PBC tracking with hdim_1 boundaries and hdim_2 boundaries

* Starting prep work to efficiency

* Switched euclidian distance tests to use numpy arrays to match what trackpy gives it

* Revision to calculate_distance_coords_pbc to be faster

* Trying benchmarks with numba

* Making numba optional

* Cleaning up unused functions

* Updated comments

* Added fix for small proto-features case

Previously, code would crash if there are 1 or more proto-features at a particular threshold where none exceed the minimum point threshold. Variable 'column_names' was left undefined, causing an error when attempting to create a dataframe from 'list_features_threshold' with columns 'column_names'. Added a new if-else statement to fix this.

* Added some more testing utilities and more tests for the tests

* Fixed PBC labeling

Added 3 new elifs in feature_detection_threshold that corrected an issue where contiguous indices which crossed boundaries would not be relabeled properly if the cross-boundary label had already been overwritten.

* Removed field_in argument for linking_trackpy

Removed field_in as an argument in linking_trackpy. This argument did not serve any meaningful purpose in the original tracking code, if I remember correctly, and is completely unused in the present implementation.

* Revert "Removed field_in argument for linking_trackpy"

This reverts commit 893d09eaafb86aa3632e5dedc3dbe888ad2797e9.

Co-authored-by: galexsky <90701223+galexsky@users.noreply.github.com>
Co-authored-by: Sean Freeman <sfreeman@parhelic.atmos.colostate.edu>
Co-authored-by: Sean Freeman <sfreeman@solvarg.atmos.colostate.edu>
Co-authored-by: galexsky <galexsky94@gmail.com>
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