Skip to content

Commit

Permalink
- moved nimpy import to skip it if not compiling Python library
Browse files Browse the repository at this point in the history
  • Loading branch information
amkrajewski committed Jan 26, 2024
1 parent 785cffa commit 2d6ccab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 2 additions & 3 deletions nimplex.nim
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ when appType != "lib":
import arraymancer/Tensor
import arraymancer/io

import nimpy

when defined(nimdoc):
import utils/plotting

Expand Down Expand Up @@ -246,7 +244,8 @@ proc attainable2elemental*(simplexPoints: Tensor[float],
# PYTHON BINDINGS
when not defined(nimdoc):
# Direct translation of the Nim API to Python using Nimpy

import nimpy

proc simplex_grid_py*(dim: int, ndiv: int): seq[seq[int]] {.exportpy.} =
simplex_grid(dim, ndiv).toSeq2D()

Expand Down
3 changes: 2 additions & 1 deletion utils/plotting.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import arraymancer/Tensor
import nimpy

## This submodule contains utility functions related to plotting of the compositional data.

Expand Down Expand Up @@ -40,5 +39,7 @@ proc simplex2cartesian*(simplexPoints: Tensor[float]): Tensor[float] =

# PYTHON BINDINGS
when not defined(nimdoc):
import nimpy

proc cartesian2simplex_py*(simplexPoints: seq[seq[float]]): seq[seq[float]] {.exportpy.} =
return simplex2cartesian(simplexPoints.toTensor()).toSeq2D()

0 comments on commit 2d6ccab

Please sign in to comment.