smashub/choco

Unknown namespace: timesig

Closed this issue · 2 comments

Using jams v0.3.4 doing audio_jams = jams.load(data/choco/v1.0.0/jams/biab-internet-corpus_201.jams) gives

Traceback (most recent call last):
  File "/cw/liir_code/NoCsBack/rubenc/miniconda3/envs/harmonyenv/lib/python3.12/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-5-96558ba4fe39>", line 1, in <module>
    audio_jams = jams.load(str(path))
                 ^^^^^^^^^^^^^^^^^^^^
  File "/cw/liir_code/NoCsBack/rubenc/jams/jams/core.py", line 216, in load
    jam.validate(strict=strict)
  File "/cw/liir_code/NoCsBack/rubenc/jams/jams/core.py", line 1813, in validate
    valid &= ann.validate(strict=strict)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cw/liir_code/NoCsBack/rubenc/jams/jams/core.py", line 764, in validate
    ann_schema = schema.namespace_array(self.namespace)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cw/liir_code/NoCsBack/rubenc/jams/jams/schema.py", line 93, in namespace_array
    obs_sch = namespace(ns_key)
              ^^^^^^^^^^^^^^^^^
  File "/cw/liir_code/NoCsBack/rubenc/jams/jams/schema.py", line 66, in namespace
    raise NamespaceError('Unknown namespace: {:s}'.format(ns_key))
jams.exceptions.NamespaceError: Unknown namespace: timesig

Hi @rubencart, this is not really an issue, because we have registered new namespaces in order to account for new types of annotations (and also to preserve the original ones before chord conversion). All you need to do before loading the annotation from jams is to import the namespaces package (have a look here), as this would register all of them. Also, you may need to add the parameter validate=False when loading the JAMS annotation.

Thanks, I had found that out in the meantime. Maybe it would be nice to add to your documentation? That one should load the namespaces before loading actual jams files, like jams.schema.add_namespace(str(ns_dir / "chord_ireal.json"))?