Simulate the vertical fish distribution influenced by physical stimuli
Project description
VerFishD is a library for simulating vertical fish distribution under the influence of physical stimuli.
Concept
VerFishD uses PhysicalFactor objects to influence fish movement. You can implement this base class to define your own physical factors, such as temperature, light, oxygen, etc. The next step is to load a StimuliProfile, which represents a collection of specific stimulus values. The migration speed function determines the final vertical movement of the fish. The sign of this function determines the movement direction, while the absolute value indicates the percentage of fish that will move. These values are combined to simulate the vertical distribution of fish over time.
Installation
VerFishD is available on PyPI and can be installed using Poetry or pip:
poetry add verfishd
or with pip:
pip install verfishd
Usage
Here is a simple example of how to use VerFishD:
# Define a custom PhysicalFactor
class Temperature(PhysicalFactor):
"""
A class representing a temperature factor.
Parameters
----------
weight : float
The weight is used to scale the factor's contribution to the evaluation function E.
"""
def __init__(self, weight: float):
super().__init__("temperature", weight)
def _calculate(self, value: float) -> float:
match value:
case _ if value > 5:
return 0.0
case _ if value < 4:
return -1.0
case _:
return value - 5.0
# Create a Stimuli Profile including depth and temperature
stimule_dataframe = pd.DataFrame({
'depth': [0.0, 1.0, 2.0, 3.0, 4.0, 5.0],
'temperature': [7.0, 6.0, 5.0, 5.4, 4.0, 3.9]
})
stimuli = StimuliProfile(stimule_dataframe)
# Create the temperature factor
temperature_factor = Temperature(1.0)
# Define a very simple migration speed function
migration_speed = lambda x: x
# Create the model
model = VerFishDModel('Example', stimuli, migration_speed, [temperature_factor])
# Simulate the model for 30 steps
model.simulate(800)
model.plot()
plt.show()
This example defines a temperature factor, creates a stimuli profile with temperature data over depth, initializes the model with this profile and factor, runs a simulation over 800 time steps, and finally plots the results.
Features
- Modularity: Implement custom physical factors that influence fish movement.
- Flexibility: Load different stimuli profiles to simulate various environmental conditions.
- Visualization: Plot functions to display simulation results.
Example Plot
Running Tests
To run tests, use:
pytest
Ideas for the future
- Combine multiple Stimuli Profiles to do a simulation for a whole day
- Algorithm to determine if simulation can end?
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file verfishd-0.2.3.tar.gz.
File metadata
- Download URL: verfishd-0.2.3.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae6731bd0a6014c587b7fded2912951032fad6c4f737f2a490bb112c408f8991
|
|
| MD5 |
42f1c8f2ed25fbf886d866959490bd14
|
|
| BLAKE2b-256 |
0a734ece1dcf58fc32b329c3c964dd1fb1c6663085863543d4343a8b6a38bab1
|
Provenance
The following attestation bundles were made for verfishd-0.2.3.tar.gz:
Publisher:
publish.yml on marine-data-science/verfishd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
verfishd-0.2.3.tar.gz -
Subject digest:
ae6731bd0a6014c587b7fded2912951032fad6c4f737f2a490bb112c408f8991 - Sigstore transparency entry: 249312799
- Sigstore integration time:
-
Permalink:
marine-data-science/verfishd@ff2395ca302f4c10f675252a9a70673d9cb98b8d -
Branch / Tag:
refs/tags/0.2.3 - Owner: https://github.com/marine-data-science
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ff2395ca302f4c10f675252a9a70673d9cb98b8d -
Trigger Event:
release
-
Statement type:
File details
Details for the file verfishd-0.2.3-py3-none-any.whl.
File metadata
- Download URL: verfishd-0.2.3-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d4f6c3b7afc3bbf272194728347d48301628a3d04de60e066de2347dde07faa
|
|
| MD5 |
5e6937decb95f467a65f276657f07597
|
|
| BLAKE2b-256 |
c6da8c7ceeae76cb697609c1f77cf0c23b53f52b54fe9ba74a9d9a9b65db7f4a
|
Provenance
The following attestation bundles were made for verfishd-0.2.3-py3-none-any.whl:
Publisher:
publish.yml on marine-data-science/verfishd
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
verfishd-0.2.3-py3-none-any.whl -
Subject digest:
0d4f6c3b7afc3bbf272194728347d48301628a3d04de60e066de2347dde07faa - Sigstore transparency entry: 249312804
- Sigstore integration time:
-
Permalink:
marine-data-science/verfishd@ff2395ca302f4c10f675252a9a70673d9cb98b8d -
Branch / Tag:
refs/tags/0.2.3 - Owner: https://github.com/marine-data-science
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ff2395ca302f4c10f675252a9a70673d9cb98b8d -
Trigger Event:
release
-
Statement type: