Skip to content

Commit

Permalink
Fixes file formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jackbdoughty committed Dec 4, 2024
1 parent 3323b32 commit 152a5dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions manual_system_tests/dae_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def _inner() -> Generator[Msg, None, None]:
yield from bps.mv(dae.number_of_periods, NUM_POINTS) # type: ignore
# Pyright does not understand as bluesky isn't typed yet
yield from bp.scan([dae], block, 0, 10, num=NUM_POINTS)
print(lf.result.fit_report())

yield from _inner()

Expand Down
13 changes: 6 additions & 7 deletions src/ibex_bluesky_core/callbacks/fitting/livefit_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import csv
import logging
import os
from pathlib import Path
from typing import Optional

Expand Down Expand Up @@ -108,27 +109,25 @@ def stop(self, doc: RunStop) -> None:
kwargs.update(self.livefit.result.values)
self.y_fit_data = self.livefit.result.model.eval(**kwargs)

self.stats = str(self.livefit.result.fit_report())
self.stats = self.stats.replace('"', "").split("\n")
self.stats = self.livefit.result.fit_report().split("\n")

# Writing to csv file
with open(self.filename, "w", newline="", encoding="utf-8") as csvfile:
# Writing the data
self.csvwriter = csv.writer(csvfile)

for row in self.stats:
self.csvwriter.writerow([row])
csvfile.write(row + os.linesep)

self.csvwriter.writerow([]) # Space out file
self.csvwriter.writerow([])
csvfile.write(os.linesep) # Space out file
csvfile.write(os.linesep)

if self.yerr is None:
self.write_fields_table()
else:
self.write_fields_table_uncertainty()

logging.basicConfig(format="%(message)s", level=logging.INFO)
logger.info("Fitting information successfully written to: %s", self.filename.name)
logger.info("Fitting information successfully written to: %s", self.filename.resolve())

def write_fields_table(self) -> None:
"""Write collected run info to the fitting file."""
Expand Down

0 comments on commit 152a5dd

Please sign in to comment.