kbasic 0.1.6__tar.gz → 0.1.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: kbasic
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: Keyan's basic utility functions.
5
5
  Requires-Dist: numpy>=2.4.2
6
6
  Requires-Dist: pylatexenc>=2.10
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "kbasic"
3
- version = "0.1.6"
3
+ version = "0.1.7"
4
4
  description = "Keyan's basic utility functions."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -56,7 +56,8 @@ def nan_clip(*args):
56
56
  return nanless_args
57
57
  def interpolate2d(
58
58
  data, factor: int,
59
- method: str = 'linear'
59
+ method: str = 'linear',
60
+ periodic: bool = True
60
61
  ) -> ndarray:
61
62
  """interpolate 2d data on a regular grid by an even factor
62
63
 
@@ -68,8 +69,16 @@ def interpolate2d(
68
69
  Returns:
69
70
  ndarray[ndarray]: an interpolated grid of data
70
71
  """
72
+ assert periodic, "non-periodic version not implemented yet! make one but be careful because the shapes will be awkward"
71
73
  Nx, Ny = array(data).shape
72
- return RegularGridInterpolator((arange(Nx), arange(Ny)), data, method=method)(mgrid[:Nx+1/factor:1/factor, :Ny+1/factor:1/factor].T).T
74
+ grid = (arange(Nx+1), arange(Ny+1))
75
+ data_repeat = np.zeros((Nx+1, Ny+1))
76
+ data_repeat[:Nx, :Ny] = data
77
+ data_repeat[-1,:-1] = data[0]
78
+ data_repeat[:-1,-1] = data[:,0]
79
+ data_repeat[-1,-1] = data[-1,-1]
80
+ new_grid = mgrid[:Nx:1/factor, :Ny:1/factor].T
81
+ return RegularGridInterpolator(grid, data_repeat, method=method)(new_grid).T
73
82
 
74
83
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
75
84
  # >-|===|> Decorators <|===|-<
@@ -59,6 +59,19 @@ qs = anvil_queue
59
59
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
60
60
  # >-|===|> Classes <|===|-<
61
61
  # !==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==!==
62
+ class Color:
63
+ HEADER = '\033[95m'
64
+ OKBLUE = '\033[94m'
65
+ OKCYAN = '\033[96m'
66
+ OKGREEN = '\033[92m'
67
+ WARNING = '\033[93m'
68
+ FAIL = '\033[91m'
69
+ ENDC = '\033[0m'
70
+ BOLD = '\033[1m'
71
+ UNDERLINE = '\033[4m'
72
+ def warn(self, text: str):
73
+ print(self.WARNING + text + self.ENC)
74
+
62
75
  class AnvilJob:
63
76
  def __init__(self, queue_row: str, sep="DISTINCTSEPERATOR"):
64
77
  self.sep = sep
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes