Commit 6605aa7d authored by matthmey's avatar matthmey

change labelformat, added stores for csv, seismic

parent 05fa7352
This diff is collapsed.
......@@ -21,6 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.'''
from pandas import to_timedelta, to_timedelta
from zarr import DirectoryStore, ABSStore
import dask
......
This diff is collapsed.
__annotation_id,__sub_index,__target,time,x,y
5a14dcff-721f-4b7e-8cca-f10ef3e9ed3a,0,mountaineer,2017-08-04 08:12:11+00:00,81,14
5a14dcff-721f-4b7e-8cca-f10ef3e9ed3a,1,mountaineer,2017-08-04 08:12:11+00:00,82,16
7a8219fa-7581-4c0f-91a1-927167979ee9,0,no_visibility,2017-01-01 05:59:04+00:00,0,0
7a8219fa-7581-4c0f-91a1-927167979ee9,1,no_visibility,2017-01-01 06:59:04+00:00,100,100
__annotation_id,__target,start_time,end_time,start_x,end_x,start_y,end_y
5a14dcff-721f-4b7e-8cca-f10ef3e9ed3a,mountaineer,2017-08-04 08:12:11+00:00,2017-08-04 08:12:11+00:00,81,82,16,14
7a8219fa-7581-4c0f-91a1-927167979ee9,no_visibility,2017-01-01 05:59:04+00:00,2017-01-01 06:59:04+00:00,0,100,0,100
\ No newline at end of file
__annotation_id,__sub_index,__target,time
5a14dcff-721f-4b7e-8cca-f10ef3e9ed3a,0,no_visibility,2017-01-01 05:59:04+00:00
5a14dcff-721f-4b7e-8cca-f10ef3e9ed3a,1,no_visibility,2017-01-01 06:01:04+00:00
7a8219fa-7581-4c0f-91a1-927167979ee9,0,snow,2017-01-01 05:59:04+00:00
7a8219fa-7581-4c0f-91a1-927167979ee9,1,snow,2017-01-01 06:01:04+00:00
75bd6584-edf8-45db-a9e6-f7c8cca52028,0,mountaineer,2017-01-21 09:59:04+00:00
7a8219fa-7581-4c0f-91a1-927167979ee9,1,mountaineer,2017-01-21 10:01:04+00:00
\ No newline at end of file
__annotation_id,__target,start_time,end_time
5a14dcff-721f-4b7e-8cca-f10ef3e9ed3a,no_visibility,2017-08-01 05:59:04+00:00,2017-08-01 10:01:04+00:00
7a8219fa-7581-4c0f-91a1-927167979ee9,snow,2017-08-01 05:59:04+00:00,2017-08-01 06:01:04+00:00
75bd6584-edf8-45db-a9e6-f7c8cca52028,mountaineer,2017-08-02 09:50:04+00:00,2017-08-02 09:54:04+00:00
......@@ -210,49 +210,62 @@ def test_csv():
filename = Path(test_data_dir).joinpath(
"timeseries", "MH30_temperature_rock_2017.csv"
)
node = stuett.data.CsvSource(filename)
x = node()
length = len(x)
assert len(x) == 8760
assert x.mean() == 0.16201109532441677
print(x)
# TODO: test with start and end time
# Test with store
directory = Path(test_data_dir).joinpath(
"timeseries")
store = stuett.DirectoryStore(directory)
filename = "MH30_temperature_rock_2017.csv"
node = stuett.data.CsvSource(filename=filename,store=store)
x = node()
assert len(x) == 8760
assert x.mean() == 0.16201109532441677
# TODO: test with start and end time
test_csv()
def test_annotations():
filename = Path(test_data_dir).joinpath("annotations", "boundingbox_timeseries.csv")
node = stuett.data.BoundingBoxAnnotation(filename)
targets = node()
assert targets[0] == 'no_visibility'
filename = Path(test_data_dir).joinpath("annotations", "boundingbox_images.csv")
node = stuett.data.BoundingBoxAnnotation(filename)
targets = node()
targets = targets.swap_dims({"index": "time"})
targets = targets.sortby("time")
# print(targets.sel(time=slice('2016-01-01','2016-01-04')))
# print(targets)
targets = targets.swap_dims({"index": "start_time"})
targets = targets.sortby("start_time")
assert targets.sel(start_time='2017-08-04T08:12:11') == 'mountaineer'
assert targets['start_y'][1] == 16
# test_annotations()
# def test_datasets():
# filename = Path(test_data_dir).joinpath("annotations", "boundingbox_timeseries.csv")
# label = stuett.data.BoundingBoxAnnotation(filename)
def test_datasets():
filename = Path(test_data_dir).joinpath("annotations", "boundingbox_timeseries.csv")
label = stuett.data.BoundingBoxAnnotation(filename)
# filename = Path(test_data_dir).joinpath(
# "timeseries", "MH30_temperature_rock_2017.csv"
# )
# data = stuett.data.CsvSource(filename)
filename = Path(test_data_dir).joinpath(
"timeseries", "MH30_temperature_rock_2017.csv"
)
data = stuett.data.CsvSource(filename)
# dataset = stuett.data.LabeledDataset(
# data,
# label,
# dataset_slice={"time": slice("2017-08-01", "2017-08-02")},
# batch_dims={"time": pd.to_timedelta(10, "s")},
# )
dataset = stuett.data.SegmentedDataset(
data,
label,
dataset_slice={"time": slice("2017-08-01", "2017-08-03")},
batch_dims={"time": pd.to_timedelta(24, "m")},
)
# test_datasets()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment