Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
a50720b
Convert RuntimeErrors raised by GalSim into GalSimErrors
rmjarvis Apr 22, 2018
145ed04
Use GalSimWarning for GalSim-emitted warnings
rmjarvis Apr 22, 2018
a7350aa
Use GalSimRangeError when user values are outside of allowed ranges
rmjarvis Apr 22, 2018
aa6bf25
Change default maximum_fft_size to 8192
rmjarvis Apr 22, 2018
f164168
Extend GalSimRangeError to more uses that had been ValueError
rmjarvis Apr 22, 2018
36e90a8
Use GalSimBoundsError for when positions fall outside allowed bounds
rmjarvis Apr 22, 2018
41b4d10
Use GalSimValueError for invalid parameter values
rmjarvis Apr 22, 2018
6fce80d
Use GalSimSEDError for cases of dimensional/spectral SED errors
rmjarvis Apr 22, 2018
bd1e630
Use GalSimImmutableError for cases of trying to modify an immutable I…
rmjarvis Apr 22, 2018
da1b2c3
Use GalSimUndefinedBoundsError for cases where a defined bounds is re…
rmjarvis Apr 22, 2018
2bfbe8f
Use GalSimIncompatibleValuesError for combinations of values that are…
rmjarvis Apr 23, 2018
e9703f2
Convert some TypeErrors into one of our new error classes
rmjarvis Apr 23, 2018
b976487
Favor OSError over IOError. (In py3, they are equivalent, but OSErro…
rmjarvis Apr 23, 2018
b5b510e
Add notes to developers giving guidance about which error to raise.
rmjarvis Apr 23, 2018
43852f2
Convert a few GalSimErrors into more specific exceptions
rmjarvis Apr 23, 2018
827c7e5
Move EnsureDir function to utilities
rmjarvis Apr 23, 2018
b4fc371
Use GalSimConfigError for errors processing config files
rmjarvis Apr 23, 2018
ea04155
Add basic tests of error object functionality
rmjarvis Apr 23, 2018
dc4e625
Move GalSimDeprecationWarning to errors.py
rmjarvis Apr 23, 2018
093c452
Update exceptions in des module
rmjarvis Apr 23, 2018
f1f5077
Update errors in wfirst module
rmjarvis Apr 23, 2018
49795ef
Check coverage on this branch
rmjarvis Apr 23, 2018
4a375e2
Missed a GalSimWarning
rmjarvis Apr 23, 2018
4a19e90
Allow for either order in dict -> str for GalSimIncompatibleValuesErr…
rmjarvis Apr 24, 2018
228ea8a
Some cleanup now that we are officially not supporting 2.6
rmjarvis Apr 24, 2018
756ca84
Improve test coverage of config module: values
rmjarvis Apr 24, 2018
23ce8ef
Improve test coverage of config module: gsobject
rmjarvis Apr 24, 2018
da6f3ed
Improve test coverage of config module: noise
rmjarvis Apr 24, 2018
495c2f3
Improve test coverage of config module: whiten
rmjarvis Apr 24, 2018
9294139
Improve test coverage of config module: wcs
rmjarvis Apr 24, 2018
2850c6e
Improve test coverage of config module: image
rmjarvis Apr 24, 2018
2eebfa7
Improve test coverage of config module: image_scattered
rmjarvis Apr 24, 2018
4df29a5
Improve test coverage of config module: image_tiled
rmjarvis Apr 24, 2018
69e449c
Improve test coverage of config module: blendset
rmjarvis Apr 24, 2018
f0aa0de
Improve test coverage of config module: power_spectrum
rmjarvis Apr 25, 2018
9090029
Improve test coverage of config module: input
rmjarvis Apr 25, 2018
d3f7ed2
Improve test coverage of config module: extra_psf
rmjarvis Apr 26, 2018
23b3aeb
Improve test coverage of config module: output
rmjarvis Apr 26, 2018
7490546
Relax psf flux test slightly.
rmjarvis Apr 26, 2018
782588c
Add a few tests for config that I missed
rmjarvis Apr 26, 2018
3e67415
Increase test coverage of des module
rmjarvis Apr 26, 2018
0224e5a
Don't support pre-astropy pyfits anymore
rmjarvis Apr 27, 2018
b569fef
Increase test coverage of wfirst module
rmjarvis Apr 27, 2018
42c312c
Increase test coverage of bandpass
rmjarvis Apr 27, 2018
4669445
Don't guard against ImportError for yaml in tests that use it.
rmjarvis Apr 27, 2018
e09e406
Increase test coverage of catalog
rmjarvis Apr 27, 2018
2d3c74e
Increase test coverage of cdmodel
rmjarvis Apr 27, 2018
f9e40ab
Increase test coverage of chromatic
rmjarvis Apr 28, 2018
3e09f61
Increase test coverage of gsobjects
rmjarvis Apr 28, 2018
088d72e
Increase test coverage of interpolatedimage
rmjarvis Apr 28, 2018
6d5533d
Increase test coverage of realgalaxy
rmjarvis Apr 29, 2018
6f9bfe0
Increase test coverage of realgalaxy
rmjarvis May 4, 2018
63d7c58
Increase test coverage of image
rmjarvis Apr 29, 2018
44c9cb0
Increase test coverage of table
rmjarvis Apr 29, 2018
094e0a5
Increase test coverage of lensing
rmjarvis Apr 29, 2018
e5d9162
Use convert_cpp_errors() context to convert C++ errors into GalSimErrors
rmjarvis May 4, 2018
cbcca5b
Increase test coverage of wcs
rmjarvis Apr 30, 2018
8ec9e1e
Increase test coverage of scene
rmjarvis May 1, 2018
a61b39e
Increase test coverage of phase_psf
rmjarvis May 1, 2018
b89bf1b
Increase test coverage of correlatednoise
rmjarvis May 1, 2018
ed71522
Add GalSimNotImplementedError for things that aren't invalid, just no…
rmjarvis May 2, 2018
0f3f752
Some fixes for Python 3
rmjarvis May 3, 2018
ad68e14
Clean up gzip and bzip2 file handling.
rmjarvis May 4, 2018
4e32c9c
Fix des_meds usage with no PSF
rmjarvis May 4, 2018
967ed39
Remove some handling of old astropy versions in AstropyWCS code
rmjarvis May 4, 2018
8137eac
Various improvements to test suite coverage
rmjarvis May 4, 2018
e43d447
Allow non-standard samples. Addresses some of desiderata in #795
rmjarvis May 4, 2018
659483b
A few more test coverage bits
rmjarvis May 4, 2018
d241184
Make OpticalPSF _psf a lazy_property, so wfirst psf tests don't take …
rmjarvis May 4, 2018
d78da34
Require 100% codecov going forward
rmjarvis May 4, 2018
54d3e73
Fix gcc6 warnings
rmjarvis May 5, 2018
deaa730
Use BuildFile rather than Process for des_meds tests to avoid implici…
rmjarvis May 6, 2018
9a14ee8
Add GalSimFFTSizeError
rmjarvis May 7, 2018
745f548
Typos, word choice, etc.
rmjarvis May 7, 2018
833fe39
Don't cover check for race condition in lock.acquire()
rmjarvis May 7, 2018
ed40205
Move maximum_fft_size item in CHANGELOG to API change
rmjarvis May 11, 2018
af74a89
typos
jmeyers314 May 16, 2018
f06cfb5
Update text about GalSimError in CHANGELOG
rmjarvis May 17, 2018
0fbc894
Switch EnsureDir to ensure_dir to match more common style in utilitie…
rmjarvis May 17, 2018
8e9631b
Use convert_cpp_errors for InterpolatedImage._shoot
rmjarvis May 17, 2018
eeeb63f
Use tuples rather than lists when used in immutable context
rmjarvis May 17, 2018
f0424c4
Remove unused f1,f2 variables in rho
rmjarvis May 17, 2018
ecb8dd9
Add text of original error if COSMOS noise file can't be read.
rmjarvis May 17, 2018
7285697
Change a couple GalSimConfigErrors into GalSimConfigValueError
rmjarvis May 17, 2018
b33043e
typos
rmjarvis May 17, 2018
2b79c69
Add galsim_warn helper function to simplify code that raises a GalSim…
rmjarvis May 17, 2018
9e57ddd
Simplify checks of valid PSFEx file, and add test that invalid file r…
rmjarvis May 17, 2018
24bd2f9
Switch combination of index and n_random from warning to error
rmjarvis May 17, 2018
cafc380
Add profile context to make it quicker to profile bits of test code
rmjarvis May 17, 2018
aba90f3
Add coverage of some warnings that weren't being covered
rmjarvis May 17, 2018
6697f88
Use LoggerWrapper in real.py for logger statements
rmjarvis May 17, 2018
20acef6
A few more coverage additions
rmjarvis May 17, 2018
3f2b197
Remove unnecessary decode lines
rmjarvis May 18, 2018
0c804e2
Just set truediv = div, rather then defining it as a new function
rmjarvis May 18, 2018
c39435e
Add another test of no photons warning
rmjarvis May 18, 2018
1523340
Make sure test of RandomGaussian with min/max has to loop at least once.
rmjarvis May 18, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
49 changes: 30 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,38 @@ Changes from v1.6 to v2.0

The principal change in GalSim 2.0 is that it is now pip installable.
See the updated INSTALL file for details on how to install GalSim using
either pip or setup.py.
either pip or setup.py. The functionality is essentially equivalent to
v1.6, although there are a few (mostly minor) API changes in some classes.

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 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)
- 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 Down Expand Up @@ -55,6 +67,10 @@ API Changes

Bug Fixes
---------
=======
- Removed the lsst module, which depended on the LSST stack and had gotten
quite out of sync and broken. (#964)
>>>>>>> Change default maximum_fft_size to 8192


Deprecated Features
Expand All @@ -66,18 +82,13 @@ 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`. For complete details
about the various sub-classes within this hierarchy, see the file errors.py.
In most cases, if you were catching a specific exception such as ValueError
or RuntimeError, the new error will still be caught properly. However, some
cases have changed to an incompatible error type, so users who have written
`except` statements with specific error types should be careful to make
sure that the errors you wanted to catch are still being caught. (#755)
- Changed the type of warnings raised by GalSim to GalSimWarning, which is
a subclass of UserWarning. (#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 pyfits 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
Loading