Skip to content
Snippets Groups Projects
Select Git revision
  • dev_mathis
  • develop
  • master default protected
  • colored_track
  • show-text
  • dev_gian
  • efb-rendering
  • develop_marc
  • docstrings
  • pdocs
  • 0.4.0 protected
  • 0.3.6.1 protected
  • 0.3.6 protected
  • 0.3.5 protected
  • 0.3.4 protected
  • 0.3.3 protected
  • 0.3.2.3 protected
  • 0.3.2.2 protected
  • 0.3.2.1 protected
  • 0.3.2 protected
  • 0.3.1 protected
  • 0.3.0 protected
  • 0.2.16 protected
  • 0.2.15 protected
  • 0.2.14 protected
  • 0.2.13 protected
  • 0.2.12 protected
  • 0.2.11 protected
  • 0.2.10 protected
  • 0.2.9 protected
30 results

io

  • Clone with SSH
  • Clone with HTTPS
  • Andi Gerken's avatar
    Andi Gerken authored
    Fix #11: local variable 'time_points' referenced before assignment
    
    Closes #11
    
    See merge request !10
    e0159e87
    History

    pipeline status

    Robofish IO

    This repository implements an easy to use interface, to create, save, load, and work with specification-compliant hdf5 files, containing 2D swarm data. This repository should be used by the different swarm projects to generate comparable standardized files.

    Documentation

    Installation

    Add our Artifacts repository to your pip config and install the packagage.

    python3 -m pip config set global.extra-index-url https://git.imp.fu-berlin.de/api/v4/projects/6392/packages/pypi/simple
    python3 -m pip install robofish-io

    Usage

    We show a simple example below. More examples can be found in examples/

    # Create a new robofish io file
    f = robofish.io.File(world_size_cm=[100, 100], frequency_hz=25.0)
    f.attrs["experiment_setup"] = "This is a simple example with made up data."
    
    # Create a new robot entity with 10 timesteps.
    # Positions and orientations are passed separately in this example.
    # Since the orientations have two columns, unit vectors are assumed
    # (orientation_x, orientation_y)
    f.create_entity(
        category="robot",
        name="robot",
        positions=np.zeros((10, 2)),
        orientations=np.ones((10, 2)) * [0, 1],
    )
    
    # Create a new fish entity with 10 timesteps.
    # In this case, we pass positions and orientations together (x, y, rad).
    # Since it is a 3 column array, orientations in radiants are assumed.
    poses = np.zeros((10, 3))
    poses[:, 0] = np.arange(-5, 5)
    poses[:, 1] = np.arange(-5, 5)
    poses[:, 2] = np.arange(0, 2 * np.pi, step=2 * np.pi / 10)
    fish = f.create_entity("fish", poses=poses)
    fish.attrs["species"] = "My rotating spaghetti fish"
    fish.attrs["fish_standard_length_cm"] = 10
    
    # Some possibilities to access the data
    print(f"The file:\n{f}")
    print(
        f"Poses Shape:\t{f.entity_poses_rad.shape}.\t"
        + "Representing(entities, timesteps, pose dimensions (x, y, ori)"
    )
    print(f"The actions of one Fish, (timesteps, (speed, turn)):\n{fish.speed_turn}")
    print(f"Fish poses with calculated orientations:\n{fish.poses_calc_ori_rad}")
    
    # Save the file
    f.save_as("example.hdf5")

    Evaluation

    Evaluate your tracks with robofish-io-evaluate $mode $file(s) Current modes are:

    • speed
    • turn
    • tank_positions
    • trajectories
    • follow_iid