Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/joss-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
# This should be the path to the paper within your repo.
paper-path: paper/paper.md
- name: Upload
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: paper
# This is the output path where Pandoc will write the compiled
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --select=E9,F63,F7,F82 --extend-ignore=F824 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
Expand Down
4 changes: 4 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ User Guide:
Changelog:
++++++++++

**3.2.0 (2025-7-18)**

- modernize install: setup.py -> pyproject.toml (@sblunt)

**3.1.0 (2024-9-09)**

- JOSS paper published! (@sblunt et al)
Expand Down
2 changes: 1 addition & 1 deletion orbitize/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

__version__ = "3.1.0"
__version__ = "3.2.0"

# set Python env variable to keep track of example data dir
orbitize_dir = os.path.dirname(__file__)
Expand Down
10 changes: 8 additions & 2 deletions orbitize/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,15 @@ def compute_all_orbits(self, params_arr, epochs=None, comp_rebound=False):
deoff = dec_kepler + dec_perturb

if self.fitting_basis == "XYZ":

# Find and filter out unbound orbits
bad_orbits = np.where(np.logical_or(ecc >= 1.0, ecc < 0.0))[0]
if bad_orbits.size != 0:
bad_orbits = []
if isinstance(ecc, float):
if ecc >= 1.0 or ecc < 0.0:
bad_orbits = [0]
else:
bad_orbits = np.where(np.logical_or(ecc >= 1.0, ecc < 0.0))[0]
if len(bad_orbits) > 0:
raoff[:, :, bad_orbits] = np.inf
deoff[:, :, bad_orbits] = np.inf
vz[:, :, bad_orbits] = np.inf
Expand Down
34 changes: 34 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[build-system]
requires = [
"setuptools",
"numpy",
"cython",
]
build-backend = "setuptools.build_meta"

[project]
name = "orbitize"
dynamic = ["version"]
dependencies = [
"numpy",
"astropy>=4",
"scipy",
"emcee>=3",
"ptemcee_for_orbitize",
"matplotlib",
"corner",
"h5py",
"deprecation",
"pytest",
"pandas",
"pyerfa",
"astroquery",
"rebound",
"dynesty"
]

[tool.setuptools.dynamic]
version = {attr = "orbitize.__version__"}

[tool.setuptools.packages]
find = {}
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ pytest
pandas
pyerfa
astroquery
sphinx>=6
docutils<0.17
rebound
dynesty
72 changes: 12 additions & 60 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,70 +1,22 @@
from setuptools import setup, find_packages, Extension
import numpy, sys
import re

USE_C_KEPLER_MODULE = 1
if "--disable-cython" in sys.argv:
sys.argv.remove("--disable-cython")
USE_C_KEPLER_MODULE = 0
else:
try:
from Cython.Build import cythonize
except:
print("Error: Importing cython build environment failed")
USE_C_KEPLER_MODULE = 0


# auto-updating version code stolen from RadVel
def get_property(prop, project):
result = re.search(
r'{}\s*=\s*[\'"]([^\'"]*)[\'"]'.format(prop),
open(project + "/__init__.py").read(),
)
return result.group(1)


def get_requires():
reqs = []
for line in open("requirements.txt", "r").readlines():
reqs.append(line)
return reqs
from setuptools import setup, Extension
import numpy
from Cython.Build import cythonize


def get_extensions():
extensions = []
if USE_C_KEPLER_MODULE:
extensions = cythonize(
[
Extension(
"orbitize._kepler",
["orbitize/_kepler.pyx"],
include_dirs=[numpy.get_include()],
)
]
)
extensions = cythonize(
[
Extension(
"orbitize._kepler",
["orbitize/_kepler.pyx"],
include_dirs=[numpy.get_include()],
)
]
)
return extensions


setup(
name="orbitize",
version=get_property("__version__", "orbitize"),
description="orbitize! Turns imaging data into orbits",
url="https://github.com/sblunt/orbitize",
author="",
author_email="",
license="BSD",
packages=find_packages(),
package_data={"": ["kernels/*.cu"]},
ext_modules=get_extensions(),
include_dirs=[numpy.get_include()],
include_package_data=True,
zip_safe=False,
classifiers=[
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Astronomy",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3.6",
],
keywords="Orbits Astronomy Astrometry",
install_requires=get_requires(),
)
30 changes: 18 additions & 12 deletions tests/test_nested_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import numpy as np
import pytest
from orbitize.system import generate_synthetic_data
import sys


def test_nested_sampler():
Expand All @@ -24,29 +25,34 @@ def test_nested_sampler():
ecc = 0.5

# initialize orbitize `System` object
sys = system.System(1, data_table, mtot, plx)
lab = sys.param_idx
mySys = system.System(1, data_table, mtot, plx)
lab = mySys.param_idx

ecc = 0.5 # eccentricity

# set all parameters except eccentricity to fixed values (same as used to generate data)
sys.sys_priors[lab["inc1"]] = np.pi / 4
sys.sys_priors[lab["sma1"]] = sma
sys.sys_priors[lab["aop1"]] = np.pi / 4
sys.sys_priors[lab["pan1"]] = np.pi / 4
sys.sys_priors[lab["tau1"]] = 0.8
sys.sys_priors[lab["plx"]] = plx
sys.sys_priors[lab["mtot"]] = mtot
mySys.sys_priors[lab["inc1"]] = np.pi / 4
mySys.sys_priors[lab["sma1"]] = sma
mySys.sys_priors[lab["aop1"]] = np.pi / 4
mySys.sys_priors[lab["pan1"]] = np.pi / 4
mySys.sys_priors[lab["tau1"]] = 0.8
mySys.sys_priors[lab["plx"]] = plx
mySys.sys_priors[lab["mtot"]] = mtot

start_method="fork"
if sys.platform == "darwin":
start_method="spawn"

# run both static & dynamic nested samplers
mysampler = sampler.NestedSampler(sys)
_ = mysampler.run_sampler(bound="multi", pfrac=0.95, static=False, num_threads=8)
mysampler = sampler.NestedSampler(mySys)
_ = mysampler.run_sampler(bound="multi", pfrac=0.95, static=False, start_method=start_method, num_threads=8)
print("Finished first run!")

dynamic_eccentricities = mysampler.results.post[:, lab["ecc1"]]
assert np.median(dynamic_eccentricities) == pytest.approx(ecc, abs=0.1)

_ = mysampler.run_sampler(bound="multi", static=True, num_threads=8)

_ = mysampler.run_sampler(bound="multi", static=True, start_method=start_method, num_threads=8)
print("Finished second run!")

static_eccentricities = mysampler.results.post[:, lab["ecc1"]]
Expand Down
Loading