Environment
- class env_wrapper.chickai_env_wrapper.ChickAIEnvWrapper(run_id: str, env_path=None, base_port=5004, **kwargs)[source]
Wrapper class for the ChickAI environment.
- Parameters:
run_id (str) – The ID of the current run.
env_path (str) – The path to the Unity environment executable.
base_port (int) – The base port number for the Unity environment.
**kwargs – Additional keyword arguments.
- env
The wrapped Unity environment.
- Type:
UnityToGymWrapper
- mode
The mode of the environment.
- Type:
str
- log(msg: str) None[source]
Write a message to the log file.
- Parameters:
msg (str) – The message to write.
- Returns:
None
- reset(seed: int | None = None, **kwargs)[source]
Reset the environment.
- Parameters:
seed (int) – The random seed for the environment.
**kwargs – Additional keyword arguments.
- Returns:
The initial state of the environment.
- class env_wrapper.parsing_env_wrapper.ParsingEnv(run_id: str, env_path=None, base_port=5004, **kwargs)[source]
A class representing the Parsing Environment.
- numb_conditions
The number of test conditions in the environment.
- Type:
int
- __init__(self, run_id
str, env_path=None, base_port=5004, **kwargs): Initializes the ParsingEnv object.
- class env_wrapper.dvs_wrapper.DVSWrapper(env, change_threshold=60, kernel_size=(3, 3), sigma=1)[source]
A gym observation wrapper that performs Dynamic Vision Sensor (DVS) transformation on the environment observations.
- Parameters:
env (gym.Env) – The environment to wrap.
change_threshold (int) – The threshold value for detecting changes in pixel intensity.
kernel_size (tuple) – The size of the Gaussian kernel used for blurring.
sigma (float) – The standard deviation of the Gaussian kernel.
- change_threshold
The threshold value for detecting changes in pixel intensity.
- Type:
int
- kernel_size
The size of the Gaussian kernel used for blurring.
- Type:
tuple
- sigma
The standard deviation of the Gaussian kernel.
- Type:
float
- num_stack
The number of frames to stack.
- Type:
int
- env
The wrapped environment.
- Type:
gym.Env
- stack
A deque to store the stacked frames.
- Type:
collections.deque
- shape
The shape of the observation space.
- Type:
tuple
- observation_space
The modified observation space.
- Type:
gym.spaces.Box
- gaussianDiff(previous, current)[source]
Computes the difference between two images using Gaussian blur.
- create_grayscale(image)[source]
Converts an image to grayscale.
- Parameters:
image (numpy.ndarray) – The input image.
- Returns:
The grayscale image.
- Return type:
numpy.ndarray
- gaussianDiff(previous, current)[source]
Computes the difference between two images using Gaussian blur.
- Parameters:
previous (numpy.ndarray) – The previous image.
current (numpy.ndarray) – The current image.
- Returns:
The difference map.
- Return type:
numpy.ndarray
- observation(obs)[source]
Performs the DVS transformation on the observation.
- Parameters:
obs (list) – The list of stacked frames.
- Returns:
The transformed observation.
- Return type:
numpy.ndarray