dstl / Stone-Soup

A software project to provide the target tracking community with a framework for the development and testing of tracking algorithms.
https://stonesoup.rtfd.io
MIT License
384 stars 126 forks source link

CSVDetectionReader not parsing csv successfully #1030

Closed Jack2104 closed 10 hours ago

Jack2104 commented 1 month ago

I'm trying to parse some data with the CSV Reader, and I'm having some issues. I'm using it like so: detection_reader = CSVDetectionReader(detections_csv_fp, state_vector_fields=("delay", "doppler"), time_field="timestamp", timestamp=True) and I'm getting the following value in detection_reader.detections: "AttributeError("'CSVDetectionReader' object has no attribute 'current'")".

Here's a snippet of my csv file:

delay,doppler,timestamp
7.95,87.81,1713883987987
22.47,195.47,1713883987987
35.93,-95.29,1713883989845

Any idea what could be going wrong? I'm new to stone soup and trying to find my way around it

apiszcz commented 1 month ago

fysa

https://github.com/dstl/Stone-Soup/issues/971

On Wed, May 29, 2024 at 6:20 AM Jack Hill @.***> wrote:

I'm trying to parse some data with the CSV Reader, and I'm having some issues. I'm using it like so: detection_reader = CSVDetectionReader(detections_csv_fp, state_vector_fields=("delay", "doppler"), time_field="timestamp", timestamp=True) and I'm getting the following value in detection_reader.detections: "AttributeError("'CSVDetectionReader' object has no attribute 'current'")".

Here's a snippet of my csv file:

delay,doppler,timestamp 7.95,87.81,1713883987987 22.47,195.47,1713883987987 35.93,-95.29,1713883989845

Any idea what could be going wrong? I'm new to stone soup and trying to find my way around it

— Reply to this email directly, view it on GitHub https://github.com/dstl/Stone-Soup/issues/1030, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAK5KTO4XDYZODRDKA4SACLZEWTYFAVCNFSM6AAAAABIOUBLFGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGMZDEOJUG44TCOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sdhiscocks commented 1 month ago

@Jack2104 The issue is that with the readers, they are designed to iterated over and they yield the data. It's designed this way so when you have sources of data that can't be read at once, for example a real camera.

this should work:

detection_reader = CSVDetectionReader(detections_csv_fp, state_vector_fields=("delay", "doppler"), time_field="timestamp", timestamp=True)

all_time_detections = set()
for time, current_detections in detection_reader:
    print(time, detections)
    all_time_detections |= current_detections