Skip to content

Commit

Permalink
first attempt at getting website to rebuild
Browse files Browse the repository at this point in the history
jcapriot committed Nov 19, 2021
1 parent dda9b6e commit a575b6e
Showing 20 changed files with 481 additions and 1,203 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: EM Website Build

on:
push:
branches:
- '*'
pull_request:
branches: [ main ]

jobs:
test:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- name: Test with pytest
run: |
pytest -s -v tests
deploy:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build pages
run: |
python _ext/build_contrib_case.py
make html
python copy_images
- name: GitHub Pages
uses: crazy-max/ghaction-github-pages@v2.5.0
with:
build_dir: _build/html
fqdn: em.geosci.xyz
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 0 additions & 14 deletions _ext/__init__.py

This file was deleted.

65 changes: 2 additions & 63 deletions _ext/autodoc.py → _ext/build_contrib_case.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import shutil
import os
import json
import io
@@ -8,10 +7,10 @@
CONTRIB_INFO = ['affiliation', 'location', 'email', 'url', 'ORCID']
CASEHISTORY_INFO = ['citations', 'contributors', 'tags']

ORCID_URL = u'http://orcid.org/'
ORCID_URL = 'http://orcid.org/'

THIS_IS_AUTOGENERATED = (
u".. --------------------------------- ..\n"
".. --------------------------------- ..\n"
".. ..\n"
".. THIS FILE IS AUTO GENEREATED ..\n"
".. ..\n"
@@ -21,48 +20,6 @@
)


def make_formula_sheet():

# Create the examples dir in the docs folder.

EquationSheetDir = os.path.sep.join(
fName.split(os.path.sep)[:-2] + ['content', 'equation_bank']
)
files = os.listdir(EquationSheetDir)

rst = os.path.sep.join(
(fName.split(os.path.sep)[:-2] + ['content', 'equation_bank' + '.rst'])
)

out = u""".. _equation_bank:
{}
Equation Bank
=============
""".format(THIS_IS_AUTOGENERATED)

print('\nCreating: equation_bank.rst')
f = open(rst, 'w')
f.write(out)

for name in files:
out = """
- {}
.. include:: equation_bank/{}
""".format(name.rstrip('.rst'), name)
f.write(out)

f.close()

print('Done writing equation_bank.rst\n')


def make_contributorslist(fpath='contributors.json',
fout='contributors.rst',
contrib_info=CONTRIB_INFO):
@@ -335,28 +292,10 @@ def make_case_histories(fpath='content/case_histories/case_histories.json',
print('Done writing case_histories.rst')


# .. raw:: html

# <span id="{uid}"></span><h3><a class="referance internal" href="{source}/index.html" title="Go to the case history">{title}</a></h3>
# <div class="row">
# <div class="col-md-6">
# <a class="reference internal image-reference" href="../../_images/{thumbnail}"><img alt="../../_images/{thumbnail}" class="align-left" src="../../_images/{thumbnail}" style="width: 250px;" /></a>
# </div>
# <div class="col-md-6">
# <ul>
# {info_block}
# </ul>
# </div>
# <br>
# <br>
# </div>


if __name__ == '__main__':
"""
Run the following to create the formula sheet.
"""

make_formula_sheet()
make_contributorslist()
make_case_histories()
15 changes: 10 additions & 5 deletions _ext/copyImages.py → _ext/copy_images.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
import shutil

def copyImages():

def copy_images():
# get relevant directories
cwd = os.getcwd()
contentdir = os.path.sep.join(cwd.split(os.path.sep) + ['content'])
@@ -27,9 +28,13 @@ def copyImages():
if root.endswith('images'):
for filename in fileList:
if filename not in imnames:
shutil.copy(os.path.join(root, filename),buildimagesdir)
return
print(f'copying in {filename}')
shutil.copy(os.path.join(root, filename), buildimagesdir)


if __name__ == '__main__':
"""
Run the following to create the formula sheet.
"""

if __name__ == "__main__":
copyImages()
copy_images()
39 changes: 0 additions & 39 deletions _ext/edit_on_github.py

This file was deleted.

34 changes: 0 additions & 34 deletions _ext/environmentSetup.py

This file was deleted.

52 changes: 0 additions & 52 deletions _ext/includeMath.py

This file was deleted.

135 changes: 0 additions & 135 deletions app.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions appengine_config.py

This file was deleted.

329 changes: 13 additions & 316 deletions conf.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -17,6 +17,9 @@
"""

# This script was used to create the static images in dcr.
# It is not needed to be run to build the decomentation.


#%%
from SimPEG import *

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -103,13 +103,10 @@ Below figure shows real and imaginary component of :math:`Q`.

.. plot::

from em_examples.EMcircuit import Qfun
import numpy as np
import matplotlib.pyplot as plt
L = 1.
R = 2000.
alpha = np.logspace(-3, 3, 100)
alpha, Q = Qfun(R, L, None, alpha=alpha)
Q = (alpha ** 2 + 1j * alpha) / (1 + alpha ** 2)
fig = plt.figure(figsize=(5, 3))
ax1 = plt.subplot(111)
ax1.semilogx(alpha, Q.real, 'k', lw=3)
8 changes: 1 addition & 7 deletions content/maxwell3_fdem/circuitmodel_for_eminduction/index.rst
Original file line number Diff line number Diff line change
@@ -72,13 +72,10 @@ is the induction number.

.. plot::

from em_examples.EMcircuit import Qfun
import numpy as np
import matplotlib.pyplot as plt
L = 1.
R = 2000.
alpha = np.logspace(-3, 3, 100)
alpha, Q = Qfun(R, L, None, alpha=alpha)
Q = (alpha ** 2 + 1j * alpha) / (1 + alpha ** 2)
fig = plt.figure(figsize=(5, 3))
ax1 = plt.subplot(111)
ax1.semilogx(alpha, Q.real, 'k', lw=3)
@@ -126,6 +123,3 @@ In the following pages we illustrate
derive_response_function
understanding_harmonicEMresponse
understanding_response_widget



Original file line number Diff line number Diff line change
@@ -120,9 +120,7 @@ Computed coupling coefficient along the line is shown below:

.. plot::

from em_examples.EMcircuit import Mijfun, Cfun, Qfun
import numpy as np
import matplotlib.pyplot as plt
from scipy.constants import mu_0
L = 1.
R = 2000.
xc = 0.
@@ -140,9 +138,41 @@ Computed coupling coefficient along the line is shown below:
yp = xp.copy()
zp = np.r_[-ht]
xyz_profile = np.c_[xp, np.zeros_like(xp), np.ones_like(xp)*ht]
c_profile, m12_profile, m23_profile, m13_profile = Cfun(L,R,xc,yc,zc,incl,decl,S,ht,f,xyz_profile)
tx_loc = xyz_profile - [S/2, 0, 0]
rx_loc = xyz_profile + [S/2, 0, 0]

def Mij(loc_i, loc_j, dir_i, dir_j, area_i=1, area_j=1):
di=dir_i[0]*np.pi/180
dd=dir_i[1]*np.pi/180

m_i = area_i * np.array([
np.cos(di)*np.cos(dd),
np.cos(di)*np.sin(dd),
np.sin(di)
])

ai=dir_j[0]*np.pi/180
ad=dir_j[1]*np.pi/180

m_j = area_j * np.array([
np.cos(ai)*np.cos(ad),
np.cos(ai)*np.sin(ad),
np.sin(ai)
])

dr = loc_i - loc_j
r = np.linalg.norm(dr, axis=-1)[:, None]
B = mu_0 / (4*np.pi) * (3 * dr * dr.dot(m_i)[:, None] / r**5 - m_i/r**3)
return B.dot(m_j)

M13 = Mij(tx_loc, rx_loc, (90, 0), (90, 0))
M12 = Mij(tx_loc, [xc, yc, zc], (90, 0), (incl, decl), area_j=3.0)
M23 = Mij([xc, yc, zc], rx_loc, (incl, decl), (90, 0), area_i=3.0)
C = -M12*M23/(M13*L)


fig = plt.figure(figsize=(5,3))
plt.plot(xp, c_profile, 'k', lw=2)
plt.plot(xp, C, 'k', lw=2)
plt.plot(xp, np.zeros_like(xp), 'k--', lw=1)
plt.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
plt.xlabel("Mid point between Tx and Rx (m)")
@@ -169,13 +199,10 @@ imaginary or ampliutde and phase.

.. plot::

from em_examples.EMcircuit import Qfun
import numpy as np
import matplotlib.pyplot as plt
L = 1.
R = 2000.
alpha = np.logspace(-3, 3, 100)
alpha, Q = Qfun(R, L, None, alpha=alpha)
Q = (alpha ** 2 + 1j * alpha) / (1 + alpha ** 2)
fig = plt.figure(figsize=(10, 3))
ax1 = plt.subplot(121)
ax2 = plt.subplot(122)
@@ -309,5 +336,3 @@ In frequency domain EM survey:

- the 90 :math:`^\circ` out-of-phase fraction of :math:`H^s_3` is called the
**Imaginary**, **Out-of-phase**, or **Quadrature** component.


Binary file removed credentials.tar.gz.enc
Binary file not shown.
107 changes: 0 additions & 107 deletions emgeosci.py

This file was deleted.

11 changes: 0 additions & 11 deletions index.yaml

This file was deleted.

264 changes: 0 additions & 264 deletions make.bat

This file was deleted.

13 changes: 2 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
numpy
scipy
ipython
ipywidgets
flask
sphinx
docutils
matplotlib
properties[math]
sphinxcontrib-bibtex
sphinx_rtd_theme
Pillow
em_examples
SimPEG
pytest
matplotlib
geoana

0 comments on commit a575b6e

Please sign in to comment.