Skip to content

Commit

Permalink
access table by device name and not dof name
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Morris committed Oct 28, 2023
1 parent f0bc991 commit fca00f0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bloptools/bayesian/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def tell(self, new_table=None, append=True, train=True, **kwargs):
if self.initialized:
cached_hypers = self.hypers

inputs = self.table.loc[:, self.dofs.subset(active=True).names].values.astype(float)
inputs = self.table.loc[:, self.dofs.subset(active=True).device_names].values.astype(float)

for i, obj in enumerate(self.objectives):
self.table.loc[:, f"{obj.key}_fitness"] = targets = self._get_objective_targets(i)
Expand Down Expand Up @@ -297,7 +297,7 @@ def acquire(self, acquisition_inputs):
if not self.allow_acquisition_errors:
raise error
logging.warning(f"Error in acquisition/digestion: {repr(error)}")
products = pd.DataFrame(acquisition_inputs, columns=self.dofs.subset(active=True, read_only=False).names)
products = pd.DataFrame(acquisition_inputs, columns=self.dofs.subset(active=True, read_only=False).device_names)
for obj in self.objectives:
products.loc[:, obj.key] = np.nan

Expand Down Expand Up @@ -615,14 +615,16 @@ def active_inputs(self):

@property
def acquisition_inputs(self):
return self.table.loc[:, self.dofs.subset(active=True, read_only=False).names].astype(float)
return self.table.loc[:, self.dofs.subset(active=True, read_only=False).device_names].astype(float)

@property
def best_inputs(self):
"""
Returns a value for each currently active and non-read-only degree of freedom
"""
return self.table.loc[np.nanargmax(self.scalarized_objectives), self.dofs.subset(active=True, read_only=False).names]
return self.table.loc[
np.nanargmax(self.scalarized_objectives), self.dofs.subset(active=True, read_only=False).device_names
]

def go_to(self, positions):
args = []
Expand Down

0 comments on commit fca00f0

Please sign in to comment.