Skip to content
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

Publication output #1621

Merged
merged 35 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
acb27f4
publish.py
abhisrkckl Aug 21, 2023
0a3ca91
param desc
abhisrkckl Aug 21, 2023
24c65a7
as_ufloat
abhisrkckl Aug 21, 2023
ea1021e
options
abhisrkckl Aug 21, 2023
be4ce42
fix descriptions
abhisrkckl Aug 21, 2023
a6280d2
exclude components
abhisrkckl Aug 21, 2023
8af98a4
fix param namess
abhisrkckl Aug 21, 2023
52bdcae
wideband
abhisrkckl Aug 21, 2023
a23008a
script
abhisrkckl Aug 21, 2023
5e2cadd
wave
abhisrkckl Aug 21, 2023
49466e3
log
abhisrkckl Aug 21, 2023
8d06f35
docs
abhisrkckl Aug 21, 2023
22de9e2
test
abhisrkckl Aug 21, 2023
4aca81b
Merge branch 'master' into publish
abhisrkckl Aug 21, 2023
9f1e4c1
changelog
abhisrkckl Aug 21, 2023
4669573
fix test
abhisrkckl Aug 22, 2023
7876c30
latex formatting
abhisrkckl Aug 22, 2023
1296d08
disable fraction
abhisrkckl Aug 22, 2023
1ca2246
desc
abhisrkckl Aug 22, 2023
715ad26
as_latex
abhisrkckl Aug 22, 2023
42b0beb
.gitignore
abhisrkckl Aug 22, 2023
a17e5ad
options
abhisrkckl Aug 22, 2023
80579c6
fix as_latex
abhisrkckl Aug 23, 2023
ab589ff
deal with old astropy
abhisrkckl Aug 23, 2023
e6a28d9
old astropy fix
abhisrkckl Aug 24, 2023
a4a7cbc
Merge branch 'nanograv:master' into publish
abhisrkckl Aug 24, 2023
6648c4a
--
abhisrkckl Aug 24, 2023
3f6f276
Merge branch 'publish' of https://github.com/abhisrkckl/PINT into pub…
abhisrkckl Aug 24, 2023
4181a21
Merge branch 'master' into publish
abhisrkckl Aug 25, 2023
e964d63
Merge branch 'nanograv:master' into publish
abhisrkckl Aug 28, 2023
8346e32
Merge branch 'nanograv:master' into publish
abhisrkckl Aug 29, 2023
13d6173
Merge branch 'nanograv:master' into publish
abhisrkckl Aug 31, 2023
bde240c
Merge branch 'master' into publish
abhisrkckl Aug 31, 2023
f303989
Merge branch 'master' into publish
abhisrkckl Sep 5, 2023
8f7792e
Merge branch 'master' into publish
abhisrkckl Sep 21, 2023
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
1 change: 1 addition & 0 deletions CHANGELOG-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ the released changes.
- `pint.print_info()` function for bug reporting
- Added an autocorrelation function to check for chain convergence in `event_optimize`
- Minor doc updates to explain default NHARMS and missing derivative functions
- `pint.output.publish` module and `pintpublish` script for generating publication (LaTeX) output.
### Fixed
- Deleting JUMP1 from flag tables will not prevent fitting
- Simulating TOAs from tim file when PLANET_SHAPIRO is true now works
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ console_scripts =
convert_parfile = pint.scripts.convert_parfile:main
compare_parfiles = pint.scripts.compare_parfiles:main
tcb2tdb = pint.scripts.tcb2tdb:main
pintpublish = pint.scripts.pintpublish:main


# See the docstring in versioneer.py for instructions. Note that you must
Expand Down
8 changes: 5 additions & 3 deletions src/pint/models/absolute_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ def __init__(self):
super().__init__()
self.add_param(
MJDParameter(
name="TZRMJD", description="Epoch of the zero phase.", time_scale="utc"
name="TZRMJD",
description="Epoch of the zero phase TOA.",
time_scale="utc",
)
)
self.add_param(
strParameter(
name="TZRSITE", description="Observatory of the zero phase measured."
name="TZRSITE", description="Observatory of the zero phase TOA."
)
)
self.add_param(
floatParameter(
name="TZRFRQ",
units=u.MHz,
description="The frequency of the zero phase measured.",
description="The frequency of the zero phase TOA.",
)
)
self.tz_cache = None
Expand Down
4 changes: 2 additions & 2 deletions src/pint/models/binary_ell1.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def __init__(self):
floatParameter(
name="EPS1",
units="",
description="First Laplace-Lagrange parameter, ECC x sin(OM) for ELL1 model",
description="First Laplace-Lagrange parameter",
abhisrkckl marked this conversation as resolved.
Show resolved Hide resolved
long_double=True,
)
)
Expand All @@ -126,7 +126,7 @@ def __init__(self):
floatParameter(
name="EPS2",
units="",
description="Second Laplace-Lagrange parameter, ECC x cos(OM) for ELL1 model",
description="Second Laplace-Lagrange parameter",
long_double=True,
)
)
Expand Down
2 changes: 1 addition & 1 deletion src/pint/models/frequency_dependent.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self):
name="FD1",
units="second",
value=0.0,
description="Coefficient of delay as a polynomial function of log-frequency",
description="Coefficient of frequency-dependent delay",
abhisrkckl marked this conversation as resolved.
Show resolved Hide resolved
# descriptionTplt=lambda x: (
# "%d term of frequency" " dependent coefficients" % x
# ),
Expand Down
2 changes: 1 addition & 1 deletion src/pint/models/jump.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(self):
maskParameter(
name="JUMP",
units="second",
description="Amount to jump the selected TOAs by.",
description="Phase jump for selection.",
)
)
self.phase_funcs_component += [self.jump_phase]
Expand Down
16 changes: 4 additions & 12 deletions src/pint/models/noise_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def __init__(
name="EFAC",
units="",
aliases=["T2EFAC", "TNEF"],
description="A multiplication factor on"
" the measured TOA uncertainties,",
description="A multiplication factor for the measured TOA uncertainties,",
)
)

Expand All @@ -68,20 +67,15 @@ def __init__(
name="EQUAD",
units="us",
aliases=["T2EQUAD"],
description="An error term added in "
"quadrature to the scaled (by"
" EFAC) TOA uncertainty.",
description="An error term added in quadrature to the TOA uncertainty.",
)
)

self.add_param(
maskParameter(
name="TNEQ",
units=u.LogUnit(physical_unit=u.second),
description="An error term added in "
"quadrature to the scaled (by"
" EFAC) TOA uncertainty in "
" the unit of log10(second).",
description="A log10-scale error term added in quadrature to the TOA uncertainty",
)
)
self.covariance_matrix_funcs += [self.sigma_scaled_cov_matrix]
Expand Down Expand Up @@ -307,9 +301,7 @@ def __init__(
name="ECORR",
units="us",
aliases=["TNECORR"],
description="An error term added that"
" correlated all TOAs in an"
" observing epoch.",
description="An error term that correlates all TOAs in an observing epoch.",
abhisrkckl marked this conversation as resolved.
Show resolved Hide resolved
)
)

Expand Down
38 changes: 38 additions & 0 deletions src/pint/models/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,18 @@ def as_ufloats(self):
error = self.uncertainty.to_value(u.d) if self.uncertainty is not None else 0
return ufloat(value1, 0), ufloat(value2, error)

def as_ufloat(self):
"""Return the parameter as a :class:`uncertainties.ufloat`
value.

If the uncertainty is not set will be returned as 0

Returns
-------
uncertainties.ufloat
"""
return ufloat(self.value, self.uncertainty_value)


class AngleParameter(Parameter):
"""Parameter in angle units.
Expand Down Expand Up @@ -1297,6 +1309,32 @@ def _print_uncertainty(self, unc):
angle_arcsec /= 15.0
return angle_arcsec.to_string(decimal=True, precision=20)

def as_ufloat(self, units=None):
"""Return the parameter as a :class:`uncertainties.ufloat`

Will cast to the specified units, or the default
If the uncertainty is not set will be returned as 0

Parameters
----------
units : astropy.units.core.Unit, optional
Units to cast the value

Returns
-------
uncertainties.ufloat

Notes
-----
Currently :class:`~uncertainties.ufloat` does not support double precision values,
so some precision may be lost.
"""
if units is None:
units = self.units
value = self.quantity.to_value(units) if self.quantity is not None else 0
error = self.uncertainty.to_value(units) if self.uncertainty is not None else 0
return ufloat(value, error)


class prefixParameter:
"""Families of parameters identified by a prefix like ``DMX_0123``.
Expand Down
6 changes: 4 additions & 2 deletions src/pint/models/pulsar_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ def __init__(self):
)
self.add_param(
floatParameter(
name="A1", units=ls, description="Projected semi-major axis, a*sin(i)"
name="A1",
units=ls,
description="Projected semi-major axis of pulsar orbit",
abhisrkckl marked this conversation as resolved.
Show resolved Hide resolved
)
)
# NOTE: the DOT here takes the value and times 1e-12, tempo/tempo2 can
Expand Down Expand Up @@ -158,7 +160,7 @@ def __init__(self):
floatParameter(
name="M2",
units=u.M_sun,
description="Mass of companion in the unit Sun mass",
description="Companion mass",
)
)
self.add_param(
Expand Down
2 changes: 1 addition & 1 deletion src/pint/models/spindown.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def F_terms(self):

def F_description(self, n):
"""Template function for description"""
return "Spin-frequency %d derivative" % n # if n else "Spin-frequency"
return "Spin-frequency derivative %d" % n if n > 0 else "Spin-frequency"

def F_unit(self, n):
"""Template function for unit"""
Expand Down
5 changes: 4 additions & 1 deletion src/pint/models/timing_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def __init__(self, name="", components=[]):
self.add_param_from_top(
strParameter(
name="BINARY",
description="The Pulsar System/Binary model to use.",
description="Pulsar System/Binary model",
value=None,
),
"",
Expand Down Expand Up @@ -2909,6 +2909,9 @@ def add_param(self, param, deriv_func=None, setup=False):
param.name = prefix + str(idx)
param.index = idx

if hasattr(self, f"{prefix}1"):
param.description = getattr(self, f"{prefix}1").description

# A more general check
if param.name in self.params:
exist_par = getattr(self, param.name)
Expand Down
Loading