-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ellipticity, position angle correction in protodc2 GCR. #48
Merged
Merged
Changes from 23 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
4e488d0
Added sky area to the reader. Added a minor-minor version number. Mov…
dkorytov e054148
added ellipciticy to the exposed quantities
dkorytov a5bebf6
Changed version checking to use StrictVersion
dkorytov b38244c
add commas to end of dictionary creation/moditications
dkorytov 868dee0
updated the yaml files for the newer catalog version.
dkorytov 47839a5
changed quantity modifiers to be the lastest by default. Older catalo…
dkorytov 6456a18
Copied over Yao's method of getting the catlaog version
dkorytov 334accf
Corrected to use strictVersion for catalog version
dkorytov c119c41
removed unneeded parenthesis
dkorytov 4bbdfa3
get info quantities added
dkorytov 7fde16e
removed stray print
dkorytov 2ea4cd3
string casting for info dict. Commas and spaces
dkorytov e5df64e
Decode instead of casting to a string
dkorytov a2a5763
added None given -> None conversion
dkorytov 71cdfea
copied Yao's condensed implementation for get info quanties funcitons
dkorytov d18b2c1
imported warning
dkorytov b398cae
import warnginSSSS <- missed the s
dkorytov b6c41fc
added corrections to ellipticity_1 and position angle
dkorytov ac3862f
Added corrections to ellip1, position_angle. Included size_true
dkorytov 2ef50df
merged with upstream
dkorytov 19e92d5
Fixed commas. Used an explicit deg2rad function. Added comments. Remo…
dkorytov 7481f56
updated version number
dkorytov 0e7ce3c
re-added the sky area
dkorytov fdddb14
Ensured sky_area is a float
dkorytov d8f30b5
default sky area is a float
dkorytov 9e8ea45
used rad2deg function. Modified comments for clearity.
dkorytov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
from GCR import BaseGenericCatalog | ||
from distutils.version import StrictVersion | ||
__all__ = ['AlphaQGalaxyCatalog'] | ||
__version__ = '2.1.1.1' #version 1 for the 2.1.1 catalog reader | ||
|
||
|
||
class AlphaQGalaxyCatalog(BaseGenericCatalog): | ||
|
@@ -23,7 +24,7 @@ def _subclass_init(self, filename, **kwargs): | |
assert os.path.isfile(filename), 'Catalog file {} does not exist'.format(filename) | ||
self._file = filename | ||
self.lightcone = kwargs.get('lightcone') | ||
|
||
|
||
with h5py.File(self._file, 'r') as fh: | ||
self.cosmology = FlatLambdaCDM( | ||
|
@@ -38,8 +39,12 @@ def _subclass_init(self, filename, **kwargs): | |
catalog_version.append(fh['/metaData/version' + version_label].value) | ||
except KeyError: | ||
break | ||
|
||
catalog_version = StrictVersion('.'.join(map(str, catalog_version or (2, 0)))) | ||
catalog_version = StrictVersion('.'.join(map(str, catalog_version or (2, 0)))) | ||
if catalog_version >= StrictVersion("2.1.1"): | ||
self.sky_area = fh['metaData/skyArea'].value | ||
else: | ||
self.sky_area = 25 #If the sky area isn't specified use the default value of the sky area. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add |
||
config_version = StrictVersion(kwargs.get('version', '0.0')) | ||
if config_version != catalog_version: | ||
raise ValueError('Catalog file version {} does not match config version {}'.format(catalog_version, config_version)) | ||
|
@@ -65,7 +70,9 @@ def _subclass_init(self, filename, **kwargs): | |
'size_bulge_true': 'morphology/spheroidHalfLightRadius', | ||
'disk_sersic_index': 'morphology/diskSersicIndex', | ||
'bulge_sersic_index': 'morphology/spheroidSersicIndex', | ||
'ellipticity_1': 'morphology/totalEllipticity1', | ||
'position_angle': (lambda pos_angle: np.rad2deg(np.rad2deg(pos_angle)), 'morphology/positionAngle'), #I converted the units the wrong way, so a double conversion is required. | ||
'ellipticity_1': (lambda ellip2, pos_angle: ellip2/np.tan(2*pos_angle*(180.0/np.pi)), 'morphology/totalEllipticity2', 'morphology/positionAngle'), #By accident used a sin instead of cos when computing the value | ||
'size_true': (lambda size1, size2, lum1, lum2: ((size1*lum1)+(size2*lum2))/(lum1+lum2), 'morphology/diskHalfLightRadius', 'morphology/spheroidHalfLightRadius', 'LSST_filters/diskLuminositiesStellar:LSST_r:rest', 'LSST_filters/spheroidLuminositiesStellar:LSST_r:rest'), | ||
'ellipticity_2': 'morphology/totalEllipticity2', | ||
'position_x': 'x', | ||
'position_y': 'y', | ||
|
@@ -129,6 +136,7 @@ def native_quantity_getter(native_quantity): | |
yield native_quantity_getter | ||
|
||
|
||
|
||
def _get_native_quantity_info_dict(self, quantity, default=None): | ||
with h5py.File(self._file, 'r') as fh: | ||
quantity_key = 'galaxyProperties/' + quantity | ||
|
@@ -137,6 +145,7 @@ def _get_native_quantity_info_dict(self, quantity, default=None): | |
modifier = lambda k, v: None if k=='description' and v==b'None given' else v.decode() | ||
return {k: modifier(k, v) for k, v in fh[quantity_key].attrs.items()} | ||
|
||
|
||
|
||
def _get_quantity_info_dict(self, quantity, default=None): | ||
q_mod = self.get_quantity_modifier(quantity) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.6.8' | ||
__version__ = '0.6.9' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a line
__version__ = '2.1.1.1'
(or your preferred versioning scheme) to indicate the version of this reader file.