Skip to content

Commit

Permalink
fix: no None in docs, variable ref
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillip Maffettone committed Apr 11, 2024
1 parent 0253cf5 commit 4044916
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions containers/mmm5-tax-day-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ services:
- BS_AGENT_STARTUP_SCRIPT_PATH=/src/pdf-agents/pdf_agents/startup_scripts/mmm5-tax-day/gsas.py
volumes:
- type: bind
source: ../pdf_agents
target: /src/pdf-agents/pdf_agents
source: ../
target: /src/pdf-agents/
read_only: true
- type: bind
source: /etc/bluesky/kafka.yml
Expand Down Expand Up @@ -53,8 +53,8 @@ services:
- BS_AGENT_STARTUP_SCRIPT_PATH=/src/pdf-agents/pdf_agents/startup_scripts/mmm5-tax-day/kmeans-gsas.py
volumes:
- type: bind
source: ../pdf_agents
target: /src/pdf-agents/pdf_agents
source: ../
target: /src/pdf-agents/
read_only: true
- type: bind
source: /etc/bluesky/kafka.yml
Expand Down
4 changes: 3 additions & 1 deletion pdf_agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def unpack_run(self, run) -> Tuple[Union[float, ArrayLike], Union[float, ArrayLi
if self.background is not None:
y = y - self.background[1]

ordinate = np.array(run.primary.data[self.roi_key]).flatten()
if self.norm_region is not None:
ordinate = np.array(run.primary.data[self.roi_key]).flatten()
idx_min = (
np.where(ordinate < self.norm_region[0])[0][-1]
if len(np.where(ordinate < self.norm_region[0])[0])
Expand Down Expand Up @@ -132,6 +132,8 @@ def unpack_run(self, run) -> Tuple[Union[float, ArrayLike], Union[float, ArrayLi
ordinate = np.array(run.primary.data[self.roi_key]).flatten()
idx_min = np.where(ordinate < self.roi[0])[0][-1] if len(np.where(ordinate < self.roi[0])[0]) else None
idx_max = np.where(ordinate > self.roi[1])[0][-1] if len(np.where(ordinate > self.roi[1])[0]) else None
else:
idx_min, idx_max = None, None

y = y[idx_min:idx_max]
self._ordinate = ordinate[idx_min:idx_max] # Update self oridnate. Should be constant unless roi changes.
Expand Down
6 changes: 3 additions & 3 deletions pdf_agents/gsas.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ def report(self) -> Dict[str, ArrayLike]:

return dict(
data_key=self.data_key,
roi_key=self.roi,
roi=self.roi,
norm_region=self.norm_region,
roi_key=self.roi_key if self.roi_key is not None else "",
roi=self.roi if self.roi is not None else "",
norm_region=self.norm_region if self.norm_region is not None else "",
observable_uid=self._recent_uid,
independent_variable=self._recent_x,
observable=self._recent_y,
Expand Down

0 comments on commit 4044916

Please sign in to comment.