diff --git a/GeoToolkit/Mag/Simulator.py b/GeoToolkit/Mag/Simulator.py index 8460f8a..0871d8d 100644 --- a/GeoToolkit/Mag/Simulator.py +++ b/GeoToolkit/Mag/Simulator.py @@ -237,7 +237,7 @@ def MagSurvey2D(East, North, Azimuth, Length, Sampling, ): North=widgets.FloatSlider(min=cntr[1]-Ly, max=cntr[1]+Ly, step=10, value=cntr[1],continuous_update=False), Azimuth=widgets.FloatSlider(min=0, max=180, step=5, value=90, continuous_update=False), Length=widgets.FloatSlider(min=20, max=diag, step=20, value=diag/2., continuous_update=False), - Sampling=widgets.BoundedFloatText(min=10, max=1000, step=5, value=100, continuous_update=False) + Sampling=widgets.BoundedIntText(min=10, max=1000, step=5, value=100, continuous_update=False) # ColorMap=widgets.Dropdown( # options=cmaps(), # value='Spectral_r', @@ -922,6 +922,7 @@ def linefun(x1, x2, y1, y2, nx, tol=1e-3): data = [data] for ii, d in enumerate(data): + d = d.astype("float64") if d.ndim == 1: dline = griddata(np.c_[x, y], d, (xLine, yLine), method='linear') @@ -993,7 +994,7 @@ def plotWidget( ) # Parse contour values - if Contours is not "": + if Contours != "": vals = re.split(',', Contours) cntrs = [] for val in vals: @@ -1002,7 +1003,7 @@ def plotWidget( cntrs += [np.arange(param[0], param[2], param[1])] else: - cntrs += [np.float(val)] + cntrs += [float(val)] Contours = np.unique(np.sort(np.hstack(cntrs))) else: Contours = None @@ -1014,7 +1015,7 @@ def plotWidget( saveAs, EPSGcode, SaveGrid, dpi=dpi ) - if Contours is not "": + if Contours != "": if SaveShape: @@ -1257,7 +1258,7 @@ def plotWidget( ) # Parse contour values - if Contours is not "": + if Contours != "": vals = re.split(',', Contours) cntrs = [] for val in vals: @@ -1266,7 +1267,7 @@ def plotWidget( cntrs += [np.arange(param[0], param[2], param[1])] else: - cntrs += [np.float(val)] + cntrs += [float(val)] Contours = np.unique(np.sort(np.hstack(cntrs))) else: @@ -1279,7 +1280,7 @@ def plotWidget( saveAs, EPSGcode, SaveGrid, dpi=dpi ) - if Contours is not "": + if Contours != "": if SaveShape: diff --git a/GeoToolkit/graphics/graphics.py b/GeoToolkit/graphics/graphics.py index b3cccaf..a5af28f 100644 --- a/GeoToolkit/graphics/graphics.py +++ b/GeoToolkit/graphics/graphics.py @@ -134,8 +134,10 @@ def equalizeColormap(cmap,bins,cdf,name='EqualizedMap'): # first retrieve the color table (lists of RGB values) behind the input colormap if cmap in colors.datad: # one of the additional colormaps in colors module cmList = colors.datad[cmap] - elif cmap in cm.cmap_d: # matplotlib colormaps + plus the new ones (viridis, inferno, etc.) - cmList = cmap_to_array(cm.cmap_d[cmap]) + elif getattr(cm, cmap, "None") is not None: + cmList = cmap_to_array(getattr(cm, cmap)) + # elif cmap in cm.cmap_d: # matplotlib colormaps + plus the new ones (viridis, inferno, etc.) + # cmList = cmap_to_array(cm.cmap_d[cmap]) else: try: # in case cmap is a colormap object @@ -144,7 +146,7 @@ def equalizeColormap(cmap,bins,cdf,name='EqualizedMap'): raise ValueError('Colormap {} has not been recognised'.format(cmap)) # normalize the input bins to interval (0,1) - bins_norm = (bins - bins.min())/np.float(bins.max() - bins.min()) + bins_norm = (bins - bins.min())/(bins.max() - bins.min()) # calculate new indices by applying the cdf as a function on the old indices # which are initially regularly spaced. diff --git a/docs/images/GIF.png b/docs/images/GIF.png index ce736f1..188ad49 100644 Binary files a/docs/images/GIF.png and b/docs/images/GIF.png differ diff --git a/environment.yml b/environment.yml index 2fddd92..022c248 100644 --- a/environment.yml +++ b/environment.yml @@ -4,11 +4,17 @@ channels: - conda-forge - defaults dependencies: - - python=3.8 + - python=3.10 - git - pip - numpy - scipy + - matplotlib + - ipywidgets + - geopandas + - scikit-image + - jupyterlab + - simpeg - pip: - git+https://github.com/geoscixyz/Toolkit.git@main - sphinx @@ -19,7 +25,3 @@ dependencies: - numpydoc - download - tqdm - - matplotlib - - ipywidgets - - geopandas - - scikit-image