1
$\begingroup$

Hopefully I'm in the appropriate section as my question is mainly about coding, but it's for astronomy.

Right now I'm trying to figure out how I can take a range of MJD values and convert them into number of days elapsed so I can normalize a plot of two supernova and their absolute magnitudes over time in IDL. Is there a simple conversion for this I'm not seeing or do I need to tediously convert every value to determine the number of days to use for my x-axis?

Note: I do not wish to convert to the date, but the actually number of days elapsed as to normalize my two plots for comparison.

Thanks!

$\endgroup$
1
  • $\begingroup$ Since MJD is a simple number of days, can't you just do days_elapsed = mjd2 - mjd1 (or whatever the syntax is for idl). This might be a better fit for StackOverflow. $\endgroup$ – James K Sep 25 '16 at 18:16
2
$\begingroup$

Like @James K said, the MJD is simply a count, so you can set some arbitrary date to be 0 and go from there.

For example, take today's MJD date and say there was one event today:

Today = 57657 

Add three months and 12 days to the next event:

Today + 103 = 57760

So if you called ten days before the first event 0, then the "dates" of the first two events would simply be the following:

Start = Event_1 - 10 = 0 
Event_1 = Start + 10 = 10 <-- Semantics right!
Event_2 = Event_1 + 103 = 113

It really is that simple. Just set a variable to equal whatever starting MJD you want to be zero and count earth days between events.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.