diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 7f95f57..8b7b052 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b21e601 --- /dev/null +++ b/.gitignore @@ -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/ + + + + + + + + diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 457ff30..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,6 +0,0 @@ -# Changelog - -## Next Version - -### Added -- PyPI support for PyStell (#4) \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..13dbbbc --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,11 @@ +# Changelog + +## Next Version + +### Added + +- PyPI support for PyStell (#4) + +### Changed + +- Replace print with logging (#5) diff --git a/src/pystell/pybooz.py b/src/pystell/pybooz.py index 3c56af9..cdb0354 100644 --- a/src/pystell/pybooz.py +++ b/src/pystell/pybooz.py @@ -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) @@ -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 @@ -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 @@ -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 @@ -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] diff --git a/src/pystell/read_boozmn.py b/src/pystell/read_boozmn.py index 777a9b4..947b9e7 100644 --- a/src/pystell/read_boozmn.py +++ b/src/pystell/read_boozmn.py @@ -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