Releases: kineticstoolkit/kineticstoolkit
0.14.3
Kinetics Toolkit 0.14.3 has been released. This is a small bugfix release with no new feature.
What's Changed
- FIX: fixed the analogs/points sampling rate comparison by @andreyzhd in #236
- Fixed bug on first index of fill_missing_samples by @Alek050 in #239
- Deprecated features scheduled to be removed in 2024 have been removed.
New Contributors
- @andreyzhd made their first contribution in #236
Full Changelog: 0.14.2...0.14.3
0.14.2
Bugfix in Player's interconnections
0.14
New features
Scripting API for the Player
The Player can now be entirely scripted:
- Get/set the TimeSeries to be visualized using
Player.get_contents()
andPlayer.set_contents()
- Get/set the point interconnections using
Player.get_interconnections()
andPlayer.set_interconnections()
- Play/pause using
Player.play()
andPlayer.pause()
- Access and modify all settings using properties such as
current_index
,current_time
,target
,zoom
,elevation
,azimuth
, etc.
Styling the Player
Every element can now be stylized using properties such as background_color
, default_point_color
, point_size
, frame_size
, frame_width
, grid_size
, grid_subdivision_size
, etc.
Exporting the Player's content to images and videos
You can now export the Player's content to image files such as PNG, JPEG, PDF, SVG or TIFF using Player.to_image()
, or to MP4 videos using Player.to_video()
. This, combined to styling, should help you giving nice presentations!
Standard views in the Player
By defining which axes (x, y, z, -x, -y, -z) correspond to the up and anterior direction using the up
and anterior
properties, you can now switch to standard orthogonal views using Player.set_view()
. For example: p.set_view("front")
, p.set_view("top")
, p.set_view("right")
, etc. These views are also available interactively using number keys 1 to 6.
Convert anything to a TimeSeries
It is now easier than never to create a TimeSeries. For instance, a list of data:
some_list = [1.0, 1.1, 1.2, 1.1, 1.4, 1.5]
can be transformed into a TimeSeries using:
some_timeseries = ktk.TimeSeries(some_list)
It works for any other array-like such as nested lists, NumPy arrays, Pandas Series, Pandas DataFrames. It can also be used to create copies of TimeSeries.
New TimeSeries.add_data method
The new TimeSeries.add_data
method now complements its siblings TimeSeries.rename_data
and TimeSeries.remove_data
. Using this method ensures that the added data is compatible with the data already present in the TimeSeries (e.g., it has the same dimension across the time dimension) and that you specify wether or not existing data of the same name must be overwritten.
New overwrite option to TimeSeries.add_data_info
A new parameter overwrite
has been added to TimeSeries.add_data_info
so that you can specify wether or not already existing data info of the same name must be overwritten.
Improvements
Improved TimeSeries assignations
It is now possible to assign any array-like value to a TimeSeries' time or data property; it will be converted automatically to a proper NumPy array.
Improved parameter checking
Parameter checking has been generally improved, so that if you make a mistake, you will be more likely to get a helpful error message.
Warning on non-interactive mode
You will now get a warning if you attempt to use an interactive Matplotlib object (e.g., the Player, or a GUI-based method) without having configured Matplotlib to be interactive.
0.13
A new release on the road toward version 1.0. Remember that starting from 0.12, the API is mostly stable and we won't remove any feature or make any incompatible change before either 1.0 is released or before 2 years of deprecation warnings. It is safe to use Kinetics Toolkit in your work, we won't let you down!
In this release:
Improvements
ktk.read_c3d()
can now read the event contexts, not just the names, using the newinclude_event_context
argument. If False, the events in the output TimeSeries are named after the events names in the C3D files, e.g.: "Start", "Heel Strike", "Toe Off". If True, the events in the output TimeSeries are named using this scheme "context:name", e.g.,: "General:Start", "Right:Heel strike", "Left:Toe Off". The default is False. Thanks @jorgomezga for suggesting and testing!- TimeSeries' methods
get_ts_between_indexes()
,get_ts_between_times()
andget_ts_between_events()
now accept a new form for their argumentinclusive
. In addition to provide a simple boolean (False: strictly between, True: inclusive between), we can now provide a tuple/list of two booleans. For instance, [True, False] means "greater or equal to first index/time, and strictly less than second index/time". - TimeSeries' methods
get_ts_between_indexes()
,get_ts_between_times()
are now much faster on very long TimeSeries. - Introducing progress bars for long operations, starting with
ktk.cycles.detect_events()
. If the optional packagetqdm
is installed, a progress bar is shown if the function takes lots of time. If it is not installed, the function works as usual, without a progress bar.
Bugfixes
ktk.read_c3d()
now works correctly with files with more than 255 markers or 255 analog signals, or with no labels. Kudos @jorgomezga for noticing and for proposing a fix!TimeSeries.get_ts_after_index
andTimeSeries.get_ts_before_index
now return aTimeSeriesRangeError
when index is invalid, instead of wrongly returning an empty TimeSeries.- Function that expect integers as arguments do not complain anymore when they receive a numpy.int64 instead.
- Saving a Pandas DataFrame that contains different data types using
ktk.save
now loads back correctly.
As always, do not hesitate to ask for help on the discussion board. We are seeing more and more activity there and it is very motivating.
0.12 released, new development phase
All onboard, direction version 1.0!
All core features have been implemented and most of them have a stable API. Therefore, I am happy to announce that we enter a new development phase, which is a steady walk toward version 1.0. What does this means?
- The current API (public classes, modules, functions) is now in "improvement" mode. No current feature will be removed anymore until version 1.0. In rare circumstances, you may get deprecation warnings that indicate that a given feature will be removed in version 1.0 or later, but these warnings will last for a minimum of 24 months before the feature is actually removed, to ensure that everybody has time to update their code. Generally this was already the case, but this is now a rule that will be enforced systematically.
- Most new features will now be developed as Kinetics Toolkit extensions. This will draw a clear line between the stable core API and open research applications. Some future extensions may then be integrated into the core if they are stable and relevant for general-purpose biomechanical analysis.
New feature
- TimeSeries.resample now accepts a new frequency in Hz in addition to a new time attribute. We can now resample a TimeSeries to a new sampling frequency very easily:
ts.resample(120)
.
Bugfixes
- Saving a C3D with missing values now works.
- No more warning in ktk.Player in Python >= 3.10.
- Fixed deprecation message in deprecated function TimeSeries.get_event_time.
- Added missing TimeSeries methods in the TimeSeries' dir, for better autocompletion in IDEs.
API changes
- Removed
fill_value
parameter from TimeSeries.resample. Now:- The resampled has nan where the original signal had nan.
- Resampling on a larger time span now always works, but there is no extrapolation: bound values are filled with nan systematically.
- Player.to_html5 has been removed. This was an internal feature for documentation generation, that should not be part of the public API.
0.11.0
New features
- ktk.write_c3d can now write analogs in addition to points.
- ktk.geometry.rotate, ktk.geometry.translate, ktk.geometry.scale: Instead of having to create a series of transformation matrices and then apply this series to a series of coordinates, we can now use these three shortcut functions that directly transform series of coordinates.
Enhancements
- Addition of a
scales
parameter to ktk.geometry.create_transforms. We already hadangles
andtranslations
, we now also have a scales parameter to create all kinds of rigid transforms matrices. - Now every ktk.geometry operation with rigid transforms checks that the transform matrices are rigid (determinant = 1) before doing the calculation. This is mainly to ensure that (1) there is no user error with the shape and contents of the provided matrix series, and (2) we propagate error from long lists of calculations on badly conditioned matrices.
- Parameter
convert_point_unit
is now optional and defaults to None in ktk.read_c3d. The docstring and behaviour of ktk.read_c3d were clarified for cases when c3d points are not expressed in meters, to clear confusion when the file contains application-specific "points" such as calculated angles, powers and forces. - These functions are not experimental anymore:
Bugfixes
- Now we get a clear error message in ktk.cycles.time_normalize when an unknown event name is given as parameter.
Requirement changes
- Now requires Python 3.10 or later.
0.10.0
- New feature:
ktk.TimeSeries.count_events
. Counts the number of occurrences of a given event. This function is useful for example to loop over cycles. - New feature:
ktk.TimeSeries.remove_duplicate_events
. Removes duplicate events (that share a same name and same time). - Improvement: Better error messages. All functions now perform basic real-time type checking and return clear messages in case of unexpected input. Many error messages are also more helpful, particularly in TimeSeries’ get_ts_ methods.
- Improvement:
ktk.Player
now allows interconnections to be any length, not only bouts of two-marker connections. - Improvement:
ktk.TimeSeries.add_event
now has an optional unique argument to prevent adding duplicate events. - Improvement:
ktk.TimeSeries.merge
does not duplicate events anymore if a same event was present in both TimeSeries. - Improvement: Now uses Python 3.9 annotations (using from future import annotations). Python 3.9 is not required yet, only Python 3.8.
- Improvement: Now uses Numpy’s ArrayLike in static typing annotations.
- Bugfix:
ktk.Player
’s target parameter now respects the ground plane orientation given by the up parameter introduced in 0.9.1. - Bugfix:
ktk.TimeSeries.sort_events
does not miss duplicate events anymore. - Deprecation: The following TimeSeries methods were deprecated because they don’t provide enough functionality compared to the complexity they generate when learning Kinetics Toolkit by new users. Using those functions now generates a deprecation warning with a suggestion to get the same result with other functions:
TimeSeries.get_event_index()
TimeSeries.get_event_time()
TimeSeries.get_ts_at_event()
TimeSeries.get_ts_at_time()
TimeSeries.sync_event()
TimeSeries.ui_get_ts_between_clicks()
- Breaking change: These parameter names were changed in
ktk.kinematics
:- Changed
marker_names
parameter fornames
inktk.kinematics.create_cluster
. - Changed
new_point
parameter forname
inktk.kinematics.extend_cluster
.
- Changed
- Breaking change: Changed default value of unique from
True
toFalse
inktk.TimeSeries.sort_events
.
0.9.2
- New feature: ktk.Player now has a
up
parameter. Before, the ground plane was xz with y being up. Now, any ground plane can be used, by choosingup
among {'x', 'y', 'z', '-x', '-y', '-z'}. - Bugfix: Resolved an error in ktk.read_c3d where reading would fail on c3d files with empty events.
0.9.0
- New feature: ktk.TimeSeries.resample to resample a TimeSeries on a new time vector, with the method of your choice (sample-and-hold, linear, spline, etc.)
- New feature: ktk.TimeSeries.get_sample_rate returns the TimeSeries sample rate, or NaN if the sample rate is not constant.
- New feature: ktk.read_c3d replaces ktk.kinematics.read_c3d_file, and now reads analogs and events in addition to points.
- New feature: ktk.write_c3d replaces ktk.kinematics.write_c3d_file, and now writes analogs and events in addition to points.
- Deprecation: ktk.kinematics.read_n3d_file was moved to the n3d extension.
- Bugfix: c3d files with accented characters in path should now be readable on Windows.
0.8.0
Adds support for extensions.