t4d-gmbh / majortrack Goto Github PK
View Code? Open in Web Editor NEWA time-resolved clustering method
Home Page: https://majortrack.rtfd.io
License: GNU General Public License v3.0
A time-resolved clustering method
Home Page: https://majortrack.rtfd.io
License: GNU General Public License v3.0
Since python 3.8 importing MajorTrack
fails with:
Traceback (most recent call last):
File ",,,/test.py", line 1, in <module>
from majortrack import MajorTrack
File ".../.virtualenvs/py310/lib/python3.10/site-packages/majortrack/__init__.py", line 9, in <module>
from .tracker import MajorTrack
File ".../.virtualenvs/py310/lib/python3.10/site-packages/majortrack/tracker.py", line 11, in <module>
from .lazylist import lazy_list
File ".../.virtualenvs/py310/lib/python3.10/site-packages/majortrack/lazylist.py", line 4, in <module>
from collections import MutableSequence
ImportError: cannot import name 'MutableSequence' from 'collections' (/usr/lib/python3.10/collections/__init__.py)
Classes from collections
are used in
Solution
The alias collections.MutableSequence
which was created when the class moved to collections.abc
in 3.3 was removed with python 3.8. So the import needs updating, to be compatible with recent python versions, but should not break backwards compatibility.
Suggestion
try:
from collections.abc import MutableSequence # noqa
except ImportError:
from collections import MutableSequence # noqa
Currently, the only out of the box options for labels that are provided are 'groupsize'
and 'group_index'
.
'group_index'
might be helpful for debugging, and for doing custom layout adaptations (see e.g. line 126 in the history.py example and the optional y_fix
parameter in AlluvialPlot) but the group IDs can be misleading since they are a priori completely unrelated between slices.
Adding the option 'dc_index'
to the set of available cluster labels, such that the dynamic cluster affiliation can also be shown by the label of a group and not just it's color.
Providing an iterator with an initial element bigger than 0 leads to an IndexError
when attempting to create fluxes between the clusters to display.
The error occurs in https://github.com/j-i-l/MajorTrack/blob/11f92c5fadb8a15c2672c750371df83847d90ca1/majortrack/tracker.py#L2509-L2510
Problem:
The elements to draw (clusters and fluxes) for each slice of the time series are collected in lists rather than in dictionaries. The elements are collected by iterating over the specified iterator and appending to these lists. If the iterator does not start at 0 this creates a miss-match between the index of the slices to draw and the index of the collections of elements to draw for that index.
Fix:
option a): Use the first element of the specified iterator as offset when accessing the elements in to draw.
option b): collect the elements to draw in dict
's rather than list
's and use the elements from the iterator parameter as keys.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.