From 255189b34f7a0d6e2c5e148a1aadfb231fc788b0 Mon Sep 17 00:00:00 2001 From: Andi Gerken <andi.gerken@gmail.com> Date: Wed, 10 Feb 2021 14:34:17 +0100 Subject: [PATCH] [ci] changed to push artifacts to the artifacts repository Updated example, updated url of track format --- ci/deploy.py | 3 +-- examples/example_readme.py | 25 ++++++++++++++++++------- src/robofish/io/file.py | 4 +++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/ci/deploy.py b/ci/deploy.py index 8ca66d5..6dda82b 100755 --- a/ci/deploy.py +++ b/ci/deploy.py @@ -18,8 +18,7 @@ if __name__ == "__main__": command += ["-m", "twine", "upload", "dist/*"] command += [ "--repository-url", - f"https://git.imp.fu-berlin.de/api/v4/projects/{env['CI_PROJECT_ID']}/packages/pypi", + f"https://git.imp.fu-berlin.de/api/v4/projects/{env['ARTIFACTS_REPOSITORY_PROJECT_ID']}/packages/pypi", ] - # ARTIFACTS_REPOSITORY_PROJECT_ID check_call(command) diff --git a/examples/example_readme.py b/examples/example_readme.py index f006082..a568f8a 100644 --- a/examples/example_readme.py +++ b/examples/example_readme.py @@ -1,16 +1,27 @@ import robofish.io -import numpy +import numpy as np + +filename = "example.hdf5" f = robofish.io.File(world_size_cm=[100, 100], frequency_hz=25.0) -# Create a single robot with 40 poses +# Create a single robot with 20 timesteps # (x,y, x_orientation, y_orientation) and specified time points -f.create_entity(category="robot", name="robot", poses=numpy.zeros((40, 4))) -# Create 2 fishes with 100 poses -# (x,y, x_orientation, y_orientation) and 40ms timesteps -f.create_multiple_entities("fish", poses=numpy.zeros((2, 100, 4))) +f.create_entity( + category="robot", + name="robot", + positions=np.ones((20, 2)) * 10, + orientations=np.zeros((20, 1)), +) + +# Create 2 fishes with 20 poses +poses = np.zeros((2, 20, 4)) +poses[:, :, 3] = 1 # all fishes pointing upwards +poses[1, :, :2] = -20 # move first fish to x,y -20,-20 +f.create_multiple_entities("fish", poses=poses) # Show and save the file print(f) -f.save("example.hdf5") +f.save(filename) +print(f"Saved to {filename}") diff --git a/src/robofish/io/file.py b/src/robofish/io/file.py index 272de38..3267763 100644 --- a/src/robofish/io/file.py +++ b/src/robofish/io/file.py @@ -32,7 +32,9 @@ import deprecation temp_dir = tempfile.TemporaryDirectory() default_format_version = np.array([1, 0], dtype=np.int32) -default_format_url = "https://git.imp.fu-berlin.de/bioroboticslab/robofish/track_format/-/releases/1.0-draft.10" +default_format_url = ( + "https://git.imp.fu-berlin.de/bioroboticslab/robofish/track_format/-/releases/1.0" +) class File(h5py.File): -- GitLab