Auto-pi-lot

Latest version: v0.5.0

Safety actively analyzes 621907 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

0.5.0

- The subject class will attempt to update any of your existing
.h5 files to the new format -- it should be nondestructive (making a backup of the whole file first
and then making backups up any tables that it can't create a new version of that fully preserves
the data from the previous version), but don't be alarmed when your subject files start updating!
We advise, as we always do, making a full backup of your data directory before making this update.
- Change references in `launch_autopilot.sh` scripts from `autopilot.core.terminal` or `autopilot.core.pilot`
to `autopilot.agents.terminal` or `autopilot.agents.pilot`, respectively
- Update any `TrialData` declarations in plugin tasks to use the new {class}`.Trial_Data` model. See {attr}`.Nafc.TrialData` for an example.
The old pytables IsDescriptor style descriptions will still work, but you will be given a warning every time.
- We advise updating pigpio to at least [`3c23715`](https://github.com/sneakers-the-rat/pigpio/commit/3c237159e5995ec58cd673579bdd66a8d819b269) to
avoid warnings and make use of some new functionality.

Package Structure

- The `autopilot.core` module was removed entirely, and was split into
- {mod}`autopilot.agent`: which contains the {class}`.Terminal` and {class}`.Pilot` classes and a stub metaclass
- {mod}`autopilot.utils.loggers`: formerly `autopilot.core.loggers`
- {mod}`autopilot.gui` (described in module documentation) now has all the GUI modules, split out by type rather than all in one file.
- {mod}`autopilot.data` was created from `autopilot.core.subject`, see below.
- {mod}`autopilot.root` contains root classes:
- {class}`.Autopilot_Type` - types and data models for handling and saving live data
- {class}`.Autopilot_Object` - General root metaclass, beneath which will be top-level metaclasses for each of the major
class hierarchies that are currently separate.
- {class}`.Autopilot_Pref` - Stub for later converting prefs and environmental configuration parameters from their scattered state.
- {mod}`autopilot.exceptions` will be used for more explicit exception handling.
- Code files were given `755` permissions to allow execution (as opposed to `644`)
- The unused git submodules for pigpio and an old temperature sensor were removed.

Major updates

- {mod}`autopilot.data` is the major change in this release! See the module-level doc page for more details
- `autopilot.core.subject` was moved to {mod}`autopilot.data.subject` and remains the main interface to autopilot data.
It was effectively rewritten to accomodate the use of data models, and many of its public methods were made private to
make its use more obvious.
- The subject structure that determines which things are located where has been made into its own class {class}`.Subject_Structure`
- Making new subjects is now done with the {meth}`.Subject.new` class method rather than from the `__init__` method
- The `open_hdf` method has been replaced with the `_h5f` private method that is a more explicit context manager allowing
locking read/write access and nonlocking read access
- The subject file now explicitly handles updates between different versions of the Subject class.
- Subject will check if the protocol `.json` file has been updated from when it was assigned and automatically update to the new version,
logging the change.
- All trial data is now saved with a `session_uuid` unique identifier column that is an always-unique key in case of any
overlapping session IDs from reassignments, etc.
- Many attributes were replaced by properties that return data models:
- {attr}`.Subject.bio` and {attr}`.Subject.info` -> {class}`.Biography`
- {attr}`.Subject.protocol` -> {class}`.Protocol_Status`, which manages the current trial, session, step, etc. rather than being treated separately
- {mod}`autopilot.data.interfaces` contains classes to relate abstract data models to different representations and formats
- {mod}`.interfaces.datajoint` allows creating datajoint schema definitions from autopilot models using the
companion [datajoint-babel](https://github.com/auto-pi-lot/datajoint-babel) project
- {mod}`.interfaces.tables` translates pydantic models to HDF5 files
- {mod}`autopilot.data.modeling` has basic types for use in data models
- {mod}`autopilot.data.models` has the models themselves
- {mod}`autopilot.data.units` stub module for using explicit units instead of anonymous floats
- A new set of general model filling widgets - {mod}`.widgets.input` and {mod}`.widgets.model` - were created that will
eventually replace much of the existing GUI which suffers from code duplication problems from minor variations between
representations of parameters, etc.
- {class}`~.loggers.Log`, {class}`.Log_Format`, {class}`.LogEntry`, {class}`.ParseError`,
{data}`.MESSAGE_FORMATS`, {data}`.LOG_FORMATS` were added to allow programmatic loading of logfiles, and {mod}`.utils.log_parsers`
was added to allow recovery of structured data (eg. from logged trial data). Loggers now use the [rich logging handler](https://rich.readthedocs.io/en/stable/logging.html)
for much more readable logs in stderr.
- {class}`.Jack_Sound` classes now put all frames at once into the processing queue, rather than one at a time for much less
variability in sound onset jitter. The {class}`.JackClient` class was updated to reflect that as well by adding a `play_q_size`
argument that controls the size of the deque used to store frames to play (rather than pulling each from a Queue as was done before). {class}`.JackClient`
also has an optional `disable_gc` (False by default) parameter that allows the garbage collector to be disabled
in the process for further (unquantified) jitter reduction.

Minor updates

- The bandwidth test ({class}`.Bandwidth_Test` widget and {meth}`.Pilot.l_bandwidth` listen) was updated to allow selecting
compression, use of a random array, or preserialized messages
- The {mod}`.Terminal` now closes cleanly (still with a warning of leaked semaphors) without hanging.
- External processes {func}`.external.start_pigpiod` and {func}`.external.start_jackd` first check if the process is already started
- {meth}`.Digital_Out.set` now has a ``result`` argument for faster setting that doesn't confirm the result when ``False``
- {class}`.Message` s now provide clearer support for compression in serialization, and automatically detect and handle
a compressed message when deserializing. This is also carried through to the {meth}`.Net_Node.send` method.
- {meth}`.Station.l_kill` was moved up to the top level {class}`.Station` class, rather than being something the Terminal station owns.
- The {mod}`~.setup.run_script` functions no longer uses the totally unreadable white on green ANSI code combo that I have no idea why i ever used in the first place.
- A `picamera_legacy` script was added for enabling the picamera on bullseye.
- The {class}`.sounds.Gammatone` sound now accepts a `filter_kwargs` dictionary that is passed on to the {class}`.timeseries.Gammatone` filter.
- The {class}`.Task` and {class}`.Nafc` classes use the new {class}`.Trial_Data` style data declarations.
- Two utility functions {func}`.common.walk_dicts` and {func}`.common.flatten_dicts` were added to make handling nested dictionaries a bit easier.
-

Bugfixes

- The Subject class would incorrectly overwrite data given a mismatch in system times between the Terminal and Pilot.
The subject class should now ideally no longer overwrite anything ever.
- The subject class would drop trial data silently if it was not in the TrialData description. En route to making the table
automatically expand to accomodate unexpected data, dropped data is now logged as an exception.
- The prefs manager handles being launched from within ipython and other processes better, but is still a bit buggy.
Now it uses the check used internally in the multiprocessing module to see if a manager can be launched,
and falls back to using a standard dictionary if not.
- `jackd_source` script uses correct `https://` rather than `git://` protocol.
- A `_TASK_LIST` was added to {mod}`.utils.registry` to support deprecated task specifications.

Regressions

- With additional checking for monotonic increases in `trial_num` and checks that prevent data overwriting,
individual writes of trial data are now a bit slower, which should be optimized for when we complete the transition to
uniform data models throughout the library.

Prefs

- `PIGPIOD` - `bool` - if `True`, start pigpiod on pilot start
- Stubs were created for converting the prefs to using data models, but they have not been filled yet.
- A `AUTOPILOT_NO_PREFS_MANAGER` environment variable now controls the use of a multiprocessing manager explicit. Documentation
for environmental variables is forthcoming.
- A `AUTOPILOT_WARN_DEFAULTS` environment variable controls whether warnings should be printed for when a default pref value
is retrieved, because that warning is a good one but can be really annoying.

Packaging & Dependencies

- Autopilot is now packaged with Poetry! This allows for fully deterministic installation with the poetry.lock file and
updates from the old setuptools style of dependency specification.
- The source repository has moved from https://github.com/wehr-lab/autopilot to https://github.com/auto-pi-lot/autopilot
- `MANIFEST.in` has been replaced by the `include` field in `pyproject.toml`
- `autopilot.__version__` is now determined by `importlib.metadata` and specified in the `pyproject.toml` file rather than in the `__init__.py` file
- `blosc` was replaced with `blosc2`
- New dependencies
- global
- pydantic (^1.9.0)
- parse (^1.19.0)
- rich (^11.2.0)
- validators (^0.18.2)
- docs
- autodoc_pydantic (^1.7.0)
- myst_parser (^0.17.2)
- Version Bumps
- pyzmq 18.1.* -> ^22.3.0
- tornado >=5.0.0 -> ^6.1.0
- numpy >=1.16.5 -> ^1.20.0
- scipy >=1.6.0 -> ^1.7.0
- pandas >=0.19.2 -> ^1.3.0 on python 3.7 and ^1.4.0 on >=3.8
- tables >=3.4.2 -> ^3.7.0
- Sphinx >=3.1.2 -> ^4.3.1
- A lot more dependencies were taken from being implicit versions to explicit
by the conversion to using Poetry...

Docs

- [Configuration](configuration) was moved to its own page, documenting setting up the system as well as the contents of the user directory.
- A [faq](FAQ) page was stubbed out (but is still pretty skeletal)
- The overview was updated with some more information in the module tour
- Virtual environment usage was moved from the setup page to its own subpage linked from the FAQ.
- A `make serve` option was added to the docs makefile that makes use of [sphinx-autobuild](https://pypi.org/project/sphinx-autobuild/)
to livereload docs while editing them.
- `autopilot_theme.css` was updated to be compatible with the new version of sphinx-rtd-theme that apparently changed the way
that TOC buttons were made, as well as remove incorrect references to fonts no longer packaged.
- The `autodoc_pydantic` and `myst_parser` extensions were added -- and we will be moving towards using MyST rather than
hellish ReST for future narrative docs!
- Private methods and functions are now no longer rendered in the main documentation, and the library will over time
use the public/private distinction more systematically to make it more understandable.
- Examples was split off into its own folder and links to wiki plugins. Blink was moved with it

Tests

- We have started importing some of the pigpio mocking tools from the [People's Ventilator Project](https://peoplesvent.org)
to start writing GPIO tests!

0.5.0a0

A lot. Namely a whole rewriting of the {mod}`autopilot.data` module.

This is being released as an alpha version while we finish working out a few of the kinks in the data modeling
system because Jonny is finishing their dissertation and has a deadline determined by the viscera of
institutional science rather than software development!

0.4.4

Several parts to this update!

- See https://github.com/wehr-lab/autopilot/pull/146 for details about improvements to jackd sound timing! In short:
- Changed the way that continuous sounds work. Rather than cycling through an array, which was easy to drop, now pass a sound object that can generate its own samples on the fly using the `hydration` module.
- More accurate timing of sound ending callbacks. Before, the event would be called immediately on buffering the sounds into the jack ports, but that was systematically too early. Instead, use jack timing methods to account for delay from blocksize and n_periods to wait_until a certain delay to `set()` the event. See `_wait_for_end`

Other stuff:

New
- `hydration` module for creating and storing autopilot objects between processes and computers!
- `Introspect` made and added to sound classes. Will be moved to root class. Allows storing the parameters given on instantiation.
- `requires` module for more explicit declarations of by-object dependencies to resolve lots of the little fragile checks throughout the package, as well as make it easier for plugins :)
- minor - added exceptions module, just stubs for now
- Made dummy sound class to just use sounds without needing a running sound server
- New transformations! The Prasad line fitting algorithm as `Linefit_Prasad` and ordering points in a line from, eg. edge detection in `Order_Points`

Improvements
- Only warn once for returning a default pref value, and make its own warning class so that it can be filtered.
- Cleaning up the base sound classes and moved them to their own module because sounds was very cumbersome and hard to reason about. Now use `get_sound_class` instead of declaring within the module.
- Made optional install packages as `extras_require` so now can install with `pip install auto-pi-lot -E pilot` rather than autodetecting based on architecture. Further improvements (moving to poetry) will be in v0.5.0

Bugfixes
- Correctly identify filenames in logging, before the last module name was treated as a suffix on the path and removed, and so only the most recent logger created would actually log to disk. Logging now works across threads and processes.
- Fall back to a non-multiprocessing-based prefs if for some reason we can't use a mp.Manager in the given context (eg. ipython) - Still need to figure out a way to not print the exception because it is thrown asynchronously.
- as much as i love it, the splash screen being absent for whatever reason shouldn't crash the program.
- Raise an exception when instantiating a picamera without having picamera installed, re: https://github.com/wehr-lab/autopilot/issues/142
- Raise ImportError when ffmpeg is not present and trying to use a videowriter class
- Use a deque rather than an infinitely growing list to store GPIO events.

Docs
- Documenting the scripts module a bit better.
- Lots more docs on jack_server

0.4.3

New Features

* `timeseries.Gammatone` filter and `sounds.Gammatone` filtered noise classes!
Thank you scipy team for making this simple!

Minor Improvements


* https://github.com/wehr-lab/autopilot/commit/579ef1a41518f57721decd7ecfc289f2b358b356b - En route to implementing universal calibrations, load and save them in a specified place for each hardware object instead of the horrific olde way which was built into `prefs` for some reason
* prefs attempts to make directories if they don't exist
* plenty of new debugging flags!

Bugfixes

* https://github.com/wehr-lab/autopilot/commit/a775723acc66e327492145066eea0e7dff59331e - Sleep before graduating tasks, lateral fix until we rework the task initiation ritual
* https://github.com/wehr-lab/autopilot/commit/360062d3ad4cd30cdba1c53eebe5ff7d7698ffad - pad sounds with silence or continuous sounds if they aren't a full period length
* https://github.com/wehr-lab/autopilot/commit/6614c808ec2f3fc86e01df17b78aa976e8843b5a - Revert to old way of making chunks to make it work with both padded and unpadded sounds
* Import sounds module directly instead of referring from the package root in tests
* Terminal node pings pilots instead of an erroneous reference to a nonexistent `Terminal.send` method
* https://github.com/wehr-lab/autopilot/commit/47dd4c2345df081fb5f3ca1c1705d2f696fc62c9 - Fix pinging by passing pilot id, and handle pressing start/stop button when subject not selected
* Fixed some GUI exceptions from trying to make blank lines in reassign window, improperly handling the Subject class.

0.4.2

Bugfixes! primarily in importing the stim module! see the changelog:
https://docs.auto-pi-lot.com/en/main/changelog/v0.4.0.html

0.4.1

* The :class:`autopilot.setup.forms.HARDWARE_FORM` would incorrectly use the class object itself
rather than the class name in a few places which caused hardware names to incorrectly display and
be impossible to add!
* Correctly handle module name in loggers when running interactively
* Use accelerometer calibration when computing :meth:`~autopilot.hardware.i2c.I2C_9DOF.rotation`
* Use :func:`autopilot.get` in :func:`autopilot.transform.make_transform`

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.