Skip to content

Commit

Permalink
tests are failing
Browse files Browse the repository at this point in the history
  • Loading branch information
dilawar committed Jul 30, 2024
1 parent 380fb0c commit 82702f0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Binary file modified figures/ECGImage.result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified figures/graphs_1.result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions plotdigitizer/plotdigitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing_extensions import Annotated

from plotdigitizer import image
from plotdigitizer import plot
from plotdigitizer.plot import plot_traj

# Logger
from loguru import logger
Expand Down Expand Up @@ -40,9 +40,9 @@ def digitize_plot(
" If not given, you will be asked to click on the figure.",
),
] = [],
plot_file: Annotated[
plot: Annotated[
T.Optional[Path],
typer.Option("--plot-file", help="Plot the final result. Requires matplotlib"),
typer.Option("--plot", help="Plot the final result. Requires matplotlib"),
] = None,
output: Annotated[
T.Optional[Path],
Expand Down Expand Up @@ -89,8 +89,8 @@ def digitize_plot(
# compute trajectories
traj = figure.trajectories()

if plot_file is not None:
plot.plot_traj(traj, figure._last(), plot_file)
if plot is not None:
plot_traj(traj, figure._last(), plot)

outfile = output or f"{infile}.traj.csv"
with open(outfile, "w") as f:
Expand Down
5 changes: 3 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
HERE = Path(__file__).parent.resolve()


def _run_cmdline(infile: Path, points, locations):
def _run_cmdline(infile: Path, points, locations, extra: str = ""):
cmd = f"plotdigitizer {str(infile)} "
pts = " ".join([f"-p {','.join(map(str,pt))}" for pt in points])
locs = " ".join([f"-l {','.join(map(str,pt))}" for pt in locations])
cmd += f"{pts} {locs}"
outfile = infile.with_suffix(".result.png")
trajfile = infile.with_suffix(".result.csv")
cmd += f" --plot {str(outfile)} --output {trajfile}"
cmd += f" --plot {str(outfile)} --output {trajfile} {extra}"
r = subprocess.run(cmd, check=True, shell=True)
assert r.returncode == 0, f"Failed test {r.returncode}"
return trajfile
Expand Down Expand Up @@ -61,5 +61,6 @@ def test_grid():
HERE / ".." / "figures" / "graph_with_grid.png",
[(200, 0), (1000, 0), (0, 50)],
[(269, 69), (1780, 69), (81, 542)],
"--remove-grid"
)
_check_csv_file(csvfile)

0 comments on commit 82702f0

Please sign in to comment.