Skip to content

Commit

Permalink
Merge f50ebe6 into 55ed29f
Browse files Browse the repository at this point in the history
  • Loading branch information
rmjarvis committed May 7, 2018
2 parents 55ed29f + f50ebe6 commit 1fde44e
Show file tree
Hide file tree
Showing 174 changed files with 8,112 additions and 4,506 deletions.
4 changes: 2 additions & 2 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ coverage:
status:
project:
default:
target: 95%
target: 100%
threshold: 0%
branches: null

patch:
default:
target: 100%
threshold: 1%
threshold: 0%
branches: null

changes: false
Expand Down
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ branches:
only:
- master
- noboost
- '#755'

language: python
python:
Expand Down
48 changes: 24 additions & 24 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,29 @@ either pip or setup.py.
Dependency Changes
------------------

- Officially no longer support Python 2.6. (#755)
- No longer support pre-astropy versions of pyfits (now bundled in astropy
as astropy.io.fits). Nor astropy versions <1.0. (#755)
- No longer support pre-2016 version of the COSMOS catalog. You may be
asked to run galsim_download_cosmos again if your version is found to
be obsolete. (#755)
- Added LSSTDESC.Coord, which contains the functionality that used to be in
GalSim as the Angle and CelestialCoord classes. We moved it to a separate
repo so people could more easily use this functionality without requiring all
of GalSim as a dependency. (#809b)
- Removed dependency on boost. (#809)
- Removed dependency on TMV. (#809)
- Added dependency on pybind11. (#809)
- Added dependency on Eigen. (#809)
- Added dependency on pybind11. (You can still use boost if you want using
the SCons installation method.) (#809)
- Added dependency on Eigen. (You can still use TMV if you want using the
SCons installation method.) (#809)
- FFTW is now the only dependency that pip cannot handle automatically. (#809)
- Officially no longer support Python 2.6. (Pretty sure no one cares.)


API Changes
-----------

- Changed the order of arguments of galsim.wfirst.allDetectorEffects. (#755)
- Most of the functionality associated with C++-layer objects has been
redesigned or removed. These were non-public-API features, so if you have
been using the public API, you should be fine. But if you have been relying
Expand All @@ -49,12 +57,8 @@ API Changes
profile (unless the inclination angle is 0 degrees). (#809f)
- Removed galsim_yaml and galsim_json scripts, which were essentially just
aliases for galsim -f yaml and galsim -f json respectively. (#809f)
- Removed lsst module, which depended on the LSST stack and had gotten quite
out of sync and broken. (#964)


Bug Fixes
---------
- Removed the lsst module, which depended on the LSST stack and had gotten
quite out of sync and broken. (#964)


Deprecated Features
Expand All @@ -66,18 +70,14 @@ Deprecated Features
New Features
------------

- Added Zernike submodule. (#832, #951)
- Updated PhaseScreen wavefront and wavefront_gradient methods to accept `None`
as a valid time argument, which means to use the internally stored time in
the screen(s). (#864)
- Added SecondKick profile GSObject. (#864)
- Updated PhaseScreenPSFs to automatically include SecondKick objects when
being drawn with geometric photon shooting. (#864)
- Added option to use circular weight function in HSM adaptive moments code.
(#917)
- Added VonKarman profile GSObject. (#940)
- Added PhotonDCR surface op to apply DCR for photon shooting. (#955)
- Added astropy units as allowed values of wave_type in Bandpass. (#955)
- Added ability to get net pixel areas from the Silicon code for a given flux
image. (#963)
- Added ability to transpose the meaning of (x,y) in the Silicon class. (#963)
- Added a new class hierarchy for exceptions raised by GalSim with the base
class `GalSimError`, a subclass of `RuntimeError`. This provides a hook for
adding sub-classes, which may provide more specific information about the
nature of an error. So far, sub-classes include GalSimHSMError for errors
during HSM measurements and GalSimRangeError for attempted use of input
parameters outside of allowed ranges. (#755)
- Changed the type of warnings raised by GalSim to GalSimWarning, which is
a subclass of UserWarning. (#755)
- Changed the default maximum_fft_size in GSParams to 8192 from 4096. This
increases the potential memory used by an FFT when drawing an object with
an FFT from 256 MB to 1 GB. (#755)
25 changes: 10 additions & 15 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1328,8 +1328,8 @@ def GetPythonVersion(config):
# there:
if not result:
py_version = ''
for v in ['2.7', '2,6', '3.4', '3.5', # supported versions first
'2.5', '2,4', '3.3', '3.2', '3.1', '3.0']: # these are mostly to give accurate logging and error messages
for v in ['2.7', '3.4', '3.5', '3.6', # supported versions first
'2.6', '2.5', '2,4', '3.3', '3.2', '3.1', '3.0']: # these are mostly to give accurate logging and error messages
if v in py_inc or v in python:
py_version = v
break
Expand Down Expand Up @@ -1601,6 +1601,9 @@ PyMODINIT_FUNC initcheck_tmv(void)

def CheckEigen(config):
eigen_source_file = """
#if defined(__GNUC__) && __GNUC__ >= 6
#pragma GCC diagnostic ignored "-Wint-in-bool-context"
#endif
#include "Python.h"
#include "Eigen/Core"
#include "Eigen/Cholesky"
Expand Down Expand Up @@ -1763,24 +1766,16 @@ PyMODINIT_FUNC initcheck_numpy(void)
return 1

def CheckPyFITS(config):
config.Message('Checking for PyFITS... ')
config.Message('Checking for astropy.io.fits... ')

result, output = TryScript(config,"import pyfits",python)
astropy = False
if not result:
result, output = TryScript(config,"import astropy.io.fits",python)
astropy = True
result, output = TryScript(config,"import astropy.io.fits",python)
if not result:
ErrorExit("Unable to import pyfits or astropy.io.fits using the python executable:\n" +
ErrorExit("Unable to import astropy.io.fits using the python executable:\n" +
python)
config.Result(1)

if astropy:
result, astropy_ver = TryScript(config,"import astropy; print(astropy.__version__)",python)
print('Astropy version is',astropy_ver)
else:
result, pyfits_ver = TryScript(config,"import pyfits; print(pyfits.__version__)",python)
print('PyFITS version is',pyfits_ver)
result, astropy_ver = TryScript(config,"import astropy; print(astropy.__version__)",python)
print('Astropy version is',astropy_ver)

return 1

Expand Down
2 changes: 1 addition & 1 deletion examples/check_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def report(file_name1, file_name2):
try:
f1 = pyfits.open(file_name1)
f2 = pyfits.open(file_name2)
except IOError as e:
except (IOError, OSError) as e:
# Then either at least one of the files doesn't exist, which diff can report for us,
# or the files are txt files, which diff can also do.
return report_txt(file_name1, file_name2)
Expand Down
13 changes: 11 additions & 2 deletions galsim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@
from .scene import COSMOSCatalog
from .table import LookupTable, LookupTable2D

# Exception and Warning classes
from .errors import GalSimError, GalSimRangeError, GalSimValueError
from .errors import GalSimKeyError, GalSimIndexError, GalSimNotImplementedError
from .errors import GalSimBoundsError, GalSimUndefinedBoundsError, GalSimImmutableError
from .errors import GalSimIncompatibleValuesError, GalSimSEDError, GalSimHSMError
from .errors import GalSimFFTSizeError
from .errors import GalSimConfigError, GalSimConfigValueError
from .errors import GalSimWarning, GalSimDeprecationWarning

# Image
from .image import Image, ImageS, ImageI, ImageF, ImageD, ImageCF, ImageCD, ImageUS, ImageUI, _Image

Expand Down Expand Up @@ -168,8 +177,8 @@
from .sensor import Sensor, SiliconSensor
from . import detectors # Everything here is a method of Image, so nothing to import by name.

# Deprecation warning class
from .deprecated import GalSimDeprecationWarning
# Deprecated functionality
from . import deprecated

# Packages we intentionally keep separate. E.g. requires galsim.fits.read(...)
from . import fits
Expand Down
1 change: 1 addition & 0 deletions galsim/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
#

from .main import main

main()
15 changes: 3 additions & 12 deletions galsim/_pyfits.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,9 @@
# and/or other materials provided with the distribution.
#

# Make it so we can use either pyfits or astropy.io.fits as pyfits.
# We used to support legacy pyfits in addition to astropy.io.fits. We still call
# astropy.io.fits in the code, but we have removed the legacy compatibility hacks.

try:
import astropy.io.fits as pyfits
# astropy started their versioning over at 0. (Understandably.)
# To make this seamless with pyfits versions, we add 4 to the astropy version.
from astropy import version as astropy_version
pyfits_version = str( (4 + astropy_version.major) + astropy_version.minor/10.)
pyfits_str = 'astropy.io.fits'
except ImportError:
import pyfits
pyfits_version = pyfits.__version__
pyfits_str = 'pyfits'
import astropy.io.fits as pyfits


22 changes: 15 additions & 7 deletions galsim/airy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from .gsparams import GSParams
from .utilities import lazy_property, doc_inherit
from .position import PositionD
from .errors import GalSimIncompatibleValuesError, GalSimNotImplementedError, convert_cpp_errors


class Airy(GSObject):
Expand Down Expand Up @@ -127,11 +128,15 @@ def __init__(self, lam_over_diam=None, lam=None, diam=None, obscuration=0., flux
# docstring.
if lam_over_diam is not None:
if lam is not None or diam is not None:
raise TypeError("If specifying lam_over_diam, then do not specify lam or diam")
raise GalSimIncompatibleValuesError(
"If specifying lam_over_diam, then do not specify lam or diam",
lam_over_diam=lam_over_diam, lam=lam, diam=diam)
self._lod = float(lam_over_diam)
else:
if lam is None or diam is None:
raise TypeError("If not specifying lam_over_diam, then specify lam AND diam")
raise GalSimIncompatibleValuesError(
"If not specifying lam_over_diam, then specify lam AND diam",
lam_over_diam=lam_over_diam, lam=lam, diam=diam)
# In this case we're going to use scale_unit, so parse it in case of string input:
if isinstance(scale_unit, str):
scale_unit = AngleUnit.from_name(scale_unit)
Expand All @@ -141,7 +146,8 @@ def __init__(self, lam_over_diam=None, lam=None, diam=None, obscuration=0., flux

@lazy_property
def _sbp(self):
return _galsim.SBAiry(self._lod, self._obscuration, self._flux, self.gsparams._gsp)
with convert_cpp_errors():
return _galsim.SBAiry(self._lod, self._obscuration, self._flux, self.gsparams._gsp)

@property
def lam_over_diam(self): return self._lod
Expand All @@ -158,8 +164,9 @@ def half_light_radius(self):
else:
# In principle can find the half light radius as a function of lam_over_diam and
# obscuration too, but it will be much more involved...!
raise NotImplementedError("Half light radius calculation not implemented for Airy "+
"objects with non-zero obscuration.")
raise GalSimNotImplementedError(
"Half light radius calculation not implemented for Airy "
"objects with non-zero obscuration.")

@property
def fwhm(self):
Expand All @@ -171,8 +178,9 @@ def fwhm(self):
else:
# In principle can find the FWHM as a function of lam_over_diam and obscuration too,
# but it will be much more involved...!
raise NotImplementedError("FWHM calculation not implemented for Airy "+
"objects with non-zero obscuration.")
raise GalSimNotImplementedError(
"FWHM calculation not implemented for Airy "
"objects with non-zero obscuration.")

def __eq__(self, other):
return (isinstance(other, Airy) and
Expand Down

0 comments on commit 1fde44e

Please sign in to comment.