wolfhece 2.1.36__py3-none-any.whl → 2.1.39__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.
Files changed (41) hide show
  1. wolfhece/PyPalette.py +282 -268
  2. wolfhece/apps/splashscreen.py +8 -8
  3. wolfhece/apps/version.py +1 -1
  4. wolfhece/libs/wolfogl.cp310-win_amd64.pyd +0 -0
  5. wolfhece/pyviews.py +10 -6
  6. wolfhece/wolf_array.py +47 -28
  7. wolfhece/wolfresults_2D.py +19 -19
  8. {wolfhece-2.1.36.dist-info → wolfhece-2.1.39.dist-info}/METADATA +2 -1
  9. {wolfhece-2.1.36.dist-info → wolfhece-2.1.39.dist-info}/RECORD +12 -41
  10. wolfhece/libs/MSVCP140.dll +0 -0
  11. wolfhece/libs/WolfDll.dll +0 -0
  12. wolfhece/libs/api-ms-win-crt-heap-l1-1-0.dll +0 -0
  13. wolfhece/libs/api-ms-win-crt-math-l1-1-0.dll +0 -0
  14. wolfhece/libs/api-ms-win-crt-runtime-l1-1-0.dll +0 -0
  15. wolfhece/libs/fribidi-0.dll +0 -0
  16. wolfhece/libs/glu32.dll +0 -0
  17. wolfhece/libs/hdf5.dll +0 -0
  18. wolfhece/libs/hdf5_hl.dll +0 -0
  19. wolfhece/libs/libcurl.dll +0 -0
  20. wolfhece/libs/libifcoremd.dll +0 -0
  21. wolfhece/libs/libifcoremdd.dll +0 -0
  22. wolfhece/libs/libifportmd.dll +0 -0
  23. wolfhece/libs/libiomp5md.dll +0 -0
  24. wolfhece/libs/libmmd.dll +0 -0
  25. wolfhece/libs/libmmdd.dll +0 -0
  26. wolfhece/libs/libpardiso600-WIN-X86-64.dll +0 -0
  27. wolfhece/libs/libraqm.dll +0 -0
  28. wolfhece/libs/mkl_core.2.dll +0 -0
  29. wolfhece/libs/mkl_intel_thread.2.dll +0 -0
  30. wolfhece/libs/mkl_rt.2.dll +0 -0
  31. wolfhece/libs/msvcr100.dll +0 -0
  32. wolfhece/libs/netcdf.dll +0 -0
  33. wolfhece/libs/paho-mqtt3cs.dll +0 -0
  34. wolfhece/libs/svml_dispmd.dll +0 -0
  35. wolfhece/libs/vcomp100.dll +0 -0
  36. wolfhece/libs/vcruntime140.dll +0 -0
  37. wolfhece/libs/vcruntime140_1.dll +0 -0
  38. wolfhece/libs/zlib1.dll +0 -0
  39. {wolfhece-2.1.36.dist-info → wolfhece-2.1.39.dist-info}/WHEEL +0 -0
  40. {wolfhece-2.1.36.dist-info → wolfhece-2.1.39.dist-info}/entry_points.txt +0 -0
  41. {wolfhece-2.1.36.dist-info → wolfhece-2.1.39.dist-info}/top_level.txt +0 -0
wolfhece/PyPalette.py CHANGED
@@ -16,7 +16,7 @@ import numpy as np
16
16
  import numpy.ma as ma
17
17
  from bisect import bisect_left
18
18
  import matplotlib.pyplot as plt
19
- from matplotlib.colors import LinearSegmentedColormap,Normalize
19
+ from matplotlib.colors import LinearSegmentedColormap, Normalize
20
20
  from collections import OrderedDict
21
21
  import typing
22
22
  import io
@@ -26,53 +26,54 @@ from .PyTranslate import _
26
26
  from .CpGrid import CpGrid
27
27
  from .PyVertex import getRGBfromI, getIfromRGB
28
28
 
29
- class wolfpalette(wx.Frame,LinearSegmentedColormap):
29
+
30
+ class wolfpalette(wx.Frame, LinearSegmentedColormap):
30
31
  """
31
32
  Palette de couleurs basée sur l'objet "LinearSegmentedColormap" de Matplotlib (Colormap objects based on lookup tables using linear segments)
32
33
  """
33
- filename:str
34
- nb:int
35
- colors:np.array
36
- colorsflt:np.array
37
- colorsuint8:np.array
34
+ filename: str
35
+ nb: int
36
+ colors: np.array
37
+ colorsflt: np.array
38
+ colorsuint8: np.array
38
39
 
39
- def __init__(self, parent=None, title=_('Colormap'),w=100,h=500,nseg=1024):
40
+ def __init__(self, parent=None, title=_('Colormap'), w=100, h=500, nseg=1024):
40
41
 
41
- self.filename=''
42
+ self.filename = ''
42
43
  self.nb = 0
43
44
  self.values = None
44
- self.colormin = np.array([1.,1.,1.,1.])
45
- self.colormax = np.array([0,0,0,1.])
46
- self.nseg=nseg
45
+ self.colormin = np.array([1., 1., 1., 1.])
46
+ self.colormax = np.array([0, 0, 0, 1.])
47
+ self.nseg = nseg
47
48
  self.automatic = True
48
49
  self.interval_cst = False
49
50
 
50
51
  self.wx_exists = wx.App.Get() is not None
51
52
 
52
- #Appel à l'initialisation d'un frame général
53
- if(self.wx_exists):
54
- wx.Frame.__init__(self, parent, title=title, size=(w,h),style=wx.DEFAULT_FRAME_STYLE)
53
+ # Appel à l'initialisation d'un frame général
54
+ if (self.wx_exists):
55
+ wx.Frame.__init__(self, parent, title=title, size=(w, h), style=wx.DEFAULT_FRAME_STYLE)
55
56
 
56
- LinearSegmentedColormap.__init__(self,'wolf',{},nseg)
57
+ LinearSegmentedColormap.__init__(self, 'wolf', {}, nseg)
57
58
  self.set_bounds()
58
59
 
59
60
  @property
60
61
  def colormin_uint8(self):
61
62
  return self.colormin.astype(np.uint8)*255
62
-
63
+
63
64
  @property
64
65
  def colormax_uint8(self):
65
66
  return self.colormax.astype(np.uint8)*255
66
67
 
67
68
  def get_colors_f32(self):
68
69
 
69
- colors = self.colorsflt[:,:3].astype(np.float32)
70
+ colors = self.colorsflt[:, :3].astype(np.float32)
70
71
 
71
72
  return colors
72
-
73
+
73
74
  def get_colors_uint8(self):
74
-
75
- colors = self.colorsflt[:,:3].astype(np.uint8) * 255
75
+
76
+ colors = self.colorsflt[:, :3].astype(np.uint8) * 255
76
77
 
77
78
  return colors
78
79
 
@@ -80,66 +81,71 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
80
81
  self.set_under(tuple(self.colormin))
81
82
  self.set_over(tuple(self.colormax))
82
83
 
83
- def get_rgba(self, x:np.ndarray):
84
+ def get_rgba(self, x: np.ndarray):
84
85
  """Récupération de la couleur en fonction de la valeur x"""
85
86
 
86
- dval=self.values[-1]-self.values[0]
87
- if dval==0.:
88
- dval=1.
87
+ dval = self.values[-1]-self.values[0]
88
+ if dval == 0.:
89
+ dval = 1.
89
90
  xloc = (x-self.values[0])/dval
90
91
 
91
92
  if self.interval_cst:
92
- rgba = np.ones((xloc.shape[0],xloc.shape[1],4), dtype=np.uint8)
93
+ rgba = np.ones((xloc.shape[0], xloc.shape[1], 4), dtype=np.uint8)
93
94
 
94
- ij = np.where(xloc<0.)
95
- rgba[ij[0],ij[1]] = self.colormin_uint8
96
- ij = np.where(xloc>=1.)
97
- rgba[ij[0],ij[1]] = self.colormax_uint8
95
+ ij = np.where(xloc < 0.)
96
+ rgba[ij[0], ij[1]] = self.colormin_uint8
97
+ ij = np.where(xloc >= 1.)
98
+ rgba[ij[0], ij[1]] = self.colormax_uint8
98
99
 
99
100
  for i in range(self.nb-1):
100
101
  val1 = (self.values[i]-self.values[0])/dval
101
102
  val2 = (self.values[i+1]-self.values[0])/dval
102
103
  # c1 = self.colorsflt[i]
103
- c1 = self.colorsuint8[i]
104
- ij = np.where((xloc>=val1) & (xloc<val2))
105
- rgba[ij[0],ij[1]] = c1
104
+ c1 = self.colorsuint8[i]
105
+ ij = np.where((xloc >= val1) & (xloc < val2))
106
+ rgba[ij[0], ij[1]] = c1
106
107
 
107
108
  return rgba
108
109
  else:
109
110
  return self(xloc, bytes=True)
110
111
 
111
- def export_palette_matplotlib(self,name):
112
+ def export_palette_matplotlib(self, name):
112
113
  cmaps = OrderedDict()
113
114
  cmaps['Perceptually Uniform Sequential'] = ['viridis', 'plasma', 'inferno', 'magma', 'cividis']
114
115
 
115
- cmaps['Sequential'] = ['Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds','YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu','GnBu', 'PuBu', 'YlGnBu','PuBuGn', 'BuGn', 'YlGn']
116
- cmaps['Sequential (2)'] = ['binary', 'gist_yarg', 'gist_gray', 'gray', 'bone', 'pink','spring', 'summer', 'autumn', 'winter', 'cool', 'Wistia','hot', 'afmhot', 'gist_heat', 'copper']
117
- cmaps['Diverging'] = ['PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu','RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']
116
+ cmaps['Sequential'] = ['Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds', 'YlOrBr',
117
+ 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu', 'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn']
118
+ cmaps['Sequential (2)'] = ['binary', 'gist_yarg', 'gist_gray', 'gray', 'bone', 'pink', 'spring',
119
+ 'summer', 'autumn', 'winter', 'cool', 'Wistia', 'hot', 'afmhot', 'gist_heat', 'copper']
120
+ cmaps['Diverging'] = ['PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu',
121
+ 'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']
118
122
  cmaps['Cyclic'] = ['twilight', 'twilight_shifted', 'hsv']
119
- cmaps['Qualitative'] = ['Pastel1', 'Pastel2', 'Paired', 'Accent','Dark2', 'Set1', 'Set2', 'Set3','tab10', 'tab20', 'tab20b', 'tab20c']
120
- cmaps['Miscellaneous'] = ['flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern','gnuplot', 'gnuplot2', 'CMRmap', 'cubehelix', 'brg','gist_rainbow', 'rainbow', 'jet', 'nipy_spectral', 'gist_ncar']
123
+ cmaps['Qualitative'] = ['Pastel1', 'Pastel2', 'Paired', 'Accent',
124
+ 'Dark2', 'Set1', 'Set2', 'Set3', 'tab10', 'tab20', 'tab20b', 'tab20c']
125
+ cmaps['Miscellaneous'] = ['flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern', 'gnuplot',
126
+ 'gnuplot2', 'CMRmap', 'cubehelix', 'brg', 'gist_rainbow', 'rainbow', 'jet', 'nipy_spectral', 'gist_ncar']
121
127
 
122
128
  for cmap_category, cmap_list in cmaps.items():
123
- if(name in cmaps[cmap_category]):
124
- self=plt.get_cmap(name)
125
- self.nb=len(self._segmentdata['blue'])
126
- self.values = np.linspace(0.,1.,self.nb)
127
- self.colorsflt = np.zeros((self.nb,4) , dtype=float)
129
+ if (name in cmaps[cmap_category]):
130
+ self = plt.get_cmap(name)
131
+ self.nb = len(self._segmentdata['blue'])
132
+ self.values = np.linspace(0., 1., self.nb, dtype=np.float64)
133
+ self.colorsflt = np.zeros((self.nb, 4), dtype=np.float64)
128
134
  for i in range(self.nb):
129
- self.colorsflt[i,0]=self._segmentdata['red'][i][2]
130
- self.colorsflt[i,1]=self._segmentdata['green'][i][2]
131
- self.colorsflt[i,2]=self._segmentdata['blue'][i][2]
132
- self.colorsflt[i,3]=self._segmentdata['alpha'][i][2]
133
- test=1
135
+ self.colorsflt[i, 0] = self._segmentdata['red'][i][2]
136
+ self.colorsflt[i, 1] = self._segmentdata['green'][i][2]
137
+ self.colorsflt[i, 2] = self._segmentdata['blue'][i][2]
138
+ self.colorsflt[i, 3] = self._segmentdata['alpha'][i][2]
139
+ test = 1
134
140
  break
135
141
  else:
136
- test=1
142
+ test = 1
137
143
 
138
- return self.nb,self.values,self._segmentdata,self.colorsflt
144
+ return self.nb, self.values, self._segmentdata, self.colorsflt
145
+
146
+ def distribute_values(self, minval: float = -99999, maxval: float = -99999, step=0, wx_permitted=True):
147
+ """ Distribution des valeurs de la palette
139
148
 
140
- def distribute_values(self, minval:float=-99999, maxval:float=-99999, step=0, wx_permitted=True):
141
- """ Distribution des valeurs de la palette
142
-
143
149
  :param minval: valeur minimale
144
150
  :param maxval: valeur maximale
145
151
  :param step: pas de distribution
@@ -149,31 +155,32 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
149
155
  """
150
156
 
151
157
  if self.wx_exists and wx_permitted:
152
- if minval==-99999:
153
- dlg = wx.TextEntryDialog(None, _('Minimum value'), value = str(self.values[0]))
158
+ if minval == -99999:
159
+ dlg = wx.TextEntryDialog(None, _('Minimum value'), value=str(self.values[0]))
154
160
  ret = dlg.ShowModal()
155
161
  self.values[0] = dlg.GetValue()
156
162
  dlg.Destroy()
157
163
  else:
158
164
  self.values[0] = minval
159
165
 
160
- if maxval==-99999 and step==0:
166
+ if maxval == -99999 and step == 0:
161
167
 
162
- dlg = wx.MessageDialog(None, _('Would you like to set the incremental step value ?'),style= wx.YES_NO|wx.YES_DEFAULT)
168
+ dlg = wx.MessageDialog(None, _('Would you like to set the incremental step value ?'),
169
+ style=wx.YES_NO | wx.YES_DEFAULT)
163
170
  ret = dlg.ShowModal()
164
171
  dlg.Destroy
165
172
  if ret == wx.ID_YES:
166
- dlg = wx.TextEntryDialog(None, _('Step value'), value = '1')
173
+ dlg = wx.TextEntryDialog(None, _('Step value'), value='1')
167
174
  ret = dlg.ShowModal()
168
175
  step = float(dlg.GetValue())
169
176
  dlg.Destroy()
170
177
  else:
171
- dlg = wx.TextEntryDialog(None, _('Maximum value'), value = str(self.values[-1]))
178
+ dlg = wx.TextEntryDialog(None, _('Maximum value'), value=str(self.values[-1]))
172
179
  ret = dlg.ShowModal()
173
180
  self.values[-1] = float(dlg.GetValue())
174
181
  dlg.Destroy()
175
-
176
- elif maxval!=-99999:
182
+
183
+ elif maxval != -99999:
177
184
  self.values[-1] = maxval
178
185
  else:
179
186
  if minval != -99999:
@@ -181,34 +188,35 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
181
188
  if maxval != -99999:
182
189
  self.values[-1] = maxval
183
190
 
184
- if step==0:
185
- self.values = np.linspace(self.values[0], self.values[-1], num=self.nb, endpoint=True)[0:self.nb]
191
+ if step == 0:
192
+ self.values = np.linspace(self.values[0], self.values[-1], num=self.nb,
193
+ endpoint=True, dtype=np.float64)[0:self.nb]
186
194
  else:
187
- self.values = np.arange(self.values[0], self.values[0]+(self.nb)*step, step)[0:self.nb]
195
+ self.values = np.arange(self.values[0], self.values[0]+(self.nb)*step, step, dtype=np.float64)[0:self.nb]
188
196
 
189
197
  self.fill_segmentdata()
190
198
 
191
- def export_image(self,fn='',h_or_v:typing.Literal['h','v',''] ='', figax = None):
199
+ def export_image(self, fn='', h_or_v: typing.Literal['h', 'v', ''] = '', figax=None):
192
200
  """
193
201
  Export image from colormap
194
202
 
195
203
  :param : fn : filepath or io.BytesIO()
196
204
  :param : h_or_v : configuration to save 'h' = horizontal, 'v' = vertical, '' = both
197
205
  """
198
- if fn=='':
199
- file=wx.FileDialog(None,"Choose .pal file", wildcard="png (*.png)|*.png|all (*.*)|*.*",style=wx.FD_SAVE)
206
+ if fn == '':
207
+ file = wx.FileDialog(None, "Choose .pal file", wildcard="png (*.png)|*.png|all (*.*)|*.*", style=wx.FD_SAVE)
200
208
  if file.ShowModal() == wx.ID_CANCEL:
201
209
  return
202
210
  else:
203
- #récupération du nom de fichier avec chemin d'accès
204
- fn =file.GetPath()
211
+ # récupération du nom de fichier avec chemin d'accès
212
+ fn = file.GetPath()
205
213
 
206
- if h_or_v=='v':
214
+ if h_or_v == 'v':
207
215
  if figax is None:
208
- fig,ax=plt.subplots(1,1)
216
+ fig, ax = plt.subplots(1, 1)
209
217
  else:
210
- fig,ax = figax
211
- plt.colorbar(ScalarMappable(Normalize(self.values[0],self.values[-1]),cmap=self),
218
+ fig, ax = figax
219
+ plt.colorbar(ScalarMappable(Normalize(self.values[0], self.values[-1]), cmap=self),
212
220
  cax=ax,
213
221
  orientation='vertical',
214
222
  extend='both',
@@ -218,29 +226,29 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
218
226
  format='%.3f')
219
227
  plt.tick_params(labelsize=14)
220
228
  if figax is None:
221
- fig.set_size_inches((2,10))
229
+ fig.set_size_inches((2, 10))
222
230
  fig.tight_layout()
223
231
 
224
- if fn!='' and fn is not None:
232
+ if fn != '' and fn is not None:
225
233
  plt.savefig(fn, format='png')
226
234
  # plt.savefig(fn,bbox_inches='tight', format='png')
227
- elif h_or_v=='h':
235
+ elif h_or_v == 'h':
228
236
  if figax is None:
229
- fig,ax=plt.subplots(1,1)
237
+ fig, ax = plt.subplots(1, 1)
230
238
  else:
231
- fig,ax = figax
232
- plt.colorbar(ScalarMappable(Normalize(self.values[0],self.values[-1]),cmap=self),
239
+ fig, ax = figax
240
+ plt.colorbar(ScalarMappable(Normalize(self.values[0], self.values[-1]), cmap=self),
233
241
  cax=ax,
234
242
  orientation='horizontal',
235
243
  extend='both',
236
244
  spacing='proportional',
237
245
  ticks=self.values,
238
246
  format='%.3f')
239
- plt.tick_params(labelsize=14,rotation=45)
247
+ plt.tick_params(labelsize=14, rotation=45)
240
248
  if figax is None:
241
- fig.set_size_inches((2,10))
249
+ fig.set_size_inches((2, 10))
242
250
  fig.tight_layout()
243
- if fn!='' and fn is not None:
251
+ if fn != '' and fn is not None:
244
252
  plt.savefig(fn, format='png')
245
253
  # plt.savefig(fn,bbox_inches='tight', format='png')
246
254
  else:
@@ -249,10 +257,10 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
249
257
  return
250
258
 
251
259
  if figax is None:
252
- fig,ax=plt.subplots(1,1)
260
+ fig, ax = plt.subplots(1, 1)
253
261
  else:
254
- fig,ax = figax
255
- plt.colorbar(ScalarMappable(Normalize(self.values[0],self.values[-1]),cmap=self),
262
+ fig, ax = figax
263
+ plt.colorbar(ScalarMappable(Normalize(self.values[0], self.values[-1]), cmap=self),
256
264
  cax=ax,
257
265
  orientation='vertical',
258
266
  extend='both',
@@ -260,117 +268,117 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
260
268
  ticks=self.values,
261
269
  format='%.3f')
262
270
  plt.tick_params(labelsize=14)
263
- fig.set_size_inches((2,10))
271
+ fig.set_size_inches((2, 10))
264
272
  fig.tight_layout()
265
- if fn!='' and fn is not None:
273
+ if fn != '' and fn is not None:
266
274
  plt.savefig(fn[:-4]+'_v.png', format='png')
267
275
 
268
276
  if figax is None:
269
- fig,ax=plt.subplots(1,1)
277
+ fig, ax = plt.subplots(1, 1)
270
278
  else:
271
- fig,ax = figax
279
+ fig, ax = figax
272
280
 
273
- plt.colorbar(ScalarMappable(Normalize(self.values[0],self.values[-1]),cmap=self),
281
+ plt.colorbar(ScalarMappable(Normalize(self.values[0], self.values[-1]), cmap=self),
274
282
  cax=ax,
275
283
  orientation='horizontal',
276
284
  extend='both',
277
285
  spacing='proportional',
278
286
  ticks=self.values,
279
287
  format='%.3f')
280
- plt.tick_params(labelsize=14,rotation=45)
281
- fig.set_size_inches((10,2))
288
+ plt.tick_params(labelsize=14, rotation=45)
289
+ fig.set_size_inches((10, 2))
282
290
  fig.tight_layout()
283
- if fn!='' and fn is not None:
291
+ if fn != '' and fn is not None:
284
292
  plt.savefig(fn[:-4]+'_h.png', format='png')
285
293
 
286
- return fig,ax
294
+ return fig, ax
287
295
 
288
- def plot(self,fig:Figure,ax:plt.Axes):
296
+ def plot(self, fig: Figure, ax: plt.Axes):
289
297
  gradient = np.linspace(0, 1, 256)
290
298
  gradient = np.vstack((gradient, gradient))
291
299
  ax.imshow(gradient, aspect='auto', cmap=self)
292
300
  ax.set_yticklabels([])
293
301
 
294
- pos=[]
295
- txt=[]
302
+ pos = []
303
+ txt = []
296
304
 
297
- dval=(self.values[-1]-self.values[0])
298
- if dval==0.:
299
- dval=1.
305
+ dval = (self.values[-1]-self.values[0])
306
+ if dval == 0.:
307
+ dval = 1.
300
308
 
301
309
  for curval in self.values:
302
310
  pos.append((curval-self.values[0])/dval*256.)
303
311
  txt.append("{0:.3f}".format(curval))
304
312
 
305
313
  ax.set_xticks(pos)
306
- ax.set_xticklabels(txt,rotation=30,fontsize=6)
314
+ ax.set_xticklabels(txt, rotation=30, fontsize=6)
307
315
 
308
- def fillgrid(self,gridto:CpGrid):
309
- gridto.SetColLabelValue(0,'Value')
310
- gridto.SetColLabelValue(1,'R')
311
- gridto.SetColLabelValue(2,'G')
312
- gridto.SetColLabelValue(3,'B')
316
+ def fillgrid(self, gridto: CpGrid):
317
+ gridto.SetColLabelValue(0, 'Value')
318
+ gridto.SetColLabelValue(1, 'R')
319
+ gridto.SetColLabelValue(2, 'G')
320
+ gridto.SetColLabelValue(3, 'B')
313
321
 
314
- nb=gridto.GetNumberRows()
315
- if len(self.values)-nb>0:
322
+ nb = gridto.GetNumberRows()
323
+ if len(self.values)-nb > 0:
316
324
  gridto.AppendRows(len(self.values)-nb)
317
325
 
318
- k=0
319
- for curv,rgba in zip(self.values,self.colors):
320
- gridto.SetCellValue(k,0,str(curv))
321
- gridto.SetCellValue(k,1,str(rgba[0]))
322
- gridto.SetCellValue(k,2,str(rgba[1]))
323
- gridto.SetCellValue(k,3,str(rgba[2]))
324
- k+=1
326
+ k = 0
327
+ for curv, rgba in zip(self.values, self.colors):
328
+ gridto.SetCellValue(k, 0, str(curv))
329
+ gridto.SetCellValue(k, 1, str(rgba[0]))
330
+ gridto.SetCellValue(k, 2, str(rgba[1]))
331
+ gridto.SetCellValue(k, 3, str(rgba[2]))
332
+ k += 1
325
333
 
326
334
  nb = gridto.GetNumberRows()
327
- while k<nb:
328
- gridto.SetCellValue(k,0,'')
329
- gridto.SetCellValue(k,1,'')
330
- gridto.SetCellValue(k,2,'')
331
- gridto.SetCellValue(k,3,'')
332
- k+=1
335
+ while k < nb:
336
+ gridto.SetCellValue(k, 0, '')
337
+ gridto.SetCellValue(k, 1, '')
338
+ gridto.SetCellValue(k, 2, '')
339
+ gridto.SetCellValue(k, 3, '')
340
+ k += 1
333
341
 
334
- def updatefromgrid(self,gridfrom:CpGrid):
335
- nbl=gridfrom.GetNumberRows()
342
+ def updatefromgrid(self, gridfrom: CpGrid):
343
+ nbl = gridfrom.GetNumberRows()
336
344
 
337
345
  for i in range(nbl):
338
- if gridfrom.GetCellValue(i,0) =='':
339
- nbl=i-1
346
+ if gridfrom.GetCellValue(i, 0) == '':
347
+ nbl = i-1
340
348
  break
341
349
 
342
350
  if i < self.nb:
343
351
  self.nb = i
344
- self.values=self.values[0:i]
345
- self.colors=self.colors[0:i,:]
352
+ self.values = self.values[0:i]
353
+ self.colors = self.colors[0:i, :]
346
354
  else:
347
355
  self.nb = i
348
356
  oldvalues = self.values
349
357
  oldcolors = self.colors
350
- self.values = np.zeros(self.nb , dtype=float)
351
- self.colors = np.zeros((self.nb,4) , dtype=int)
358
+ self.values = np.zeros(self.nb, dtype=np.float64)
359
+ self.colors = np.zeros((self.nb, 4), dtype=int)
352
360
  self.values[0:len(oldvalues)] = oldvalues
353
- self.colors[0:len(oldcolors),:] = oldcolors
361
+ self.colors[0:len(oldcolors), :] = oldcolors
354
362
 
355
363
  update = False
356
364
 
357
365
  for k in range(self.nb):
358
366
 
359
- update = update or self.values[k]!=float(gridfrom.GetCellValue(k,0))
360
- update = update or self.colors[k,0]!=float(gridfrom.GetCellValue(k,1))
361
- update = update or self.colors[k,1]!=float(gridfrom.GetCellValue(k,2))
362
- update = update or self.colors[k,2]!=float(gridfrom.GetCellValue(k,3))
367
+ update = update or self.values[k] != float(gridfrom.GetCellValue(k, 0))
368
+ update = update or self.colors[k, 0] != float(gridfrom.GetCellValue(k, 1))
369
+ update = update or self.colors[k, 1] != float(gridfrom.GetCellValue(k, 2))
370
+ update = update or self.colors[k, 2] != float(gridfrom.GetCellValue(k, 3))
363
371
 
364
- self.values[k]=float(gridfrom.GetCellValue(k,0))
365
- self.colors[k,0]=int(gridfrom.GetCellValue(k,1))
366
- self.colors[k,1]=int(gridfrom.GetCellValue(k,2))
367
- self.colors[k,2]=int(gridfrom.GetCellValue(k,3))
372
+ self.values[k] = float(gridfrom.GetCellValue(k, 0))
373
+ self.colors[k, 0] = int(gridfrom.GetCellValue(k, 1))
374
+ self.colors[k, 1] = int(gridfrom.GetCellValue(k, 2))
375
+ self.colors[k, 2] = int(gridfrom.GetCellValue(k, 3))
368
376
 
369
377
  self.fill_segmentdata()
370
378
 
371
379
  return update
372
380
 
373
- def updatefrompalette(self,srcpal):
381
+ def updatefrompalette(self, srcpal):
374
382
  """
375
383
  Mise à jour de la palette sur base d'une autre
376
384
 
@@ -378,131 +386,137 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
378
386
  """
379
387
 
380
388
  for k in range(len(srcpal.values)):
381
- self.values[k]=srcpal.values[k]
389
+ self.values[k] = srcpal.values[k]
382
390
 
383
391
  self.fill_segmentdata()
384
392
 
385
- def lookupcolor(self,x):
386
- if x < self.values[0]: return wx.Colour(self.colormin)
387
- if x > self.values[-1]: return wx.Colour(self.colormax)
393
+ def lookupcolor(self, x):
394
+ if x < self.values[0]:
395
+ return wx.Colour(self.colormin)
396
+ if x > self.values[-1]:
397
+ return wx.Colour(self.colormax)
388
398
 
389
399
  i = bisect_left(self.values, x)
390
400
  k = (x - self.values[i-1])/(self.values[i] - self.values[i-1])
391
401
 
392
- r=int(k*(float(self.colors[i,0]-self.colors[i-1,0]))) + self.colors[i-1,0]
393
- g=int(k*(float(self.colors[i,1]-self.colors[i-1,1]))) + self.colors[i-1,1]
394
- b=int(k*(float(self.colors[i,2]-self.colors[i-1,2]))) + self.colors[i-1,2]
395
- a=int(k*(float(self.colors[i,3]-self.colors[i-1,3]))) + self.colors[i-1,3]
402
+ r = int(k*(float(self.colors[i, 0]-self.colors[i-1, 0]))) + self.colors[i-1, 0]
403
+ g = int(k*(float(self.colors[i, 1]-self.colors[i-1, 1]))) + self.colors[i-1, 1]
404
+ b = int(k*(float(self.colors[i, 2]-self.colors[i-1, 2]))) + self.colors[i-1, 2]
405
+ a = int(k*(float(self.colors[i, 3]-self.colors[i-1, 3]))) + self.colors[i-1, 3]
396
406
 
397
- y = wx.Colour(r,g,b,a)
407
+ y = wx.Colour(r, g, b, a)
398
408
 
399
409
  return y
400
410
 
401
- def lookupcolorflt(self,x):
402
- if x < self.values[0]: return wx.Colour(self.colormin)
403
- if x > self.values[-1]: return wx.Colour(self.colormax)
411
+ def lookupcolorflt(self, x):
412
+ if x < self.values[0]:
413
+ return wx.Colour(self.colormin)
414
+ if x > self.values[-1]:
415
+ return wx.Colour(self.colormax)
404
416
 
405
417
  i = bisect_left(self.values, x)
406
418
  k = (x - self.values[i-1])/(self.values[i] - self.values[i-1])
407
419
 
408
- r=k*(self.colorsflt[i,0]-self.colorsflt[i-1,0]) + self.colorsflt[i-1,0]
409
- g=k*(self.colorsflt[i,1]-self.colorsflt[i-1,1]) + self.colorsflt[i-1,1]
410
- b=k*(self.colorsflt[i,2]-self.colorsflt[i-1,2]) + self.colorsflt[i-1,2]
411
- a=k*(self.colorsflt[i,3]-self.colorsflt[i-1,3]) + self.colorsflt[i-1,3]
420
+ r = k*(self.colorsflt[i, 0]-self.colorsflt[i-1, 0]) + self.colorsflt[i-1, 0]
421
+ g = k*(self.colorsflt[i, 1]-self.colorsflt[i-1, 1]) + self.colorsflt[i-1, 1]
422
+ b = k*(self.colorsflt[i, 2]-self.colorsflt[i-1, 2]) + self.colorsflt[i-1, 2]
423
+ a = k*(self.colorsflt[i, 3]-self.colorsflt[i-1, 3]) + self.colorsflt[i-1, 3]
412
424
 
413
- y=[r,g,b,a]
425
+ y = [r, g, b, a]
414
426
  return y
415
427
 
416
- def lookupcolorrgb(self,x):
417
- if x < self.values[0]: return wx.Colour(self.colormin)
418
- if x > self.values[-1]: return wx.Colour(self.colormax)
428
+ def lookupcolorrgb(self, x):
429
+ if x < self.values[0]:
430
+ return wx.Colour(self.colormin)
431
+ if x > self.values[-1]:
432
+ return wx.Colour(self.colormax)
419
433
 
420
434
  i = bisect_left(self.values, x)
421
435
  k = (x - self.values[i-1])/(self.values[i] - self.values[i-1])
422
436
 
423
- r=int(k*(float(self.colors[i,0]-self.colors[i-1,0]))) + self.colors[i-1,0]
424
- g=int(k*(float(self.colors[i,1]-self.colors[i-1,1]))) + self.colors[i-1,1]
425
- b=int(k*(float(self.colors[i,2]-self.colors[i-1,2]))) + self.colors[i-1,2]
426
- a=int(k*(float(self.colors[i,3]-self.colors[i-1,3]))) + self.colors[i-1,3]
437
+ r = int(k*(float(self.colors[i, 0]-self.colors[i-1, 0]))) + self.colors[i-1, 0]
438
+ g = int(k*(float(self.colors[i, 1]-self.colors[i-1, 1]))) + self.colors[i-1, 1]
439
+ b = int(k*(float(self.colors[i, 2]-self.colors[i-1, 2]))) + self.colors[i-1, 2]
440
+ a = int(k*(float(self.colors[i, 3]-self.colors[i-1, 3]))) + self.colors[i-1, 3]
427
441
 
428
- return r,g,b,a
442
+ return r, g, b, a
429
443
 
430
444
  def default16(self):
431
445
  """Palette 16 coulrurs par défaut dans WOLF"""
432
446
 
433
- self.nb=16
434
- self.values = np.linspace(0.,1.,16)
435
- self.colors = np.zeros((self.nb,4) , dtype=int)
436
- self.colorsflt = np.zeros((self.nb,4) , dtype=float)
437
-
438
- self.colors[0,:] = [128,255,255,255]
439
- self.colors[1,:] = [89,172,255,255]
440
- self.colors[2,:] = [72,72,255,255]
441
- self.colors[3,:] = [0,0,255,255]
442
- self.colors[4,:] = [0,128,0,255]
443
- self.colors[5,:] = [0,221,55,255]
444
- self.colors[6,:] = [128,255,128,255]
445
- self.colors[7,:] = [255,255,0,255]
446
- self.colors[8,:] = [255,128,0,255]
447
- self.colors[9,:] = [235,174,63,255]
448
- self.colors[10,:] = [255,0,0,255]
449
- self.colors[11,:] = [209,71,12,255]
450
- self.colors[12,:] = [128,0,0,255]
451
- self.colors[13,:] = [185,0,0,255]
452
- self.colors[14,:] = [111,111,111,255]
453
- self.colors[15,:] = [192,192,192,255]
447
+ self.nb = 16
448
+ self.values = np.linspace(0., 1., 16, dtype=np.float64)
449
+ self.colors = np.zeros((self.nb, 4), dtype=int)
450
+ self.colorsflt = np.zeros((self.nb, 4), dtype=np.float64)
451
+
452
+ self.colors[0, :] = [128, 255, 255, 255]
453
+ self.colors[1, :] = [89, 172, 255, 255]
454
+ self.colors[2, :] = [72, 72, 255, 255]
455
+ self.colors[3, :] = [0, 0, 255, 255]
456
+ self.colors[4, :] = [0, 128, 0, 255]
457
+ self.colors[5, :] = [0, 221, 55, 255]
458
+ self.colors[6, :] = [128, 255, 128, 255]
459
+ self.colors[7, :] = [255, 255, 0, 255]
460
+ self.colors[8, :] = [255, 128, 0, 255]
461
+ self.colors[9, :] = [235, 174, 63, 255]
462
+ self.colors[10, :] = [255, 0, 0, 255]
463
+ self.colors[11, :] = [209, 71, 12, 255]
464
+ self.colors[12, :] = [128, 0, 0, 255]
465
+ self.colors[13, :] = [185, 0, 0, 255]
466
+ self.colors[14, :] = [111, 111, 111, 255]
467
+ self.colors[15, :] = [192, 192, 192, 255]
454
468
 
455
469
  self.fill_segmentdata()
456
470
 
457
471
  def set_values_colors(self,
458
- values:typing.Union[list[float], np.ndarray],
459
- colors:typing.Union[list[tuple[int]], np.ndarray]):
472
+ values: typing.Union[list[float], np.ndarray],
473
+ colors: typing.Union[list[tuple[int]], np.ndarray]):
460
474
  """ Mise à jour des valeurs et couleurs de la palette """
461
475
 
462
476
  assert len(values) == len(colors), "Length of values and colors must be the same"
463
477
  assert len(values) > 1, "At least 2 values are required"
464
- assert len(colors[0]) in [3,4], "Colors must be in RGB or RGBA format"
478
+ assert len(colors[0]) in [3, 4], "Colors must be in RGB or RGBA format"
465
479
 
466
480
  self.nb = len(values)
467
- self.values = np.asarray(values)
481
+ self.values = np.asarray(values, dtype=np.float64)
468
482
 
469
- self.colors = np.zeros((self.nb,4) , dtype=int)
470
- self.colorsflt = np.zeros((self.nb,4) , dtype=float)
483
+ self.colors = np.zeros((self.nb, 4), dtype=int)
484
+ self.colorsflt = np.zeros((self.nb, 4), dtype=np.float64)
471
485
 
472
486
  if isinstance(colors, list):
473
487
  if len(colors[0]) == 3:
474
488
  for curcol in range(self.nb):
475
- self.colors[curcol,0] = colors[curcol][0]
476
- self.colors[curcol,1] = colors[curcol][1]
477
- self.colors[curcol,2] = colors[curcol][2]
478
- self.colors[curcol,3] = 255
489
+ self.colors[curcol, 0] = colors[curcol][0]
490
+ self.colors[curcol, 1] = colors[curcol][1]
491
+ self.colors[curcol, 2] = colors[curcol][2]
492
+ self.colors[curcol, 3] = 255
479
493
  elif len(colors[0]) == 4:
480
494
  for curcol in range(self.nb):
481
- self.colors[curcol,0] = colors[curcol][0]
482
- self.colors[curcol,1] = colors[curcol][1]
483
- self.colors[curcol,2] = colors[curcol][2]
484
- self.colors[curcol,3] = colors[curcol][3]
495
+ self.colors[curcol, 0] = colors[curcol][0]
496
+ self.colors[curcol, 1] = colors[curcol][1]
497
+ self.colors[curcol, 2] = colors[curcol][2]
498
+ self.colors[curcol, 3] = colors[curcol][3]
485
499
  elif isinstance(colors, np.ndarray):
486
500
  if colors.shape[1] == 3:
487
501
  for curcol in range(self.nb):
488
- self.colors[curcol,0] = colors[curcol,0]
489
- self.colors[curcol,1] = colors[curcol,1]
490
- self.colors[curcol,2] = colors[curcol,2]
491
- self.colors[curcol,3] = 255
502
+ self.colors[curcol, 0] = colors[curcol, 0]
503
+ self.colors[curcol, 1] = colors[curcol, 1]
504
+ self.colors[curcol, 2] = colors[curcol, 2]
505
+ self.colors[curcol, 3] = 255
492
506
  elif colors.shape[1] == 4:
493
507
  for curcol in range(self.nb):
494
- self.colors[curcol,0] = colors[curcol,0]
495
- self.colors[curcol,1] = colors[curcol,1]
496
- self.colors[curcol,2] = colors[curcol,2]
497
- self.colors[curcol,3] = colors[curcol,3]
498
-
508
+ self.colors[curcol, 0] = colors[curcol, 0]
509
+ self.colors[curcol, 1] = colors[curcol, 1]
510
+ self.colors[curcol, 2] = colors[curcol, 2]
511
+ self.colors[curcol, 3] = colors[curcol, 3]
512
+
499
513
  self.fill_segmentdata()
500
514
 
501
515
  def defaultgray(self):
502
516
  """Palette grise par défaut dans WOLF"""
503
- self.nb=2
504
- self.values = np.asarray([0.,1.])
505
- self.colors = np.asarray([[0,0,0,255],[255,255,255,255]],dtype=np.int32)
517
+ self.nb = 2
518
+ self.values = np.asarray([0., 1.], dtype=np.float64)
519
+ self.colors = np.asarray([[0, 0, 0, 255], [255, 255, 255, 255]], dtype=np.int32)
506
520
 
507
521
  self.fill_segmentdata()
508
522
 
@@ -512,89 +526,89 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
512
526
  self.colorsflt = self.colors.astype(float)/255.
513
527
  self.colorsuint8 = self.colors.astype(np.uint8)
514
528
 
515
- dval=self.values[-1]-self.values[0]
529
+ dval = self.values[-1]-self.values[0]
516
530
 
517
531
  normval = np.ones([len(self.values)])
518
532
 
519
- if dval>0.:
533
+ if dval > 0.:
520
534
  normval = (self.values-self.values[0])/(self.values[-1]-self.values[0])
521
535
 
522
- normval[0]=0.
523
- normval[-1]=1.
524
- segmentdata = {"red": np.column_stack([normval, self.colorsflt[:,0], self.colorsflt[:,0]]),
525
- "green": np.column_stack([normval, self.colorsflt[:,1], self.colorsflt[:,1]]),
526
- "blue": np.column_stack([normval, self.colorsflt[:,2], self.colorsflt[:,2]]),
527
- "alpha": np.column_stack([normval, self.colorsflt[:,3], self.colorsflt[:,3]])}
536
+ normval[0] = 0.
537
+ normval[-1] = 1.
538
+ segmentdata = {"red": np.column_stack([normval, self.colorsflt[:, 0], self.colorsflt[:, 0]]),
539
+ "green": np.column_stack([normval, self.colorsflt[:, 1], self.colorsflt[:, 1]]),
540
+ "blue": np.column_stack([normval, self.colorsflt[:, 2], self.colorsflt[:, 2]]),
541
+ "alpha": np.column_stack([normval, self.colorsflt[:, 3], self.colorsflt[:, 3]])}
528
542
 
529
- LinearSegmentedColormap.__init__(self,'wolf',segmentdata,self.nseg)
543
+ LinearSegmentedColormap.__init__(self, 'wolf', segmentdata, self.nseg)
530
544
 
531
- def readfile(self,*args):
545
+ def readfile(self, *args):
532
546
  """Lecture de la palette sur base d'un fichier WOLF .pal"""
533
- if len(args)>0:
534
- #s'il y a un argument on le prend tel quel
547
+ if len(args) > 0:
548
+ # s'il y a un argument on le prend tel quel
535
549
  self.filename = str(args[0])
536
550
  else:
537
551
  if self.wx_exists:
538
- #ouverture d'une boîte de dialogue
539
- file=wx.FileDialog(None,"Choose .pal file", wildcard="pal (*.pal)|*.pal|all (*.*)|*.*")
552
+ # ouverture d'une boîte de dialogue
553
+ file = wx.FileDialog(None, "Choose .pal file", wildcard="pal (*.pal)|*.pal|all (*.*)|*.*")
540
554
  if file.ShowModal() == wx.ID_CANCEL:
541
555
  file.Destroy()
542
556
  return
543
557
  else:
544
- #récuparétaion du nom de fichier avec chemin d'accès
545
- self.filename =file.GetPath()
558
+ # récuparétaion du nom de fichier avec chemin d'accès
559
+ self.filename = file.GetPath()
546
560
  file.Destroy()
547
561
  else:
548
562
  return
549
563
 
550
- #lecture du contenu
564
+ # lecture du contenu
551
565
  with open(self.filename, 'r') as myfile:
552
- #split des lignes --> récupération des infos sans '\n' en fin de ligne
566
+ # split des lignes --> récupération des infos sans '\n' en fin de ligne
553
567
  # différent de .readlines() qui lui ne supprime pas les '\n'
554
568
  mypallines = myfile.read().splitlines()
555
569
  myfile.close()
556
570
 
557
571
  self.nb = int(mypallines[0])
558
- self.values = np.zeros(self.nb , dtype=float)
559
- self.colors = np.zeros((self.nb,4) , dtype=int)
572
+ self.values = np.zeros(self.nb, dtype=np.float64)
573
+ self.colors = np.zeros((self.nb, 4), dtype=int)
560
574
 
561
575
  for i in range(self.nb):
562
576
  self.values[i] = mypallines[i*4+1]
563
- self.colors[i,0] = mypallines[i*4+2]
564
- self.colors[i,1] = mypallines[i*4+3]
565
- self.colors[i,2] = mypallines[i*4+4]
566
- self.colors[i,3] = 255
577
+ self.colors[i, 0] = mypallines[i*4+2]
578
+ self.colors[i, 1] = mypallines[i*4+3]
579
+ self.colors[i, 2] = mypallines[i*4+4]
580
+ self.colors[i, 3] = 255
567
581
 
568
582
  self.fill_segmentdata()
569
583
 
570
- def savefile(self,*args):
584
+ def savefile(self, *args):
571
585
  """Lecture de la palette sur base d'un fichier WOLF .pal"""
572
- if len(args)>0:
573
- #s'il y a un argument on le prend tel quel
586
+ if len(args) > 0:
587
+ # s'il y a un argument on le prend tel quel
574
588
  fn = str(args[0])
575
589
  else:
576
- #ouverture d'une boîte de dialogue
577
- file=wx.FileDialog(None,"Choose .pal file", wildcard="pal (*.pal)|*.pal|all (*.*)|*.*",style=wx.FD_SAVE)
590
+ # ouverture d'une boîte de dialogue
591
+ file = wx.FileDialog(None, "Choose .pal file", wildcard="pal (*.pal)|*.pal|all (*.*)|*.*", style=wx.FD_SAVE)
578
592
  if file.ShowModal() == wx.ID_CANCEL:
579
593
  return
580
594
  else:
581
- #récuparétaion du nom de fichier avec chemin d'accès
582
- fn =file.GetPath()
595
+ # récuparétaion du nom de fichier avec chemin d'accès
596
+ fn = file.GetPath()
583
597
 
584
- self.filename=fn
598
+ self.filename = fn
585
599
 
586
- #lecture du contenu
600
+ # lecture du contenu
587
601
  with open(self.filename, 'w') as myfile:
588
- #split des lignes --> récupération des infos sans '\n' en fin de ligne
602
+ # split des lignes --> récupération des infos sans '\n' en fin de ligne
589
603
  # différent de .readlines() qui lui ne supprime pas les '\n'
590
604
  myfile.write(str(self.nb)+'\n')
591
605
  for i in range(self.nb):
592
606
  myfile.write(str(self.values[i])+'\n')
593
- myfile.write(str(self.colors[i,0])+'\n')
594
- myfile.write(str(self.colors[i,1])+'\n')
595
- myfile.write(str(self.colors[i,2])+'\n')
607
+ myfile.write(str(self.colors[i, 0])+'\n')
608
+ myfile.write(str(self.colors[i, 1])+'\n')
609
+ myfile.write(str(self.colors[i, 2])+'\n')
596
610
 
597
- def isopop(self, array: ma.masked_array, nbnotnull:int=99999):
611
+ def isopop(self, array: ma.masked_array, nbnotnull: int = 99999):
598
612
  """Remplissage des valeurs de palette sur base d'une équirépartition de valeurs"""
599
613
 
600
614
  sortarray = array.flatten(order='F')
@@ -607,7 +621,7 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
607
621
 
608
622
  sortarray.sort(axis=-1)
609
623
 
610
- #valeurs min et max
624
+ # valeurs min et max
611
625
  if nbnotnull == 0:
612
626
  self.values[0] = 0
613
627
  self.values[1:] = 1
@@ -617,7 +631,7 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
617
631
 
618
632
  self.values[0] = sortarray[0]
619
633
 
620
- if(nbnotnull==99999):
634
+ if (nbnotnull == 99999):
621
635
  self.values[-1] = sortarray[-1]
622
636
  nb = sortarray.count()
623
637
  else:
@@ -625,41 +639,41 @@ class wolfpalette(wx.Frame,LinearSegmentedColormap):
625
639
  nb = nbnotnull
626
640
 
627
641
  interv = int(nb / (self.nb-1))
628
- if interv==0:
642
+ if interv == 0:
629
643
  self.values[:] = self.values[-1]
630
644
  self.values[0] = self.values[-1]-1.
631
645
  else:
632
- for cur in range(1,self.nb-1):
646
+ for cur in range(1, self.nb-1):
633
647
  self.values[cur] = sortarray[cur * interv]
634
648
 
635
649
  self.fill_segmentdata()
636
650
 
637
- def defaultgray_minmax(self,array: ma.masked_array,nbnotnull=99999):
651
+ def defaultgray_minmax(self, array: ma.masked_array, nbnotnull=99999):
638
652
  """Remplissage des valeurs de palette sur base d'une équirépartition de valeurs"""
639
653
 
640
- self.nb=2
641
- self.values = np.asarray([np.min(array),np.max(array)])
642
- self.colors = np.asarray([[0,0,0,255],[255,255,255,255]],dtype=np.int32)
643
- self.colorsflt = np.asarray([[0.,0.,0.,1.],[1.,1.,1.,1.]],dtype=np.float64)
654
+ self.nb = 2
655
+ self.values = np.asarray([np.min(array), np.max(array)], dtype=np.float64)
656
+ self.colors = np.asarray([[0, 0, 0, 255], [255, 255, 255, 255]], dtype=np.int32)
657
+ self.colorsflt = np.asarray([[0., 0., 0., 1.], [1., 1., 1., 1.]], dtype=np.float64)
644
658
 
645
659
  self.fill_segmentdata()
646
660
 
647
- def defaultblue_minmax(self,array: ma.masked_array,nbnotnull=99999):
661
+ def defaultblue_minmax(self, array: ma.masked_array, nbnotnull=99999):
648
662
  """Remplissage des valeurs de palette sur base d'une équirépartition de valeurs"""
649
663
 
650
- self.nb=2
651
- self.values = np.asarray([np.min(array),np.max(array)])
652
- self.colors = np.asarray([[255,255,255,255],[0,0,255,255]],dtype=np.int32)
653
- self.colorsflt = np.asarray([[0.,0.,0.,1.],[1.,1.,1.,1.]],dtype=np.float64)
664
+ self.nb = 2
665
+ self.values = np.asarray([np.min(array), np.max(array)], dtype=np.float64)
666
+ self.colors = np.asarray([[255, 255, 255, 255], [0, 0, 255, 255]], dtype=np.int32)
667
+ self.colorsflt = np.asarray([[0., 0., 0., 1.], [1., 1., 1., 1.]], dtype=np.float64)
654
668
 
655
669
  self.fill_segmentdata()
656
670
 
657
671
  def defaultblue(self):
658
672
  """Remplissage des valeurs de palette sur base d'une équirépartition de valeurs"""
659
673
 
660
- self.nb=2
661
- self.values = np.asarray([0.,1.])
662
- self.colors = np.asarray([[255,255,255,255],[0,0,255,255]],dtype=np.int32)
663
- self.colorsflt = np.asarray([[0.,0.,0.,1.],[1.,1.,1.,1.]],dtype=np.float64)
674
+ self.nb = 2
675
+ self.values = np.asarray([0., 1.], dtype=np.float64)
676
+ self.colors = np.asarray([[255, 255, 255, 255], [0, 0, 255, 255]], dtype=np.int32)
677
+ self.colorsflt = np.asarray([[0., 0., 0., 1.], [1., 1., 1., 1.]], dtype=np.float64)
664
678
 
665
679
  self.fill_segmentdata()