Skip to content

Commit

Permalink
distribution bugfix (2.3.54 release) (#528)
Browse files Browse the repository at this point in the history
* updates `distl` to convert units with recent changes to astropy.  See also the changes in 2.3.51 and 2.3.52.
* fixes median introduced in 2.3.52 to act on distribution object instead of just arrays.
  • Loading branch information
kecnry authored Sep 18, 2021
1 parent d53950f commit 840a067
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ To understand how to use PHOEBE, please consult the [tutorials, scripts and manu
CHANGELOG
----------

### 2.3.54 - distribution bugfix

* updates `distl` to convert units with recent changes to astropy. See also the changes in 2.3.51 and 2.3.52.
* fixes median introduced in 2.3.52 to act on distribution object instead of just arrays.

### 2.3.53 - adopt_solution adopt_values bugfix

* adopting a solution with `adopt_values=True` for a sampler solver will now adopt the median from the samples rather than the mean, to be consistent with the central values reported by the distributions themselves.
Expand Down
2 changes: 1 addition & 1 deletion phoebe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""

__version__ = '2.3.53'
__version__ = '2.3.54'

import os as _os
import sys as _sys
Expand Down
38 changes: 21 additions & 17 deletions phoebe/dependencies/distl/distl.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,29 @@
_builtin_attrs = ['unit', 'label', 'wrap_at', 'dimension', 'dist_constructor_argnames', 'dist_constructor_args', 'dist_constructor_func', 'dist_constructor_object']

_physical_types_to_solar = {'length': 'solRad',
'mass': 'solMass',
'temperature': 'solTeff',
'power': 'solLum',
'time': 'd',
'speed': 'solRad/d',
'angle': 'rad',
'angular speed': 'rad/d',
'dimensionless': ''}

_physical_types_to_si = {'length': 'm',
'mass': 'kg',
'temperature': 'K',
'power': 'W',
'time': 's',
'speed': 'm/s',
'area': 'solRad2',
'volume': 'solRad3',
'mass': 'solMass',
'temperature': 'solTeff',
'power': 'solLum',
'time': 'd',
'speed': 'solRad/d',
'angle': 'rad',
'angular speed': 'rad/s',
'angular speed': 'rad/d',
'dimensionless': ''}

_physical_types_to_si = {'length': 'm',
'area': 'm2',
'volume': 'm3',
'mass': 'kg',
'temperature': 'K',
'power': 'W',
'time': 's',
'speed': 'm/s',
'angle': 'rad',
'angular speed': 'rad/s',
'dimensionless': ''}

def _uniqueid(n=20):
return ''.join(_random.SystemRandom().choice(
_string.ascii_uppercase +_string.ascii_lowercase)
Expand Down Expand Up @@ -2102,7 +2106,7 @@ def to_solar(self, strip_units=False):
-------------
* distribution object
"""
physical_type = self.unit.physical_type
physical_type = str(self.unit.physical_type)

if physical_type not in _physical_types_to_solar.keys():
raise NotImplementedError("cannot convert object with physical_type={} to solar units".format(physical_type))
Expand Down
5 changes: 3 additions & 2 deletions phoebe/frontend/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -12073,9 +12073,10 @@ def adopt_solution(self, solution=None,
changed_params.append(param)

if index is None:
param.set_value(value=np.median(dist.slice(i)), unit=dist.slice(i).unit)
# NOTE: .median() is necesary over np.median() since its acting on a distl object
param.set_value(value=dist.slice(i).median(), unit=dist.slice(i).unit)
else:
param.set_index_value(index=index, value=np.median(dist.slice(i)), unit=dist.slice(i).unit)
param.set_index_value(index=index, value=dist.slice(i).median(), unit=dist.slice(i).unit)

else:
fitted_values = solution_ps.get_value(qualifier='fitted_values', **_skip_filter_checks)
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ def _env_variable_bool(key, default):
long_description = "\n".join(long_description_s[long_description_s.index("INTRODUCTION"):])

setup (name = 'phoebe',
version = '2.3.53',
description = 'PHOEBE 2.3.53',
version = '2.3.54',
description = 'PHOEBE 2.3.54',
long_description=long_description,
author = 'PHOEBE development team',
author_email = 'phoebe-devel@lists.sourceforge.net',
Expand All @@ -367,7 +367,7 @@ def _env_variable_bool(key, default):
'Programming Language :: Python :: 3 :: Only',
],
python_requires='>=3.6, <4',
download_url = 'https://github.com/phoebe-project/phoebe2/tarball/2.3.53',
download_url = 'https://github.com/phoebe-project/phoebe2/tarball/2.3.54',
packages = ['phoebe', 'phoebe.parameters', 'phoebe.parameters.solver', 'phoebe.parameters.figure', 'phoebe.frontend', 'phoebe.constraints', 'phoebe.dynamics', 'phoebe.distortions', 'phoebe.algorithms', 'phoebe.atmospheres', 'phoebe.backend', 'phoebe.solverbackends', 'phoebe.solverbackends.ebai', 'phoebe.utils', 'phoebe.helpers', 'phoebe.pool', 'phoebe.dependencies', 'phoebe.dependencies.autofig', 'phoebe.dependencies.nparray', 'phoebe.dependencies.distl', 'phoebe.dependencies.unitsiau2015'],
install_requires=['numpy>=1.12','scipy>=1.2','astropy>=1.0', 'corner', 'pytest', 'requests', 'python-socketio[client]']+['flask', 'flask-cors', 'flask-socketio==4.3.*', 'gevent-websocket'],
package_data={'phoebe.atmospheres':['tables/wd/*', 'tables/passbands/*'],
Expand Down

0 comments on commit 840a067

Please sign in to comment.