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

Setting MJDParameter from Time #678

Open
paulray opened this issue Apr 27, 2020 · 3 comments
Open

Setting MJDParameter from Time #678

paulray opened this issue Apr 27, 2020 · 3 comments

Comments

@paulray
Copy link
Member

paulray commented Apr 27, 2020

As I was writing docs, I found this:

result = val

When you set an MJDParameter to an astropy.Time that is in a scale different than par.time_scale, it is not converted. I think probably it should be.

par.quantity = Time(58000.0,format='mjd',scale='tdb')
print("Quantity       ", par.quantity, type(par.quantity))
print("Value          ", par.value)
print(par)
par.quantity 

returns

Quantity        58000.0 <class 'astropy.time.core.Time'>
Value           58000.0
MJDParameter(   TZRMJD          58000.0000000000000000 (d) frozen=True)
<Time object: scale='tdb' format='mjd' value=58000.0>

So I think probably the line should be

    result = Time(val,scale=self.time_scale)

But this probably needs some discussion.

One question is how the time_scale is handled for TZRMJD. For most TZRSITE values, TZRMJD should be a pulsar_mjd in UTC, but fro TZRSITE at the barycenter, TZRMJD should be in the TDB timescale. Is this done correctly currently?

@luojing1211
Copy link
Member

I agree with you @paulray, it should convert to the right scale. However, the location in the timing scale is a tricky part. Should we allow MJDparameter has a location?

@paulray
Copy link
Member Author

paulray commented Apr 27, 2020

Yeah, this is a bit tricky!

Nearly all MJD parameters are in TDB and should not have a location (e.g. T0, PEPOCH, TASC, etc...)

I think only TZRMJD is something that might want a location. However, its location is really specified by TZRSITE, so I think the TZRMJD parameter should not have a location associated with its Time object. Instead, when a TOA is constructed from TZRMJD, TZRSITE, TZRFRQ, it should get the location from TZRSITE.

@luojing1211
Copy link
Member

Maybe in the future, astropy can allow a location at pulsar barycenter. and do the conversion for us. You know what, that is called astropy.pint module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants