enterprise/signals/utils.py
def createfourierdesignmatrix_physicalephem(
    toas,
    planetssb,
    pos_t,
    frame_drift_rate=1e-9,
    d_jupiter_mass=1.54976690e-11,
    d_saturn_mass=8.17306184e-12,
    d_uranus_mass=5.71923361e-11,
    d_neptune_mass=7.96103855e-11,
    jup_orb_elements=0.05,
    sat_orb_elements=0.5,
    model="setIII",
):
    """
    Construct physical ephemeris perturbation design matrix and 'frequencies'.
    Parameters can be excluded by setting the corresponding prior sigma to None
    :param toas:             vector of time series in seconds
    :param pos:              pulsar position as Cartesian vector
    :param frame_drift_rate: normal sigma for frame drift rate
    :param d_jupiter_mass:   normal sigma for Jupiter mass perturbation
    :param d_saturn_mass:    normal sigma for Saturn mass perturbation
    :param d_uranus_mass:    normal sigma for Uranus mass perturbation
    :param d_neptune_mass:   normal sigma for Neptune mass perturbation
    :param jup_orb_elements: normal sigma for Jupiter orbital elem. perturb.
    :param sat_orb_elements: normal sigma for Saturn orbital elem. perturb.
    :param model:            vector basis used by Jupiter and Saturn perturb.;
                             see PhysicalEphemerisSignal, defaults to "setIII"
    :return: F: Fourier design matrix of shape (len(toas), nvecs)
    :return: sigmas: Phi sigmas (nvecs, to be passed to physicalephem_spectrum)
    """

    # Jupiter + Saturn orbit definitions that we pass to physical_ephem_delay
    oa = {}
    (oa["times"], oa["jup_orbit"], oa["sat_orbit"]) = get_planet_orbital_elements(model)

    dpar = 1e-5  # may need finessing
    Fl, Phil = [], []

    for parname in [
        "frame_drift_rate",
        "d_jupiter_mass",
        "d_saturn_mass",
        "d_uranus_mass",
        "d_neptune_mass",
        "jup_orb_elements",
        "sat_orb_elements",
    ]:

        ppar = locals()[parname]
        if ppar:
            if parname not in ["jup_orb_elements", "sat_orb_elements"]:
                # need to normalize?
                Fl.append(physical_ephem_delay(toas, planetssb, pos_t, **{parname: dpar}) / dpar)
                Phil.append(ppar)
            else:
                for i in range(6):
                    c = np.zeros(6)
                    c[i] = dpar

                    # Fl.append(physical_ephem_delay(toas, planetssb, pos_t,
                    #                               **{parname: c}, **oa)/dpar)
                    kwarg_dict = {parname: c}
                    kwarg_dict.update(oa)
                    Fl.append(physical_ephem_delay(toas, planetssb, pos_t, **kwarg_dict) / dpar)

                    Phil.append(ppar)

    return np.array(Fl).T.copy(), np.array(Phil)

    Construct physical ephemeris perturbation design matrix and 'frequencies'.
    Parameters can be excluded by setting the corresponding prior sigma to None
    :param toas:             vector of time series in seconds
    :param pos:              pulsar position as Cartesian vector
    :param frame_drift_rate: normal sigma for frame drift rate
    :param d_jupiter_mass:   normal sigma for Jupiter mass perturbation
    :param d_saturn_mass:    normal sigma for Saturn mass perturbation
    :param d_uranus_mass:    normal sigma for Uranus mass perturbation
    :param d_neptune_mass:   normal sigma for Neptune mass perturbation
    :param jup_orb_elements: normal sigma for Jupiter orbital elem. perturb.
    :param sat_orb_elements: normal sigma for Saturn orbital elem. perturb.
    :param model:            vector basis used by Jupiter and Saturn perturb.;
                             see PhysicalEphemerisSignal, defaults to "setIII"
    :return: F: Fourier design matrix of shape (len(toas), nvecs)
    :return: sigmas: Phi sigmas (nvecs, to be passed to physicalephem_spectrum)
    
Construct physical ephemeris perturbation design matrix and 'frequencies'.
Parameters can be excluded by setting the corresponding prior sigma to None
Construct physical ephemeris perturbation design matrix and ' frequencies ' . Parameters can be excluded by setting the corresponding prior sigma to None
def createfourierdesignmatrix_physicalephem(
    toas,
    planetssb,
    pos_t,
    frame_drift_rate=1e-9,
    d_jupiter_mass=1.54976690e-11,
    d_saturn_mass=8.17306184e-12,
    d_uranus_mass=5.71923361e-11,
    d_neptune_mass=7.96103855e-11,
    jup_orb_elements=0.05,
    sat_orb_elements=0.5,
    model="setIII",
):
    oa = {}
    (oa["times"], oa["jup_orbit"], oa["sat_orbit"]) = get_planet_orbital_elements(model)
    dpar = 1e-5  
    Fl, Phil = [], []
    for parname in [
        "frame_drift_rate",
        "d_jupiter_mass",
        "d_saturn_mass",
        "d_uranus_mass",
        "d_neptune_mass",
        "jup_orb_elements",
        "sat_orb_elements",
    ]:
        ppar = locals()[parname]
        if ppar:
            if parname not in ["jup_orb_elements", "sat_orb_elements"]:
                Fl.append(physical_ephem_delay(toas, planetssb, pos_t, **{parname: dpar}) / dpar)
                Phil.append(ppar)
            else:
                for i in range(6):
                    c = np.zeros(6)
                    c[i] = dpar
                    kwarg_dict = {parname: c}
                    kwarg_dict.update(oa)
                    Fl.append(physical_ephem_delay(toas, planetssb, pos_t, **kwarg_dict) / dpar)
                    Phil.append(ppar)
    return np.array(Fl).T.copy(), np.array(Phil)
def createfourierdesignmatrix_physicalephem ( toas , planetssb , pos_t , frame_drift_rate = 1e-9 , d_jupiter_mass = 1.54976690e-11 , d_saturn_mass = 8.17306184e-12 , d_uranus_mass = 5.71923361e-11 , d_neptune_mass = 7.96103855e-11 , jup_orb_elements = 0.05 , sat_orb_elements = 0.5 , model = "setIII" , ) : oa = { } ( oa [ "times" ] , oa [ "jup_orbit" ] , oa [ "sat_orbit" ] ) = get_planet_orbital_elements ( model ) dpar = 1e-5 Fl , Phil = [ ] , [ ] for parname in [ "frame_drift_rate" , "d_jupiter_mass" , "d_saturn_mass" , "d_uranus_mass" , "d_neptune_mass" , "jup_orb_elements" , "sat_orb_elements" , ] : ppar = locals ( ) [ parname ] if ppar : if parname not in [ "jup_orb_elements" , "sat_orb_elements" ] : Fl . append ( physical_ephem_delay ( toas , planetssb , pos_t , ** { parname : dpar } ) / dpar ) Phil . append ( ppar ) else : for i in range ( 6 ) : c = np . zeros ( 6 ) c [ i ] = dpar kwarg_dict = { parname : c } kwarg_dict . update ( oa ) Fl . append ( physical_ephem_delay ( toas , planetssb , pos_t , ** kwarg_dict ) / dpar ) Phil . append ( ppar ) return np . array ( Fl ) . T . copy ( ) , np . array ( Phil )
Construct physical ephemeris perturbation design matrix and 'frequencies'.
Construct physical ephemeris perturbation design matrix and ' frequencies ' .
"""
    Construct physical ephemeris perturbation design matrix and 'frequencies'.
    Parameters can be excluded by setting the corresponding prior sigma to None
    :param toas:             vector of time series in seconds
    :param pos:              pulsar position as Cartesian vector
    :param frame_drift_rate: normal sigma for frame drift rate
    :param d_jupiter_mass:   normal sigma for Jupiter mass perturbation
    :param d_saturn_mass:    normal sigma for Saturn mass perturbation
    :param d_uranus_mass:    normal sigma for Uranus mass perturbation
    :param d_neptune_mass:   normal sigma for Neptune mass perturbation
    :param jup_orb_elements: normal sigma for Jupiter orbital elem. perturb.
    :param sat_orb_elements: normal sigma for Saturn orbital elem. perturb.
    :param model:            vector basis used by Jupiter and Saturn perturb.;
                             see PhysicalEphemerisSignal, defaults to "setIII"
    :return: F: Fourier design matrix of shape (len(toas), nvecs)
    :return: sigmas: Phi sigmas (nvecs, to be passed to physicalephem_spectrum)
    """ # Jupiter + Saturn orbit definitions that we pass to physical_ephem_delay # may need finessing # need to normalize? # Fl.append(physical_ephem_delay(toas, planetssb, pos_t, #                               **{parname: c}, **oa)/dpar)
Fourier design matrix of shape (len(toas), nvecs)
Fourier design matrix of shape ( len ( toas ) nvecs )
Phi sigmas (nvecs, to be passed to physicalephem_spectrum)
Phi sigmas ( nvecs to be passed to physicalephem_spectrum )
toas
vector of time series in seconds
vector of time series in seconds
planetssb
pos_t
frame_drift_rate
normal sigma for frame drift rate
normal sigma for frame drift rate
d_jupiter_mass
normal sigma for Jupiter mass perturbation
normal sigma for Jupiter mass perturbation
d_saturn_mass
normal sigma for Saturn mass perturbation
normal sigma for Saturn mass perturbation
d_uranus_mass
normal sigma for Uranus mass perturbation
normal sigma for Uranus mass perturbation
d_neptune_mass
normal sigma for Neptune mass perturbation
normal sigma for Neptune mass perturbation
jup_orb_elements
normal sigma for Jupiter orbital elem. perturb.
normal sigma for Jupiter orbital elem . perturb .
sat_orb_elements
normal sigma for Saturn orbital elem. perturb.
normal sigma for Saturn orbital elem . perturb .
model
vector basis used by Jupiter and Saturn perturb.;
see PhysicalEphemerisSignal, defaults to "setIII"
vector basis used by Jupiter and Saturn perturb . ; see PhysicalEphemerisSignal defaults to " setIII "
"setIII"
pos
pulsar position as Cartesian vector
pulsar position as Cartesian vector