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

Replace print with logging #5

Open
wants to merge 2 commits into
base: master
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
2 changes: 1 addition & 1 deletion .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: |
gh release create ${{ github.ref }} \
-t "Release $GITHUB_REF_NAME" \
-F CHANGELOG \
-F CHANGELOG.md \
./dist/*

- name: Publish package to PyPI
Expand Down
87 changes: 87 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/








6 changes: 0 additions & 6 deletions CHANGELOG

This file was deleted.

11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

## Next Version

### Added

- PyPI support for PyStell (#4)

### Changed

- Replace print with logging (#5)
23 changes: 11 additions & 12 deletions src/pystell/pybooz.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,9 @@ def __init__(self, vmecdata, nboz, mboz):
gpsi, Ipsi, jrad, lt, lz, lam, wt, wz, wp
)
if jrad == 9:
print("p1: ", p1[:10])
print("q1: ", q1[:10])
print("xjac: ", xjac[:10])

logging.info("p1: %s", p1[:10])
logging.info("q1: %s", q1[:10])
logging.info("xjac: %s", xjac[:10])

r12 = np.empty(self.nunv)
z12 = np.empty(self.nunv)
Expand All @@ -281,11 +280,11 @@ def __init__(self, vmecdata, nboz, mboz):
self.sinnn[:] = 0.0

if jrad == 2:
print("bmncb: ", self.bmncb[:10, jrad])
print("rmncb: ", self.rmncb[:10, jrad])
print("zmnsb: ", self.zmnsb[:10, jrad])
print("pmnsb: ", self.pmnsb[:10, jrad])
print("gmncb: ", self.gmncb[:10, jrad])
logging.info("bmncb: %s", self.bmncb[:10, jrad])
logging.info("rmncb: %s", self.rmncb[:10, jrad])
logging.info("zmnsb: %s", self.zmnsb[:10, jrad])
logging.info("pmnsb: %s", self.pmnsb[:10, jrad])
logging.info("gmncb: %s", self.gmncb[:10, jrad])

# We store angles corresponding to 0 and pi, have to subtract 1
# due to the python/fortran index difference
Expand Down Expand Up @@ -329,7 +328,7 @@ def setup_xmnb(self):
n1 = 0
for n in range(n1, n2 + 1):
if mnboz0 >= self.mnboz:
print("problem: mnboz0 > mnboz")
logging.error("problem: mnboz0 > mnboz")
return
self.xnb[mnboz0] = n * self.nfp
self.xmb[mnboz0] = m
Expand Down Expand Up @@ -441,7 +440,7 @@ def vcoords_rz(self, jrad, r, z, lt, lz, lam, nparity=0):
js = jrad
js1 = js - 1
if js <= 0:
print("Something wrong js <= 0")
logging.error("Something wrong js <= 0")
return
r = 0.0
z = 0.0
Expand Down Expand Up @@ -666,7 +665,7 @@ def boozerfun(self, bmod_b, rad, zee, uboz, vboz, xjac, jacfac, jrad):
i = nv * (nu2 - 1)
imax = i + nv
if jrad == 9:
print("i,max,", i, imax)
logging.info("i = %d, imax = %d", i, imax)
for m in range(self.mboz + 1):
self.cosmm[:nv, m] = 0.5 * self.cosmm[:nv, m]
self.cosmm[i:imax, m] = 0.5 * self.cosmm[i:imax, m]
Expand Down
2 changes: 1 addition & 1 deletion src/pystell/read_boozmn.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def solve_function(booz_coords):
if s < mins:
logging.warning("s value of %.4f is too low, answer may be incorrect", s)
if s > maxs:
print("s value of %.4f is too high, answer may be incorrect", s)
logging.warning("s value of %.4f is too high, answer may be incorrect", s)

return sol.x

Expand Down