Commit fe82be9e authored by Jean-Baptiste Delisle's avatar Jean-Baptiste Delisle
Browse files

change package name (sam -> samsam)

parent 8a23ba0a
Pipeline #24917 passed with stages
in 7 minutes and 41 seconds
...@@ -9,13 +9,13 @@ Build distribution: ...@@ -9,13 +9,13 @@ Build distribution:
stage: build stage: build
before_script: before_script:
- export PATH=$PATH:/opt/anaconda3/bin/ - export PATH=$PATH:/opt/anaconda3/bin/
- conda env create -f sam_env.yml - conda env create -f samsam_env.yml
- conda activate sam - conda activate samsam
script: script:
- python setup.py sdist - python setup.py sdist
after_script: after_script:
- conda deactivate - conda deactivate
- conda env remove -n sam - conda env remove -n samsam
artifacts: artifacts:
paths: paths:
- dist/*.tar.gz - dist/*.tar.gz
...@@ -25,29 +25,29 @@ Run test: ...@@ -25,29 +25,29 @@ Run test:
stage: test stage: test
before_script: before_script:
- export PATH=$PATH:/opt/anaconda3/bin/ - export PATH=$PATH:/opt/anaconda3/bin/
- conda env create -f sam_env.yml - conda env create -f samsam_env.yml
- conda activate sam - conda activate samsam
script: script:
- pip install dist/*.tar.gz - pip install dist/*.tar.gz
- cd test - cd test
- python -m pytest - python -m pytest
after_script: after_script:
- conda deactivate - conda deactivate
- conda env remove -n sam - conda env remove -n samsam
Generate documentation: Generate documentation:
stage: documentation stage: documentation
before_script: before_script:
- export PATH=$PATH:/opt/anaconda3/bin/ - export PATH=$PATH:/opt/anaconda3/bin/
- conda env create -f sam_env.yml - conda env create -f samsam_env.yml
- conda activate sam - conda activate samsam
script: script:
- pip install dist/*.tar.gz - pip install dist/*.tar.gz
- cd doc - cd doc
- make html - make html
after_script: after_script:
- conda deactivate - conda deactivate
- conda env remove -n sam - conda env remove -n samsam
artifacts: artifacts:
paths: paths:
- doc/build/html - doc/build/html
...@@ -56,9 +56,9 @@ Generate documentation: ...@@ -56,9 +56,9 @@ Generate documentation:
Deploy on Staging: Deploy on Staging:
stage: staging stage: staging
script: script:
- cp dist/*.tar.gz /www/people/delisle/public/staging/sam - cp dist/*.tar.gz /www/people/delisle/public/staging/samsam
- rm -rf /www/people/delisle/public/staging/sam/doc/* - rm -rf /www/people/delisle/public/staging/samsam/doc/*
- cp -R doc/build/html/* /www/people/delisle/public/staging/sam/doc - cp -R doc/build/html/* /www/people/delisle/public/staging/samsam/doc
Release and deploy on Production: Release and deploy on Production:
stage: production stage: production
...@@ -68,20 +68,20 @@ Release and deploy on Production: ...@@ -68,20 +68,20 @@ Release and deploy on Production:
- git checkout -B master origin/master - git checkout -B master origin/master
- git config --global user.name 'Gitlab CI' - git config --global user.name 'Gitlab CI'
- git config --global user.email '' - git config --global user.email ''
- git remote set-url origin "https://gitlab-ci-token:$RELEASE_TOKEN@gitlab.unige.ch/jean-baptiste.delisle/sam.git" - git remote set-url origin "https://gitlab-ci-token:$RELEASE_TOKEN@gitlab.unige.ch/jean-baptiste.delisle/samsam.git"
script: script:
# Tag # Tag
- VERSION=`grep __version__ sam/__info__.py | sed 's/.*version__ = "//' | sed 's/"//'` - VERSION=`grep __version__ samsam/__info__.py | sed 's/.*version__ = "//' | sed 's/"//'`
- TAG_VERSION="v$VERSION" - TAG_VERSION="v$VERSION"
- git tag -a "$TAG_VERSION" -m "Release sam $TAG_VERSION" - git tag -a "$TAG_VERSION" -m "Release samsam $TAG_VERSION"
- git push origin "$TAG_VERSION" --quiet - git push origin "$TAG_VERSION" --quiet
- CHANGES=`cat CHANGES.txt` - CHANGES=`cat CHANGES.txt`
# Add release on gitlab (via gitlab API) # Add release on gitlab (via gitlab API)
- curl -X POST -H "PRIVATE-TOKEN:$RELEASE_TOKEN" -F "name=Release sam $TAG_VERSION" -F "tag_name=$TAG_VERSION" -F "ref=$TAG_VERSION" -F "description=Changes:$CHANGES" 'https://gitlab.unige.ch/api/v4/projects/1383/releases' - curl -X POST -H "PRIVATE-TOKEN:$RELEASE_TOKEN" -F "name=Release samsam $TAG_VERSION" -F "tag_name=$TAG_VERSION" -F "ref=$TAG_VERSION" -F "description=Changes:$CHANGES" 'https://gitlab.unige.ch/api/v4/projects/1383/releases'
# Deploy on production # Deploy on production
- cp dist/*.tar.gz /www/people/delisle/public/sam - cp dist/*.tar.gz /www/people/delisle/public/samsam
- rm -rf /www/people/delisle/public/sam/doc/* - rm -rf /www/people/delisle/public/samsam/doc/*
- cp -R doc/build/html/* /www/people/delisle/public/sam/doc - cp -R doc/build/html/* /www/people/delisle/public/samsam/doc
# Upgrade to next version # Upgrade to next version
- MAJOR_DIGIT=`echo $VERSION | awk -F. '{print $1}'` - MAJOR_DIGIT=`echo $VERSION | awk -F. '{print $1}'`
- MINOR_DIGIT=`echo $VERSION | awk -F. '{print $2}'` - MINOR_DIGIT=`echo $VERSION | awk -F. '{print $2}'`
...@@ -90,8 +90,8 @@ Release and deploy on Production: ...@@ -90,8 +90,8 @@ Release and deploy on Production:
- NEW_VERSION="$MAJOR_DIGIT.$MINOR_DIGIT.$PATCH_DIGIT" - NEW_VERSION="$MAJOR_DIGIT.$MINOR_DIGIT.$PATCH_DIGIT"
- echo $NEW_VERSION - echo $NEW_VERSION
# Need to hack sed to work on both mac and unix. See details here : https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux # Need to hack sed to work on both mac and unix. See details here : https://stackoverflow.com/questions/5694228/sed-in-place-flag-that-works-both-on-mac-bsd-and-linux
- sed -i.bak s"/version__ = \"$VERSION\"/version__ = \"$NEW_VERSION\"/g" sam/__info__.py - sed -i.bak s"/version__ = \"$VERSION\"/version__ = \"$NEW_VERSION\"/g" samsam/__info__.py
- git add sam/__info__.py - git add samsam/__info__.py
- git commit -m "Upgrade project to next version $NEW_VERSION" - git commit -m "Upgrade project to next version $NEW_VERSION"
- git push origin master --quiet - git push origin master --quiet
when: manual when: manual
graft sam graft samsam
sam: Scaled Adaptive Metropolis samsam: Scaled Adaptive Metropolis SAMpler
=============================== ==========================================
Read the documentation at `<https://obswww.unige.ch/~delisle/sam/doc/>`_. Read the documentation at `<https://obswww.unige.ch/~delisle/samsam/doc/>`_.
import os import os
import sys import sys
import sam import samsam
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
project = 'sam' project = 'samsam'
copyright = '2021, Jean-Baptiste Delisle' copyright = '2021, Jean-Baptiste Delisle'
author = 'Jean-Baptiste Delisle' author = 'Jean-Baptiste Delisle'
......
sam documentation samsam documentation
================= ====================
The sam package provides two samplers: The samsam package provides two samplers:
- :doc:`_autosummary/sam.sam` : a Scaled Adaptive Metropolis algorithm (see [1]_, [2]_, [3]_), to robustly obtain samples from a target distribution, - :doc:`_autosummary/samsam.sam` : a Scaled Adaptive Metropolis algorithm (see [1]_, [2]_, [3]_), to robustly obtain samples from a target distribution,
- :doc:`_autosummary/sam.covis` : a COVariance Importance Sampling algorithm, to efficiently compute the model evidence (or other integrals). - :doc:`_autosummary/samsam.covis` : a COVariance Importance Sampling algorithm, to efficiently compute the model evidence (or other integrals).
It additionally includes tools (:doc:`_autosummary/sam.acf`) It additionally includes tools (:doc:`_autosummary/samsam.acf`)
to assess the convergence of the sam sampler (ACF, IAT), to assess the convergence of the sam sampler (ACF, IAT),
and a few commonly used prior distributions (:doc:`_autosummary/sam.logprior`). and a few commonly used prior distributions (:doc:`_autosummary/samsam.logprior`).
Installation Installation
------------ ------------
The sam package can be installed using the pip utility The samsam package can be installed using the pip utility
``pip install --extra-index-url https://obswww.unige.ch/~delisle sam`` ``pip install --extra-index-url https://obswww.unige.ch/~delisle samsam``
and upgraded with and upgraded with
``pip install --extra-index-url https://obswww.unige.ch/~delisle sam --upgrade`` ``pip install --extra-index-url https://obswww.unige.ch/~delisle samsam --upgrade``
Example Example
------- -------
...@@ -31,7 +31,7 @@ Let us first define a simple log-probability function: ...@@ -31,7 +31,7 @@ Let us first define a simple log-probability function:
In [1]: import numpy as np In [1]: import numpy as np
...: import matplotlib.pyplot as plt ...: import matplotlib.pyplot as plt
...: from sam import sam, covis, acf ...: from samsam import sam, covis, acf
...: from corner import corner ...: from corner import corner
...: np.random.seed(0) ...: np.random.seed(0)
...: ...:
...@@ -91,9 +91,9 @@ API Reference ...@@ -91,9 +91,9 @@ API Reference
:template: autosummary/custom_module.rst :template: autosummary/custom_module.rst
:recursive: :recursive:
sam samsam
sam.acf samsam.acf
sam.logprior samsam.logprior
References References
---------- ----------
......
...@@ -2,25 +2,25 @@ ...@@ -2,25 +2,25 @@
# Copyright 2021 Jean-Baptiste Delisle # Copyright 2021 Jean-Baptiste Delisle
# #
# This file is part of sam. # This file is part of samsam.
# #
# sam is free software: you can redistribute it and/or modify # samsam is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# sam is distributed in the hope that it will be useful, # samsam is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with sam. If not, see <http://www.gnu.org/licenses/>. # along with samsam. If not, see <http://www.gnu.org/licenses/>.
__title__ = 'sam' __title__ = 'samsam'
__description__ = 'Scaled Adaptive Metropolis.' __description__ = 'Scaled Adaptive Metropolis.'
__author__ = 'Jean-Baptiste Delisle' __author__ = 'Jean-Baptiste Delisle'
__author_email__ = 'jean-baptiste.delisle@unige.ch' __author_email__ = 'jean-baptiste.delisle@unige.ch'
__license__ = 'GPLv3' __license__ = 'GPLv3'
__url__ = 'https://gitlab.unige.ch/jean-baptiste.delisle/sam' __url__ = 'https://gitlab.unige.ch/jean-baptiste.delisle/samsam'
__version__ = "0.1.1" __version__ = "0.1.1"
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
# Copyright 2021 Jean-Baptiste Delisle # Copyright 2021 Jean-Baptiste Delisle
# #
# This file is part of sam. # This file is part of samsam.
# #
# sam is free software: you can redistribute it and/or modify # samsam is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# sam is distributed in the hope that it will be useful, # samsam is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with sam. If not, see <http://www.gnu.org/licenses/>. # along with samsam. If not, see <http://www.gnu.org/licenses/>.
import numpy as np import numpy as np
from .__info__ import __version__ from .__info__ import __version__
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
# Copyright 2021 Jean-Baptiste Delisle # Copyright 2021 Jean-Baptiste Delisle
# #
# This file is part of sam. # This file is part of samsam.
# #
# sam is free software: you can redistribute it and/or modify # samsam is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# sam is distributed in the hope that it will be useful, # samsam is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with sam. If not, see <http://www.gnu.org/licenses/>. # along with samsam. If not, see <http://www.gnu.org/licenses/>.
import numpy as np import numpy as np
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
# Copyright 2021 Jean-Baptiste Delisle # Copyright 2021 Jean-Baptiste Delisle
# #
# This file is part of sam. # This file is part of samsam.
# #
# sam is free software: you can redistribute it and/or modify # samsam is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# sam is distributed in the hope that it will be useful, # samsam is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with sam. If not, see <http://www.gnu.org/licenses/>. # along with samsam. If not, see <http://www.gnu.org/licenses/>.
import numpy as np import numpy as np
from scipy.special import beta as sp_beta from scipy.special import beta as sp_beta
......
name: sam name: samsam
channels: channels:
- conda-forge - conda-forge
dependencies: dependencies:
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
# Copyright 2021 Jean-Baptiste Delisle # Copyright 2021 Jean-Baptiste Delisle
# #
# This file is part of sam. # This file is part of samsam.
# #
# sam is free software: you can redistribute it and/or modify # samsam is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# sam is distributed in the hope that it will be useful, # samsam is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with sam. If not, see <http://www.gnu.org/licenses/>. # along with samsam. If not, see <http://www.gnu.org/licenses/>.
from setuptools import setup from setuptools import setup
import os import os
...@@ -23,7 +23,7 @@ import os ...@@ -23,7 +23,7 @@ import os
path = os.path.abspath(os.path.dirname(__file__)) path = os.path.abspath(os.path.dirname(__file__))
info = {} info = {}
with open(os.path.join(path, 'sam', '__info__.py'), 'r') as f: with open(os.path.join(path, 'samsam', '__info__.py'), 'r') as f:
exec(f.read(), info) exec(f.read(), info)
setup(name=info['__title__'], setup(name=info['__title__'],
...@@ -33,6 +33,6 @@ setup(name=info['__title__'], ...@@ -33,6 +33,6 @@ setup(name=info['__title__'],
license=info['__license__'], license=info['__license__'],
description=info['__description__'], description=info['__description__'],
url=info['__url__'], url=info['__url__'],
packages=['sam'], packages=['samsam'],
python_requires='>=3.6', python_requires='>=3.6',
install_requires=['numpy>=1.16', 'scipy>=1.2']) install_requires=['numpy>=1.16', 'scipy>=1.2'])
import pytest import pytest
import numpy as np import numpy as np
from sam import sam, covis, logprior, acf from samsam import sam, covis, logprior, acf
n = 4 n = 4
nsamples = 100000 nsamples = 100000
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment