wolfhece 2.1.126__py3-none-any.whl → 2.1.128__py3-none-any.whl

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.
wolfhece/PyPalette.py CHANGED
@@ -109,6 +109,34 @@ class wolfpalette(wx.Frame, LinearSegmentedColormap):
109
109
  else:
110
110
  return self(xloc, bytes=True)
111
111
 
112
+ def get_rgba_oneval(self, x: float):
113
+ """Récupération de la couleur en fonction de la valeur x"""
114
+
115
+ dval = self.values[-1]-self.values[0]
116
+ if dval == 0.:
117
+ dval = 1.
118
+ xloc = (x-self.values[0])/dval
119
+
120
+ if self.interval_cst:
121
+ rgba = np.ones((4), dtype=np.uint8)
122
+
123
+ if xloc < 0.:
124
+ rgba = self.colormin_uint8
125
+ elif xloc >= 1.:
126
+ rgba = self.colormax_uint8
127
+ else:
128
+ for i in range(self.nb-1):
129
+ val1 = (self.values[i]-self.values[0])/dval
130
+ val2 = (self.values[i+1]-self.values[0])/dval
131
+ if (xloc >= val1) & (xloc < val2):
132
+ c1 = self.colorsuint8[i]
133
+ rgba = c1
134
+ break
135
+
136
+ return rgba
137
+ else:
138
+ return self(xloc, bytes=True)
139
+
112
140
  def export_palette_matplotlib(self, name):
113
141
  cmaps = OrderedDict()
114
142
  cmaps['Perceptually Uniform Sequential'] = ['viridis', 'plasma', 'inferno', 'magma', 'cividis']
@@ -213,6 +241,14 @@ class wolfpalette(wx.Frame, LinearSegmentedColormap):
213
241
 
214
242
  self.fill_segmentdata()
215
243
 
244
+ def get_ScalarMappable_mpl(self):
245
+ """ Récupération de l'objet ScalarMappable via Matplotlib """
246
+ if self.interval_cst:
247
+ discrete_cmap = ListedColormap(self.colorsflt[:, :3])
248
+ colorbar = ScalarMappable(BoundaryNorm(self.values, ncolors=self.nb-1), cmap=discrete_cmap)
249
+ else:
250
+ return ScalarMappable(Normalize(self.values[0], self.values[-1]), cmap=self)
251
+
216
252
  def export_image(self, fn='', h_or_v: typing.Literal['h', 'v', ''] = '', figax=None):
217
253
  """
218
254
  Export image from colormap
wolfhece/PyParams.py CHANGED
@@ -753,7 +753,7 @@ class Wolf_Param(wx.Frame):
753
753
  def SavetoFile(self, event:wx.MouseEvent):
754
754
  """ sauvegarde dans le fichier texte """
755
755
 
756
- self.save()
756
+ self.Save()
757
757
 
758
758
  def Save(self, filename:str = ''):
759
759
  """ Save the parameters in a file """
@@ -1308,7 +1308,7 @@ class Wolf_Param(wx.Frame):
1308
1308
  posSep2 = positions[-1] #nameStr[posSep1+1:].find("$")
1309
1309
 
1310
1310
  # select the string between the two '$'
1311
- iterCode = nameStr[posSep1:posSep1+posSep2+1]
1311
+ iterCode = nameStr[posSep1:posSep2+1]
1312
1312
 
1313
1313
  positions_left = [i for i, char in enumerate(iterCode) if char == "("]
1314
1314
  positions_right = [i for i, char in enumerate(iterCode) if char == ")"]