Skip to content

Commit

Permalink
Merge pull request #28 from jbkalmbach/issue/23/add_setup
Browse files Browse the repository at this point in the history
Issue/23/add setup
  • Loading branch information
jbkalmbach authored Sep 13, 2018
2 parents 359193e + fbca78a commit cda960e
Show file tree
Hide file tree
Showing 43 changed files with 44 additions and 27 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ install:
- conda info -a

- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION
- conda install -c conda-forge numpy scipy matplotlib nose future scikit-learn
- conda install -c conda-forge codecov
- conda install -c conda-forge scikit-optimize
- conda install -c conda-forge numpy scipy matplotlib nose future scikit-learn codecov scikit-optimize
- source activate test-environment
- conda install coverage

Expand Down
23 changes: 23 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from setuptools import setup, find_packages

setup(
name="siggi",
version="0.1.0",
author="Bryce Kalmbach",
author_email="[email protected]",
url="https://github.com/jbkalmbach/siggi",
packages=find_packages(),
description="Spectral Information Gain Optimization",
long_description=open("README.md").read(),
package_data={"": ["README.md", "LICENSE"],
"siggi": ["data/*",
"data/lsst_baseline_throughputs/*"]},
include_package_data=True,
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python",
],
)
2 changes: 1 addition & 1 deletion siggi/calcIG.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, filter_dict, sed_list, sed_probs, sed_mags=22.0,
def calc_colors(self, return_all=False):

"""
Calculate the colors and errors in color measurement
Calculate the colors and errors in color measurement
of the SEDs in the given filters.
"""

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 6 additions & 2 deletions siggi/lsst_utils/BandpassDict.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,17 @@ def loadBandpassesFromFiles(cls,

@classmethod
def addSystemBandpass(cls, filter_dict,
bandpassDir=os.path.join(os.path.dirname(__file__),
'../../data/lsst_baseline_throughputs'),
bandpassDir=None,
components=['detector.dat', 'm1.dat', 'm2.dat',
'm3.dat', 'lens1.dat',
'lens2.dat', 'lens3.dat'],
atmosFile='atmos_std.dat'):

if bandpassDir is None:
bandpassDir = os.path.join(os.path.dirname(__file__),
'..', 'data',
'lsst_baseline_throughputs')

comp_list = [os.path.join(bandpassDir, comp) for comp in components]
comp_atmos_list = comp_list + [os.path.join(bandpassDir, atmosFile)]

Expand Down
2 changes: 1 addition & 1 deletion siggi/siggi.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, spec_list, spec_weights, z_prior,
self.z_probs.append(z_prior(z_val)*weight)

bp_dict_folder = os.path.join(os.path.dirname(__file__),
'../data',
'data',
'lsst_baseline_throughputs')
bp_dict = BandpassDict.loadTotalBandpassesFromFiles(
bandpassDir=bp_dict_folder)
Expand Down
6 changes: 3 additions & 3 deletions siggi/spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ def get_red_spectrum(self):

sed_obj = Sed()
sed_obj.readSED_flambda(os.path.join(os.path.dirname(__file__),
'../data/Inst.10E10.1Z.spec.gz'))
'data/Inst.10E10.1Z.spec.gz'))

return sed_obj

def get_blue_spectrum(self):

sed_obj = Sed()
sed_obj.readSED_flambda(os.path.join(os.path.dirname(__file__),
'../data/Inst.64E08.1Z.spec.gz'))
'data/Inst.64E08.1Z.spec.gz'))

return sed_obj

def get_dark_sky_spectrum(self):

sed_obj = Sed()
sky_sed = os.path.join(os.path.dirname(__file__),
'../data/lsst_baseline_throughputs',
'data/lsst_baseline_throughputs',
'darksky.dat')
sed_obj.readSED_flambda(sky_sed)

Expand Down
2 changes: 0 additions & 2 deletions tests/test_calcIG.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys
sys.path.append('..')
import unittest
import numpy as np
from siggi import filters, spectra, calcIG
Expand Down
2 changes: 0 additions & 2 deletions tests/test_filters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys
sys.path.append('..')
import unittest
import numpy as np
from siggi import filters
Expand Down
2 changes: 0 additions & 2 deletions tests/test_mathUtils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys
sys.path.append('..')
import unittest
import numpy as np
from scipy.spatial.distance import cdist
Expand Down
16 changes: 8 additions & 8 deletions tests/test_siggi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys
sys.path.append('..')
import os
import unittest
import pickle
Expand All @@ -21,7 +19,7 @@ def setUpClass(cls):
cls.frozen_dict = BandpassDict.loadTotalBandpassesFromFiles(
bandpassNames=['u', 'g'],
bandpassDir=os.path.join(os.path.dirname(__file__),
'../data',
'../siggi/data',
'lsst_baseline_throughputs'))

return
Expand Down Expand Up @@ -51,7 +49,7 @@ def prior_z(z, z0=0.5):
system_wavelen_max=1200.,
n_opt_points=14,
optimizer_verbosity=10,
procs=4,
procs=4,
acq_func_kwargs_dict={'kappa': 3},
frozen_filt_dict=self.frozen_dict,
frozen_filt_eff_wavelen=[365, 477],
Expand All @@ -65,7 +63,7 @@ def prior_z(z, z0=0.5):
system_wavelen_max=1200.,
n_opt_points=14,
optimizer_verbosity=10,
procs=4,
procs=4,
acq_func_kwargs_dict={'kappa': 3},
frozen_filt_dict=self.frozen_dict,
frozen_filt_eff_wavelen=[365, 477],
Expand All @@ -85,7 +83,7 @@ def prior_z(z, z0=0.5):
system_wavelen_max=1200.,
n_opt_points=10,
optimizer_verbosity=10,
procs=4,
procs=4,
acq_func_kwargs_dict={'kappa': 3},
frozen_filt_dict=self.frozen_dict,
frozen_filt_eff_wavelen=[365, 477],
Expand All @@ -104,21 +102,23 @@ def prior_z(z, z0=0.5):
system_wavelen_max=1200.,
n_opt_points=4,
optimizer_verbosity=10,
procs=4,
procs=4,
acq_func_kwargs_dict={'kappa': 3},
frozen_filt_dict=self.frozen_dict,
frozen_filt_eff_wavelen=[365, 477],
starting_points=None,
load_optimizer=test_opt,
rand_state=23)

np.testing.assert_array_equal(t_1.Xi, t_4.Xi)
np.testing.assert_array_equal(t_1.yi, t_4.yi)

@classmethod
def tearDownClass(cls):

os.remove('test.pkl')
os.remove('Xi.out')
os.remove('yi.out')

return

Expand Down
4 changes: 1 addition & 3 deletions tests/test_siggiBase.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import sys
sys.path.append('..')
import os
import unittest
from siggi import _siggiBase, filters, spectra, calcIG
Expand All @@ -20,7 +18,7 @@ def setUpClass(cls):
cls.frozen_dict = BandpassDict.loadTotalBandpassesFromFiles(
bandpassNames=['u', 'g'],
bandpassDir=os.path.join(os.path.dirname(__file__),
'../data',
'../siggi/data',
'lsst_baseline_throughputs'))

return
Expand Down

0 comments on commit cda960e

Please sign in to comment.