chemistrylab.lab
chemistrylab.lab.lab
- class chemistrylab.lab.lab.Lab(render_mode: Optional[str] = None, max_num_vessels: int = 100)[source]
Bases:
Env,ABCThe lab class is meant to be a gym environment so that an agent can figure out how to synthesize different chemicals
- action_space: spaces.Space[ActType]
- load_distillation_bench(index)[source]
this function returns the distillation environment that the agent has selected
- Parameters:
index (the index of the agent to be run) –
- Return type:
the gym environment that has been loaded
- load_extraction_bench(index)[source]
this function returns the extraction environment that the agent has selected
- Parameters:
index (the index of the agent to be run) –
- Return type:
the gym environment that has been loaded
- load_reaction_bench(index: int)[source]
this function returns the reaction environment that the agent has selected
- Parameters:
index (the index of the agent to be run) –
- Return type:
the gym environment that has been loaded
- observation_space: spaces.Space[ObsType]
- register_agent(bench: str, name: str, agent: object)[source]
a function that registers an agent for a specified bench
- Parameters:
bench (the bench for which the agent will be registered) –
name (the name of the agent to be registered) –
agent (the agent itself derived from the agent class) –
- Return type:
None
- reset()[source]
this function resets the shelf and gets rid of all the currently stored vessels :rtype: None
- run_bench(bench, env_index, vessel_index, agent_index=0, custom_agent=None)[source]
this function works as a wrapper for the lab environment and allows for an agent to specify what environment they wish to run and with what vessel and agent
- Parameters:
bench –
env_index –
vessel_index –
agent_index –
custom_agent –
- step(action: list)[source]
This function takes in an agents command and deconstructs the command and runs the appropriate environment with the specified bench, environment, vessel, and agent :param action: :type action: [list, np.array]: this parameter specifies the action the agent takes :param action: :type action: [bench_id, environment_id, vessel_id, agent_id]
- Return type:
None
chemistrylab.lab.manager
- class chemistrylab.lab.manager.Manager(mode='custom', agent=None)[source]
Bases:
object- create_new_vessel()[source]
Method to create a new vessel and place the new vessel on the shelf.
- Parameters:
None –
- Return type:
None
- Raises:
None –
- list_vessels()[source]
Method to list all the vessels available on the shelf and their contents.
- Parameters:
None –
- Return type:
None
- Raises:
None –
- load_bench(bench, env_index, vessel_index, agent)[source]
Method to load the specified bench based on the environment, vessel, and agent parameters.
- Parameters:
bench (str) – The name of the bench that is to be loaded.
env_index (np.int64) – The index corresponding to the requested bench environment that is to be set up.
vessel_index (np.int64) – The index corresponding to the requested vessel that is to be set up.
agent (np.int64) – The index corresponding to the requested agent that is to be set up.
- Return type:
None
- Raises:
None –
- load_vessel(path)[source]
Method to load a vessel from a specified path.
- Parameters:
path (str) – The directory path to a valid pickle file containing a vessel object.
- Return type:
None
- Raises:
IOError – Raised if the specified file path does not correspond to a valid vessel pickle file.
- register_agent(name: str, agent: object)[source]
Allows the user to add a lab agent to the manager environment. Added lab agents can then use to perform actions in the lab environment.
- Parameters:
name (str) – The name of the agent to be registered.
agent (agent.Agent) – The class representation of the agent to be registered.
- Return type:
None
- Raises:
None –
- register_bench_agent(bench: str, name: str, agent: object)[source]
Method to allow the user to add bench-specific agents to the lab environment. Added bench agents can then be used in order to perform actions in a bench
- Parameters:
bench (str) – The name of the bench to which the agent is being assigned.
name (str) – The name of the agent to be registered.
agent (agent.Agent) – The class representation of the agent to be registered.
- Return type:
None
- Raises:
None –
chemistrylab.lab.shelf
- class chemistrylab.lab.shelf.Shelf(vessels, n_working=1)[source]
Bases:
objectThe shelf class holds vessels from experiments.
pop, __getitem__, __delitem__, and append are implemented so shelves can be used similar to a list of vessels
- get_working_vessels()[source]
Returns a tuple of the ‘working’ vessels used for observations and rewards.