Skip to content

Commit

Permalink
2.4.11 bugfix release (#723)
Browse files Browse the repository at this point in the history
* fix jktebop backend handling of mass-ratio and eccentricity for RVs.
* bumps version requirements in pip for numpy, scipy, astropy.
* allows sma@star and asini@star to flip to solve for q
* fixes handling of spots on rotating single stars.
* fixes constraint migration for 2.3 -> 2.4 

---------

Co-authored-by: Jeppe Sinkbæk Thomsen <[email protected]>
Co-authored-by: Michael Abdul-Masih <[email protected]>
Co-authored-by: David Jones <[email protected]>
Co-authored-by: Andrej Prsa <[email protected]>
  • Loading branch information
5 people authored Jun 16, 2023
1 parent 3d2032d commit 7bc4489
Show file tree
Hide file tree
Showing 20 changed files with 856 additions and 13 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/on_pr_test_python_31x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,23 @@ jobs:
- name: Test photodynam install
run: |
python -c "import photodynam"
- name: Setup GNU Fortran
uses: modflowpy/install-gfortran-action@v1

- name: Install jktebop
run: |
wget https://www.astro.keele.ac.uk/jkt/codes/jktebop-v43.tgz
tar -xvzf jktebop-v43.tgz
cd jktebop43
gfortran -o jktebop jktebop.f
echo $(pwd) >> $GITHUB_PATH
cd ..
- name: Test jktebop install
run: |
jktebop
- name: Run tests
run: |
pytest --verbose --capture=no --full-trace tests/nosetests/
16 changes: 16 additions & 0 deletions .github/workflows/on_pr_test_python_37.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,22 @@ jobs:
run: |
python -c "import photodynam"
- name: Setup GNU Fortran
uses: modflowpy/install-gfortran-action@v1

- name: Install jktebop
run: |
wget https://www.astro.keele.ac.uk/jkt/codes/jktebop-v43.tgz
tar -xvzf jktebop-v43.tgz
cd jktebop43
gfortran -o jktebop jktebop.f
echo $(pwd) >> $GITHUB_PATH
cd ..
- name: Test jktebop install
run: |
jktebop
- name: Run tests
run: |
pytest --verbose --capture=no tests/nosetests/
16 changes: 16 additions & 0 deletions .github/workflows/on_pr_test_python_38.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,22 @@ jobs:
run: |
python -c "import photodynam"
- name: Setup GNU Fortran
uses: modflowpy/install-gfortran-action@v1

- name: Install jktebop
run: |
wget https://www.astro.keele.ac.uk/jkt/codes/jktebop-v43.tgz
tar -xvzf jktebop-v43.tgz
cd jktebop43
gfortran -o jktebop jktebop.f
echo $(pwd) >> $GITHUB_PATH
cd ..
- name: Test jktebop install
run: |
jktebop
- name: Run tests
run: |
pytest --verbose --capture=no tests/nosetests/
17 changes: 17 additions & 0 deletions .github/workflows/on_pr_test_python_39.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,23 @@ jobs:
run: |
python -c "import photodynam"
- name: Setup GNU Fortran
uses: modflowpy/install-gfortran-action@v1

- name: Install jktebop
run: |
wget https://www.astro.keele.ac.uk/jkt/codes/jktebop-v43.tgz
tar -xvzf jktebop-v43.tgz
cd jktebop43
gfortran -o jktebop jktebop.f
echo $(pwd) >> $GITHUB_PATH
cd ..
- name: Test jktebop install
run: |
echo $PATH
jktebop
- name: Run tests
run: |
pytest --verbose --capture=no --full-trace tests/nosetests/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ MANIFEST
*.log
*.txt
*.png
*.so
*.egg-info
.DS_Store
libphoebe.so

*.swp
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ To understand how to use PHOEBE, please consult the [tutorials, scripts and manu
CHANGELOG
----------

### 2.4.11

* fix jktebop backend handling of mass-ratio and eccentricity for RVs.
* bumps version requirements in pip for numpy, scipy, astropy.
* allows sma@star and asini@star to flip to solve for q
* fixes handling of spots on rotating single stars.
* fixes constraint migration for 2.3 -> 2.4

### 2.4.10

* fixes implementation of gravitational redshift.
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.4.10'
__version__ = '2.4.11'

import os as _os
import sys as _sys
Expand Down
15 changes: 13 additions & 2 deletions phoebe/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -2145,8 +2145,11 @@ def _worker_setup(self, b, compute, infolist, **kwargs):
rA = b.get_value(qualifier='requiv', component=starrefs[0], context='component', unit=u.solRad, **_skip_filter_checks)
rB = b.get_value(qualifier='requiv', component=starrefs[1], context='component', unit=u.solRad, **_skip_filter_checks)
sma = b.get_value(qualifier='sma', component=orbitref, context='component', unit=u.solRad, **_skip_filter_checks)
sma_A = b.get_value(qualifier='sma', component=starrefs[0], context='component', unit=u.solRad, **_skip_filter_checks)
sma_B = b.get_value(qualifier='sma', component=starrefs[1], context='component', unit=u.solRad, **_skip_filter_checks)
incl = b.get_value(qualifier='incl', component=orbitref, context='component', unit=u.deg, **_skip_filter_checks)
q = b.get_value(qualifier='q', component=orbitref, context='component', **_skip_filter_checks)
ecc = b.get_value(qualifier='ecc', component=orbitref, context='component', **_skip_filter_checks)
ecosw = b.get_value(qualifier='ecosw', component=orbitref, context='component', **_skip_filter_checks)
esinw = b.get_value(qualifier='esinw', component=orbitref, context='component', **_skip_filter_checks)

Expand All @@ -2167,7 +2170,11 @@ def _worker_setup(self, b, compute, infolist, **kwargs):
ecosw=ecosw, esinw=esinw,
gravbA=gravbA, gravbB=gravbB,
period=period, t0_supconj=t0_supconj,
pblums=kwargs.get('pblums'))
pblums=kwargs.get('pblums'),
sma_A=sma_A,
sma_B=sma_B,
ecc=ecc
)

def _run_single_dataset(self, b, info, **kwargs):
"""
Expand All @@ -2183,12 +2190,15 @@ def _run_single_dataset(self, b, info, **kwargs):
rA = kwargs.get('rA')
rB = kwargs.get('rB')
sma = kwargs.get('sma')
sma_A = kwargs.get('sma_A')
sma_B = kwargs.get('sma_B')
incl = kwargs.get('incl')
q = kwargs.get('q')
if distortion_method == 'sphere':
q *= -1
ecosw = kwargs.get('ecosw')
esinw = kwargs.get('esinw')
ecc = kwargs.get('ecc')
gravbA = kwargs.get('gravbA')
gravbB = kwargs.get('gravbB')
period = kwargs.get('period')
Expand Down Expand Up @@ -2337,7 +2347,8 @@ def _run_single_dataset(self, b, info, **kwargs):
#~ fi.write('rv2 llaqr-rv2.dat llaqr-rv2.out 55.0 -10.0 0 0\n')
if info['kind'] == 'rv':
# NOTE: we disable systemic velocity as it will be added in bundle.run_compute
K = np.pi * (sma*u.solRad).to(u.km).value * np.sin((incl*u.deg).to(u.rad).value) / (period*u.d).to(u.s).value
sma_ = sma_A if info['component'] == starrefs[0] else sma_B
K = np.pi * 2*(sma_*u.solRad).to(u.km).value * np.sin((incl*u.deg).to(u.rad).value) / ((period*u.d).to(u.s).value * np.sqrt(1-ecc**2))
fi.write('{} {} {} {} {} 0 0\n'.format('rv1' if info['component'] == starrefs[0] else 'rv2', tmpfilenamervin, tmpfilenamervout, K, 0.0))


Expand Down
2 changes: 1 addition & 1 deletion phoebe/backend/universe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2432,7 +2432,7 @@ def is_convex(self):
def needs_recompute_instantaneous(self):
# recompute instantaneous for asynchronous spots, even if meshing
# doesn't need to be recomputed
return self.needs_remesh or (len(self.features) and self.F != 1.0)
return self.needs_remesh or (not self.is_single and len(self.features) and self.F != 1)

@property
def needs_remesh(self):
Expand Down
4 changes: 2 additions & 2 deletions phoebe/frontend/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,9 +989,9 @@ def existing_value(param):
logger.warning("re-creating {} constraint".format(constraint.twig))
solved_for = constraint.get_constrained_parameter()
b.remove_constraint(uniqueid=constraint.uniqueid)
new_constraint = b.add_constraint(constraint.constraint_func, component=constraint.component)
new_constraint_ps = b.add_constraint(constraint.constraint_func, component=constraint.component)
if solved_for.qualifier != constraint.constraint_func:
new_constraint.flip_for(solved_for.twig)
new_constraint_ps.get_parameter().flip_for(solved_for.twig)


if conf_interactive_checks:
Expand Down
19 changes: 17 additions & 2 deletions phoebe/parameters/constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ def mass(b, component, solve_for=None, **kwargs):
#
# return lhs, rhs, [esinw, ecosw, ecc, per0], {'orbit': orbit}

_validsolvefor['comp_sma'] = ['sma@orbit', 'incl@orbit']
_validsolvefor['comp_sma'] = ['sma@orbit', 'incl@orbit', 'q']
def comp_sma(b, component, solve_for=None, **kwargs):
"""
Create a constraint for the star's semi-major axes WITHIN its
Expand Down Expand Up @@ -1854,12 +1854,20 @@ def comp_sma(b, component, solve_for=None, **kwargs):
lhs = sma
rhs = compsma * qthing

elif solve_for == q:
if hier.get_primary_or_secondary(component)=='primary':
lhs = q
rhs = 1.0 / ((sma / compsma) - 1.0)
else:
lhs = q
rhs = (sma / compsma) - 1.0

else:
raise NotImplementedError

return lhs, rhs, [], {'component': component}

_validsolvefor['comp_asini'] = ['asini@star', 'sma@orbit']
_validsolvefor['comp_asini'] = ['asini@star', 'sma@orbit', 'q']
def comp_asini(b, component, solve_for=None, **kwargs):
"""
Create a constraint for the star's projected semi-major axes WITHIN its
Expand Down Expand Up @@ -1934,6 +1942,13 @@ def comp_asini(b, component, solve_for=None, **kwargs):
lhs = sma
rhs = compasini / sin(incl) * qthing

elif solve_for == q:
if hier.get_primary_or_secondary(component)=='primary':
lhs = q
rhs = 1.0 / (((sma * sin(incl)) / compasini) - 1.0)
else:
lhs = q
rhs = ((sma * sin(incl)) / compasini) - 1.0
else:
raise NotImplementedError

Expand Down
4 changes: 2 additions & 2 deletions phoebe/parameters/figure/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ def _figure_style_nosources(b, cycler='default', **kwargs):

params += [ChoiceParameter(qualifier='color', value=b._mplcolorcyclers.get(cycler).get(kwargs.get('color', None)), choices=_mplcolors, description='Default color when plotted via run_figure')]

params += [ChoiceParameter(qualifier='marker', value=b._mplmarkercyclers.get(cycler).get(kwargs.get('marker', None)) if kwargs.get('marker', None) is not "None" else "None", choices=["None"] + _mplmarkers, description='Default marker when plotted via run_figure')]
params += [ChoiceParameter(qualifier='marker', value=b._mplmarkercyclers.get(cycler).get(kwargs.get('marker', None)) if kwargs.get('marker', None) != "None" else "None", choices=["None"] + _mplmarkers, description='Default marker when plotted via run_figure')]

params += [ChoiceParameter(qualifier='linestyle', value=b._mpllinestylecyclers.get(cycler).get(kwargs.get('linestyle', None)) if kwargs.get('linestyle', None) is not "None" else "None", choices=["None"] + _mpllinestyles, description='Default linestyle when plotted via run_figure')]
params += [ChoiceParameter(qualifier='linestyle', value=b._mpllinestylecyclers.get(cycler).get(kwargs.get('linestyle', None)) if kwargs.get('linestyle', None) != "None" else "None", choices=["None"] + _mpllinestyles, description='Default linestyle when plotted via run_figure')]

return params

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def _env_variable_bool(key, default):
long_description = "\n".join(long_description_s[long_description_s.index("INTRODUCTION"):])

setup (name = 'phoebe',
version = '2.4.10',
version = '2.4.11',
description = 'PHOEBE 2.4',
long_description=long_description,
author = 'PHOEBE development team',
Expand Down
101 changes: 101 additions & 0 deletions tests/nosetests/test_jktebop_agreement/jktebop1.rv1.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# TIME RV_STAR_A ERROR PHASE MODEL (O-C)
0.000000 1.00000 -1.000000 0.00000000 0.00000 1.00000
0.010101 1.00000 -1.000000 0.01010100 -8.50328 9.50328
0.020202 1.00000 -1.000000 0.02020200 -16.97233 17.97233
0.030303 1.00000 -1.000000 0.03030300 -25.37303 26.37303
0.040404 1.00000 -1.000000 0.04040400 -33.67156 34.67156
0.050505 1.00000 -1.000000 0.05050500 -41.83451 42.83451
0.060606 1.00000 -1.000000 0.06060600 -49.82901 50.82901
0.070707 1.00000 -1.000000 0.07070700 -57.62287 58.62287
0.080808 1.00000 -1.000000 0.08080800 -65.18470 66.18470
0.090909 1.00000 -1.000000 0.09090900 -72.48405 73.48405
0.101010 1.00000 -1.000000 0.10101000 -79.49154 80.49154
0.111111 1.00000 -1.000000 0.11111100 -86.17894 87.17894
0.121212 1.00000 -1.000000 0.12121200 -92.51933 93.51933
0.131313 1.00000 -1.000000 0.13131300 -98.48718 99.48718
0.141414 1.00000 -1.000000 0.14141400 -104.05845 105.05845
0.151515 1.00000 -1.000000 0.15151500 -109.21073 110.21073
0.161616 1.00000 -1.000000 0.16161600 -113.92324 114.92324
0.171717 1.00000 -1.000000 0.17171700 -118.17704 119.17704
0.181818 1.00000 -1.000000 0.18181800 -121.95497 122.95497
0.191919 1.00000 -1.000000 0.19191900 -125.24184 126.24184
0.202020 1.00000 -1.000000 0.20202000 -128.02440 129.02440
0.212121 1.00000 -1.000000 0.21212100 -130.29145 131.29145
0.222222 1.00000 -1.000000 0.22222200 -132.03387 133.03387
0.232323 1.00000 -1.000000 0.23232300 -133.24464 134.24464
0.242424 1.00000 -1.000000 0.24242400 -133.91887 134.91887
0.252525 1.00000 -1.000000 0.25252500 -134.05387 135.05387
0.262626 1.00000 -1.000000 0.26262600 -133.64907 134.64907
0.272727 1.00000 -1.000000 0.27272700 -132.70612 133.70612
0.282828 1.00000 -1.000000 0.28282800 -131.22882 132.22882
0.292929 1.00000 -1.000000 0.29292900 -129.22310 130.22310
0.303030 1.00000 -1.000000 0.30303000 -126.69704 127.69704
0.313131 1.00000 -1.000000 0.31313100 -123.66082 124.66082
0.323232 1.00000 -1.000000 0.32323200 -120.12667 121.12667
0.333333 1.00000 -1.000000 0.33333300 -116.10881 117.10881
0.343434 1.00000 -1.000000 0.34343400 -111.62342 112.62342
0.353535 1.00000 -1.000000 0.35353500 -106.68856 107.68856
0.363636 1.00000 -1.000000 0.36363600 -101.32410 102.32410
0.373737 1.00000 -1.000000 0.37373700 -95.55166 96.55166
0.383838 1.00000 -1.000000 0.38383800 -89.39445 90.39445
0.393939 1.00000 -1.000000 0.39393900 -82.87729 83.87729
0.404040 1.00000 -1.000000 0.40404000 -76.02642 77.02642
0.414141 1.00000 -1.000000 0.41414100 -68.86941 69.86941
0.424242 1.00000 -1.000000 0.42424200 -61.43509 62.43509
0.434343 1.00000 -1.000000 0.43434300 -53.75339 54.75339
0.444444 1.00000 -1.000000 0.44444400 -45.85525 46.85525
0.454545 1.00000 -1.000000 0.45454500 -37.77246 38.77246
0.464646 1.00000 -1.000000 0.46464600 -29.53758 30.53758
0.474747 1.00000 -1.000000 0.47474700 -21.18376 22.18376
0.484848 1.00000 -1.000000 0.48484800 -12.74464 13.74464
0.494949 1.00000 -1.000000 0.49494900 -4.25420 5.25420
0.505051 1.00000 -1.000000 0.50505100 4.25420 -3.25420
0.515152 1.00000 -1.000000 0.51515200 12.74464 -11.74464
0.525253 1.00000 -1.000000 0.52525300 21.18376 -20.18376
0.535354 1.00000 -1.000000 0.53535400 29.53758 -28.53758
0.545455 1.00000 -1.000000 0.54545500 37.77246 -36.77246
0.555556 1.00000 -1.000000 0.55555600 45.85525 -44.85525
0.565657 1.00000 -1.000000 0.56565700 53.75339 -52.75339
0.575758 1.00000 -1.000000 0.57575800 61.43509 -60.43509
0.585859 1.00000 -1.000000 0.58585900 68.86941 -67.86941
0.595960 1.00000 -1.000000 0.59596000 76.02642 -75.02642
0.606061 1.00000 -1.000000 0.60606100 82.87729 -81.87729
0.616162 1.00000 -1.000000 0.61616200 89.39445 -88.39445
0.626263 1.00000 -1.000000 0.62626300 95.55166 -94.55166
0.636364 1.00000 -1.000000 0.63636400 101.32410 -100.32410
0.646465 1.00000 -1.000000 0.64646500 106.68856 -105.68856
0.656566 1.00000 -1.000000 0.65656600 111.62342 -110.62342
0.666667 1.00000 -1.000000 0.66666700 116.10881 -115.10881
0.676768 1.00000 -1.000000 0.67676800 120.12667 -119.12667
0.686869 1.00000 -1.000000 0.68686900 123.66082 -122.66082
0.696970 1.00000 -1.000000 0.69697000 126.69704 -125.69704
0.707071 1.00000 -1.000000 0.70707100 129.22310 -128.22310
0.717172 1.00000 -1.000000 0.71717200 131.22882 -130.22882
0.727273 1.00000 -1.000000 0.72727300 132.70612 -131.70612
0.737374 1.00000 -1.000000 0.73737400 133.64907 -132.64907
0.747475 1.00000 -1.000000 0.74747500 134.05387 -133.05387
0.757576 1.00000 -1.000000 0.75757600 133.91887 -132.91887
0.767677 1.00000 -1.000000 0.76767700 133.24464 -132.24464
0.777778 1.00000 -1.000000 0.77777800 132.03387 -131.03387
0.787879 1.00000 -1.000000 0.78787900 130.29145 -129.29145
0.797980 1.00000 -1.000000 0.79798000 128.02440 -127.02440
0.808081 1.00000 -1.000000 0.80808100 125.24184 -124.24184
0.818182 1.00000 -1.000000 0.81818200 121.95497 -120.95497
0.828283 1.00000 -1.000000 0.82828300 118.17704 -117.17704
0.838384 1.00000 -1.000000 0.83838400 113.92324 -112.92324
0.848485 1.00000 -1.000000 0.84848500 109.21073 -108.21073
0.858586 1.00000 -1.000000 0.85858600 104.05845 -103.05845
0.868687 1.00000 -1.000000 0.86868700 98.48718 -97.48718
0.878788 1.00000 -1.000000 0.87878800 92.51933 -91.51933
0.888889 1.00000 -1.000000 0.88888900 86.17894 -85.17894
0.898990 1.00000 -1.000000 0.89899000 79.49154 -78.49154
0.909091 1.00000 -1.000000 0.90909100 72.48405 -71.48405
0.919192 1.00000 -1.000000 0.91919200 65.18470 -64.18470
0.929293 1.00000 -1.000000 0.92929300 57.62287 -56.62287
0.939394 1.00000 -1.000000 0.93939400 49.82901 -48.82901
0.949495 1.00000 -1.000000 0.94949500 41.83451 -40.83451
0.959596 1.00000 -1.000000 0.95959600 33.67156 -32.67156
0.969697 1.00000 -1.000000 0.96969700 25.37303 -24.37303
0.979798 1.00000 -1.000000 0.97979800 16.97233 -15.97233
0.989899 1.00000 -1.000000 0.98989900 8.50328 -7.50328
1.000000 1.00000 -1.000000 0.00000000 0.00000 1.00000
Loading

0 comments on commit 7bc4489

Please sign in to comment.