Skip to content

Commit

Permalink
Merge pull request #26 from kaklise/master
Browse files Browse the repository at this point in the history
Updates to support Pandas 1.0 and other minor changes
  • Loading branch information
kaklise authored Feb 28, 2020
2 parents 802b252 + efc441e commit d75bb05
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 46 deletions.
10 changes: 1 addition & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ sudo: false # if false, use TravisCI's container based build

matrix:
include:
- python: 2.7
env: CONDA_ENV=py27
services:
- xvfb
- python: 3.5
env: CONDA_ENV=py35
services:
Expand Down Expand Up @@ -47,11 +43,7 @@ before_script:
before_install:
- echo "before install"
- export PATH=/usr/lib/ccache:$PATH
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget http://repo.continuum.io/miniconda/Miniconda-3.16.0-Linux-x86_64.sh -O miniconda.sh;
else
wget http://repo.continuum.io/miniconda/Miniconda3-3.16.0-Linux-x86_64.sh -O miniconda.sh;
fi
- wget http://repo.continuum.io/miniconda/Miniconda3-3.16.0-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
License Notice==============Copyright 2016-2019 National Technology & Engineering Solutions of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights in this software.This software is distributed under the Revised BSD License.Chama also leverages a variety of third-party software packages, whichhave separate licensing policies. Revised BSD License-------------------Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.* Neither the name of Sandia National Laboratories, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FORA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHTOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITEDTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDINGNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THISSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License Notice==============Copyright 2016 National Technology & Engineering Solutions of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights in this software.This software is distributed under the Revised BSD License.Chama also leverages a variety of third-party software packages, whichhave separate licensing policies. Revised BSD License-------------------Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditionsare met:* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.* Neither the name of Sandia National Laboratories, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOTLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FORA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHTOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITEDTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDINGNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THISSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
![Chama](documentation/figures/logo.png)
=======================================
=========================================

[![TravisCI](https://travis-ci.org/sandialabs/chama.svg?branch=master)](https://travis-ci.org/sandialabs/chama)
[![Coverage Status](https://coveralls.io/repos/github/sandialabs/chama/badge.svg?branch=master)](https://coveralls.io/github/sandialabs/chama?branch=master)
[![Documentation Status](https://readthedocs.org/projects/chama/badge/?version=latest)](http://chama.readthedocs.io/en/latest/?badge=latest)
[![Downloads](https://pepy.tech/badge/chama)](https://pepy.tech/project/chama)

Continuous or regularly scheduled monitoring has the potential to quickly
identify changes in the environment. However, even with low-cost sensors, only
Expand Down
4 changes: 2 additions & 2 deletions chama/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from chama import optimize
from chama import graphics

__version__ = '0.1.2'
__version__ = '0.1.3'

__copyright__ = """Copyright 2016-2019 National Technology & Engineering
__copyright__ = """Copyright 2016 National Technology & Engineering
Solutions of Sandia, LLC (NTESS). Under the terms of Contract
DE-NA0003525 with NTESS, the U.S. Government retains certain rights
in this software."""
Expand Down
17 changes: 15 additions & 2 deletions chama/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,21 @@ def _get_signal_at_sample_points(self, signal, sample_points,

# Get subset of signal. If a sample point is not in signal then NaN
# is inserted
signal_subset = signal.loc[sample_points, :]

try:
signal_subset = signal.loc[sample_points, :]
except: # Some sample points are not in the signal
if ['T', 'X', 'Y', 'Z'] == signal.index.names:
signal_subset = pd.DataFrame(data=np.nan, columns=signal.columns,
index=pd.MultiIndex.from_tuples(sample_points, names=['T', 'X', 'Y', 'Z']))
elif ['T', 'Node'] == signal.index.names:
signal_subset = pd.DataFrame(data=np.nan, columns=signal.columns,
index=pd.MultiIndex.from_tuples(sample_points, names=['T', 'Node']))
else:
raise ValueError('Unrecognized signal format')

sample_points_in_signal = list(set(sample_points).intersection(set(signal.index)))
signal_subset.loc[sample_points_in_signal, :] = signal.loc[sample_points_in_signal, :]

if interp_method is None:
return signal_subset

Expand Down
13 changes: 0 additions & 13 deletions ci/requirements-py27.yml

This file was deleted.

7 changes: 4 additions & 3 deletions documentation/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import sys
import os
import shlex
from chama import __version__

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -66,17 +67,17 @@

# General information about the project.
project = u'Chama'
copyright = u'2016-2019, National Technology & Engineering Solutions of Sandia, LLC (NTESS)'
copyright = u'2016 National Technology & Engineering Solutions of Sandia, LLC (NTESS)'
author = u'Sandia National Laboratories'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.1.2'
version = __version__
# The full version, including alpha/beta/rc tags.
release = '0.1.2'
release = __version__

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
5 changes: 1 addition & 4 deletions documentation/environment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
name: chama
channels:
- conda-forge
- defaults
dependencies:
- python=3.7
- numpy
Expand All @@ -10,4 +7,4 @@ dependencies:
- sphinx
- numpydoc
- matplotlib
- pyomo

2 changes: 1 addition & 1 deletion documentation/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Installation
======================================

Chama requires Python (2.7, 3.5, 3.6, or 3.7) along with several Python package dependencies.
Chama requires Python (tested on 3.5, 3.6, and 3.7) along with several Python package dependencies.
Information on installing and using Python can be found at
https://www.python.org/.
Python distributions, such as Anaconda, are recommended to manage the Python interface.
Expand Down
2 changes: 1 addition & 1 deletion documentation/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Copyright
------------
.. code-block:: none
Copyright 2016-2019 National Technology & Engineering Solutions of Sandia,
Copyright 2016 National Technology & Engineering Solutions of Sandia,
LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
Government retains certain rights in this software.
Expand Down
2 changes: 2 additions & 0 deletions documentation/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
Release notes
================

.. include:: whatsnew/v0.1.3.rst

.. include:: whatsnew/v0.1.2.rst

.. include:: whatsnew/v0.1.1.rst
Expand Down
7 changes: 7 additions & 0 deletions documentation/whatsnew/v0.1.3.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
v0.1.3 (February 28, 2020)
----------------------------

* Updated methods to be compatible with Pandas 1.0
* Added required dependencies to setup.py
* Dropped Python 2.7 tests
* Updated documentation
35 changes: 26 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
from setuptools import setup, find_packages
from distutils.core import Extension
import os
import re

DISTNAME = 'chama'
VERSION = '0.1.2'
PACKAGES = ['chama']
EXTENSIONS = []
DESCRIPTION = 'Sensor Placement Optimization.'
LONG_DESCRIPTION = open('README.md').read()
AUTHOR = 'Chama developers'
MAINTAINER_EMAIL = '[email protected]'
LICENSE = 'Revised BSD'
URL = 'https://github.com/sandialabs/chama'
DEPENDENCIES = ['pyomo', 'pandas', 'numpy', 'scipy']

setuptools_kwargs = {
'zip_safe': False,
'install_requires': [],
'scripts': [],
'include_package_data': True
}
# use README file as the long description
file_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(file_dir, 'README.md'), encoding='utf-8') as f:
LONG_DESCRIPTION = f.read()

# use README file as the long description
file_dir = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(file_dir, 'README.md'), encoding='utf-8') as f:
LONG_DESCRIPTION = f.read()

# get version from __init__.py
with open(os.path.join(file_dir, 'chama', '__init__.py')) as f:
version_file = f.read()
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
VERSION = version_match.group(1)
else:
raise RuntimeError("Unable to find version string.")

setup(name=DISTNAME,
version=VERSION,
packages=PACKAGES,
Expand All @@ -29,4 +43,7 @@
maintainer_email=MAINTAINER_EMAIL,
license=LICENSE,
url=URL,
**setuptools_kwargs)
zip_safe=False,
install_requires=DEPENDENCIES,
scripts=[],
include_package_data=True)

0 comments on commit d75bb05

Please sign in to comment.