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/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Details
Installation
============

Currently requires and python 3.9-3.11 ish and `astropy`, `corner`, `dynesty`, `matplotlib`, `numpy`, `novas`, `novas_de405`, and their dependencies. Note that `novas` is not supported on Windows. You can create a working environment using conda+pip via a few lines of code:
Currently requires and python 3.10-3.13 and `astropy`, `corner`, `dynesty`, `matplotlib`, `numpy`, `novas`, `novas_de405`, and their dependencies. Note that `novas` is not supported on Windows. You can create a working environment using conda+pip via a few lines of code:

.. code-block:: console

Expand Down
48 changes: 37 additions & 11 deletions backtracks/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from astropy.time import Time
from dynesty import plotting as dyplot
from matplotlib.ticker import FuncFormatter
from scipy.stats import norm

from backtracks.utils import transform_gengamm, radec2seppa, seppa2radec, transform_errors, utc2tt, radecdists

Expand Down Expand Up @@ -213,7 +214,7 @@ def trackplot(

ra_stat, dec_stat = radecdists(backtracks, plot_epochs_tt, stat_pars)
axs['A'].plot(ra_stat, dec_stat, color="lightgray", ls='--',
label="Stationary track, $\chi^2_r={}$".format(round(backtracks.stationary_chi2_red,2)))
label=rf"Stationary track, $\chi^2_r={backtracks.stationary_chi2_red:.2f}$")

if plot_radec:
axs['B'].plot(plot_times.decimalyear, ra_stat, color="lightgray", ls='--')
Expand Down Expand Up @@ -267,7 +268,7 @@ def trackplot(

ra_bg, dec_bg = radecdists(backtracks, plot_epochs_tt, backtracks.run_median)

axs['A'].plot(ra_bg, dec_bg, color="black", label="Median track, $\chi^2_r={}$".format(round(backtracks.median_chi2_red,2)))
axs['A'].plot(ra_bg, dec_bg, color="black", label=fr"Median track, $\chi^2_r={backtracks.median_chi2_red:.2f}$")

if plot_radec:
axs['B'].plot(plot_times.decimalyear, ra_bg, color='black')
Expand Down Expand Up @@ -410,20 +411,45 @@ def neighborhood(backtracks, fileprefix='./', filepost='.pdf'):
elif len(truths) == 2:
truths = np.append(truths, 0.)

# 1,2,3 sigma levels for a 2d gaussian
levels = 1.0 - np.exp(-0.5 * np.arange(1, 3.1, 1) ** 2)

nearby_array = nearby_table.to_numpy()
nan_idx = np.isnan(nearby_array).any(axis=1)

# Quantiles for the 1D distributions (-1, 1 sigma)
quantiles = [norm.cdf(n_sigma) for n_sigma in [-1, 1]]

# Quantiles for the titles (-1, 0, 1 sigma)
title_quantiles = [norm.cdf(n_sigma) for n_sigma in [-1, 0, 1]]

# Credible regions for the 2D distributions (1, 2 sigma)
# Radial integral of the Gaussian probability
levels = [1.0 - np.exp(-0.5 * n_sigma ** 2) for n_sigma in [1, 2]]

# Exclude 1% of the outliers from the posterior plot for clarity
range_select = np.full(nearby_table.shape[1], 0.99)

titles = [r"$\mu_\alpha \cos\delta$", r"$\mu_\delta$", r"$\pi$"]
labels = [r"$\mu_\alpha \cos\delta$ (mas/yr)", r"$\mu_\delta$ (mas/yr)", r"$\pi$ (mas)"]

fig = corner.corner(nearby_array[~nan_idx, ],
truths=truths,
truth_color='cornflowerblue',
labels=["pmra (mas/yr)", "pmdec (mas/yr)", "parallax (mas)"],
smooth=1,
smooth_1d=1,
quantiles=[0.00135, 0.99865],
levels=levels)
labels=labels,
titles=titles,
title_quantiles=title_quantiles,
title_fmt=".1f",
show_titles=True,
smooth=None,
smooth_1d=None,
quantiles=quantiles,
levels=levels,
range=range_select,
labelpad=-0.08)

for ax in fig.axes:
ax.title.set_fontsize(14.)
ax.xaxis.label.set_fontsize(15.)
ax.yaxis.label.set_fontsize(15.)
ax.tick_params(axis='both', labelsize=13.)

target_name = backtracks.target_name.replace(' ', '_')
object_label = f"cc{backtracks.obj_num}"
Expand Down Expand Up @@ -485,7 +511,7 @@ def stationtrackplot(

ra_stat, dec_stat = radecdists(backtracks, plot_epochs_tt, stat_pars)
axs['A'].plot(ra_stat, dec_stat, color="lightgray", ls='--',
label="Stationary track, $\chi^2_r={}$".format(round(backtracks.stationary_chi2_red,2)))
label=fr"Stationary track, $\chi^2_r={backtracks.stationary_chi2_red:.2f}$")

if plot_radec:
axs['B'].plot(plot_times.decimalyear, ra_stat, color="lightgray", ls='--')
Expand Down
6 changes: 3 additions & 3 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
Installation
============

Currently requires and python 3.9-3.11 ish and `astropy`, `corner`, `dynesty`, `matplotlib`, `numpy`, `novas`, `novas_de405` and their dependencies. Note that `novas` is not supported on Windows. You can create a working environment using conda+pip via a few lines of code:
Currently requires and python 3.10-3.13 and `astropy`, `corner`, `dynesty`, `matplotlib`, `numpy`, `novas`, `novas_de405` and their dependencies. Note that `novas` is not supported on Windows. You can create a working environment using conda+pip via a few lines of code:

.. code-block:: console

$ conda create python=3.11 -n backtracks
$ conda create python=3.13 -n backtracks
$ conda activate backtracks
$ conda install pip
$ pip install backtracks
Expand All @@ -16,7 +16,7 @@ Or, to clone the repo and install in development mode (we recommend this, as the

.. code-block:: console

$ conda create python=3.11 -n backtracks
$ conda create python=3.13 -n backtracks
$ conda activate backtracks
$ conda install pip
$ git clone https://github.com/wbalmer/backtracks.git
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ authors = [
]
description = "Python package to fit relative astrometry with background star motion tracks."
readme = "PYPI_SAFE_README.rst"
requires-python = ">=3.9,<3.13"
requires-python = ">=3.10,<3.14"
dynamic = ["dependencies"]
classifiers = [
"Programming Language :: Python :: 3",
Expand Down