Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first pass getting the mag toolkit back up and running #155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions GeoToolkit/Mag/Simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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')

Expand Down Expand Up @@ -993,7 +994,7 @@ def plotWidget(
)

# Parse contour values
if Contours is not "":
if Contours != "":
vals = re.split(',', Contours)
cntrs = []
for val in vals:
Expand All @@ -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
Expand All @@ -1014,7 +1015,7 @@ def plotWidget(
saveAs, EPSGcode, SaveGrid, dpi=dpi
)

if Contours is not "":
if Contours != "":

if SaveShape:

Expand Down Expand Up @@ -1257,7 +1258,7 @@ def plotWidget(
)

# Parse contour values
if Contours is not "":
if Contours != "":
vals = re.split(',', Contours)
cntrs = []
for val in vals:
Expand All @@ -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:
Expand All @@ -1279,7 +1280,7 @@ def plotWidget(
saveAs, EPSGcode, SaveGrid, dpi=dpi
)

if Contours is not "":
if Contours != "":

if SaveShape:

Expand Down
8 changes: 5 additions & 3 deletions GeoToolkit/graphics/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
Binary file modified docs/images/GIF.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,7 +25,3 @@ dependencies:
- numpydoc
- download
- tqdm
- matplotlib
- ipywidgets
- geopandas
- scikit-image