You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While creating a local DJ database from scratch and ingesting the sample data following the guide in PR SainsburyWellcomeCentre/aeon_docs#84, aeon_ingest streams_worker throws the following error:
Traceback (most recent call last):
File "...\aeon\dj_pipeline\populate\process.py", line 82, in run
worker.run()
File "...\miniconda3\envs\aeon\Lib\site-packages\datajoint_utilities\dj_worker\worker.py", line 215, in run
self.register_worker()
File "...\miniconda3\envs\aeon\Lib\site-packages\datajoint_utilities\dj_worker\worker.py", line 118, in register_worker
"key_source_sql": process.key_source.proj().make_sql()
^^^^^^^^^^^^^^^^^^
File "...\miniconda3\envs\aeon\Lib\site-packages\datajoint\user_tables.py", line 55, in getattribute
cls().getattribute(name)
File "...\aeon\dj_pipeline\streams.py", line 856, in key_source
device_type_name = dj.utils.from_camel_case(device_type)
^^^^^^^^^^^
NameError: name 'device_type' is not defined
This error stems from the following class added by streams_maker.py to aeon.dj_pipeline.streams.py:
@schemaclassSpinnakerVideoSourcePosition(dj.Imported):
definition=""" # Raw per-chunk Position from SpinnakerVideoSource(auto-generated with vunknown) -> SpinnakerVideoSource -> acquisition.Chunk --- sample_count: int # number of data points acquired from this stream for a given chunk timestamps: longblob # (datetime) timestamps of Position data x: longblob y: longblob angle: longblob major: longblob minor: longblob area: longblob id: longblob """@propertydefkey_source(self):
docstring=f"""Only the combination of Chunk and SpinnakerVideoSource with overlapping time. + Chunk(s) started after SpinnakerVideoSource install time & ended before SpinnakerVideoSource remove time + Chunk(s) started after SpinnakerVideoSource install time for SpinnakerVideoSource and not yet removed """self.__doc__=docstringdevice_type_name=dj.utils.from_camel_case(device_type)
return (
acquisition.Chunk*SpinnakerVideoSource.join(SpinnakerVideoSource.RemovalTime, left=True)
&'chunk_start >= spinnaker_video_source_install_time'&f'chunk_start < IFNULL({device_type_name}_removal_time,"2200-01-01")'
)
defmake(self, key):
"""Load and insert the data for the SpinnakerVideoSourcePosition table."""chunk_start, chunk_end= (acquisition.Chunk&key).fetch1("chunk_start", "chunk_end")
data_dirs=acquisition.Experiment.get_data_directories(key)
device_name= (SpinnakerVideoSource&key).fetch1(f"{dj.utils.from_camel_case(device_type)}_name")
devices_schema=getattr(
aeon_schemas,
(acquisition.Experiment.DevicesSchema& {"experiment_name": key["experiment_name"]}).fetch1(
"devices_schema_name"
),
)
stream_reader=getattr(getattr(devices_schema, device_name), "Position")
stream_data=io_api.load(
root=data_dirs,
reader=stream_reader,
start=pd.Timestamp(chunk_start),
end=pd.Timestamp(chunk_end),
)
self.insert1(
{
**key,
"sample_count": len(stream_data),
"timestamps": stream_data.index.values,
**{
re.sub(r"\([^)]*\)", "", c): stream_data[c].valuesforcinstream_reader.columnsifnotc.startswith("_")
},
},
ignore_extra_fields=True,
)
The text was updated successfully, but these errors were encountered:
This bug is caused by some unintended consequences during our ruff fixes that I missed. What appears to be stylistic changes actually do have negative implication to the code logic, due to the complex "code-generation" logic in streams_maker.
Thanks for checking @ttngu207 ! Note also that the table definitions do not need to be f-strings as the replacement dict will replace the placeholders enclosed within curly braces, e.g. {aeon.__version__}
While creating a local DJ database from scratch and ingesting the sample data following the guide in PR SainsburyWellcomeCentre/aeon_docs#84,
aeon_ingest streams_worker
throws the following error:This error stems from the following class added by
streams_maker.py
toaeon.dj_pipeline.streams.py
:The text was updated successfully, but these errors were encountered: