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:
stage: build
before_script:
- export PATH=$PATH:/opt/anaconda3/bin/
- conda env create -f sam_env.yml
- conda activate sam
- conda env create -f samsam_env.yml
- conda activate samsam
script:
- python setup.py sdist
after_script:
- conda deactivate
- conda env remove -n sam
- conda env remove -n samsam
artifacts:
paths:
- dist/*.tar.gz
......@@ -25,29 +25,29 @@ Run test:
stage: test
before_script:
- export PATH=$PATH:/opt/anaconda3/bin/
- conda env create -f sam_env.yml
- conda activate sam
- conda env create -f samsam_env.yml
- conda activate samsam
script:
- pip install dist/*.tar.gz
- cd test
- python -m pytest
after_script:
- conda deactivate
- conda env remove -n sam
- conda env remove -n samsam
Generate documentation:
stage: documentation
before_script:
- export PATH=$PATH:/opt/anaconda3/bin/
- conda env create -f sam_env.yml
- conda activate sam
- conda env create -f samsam_env.yml
- conda activate samsam
script:
- pip install dist/*.tar.gz
- cd doc
- make html
after_script:
- conda deactivate
- conda env remove -n sam
- conda env remove -n samsam
artifacts:
paths:
- doc/build/html
......@@ -56,9 +56,9 @@ Generate documentation:
Deploy on Staging:
stage: staging
script:
- cp dist/*.tar.gz /www/people/delisle/public/staging/sam
- rm -rf /www/people/delisle/public/staging/sam/doc/*
- cp -R doc/build/html/* /www/people/delisle/public/staging/sam/doc
- cp dist/*.tar.gz /www/people/delisle/public/staging/samsam
- rm -rf /www/people/delisle/public/staging/samsam/doc/*
- cp -R doc/build/html/* /www/people/delisle/public/staging/samsam/doc
Release and deploy on Production:
stage: production
......@@ -68,20 +68,20 @@ Release and deploy on Production:
- git checkout -B master origin/master
- git config --global user.name 'Gitlab CI'
- 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:
# 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"
- 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
- CHANGES=`cat CHANGES.txt`
# 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
- cp dist/*.tar.gz /www/people/delisle/public/sam
- rm -rf /www/people/delisle/public/sam/doc/*
- cp -R doc/build/html/* /www/people/delisle/public/sam/doc
- cp dist/*.tar.gz /www/people/delisle/public/samsam
- rm -rf /www/people/delisle/public/samsam/doc/*
- cp -R doc/build/html/* /www/people/delisle/public/samsam/doc
# Upgrade to next version
- MAJOR_DIGIT=`echo $VERSION | awk -F. '{print $1}'`
- MINOR_DIGIT=`echo $VERSION | awk -F. '{print $2}'`
......@@ -90,8 +90,8 @@ Release and deploy on Production:
- NEW_VERSION="$MAJOR_DIGIT.$MINOR_DIGIT.$PATCH_DIGIT"
- 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
- sed -i.bak s"/version__ = \"$VERSION\"/version__ = \"$NEW_VERSION\"/g" sam/__info__.py
- git add sam/__info__.py
- sed -i.bak s"/version__ = \"$VERSION\"/version__ = \"$NEW_VERSION\"/g" samsam/__info__.py
- git add samsam/__info__.py
- git commit -m "Upgrade project to next version $NEW_VERSION"
- git push origin master --quiet
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 sys
import sam
import samsam
# -- Project information -----------------------------------------------------
project = 'sam'
project = 'samsam'
copyright = '2021, 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/sam.covis` : a COVariance Importance Sampling algorithm, to efficiently compute the model evidence (or other integrals).
- :doc:`_autosummary/samsam.sam` : a Scaled Adaptive Metropolis algorithm (see [1]_, [2]_, [3]_), to robustly obtain samples from a target distribution,
- :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),
and a few commonly used prior distributions (:doc:`_autosummary/sam.logprior`).
and a few commonly used prior distributions (:doc:`_autosummary/samsam.logprior`).
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
``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
-------
......@@ -31,7 +31,7 @@ Let us first define a simple log-probability function:
In [1]: import numpy as np
...: import matplotlib.pyplot as plt
...: from sam import sam, covis, acf
...: from samsam import sam, covis, acf
...: from corner import corner
...: np.random.seed(0)
...:
......@@ -91,9 +91,9 @@ API Reference
:template: autosummary/custom_module.rst
:recursive:
sam
sam.acf
sam.logprior
samsam
samsam.acf
samsam.logprior
References
----------
......
......@@ -2,25 +2,25 @@
# 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
# the Free Software Foundation, either version 3 of the License, or
# (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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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.'
__author__ = 'Jean-Baptiste Delisle'
__author_email__ = 'jean-baptiste.delisle@unige.ch'
__license__ = 'GPLv3'
__url__ = 'https://gitlab.unige.ch/jean-baptiste.delisle/sam'
__url__ = 'https://gitlab.unige.ch/jean-baptiste.delisle/samsam'
__version__ = "0.1.1"
......@@ -2,20 +2,20 @@
# 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
# the Free Software Foundation, either version 3 of the License, or
# (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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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
from .__info__ import __version__
......
......@@ -2,20 +2,20 @@
# 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
# the Free Software Foundation, either version 3 of the License, or
# (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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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
......
......@@ -2,20 +2,20 @@
# 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
# the Free Software Foundation, either version 3 of the License, or
# (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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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
from scipy.special import beta as sp_beta
......
name: sam
name: samsam
channels:
- conda-forge
dependencies:
......
......@@ -2,20 +2,20 @@
# 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
# the Free Software Foundation, either version 3 of the License, or
# (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
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# 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
import os
......@@ -23,7 +23,7 @@ import os
path = os.path.abspath(os.path.dirname(__file__))
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)
setup(name=info['__title__'],
......@@ -33,6 +33,6 @@ setup(name=info['__title__'],
license=info['__license__'],
description=info['__description__'],
url=info['__url__'],
packages=['sam'],
packages=['samsam'],
python_requires='>=3.6',
install_requires=['numpy>=1.16', 'scipy>=1.2'])
import pytest
import numpy as np
from sam import sam, covis, logprior, acf
from samsam import sam, covis, logprior, acf
n = 4
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