Skip to content

Commit

Permalink
publish on pypi from github
Browse files Browse the repository at this point in the history
  • Loading branch information
sambit-giri committed Oct 22, 2024
1 parent 93fbdaf commit 8b10e5e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish Python Package to PyPI

on:
push:
tags:
- 'v*' # Trigger on version tags

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build package
run: python setup.py sdist bdist_wheel

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*

- name: Clean up
run: rm -rf dist build *.egg-info
4 changes: 3 additions & 1 deletion src/tools21cm/gaussian_random_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
from scipy import fftpack
from .power_spectrum import _get_dims, _get_k, power_spectrum_1d
from scipy.interpolate import interp1d
from scipy.interpolate import interp1d, splrep, splev

def make_gaussian_random_field(dims, box_dims, power_spectrum, random_seed=None):
'''
Expand Down Expand Up @@ -97,6 +97,8 @@ def _get_ps_func_for_field(input_field, box_dims, kbins=10):
box_dims=box_dims, kbins=kbins, return_n_modes=True)
ps_k = interp1d(k_input[n_modes>0], ps_input[n_modes>0], kind='linear', \
bounds_error=False, fill_value=0.)
# tckp = splrep(np.log10(k_input[n_modes>0]), np.log10(ps_input[n_modes>0]), k=1)
# ps_k = lambda k: 10**splev(np.log10(k), tckp)
return ps_k


Expand Down

0 comments on commit 8b10e5e

Please sign in to comment.