@@ -109,10 +109,9 @@ and prediction procedures with a `taggingbackends.explorer.BackendExplorer` obje
...
@@ -109,10 +109,9 @@ and prediction procedures with a `taggingbackends.explorer.BackendExplorer` obje
The internal representation is as follows:
The internal representation is as follows:
* dictionary of run identifiers (`str`, typically `date_time`) as keys and, as values:
* dictionary of run/assay identifiers (`str`, typically `date_time`) as keys and, as values:
* dictionary of larva identifiers (`int`) as keys and, as values:
* dictionary of track/larva identifiers (`int`) as keys and, as values:
* dictionary of timestamps (`float`) as keys and discrete behavioral states (`str`) as
* dictionary of timestamps (`float`) as keys and discrete behavioral states/actions (`str` or `list` of `str`) as values.
values.
Labels are encapsulated in a dedicated datatype that also stores metadata and information
Labels are encapsulated in a dedicated datatype that also stores metadata and information
about labels (names, colors).
about labels (names, colors).
...
@@ -148,25 +147,27 @@ The communication between the two language stacks requires Julia package *Taggin
...
@@ -148,25 +147,27 @@ The communication between the two language stacks requires Julia package *Taggin
Depending on where *TaggingBackends* is installed, a pointer to that location may be needed.
Depending on where *TaggingBackends* is installed, a pointer to that location may be needed.
The simplest approach consists in doing so in the main Julia environment.
The simplest approach consists in doing so in the main Julia environment.
In this case, you will have to explicitly install *PlanarLarvae* as well:
In this case, you will have to explicitly install *PlanarLarvae* as well, *e.g.*:
```
```
julia -e 'using Pkg; Pkg.add(url="https://gitlab.pasteur.fr/nyx/planarlarvae.jl"); Pkg.add(url="https://gitlab.pasteur.fr/nyx/TaggingBackends")'
julia -e 'using Pkg; Pkg.add(url="https://gitlab.pasteur.fr/nyx/planarlarvae.jl"); Pkg.add(url="https://gitlab.pasteur.fr/nyx/TaggingBackends")'
```
```
This is enough for Python-side *taggingbackends* to find its Julia counterpart.
This is enough for Python-side *taggingbackends* to find its Julia counterpart.
Another approach we recommend, if you have LarvaTagger.jl installed, consists in installing *TaggingBackends* in the Julia environment associated with *LarvaTagger*, and set the JULIA_PROJECT environment variable so that it points to the directory associated with this environment.
Another approach we recommend, so that your main Julia environment is not populated by packages you do not need in every circumtances, consists in installing *TaggingBackends* in an existing Julia environment, *e.g.* the one that accommodates the *LarvaTagger* package.
This directory typically is the root directory of your local copy of LarvaTagger.jl, if you installed *LarvaTagger* with `julia --project=.`.
To do so, on Unix-like OSes:
As a major inconvenience of this approach, the `JULIA_PROJECT` environment variable will have to be set whenever `tagging-backend train` is called.
The `JULIA_PROJECT` variable should be the absolute path to the directory associated with the environment that accommodates the *TaggingBackends* package.
If for example you have a local copy of the LarvaTagger.jl project, you can install *TaggingBackends* in the associated environment:
```
```
cd /path/to/LarvaTagger.jl/
cd /path/to/LarvaTagger/
export JULIA_PROJECT=$(pwd)
julia --project=. -e 'using Pkg; Pkg.add(url="https://gitlab.pasteur.fr/nyx/TaggingBackends")'
julia --project=. -e 'using Pkg; Pkg.add(url="https://gitlab.pasteur.fr/nyx/TaggingBackends")'
export JULIA_PROJECT=$(pwd)
```
```
The `export` expression will work in Unix-like OSes only. On Windows, the `JULIA_PROJECT` environment variable can be set in the same configuration panel as the user's `Path` variable.
With the above `export` expression, the JULIA_PROJECT environment variable is set for the running commandline.
Note also that, with the above `export` expression, the `JULIA_PROJECT` environment variable is set for the running command interpreter, and will have to be set again if the interpreter is closed and started again.
To install a backend, taking MaggotUBA-adapter as an example:
To install a backend, taking MaggotUBA-adapter as an example:
Note that, if PyCall is not found, the above command will install it.
Note that, if PyCall is not found, the above command will install it.
However, TaggingBackends still needs to be installed for Python-side *taggingbackends* to successfully call Julia-side *TaggingBackends*.
However, TaggingBackends still needs to be installed for Python-side *taggingbackends* to successfully call Julia-side *TaggingBackends*.
A major drawback of this second approach is the JULIA_PROJECT environment variable must be set accordingly everytime the `train` command is called.
So again, the `JULIA_PROJECT` environment variable must be set accordingly everytime the `train` command is called, which can also be done assigning the adequate absolute path to the variable on the same line as the command, immediately before the command.
For example, from the backend directory tree, on Unix-like OSes:
For example, from the backend directory tree, on Unix-like OSes:
```
```
JULIA_PROJECT=<path> poetry run tagging-backend train
JULIA_PROJECT=<path> poetry run tagging-backend train
...
@@ -191,6 +192,12 @@ or, from LarvaTagger.jl root directory:
...
@@ -191,6 +192,12 @@ or, from LarvaTagger.jl root directory:
```
```
JULIA_PROJECT=<path> scripts/larvatagger.jl train
JULIA_PROJECT=<path> scripts/larvatagger.jl train
```
```
with `<path>` the path of the Julia project with TaggingBackends installed.
with `<path>` the absolute path to the Julia project/environement with TaggingBackends installed.
There is a known issue with `JULIA_PROJECT` not being properly propagated on calling `larvatagger.jl`, in the case Julia was installed using juliaup.
Prefer [jill](https://pypi.org/project/jill/), instead of juliaup.
Note however that the last command above will not work if Julia was installed using juliaup. Prefer [jill](https://pypi.org/project/jill/).
Note also that, on Linux, or macOS with coreutils installed, a relative path can be conveniently turned into an absolute path using the `realpath` command: