Skip to content

Commit

Permalink
Merge pull request #147 from abhisrkckl/solarwind
Browse files Browse the repository at this point in the history
Derivatives of NE_SW
  • Loading branch information
abhisrkckl authored Dec 17, 2024
2 parents c40f9d3 + 133e09b commit c4285d8
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 26 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pyvela-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools pytest pytest-xdist pytest-rerunfailures pytest-cov coverage black emcee pint-pulsar>=1.1
pip install git+https://github.com/nanograv/PINT/
pip install setuptools pytest pytest-xdist pytest-rerunfailures pytest-cov coverage black emcee
julia -e 'import Pkg; Pkg.develop(path=".")'
julia -e 'import Pkg; Pkg.add(["Distributions", "DoubleFloats", "BenchmarkTools"])'
pip install -e .
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Unreleased
## Added
- `time_residuals`, `scaled_toa_uncertainties`, and `model_dm`, `from_pint` methods in `SPNTA`
- NE_SW derivatives in `SolarWind`
- `Pulsar` class
## Changed
## Fixed
Expand Down
47 changes: 25 additions & 22 deletions pyvela/examples/sim_sw.par
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
# Created: 2024-08-06T11:21:40.738219
# PINT_version: 1.0.1
# User: abhimanyu
# Created: 2024-11-12T10:39:22.328123
# PINT_version: 1.1+6.gd6c4d551
# User: Abhimanyu Susobhanan (abhimanyu)
# Host: abhimanyu-HP-Envy-x360-2-in-1-Laptop-15-fh0xxx
# OS: Linux-6.5.0-45-generic-x86_64-with-glibc2.35
# Python: 3.10.13 | packaged by conda-forge | (main, Dec 23 2023, 15:36:39) [GCC 12.3.0]
# OS: Linux-6.8.0-48-generic-x86_64-with-glibc2.39
# Python: 3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:50:58) [GCC 12.3.0]
# Format: pint
PSR SIM_SW
EPHEM DE440
CLOCK TT(BIPM2019)
UNITS TDB
START 50000.0999999753324884
FINISH 51999.9999999392235532
START 54000.9999999475001389
FINISH 55985.0000000566945255
DILATEFREQ N
DMDATA N
NTOA 1000
CHI2 972.8007702671907
CHI2R 0.9806459377693455
TRES 0.98630663094248521817
ELONG 14.999999996311441 1 0.00000000525078037420
ELAT 5.000000092168528 1 0.00000006671050487306
NTOA 2000
CHI2 1895.0765439307224
CHI2R 0.9522997708194585
TRES 0.9688010035121765052
ELONG 14.999999998230809 1 0.00000000371302162626
ELAT 5.000000046868347 1 0.00000004468654498819
PMELONG 0.0
PMELAT 0.0
PX 0.0
ECL IERS2010
F0 99.999999999999752746 1 9.990489073031051694e-13
F1 -9.999988208439190461e-16 1 2.8851352047765038099e-21
F0 99.99999999999972139 1 5.967648440535254721e-14
F1 -9.999965405789203013e-16 1 2.0232262514790655615e-21
F2 0.0
PEPOCH 55000.0000000000000000
PLANET_SHAPIRO Y
NE_SW 4.002168186284519 1 0.060471636417512374
SWM 0
DM 14.999994773063369366 1 2.649714786987681787e-06
DM1 0.0 1 1e-4
DMEPOCH 55000.0000000000000000
TZRMJD 55000.0000000000000000
TZRSITE gbt
TZRFRQ 1400.0
PHOFF 0.00011028120917585654 1 0.0001702000332934474
PHOFF 0.00011473949932422265 1 3.877904946639033e-06
PLANET_SHAPIRO Y
NE_SW 3.915654416109671 1 0.05721910141826878
NE_SW1 -0.00011791003470283466 1 0.034841573356774416
SWEPOCH 55000.0000000000000000
SWM 0
DM 14.999997420572190401 1 2.0695596881830933093e-06
DM1 -1.13306474969863191e-06 1 1.3463369578120024672e-06
DM2 0.0
DMEPOCH 55000.0000000000000000
2 changes: 1 addition & 1 deletion pyvela/pyvela/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _get_multiparam_elements(model: TimingModel, multi_param_names: List[str]):

# Parameters that are treated as single `Parameter`s in `PINT` due to compatibility reasons,
# but logically should have been `prefixParameter`s.
pseudo_single_params = ["DM", "CM"]
pseudo_single_params = ["DM", "CM", "NE_SW"]


def pint_parameters_to_vela(model: TimingModel):
Expand Down
5 changes: 4 additions & 1 deletion src/model/solarwind.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ function dispersion_slope(
params::NamedTuple,
)::GQ
ρ, r = sun_angle_and_distance(toa, toacorr)
return params.NE_SW * AU * AU * ρ / (r * sin(ρ))
t0 = params.SWEPOCH
t = corrected_toa_value(toa, toacorr, Float64)
ne_sw = taylor_horner(t - t0, params.NE_SW)
return ne_sw * AU * AU * ρ / (r * sin(ρ))
end
Binary file modified test/datafiles/sim_sw.wb.jlso
Binary file not shown.
3 changes: 2 additions & 1 deletion test/test_solarwind.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
PX = GQ{-1}(3e-12),
PMELAT = GQ{-1}(-7e-16),
PMELONG = GQ{-1}(-5e-16),
NE_SW = GQ{-2}(1.6e8),
NE_SW = (GQ{-2}(1.6e8),),
SWEPOCH = time((53470.0 - epoch_mjd) * day_to_s),
)

swd = SolarWindDispersion()
Expand Down

0 comments on commit c4285d8

Please sign in to comment.