Next: , Previous: , Up: Directory Index   [Contents][Index]


2.4 convert-units

Function File: ret = dms_to_rad ( degs )

convert degrees in the format "deg:min:sec.xx" into radians

Examples

rads = dms_to_rad ( "10:11:12.345" );
rads0 = (10 + 11/60 + 12.345/3600)*pi/180;
assert ( rads, rads0, eps );
[sig, dd,mm,ss] = rad_to_dms ( rads );
assert ( sig, 1 ); assert ( dd, 10 ); assert ( mm, 11 ); assert ( ss, 12.345, 1e5*eps );
rads = dms_to_rad ( "-10:11:12.345" );
rads0 = -(10 + 11/60 + 12.345/3600)*pi/180;
assert ( rads, rads0, eps );
[sig, dd,mm,ss] = rad_to_dms ( rads );
assert (sig, -1 ); assert ( dd, 10 ); assert ( mm, 11 ); assert ( ss, 12.345, 1e5*eps );
rads = dms_to_rad ( "-0:11:12.345" );
rads0 = -(11/60 + 12.345/3600)*pi/180;
assert ( rads, rads0, eps );
[sig, dd,mm,ss] = rad_to_dms ( rads );
assert ( sig, -1 ); assert ( dd, 0 ); assert ( mm, 11 ); assert ( ss, 12.345, 1e5*eps );
Function File: utc = gps_to_utc ( gps )
Function File: gps_to_utc gps

Convert GPS times to UTC date strings (using LAL functions)

Arguments

utc

cell array of UTC date strings (or a single string)

gps

matrix of GPS times

Examples

try
  lal; lalpulsar;
catch
  disp("skipping test: LALSuite bindings not available"); return;
end_try_catch
assert(strcmp(gps_to_utc(800000000), "13-May-2005 06:13:07"));
Function File: ret = hms_to_rad ( hms )

convert an "hour:minute:second.xxx" string into radians

Examples

rads = hms_to_rad ( "10:11:12.345" );
rads0 = (10 + 11/60 + 12.345/3600)*pi/12;
assert ( rads, rads0, eps );
[hh, mm, ss] = rad_to_hms ( rads );
assert ( hh, 10 ); assert ( mm, 11 ); assert ( ss, 12.345, 1e4*eps );
rads = hms_to_rad ( "0:11:12.345" );
rads0 = (11/60 + 12.345/3600)*pi/12;
assert ( rads, rads0, eps );
[hh, mm, ss] = rad_to_hms ( rads );
assert ( hh, 0 ); assert ( mm, 11 ); assert ( ss, 12.345, 1e4*eps );
Function File: GPS = MJDtdb_to_GPS ( MJD_tdb )

convert MJD (based on TDB) into GPS seconds translated from LAL-function LALTDBMJDtoGPS() in BinaryPulsarTiming.c

Examples

assert(MJDtt_to_GPS(45123), 75945548.816, 1e-6)
assert(MJDtt_to_GPS(123456), 6843916748.816, 1e-6)
Function File: GPS = MJDtt_to_GPS ( MJDtt )

convert MJD (based on TT) into GPS seconds translated from LAL-function LALTTMJDtoGPS() in BinaryPulsarTiming.c

Examples

assert(MJDtt_to_GPS(45123), 75945548.816, 1e-6)
assert(MJDtt_to_GPS(123456), 6843916748.816, 1e-6)
Function File: GPS = MJDutc_to_GPS ( MJDutc )

convert MJD (based on UTC) into GPS seconds translated from lalapps-CVS/src/pulsar/TDS_isolated/TargetedPulsars.c This conversion corresponds to what lalapps_tconvert does, but is NOT the right thing for pulsar timing, as pulsar-epochs are typically given in MJD(TDB) ! ==> use MJDtdb_to_GPS.m for that purpose!

Examples

assert(MJDutc_to_GPS(45123), 75945613, 1e-6)
assert(MJDutc_to_GPS(123456), 6843916813, 1e-6)
Function File: [ sig, degs, mins, secs ] = rad_to_dms ( rads )

convert radians ’rads’ into degrees "<sig>degs:minutes:secs", where <sig> is either +1 or -1

Examples

rads = dms_to_rad ( "10:11:12.345" );
[sig, dd,mm,ss] = rad_to_dms ( rads );
assert ( sig, 1 ); assert ( dd, 10 ); assert ( mm, 11 ); assert ( ss, 12.345, 1e5*eps );
rads = dms_to_rad ( "-10:11:12.345" );
[sig, dd,mm,ss] = rad_to_dms ( rads );
assert (sig, -1 ); assert ( dd, 10 ); assert ( mm, 11 ); assert ( ss, 12.345, 1e5*eps );
rads = dms_to_rad ( "-0:11:12.345" );
[sig, dd,mm,ss] = rad_to_dms ( rads );
assert ( sig, -1 ); assert ( dd, 0 ); assert ( mm, 11 ); assert ( ss, 12.345, 1e5*eps );
Function File: [ hours, mins, secs ] = rad_to_hms ( rads )

convert radians into hours:minutes:seconds format

Examples

rads = hms_to_rad ( "10:11:12.345" );
[hh, mm, ss] = rad_to_hms ( rads );
assert ( hh, 10 ); assert ( mm, 11 ); assert ( ss, 12.345, 1e4*eps );
rads = hms_to_rad ( "0:11:12.345" );
[hh, mm, ss] = rad_to_hms ( rads );
assert ( hh, 0 ); assert ( mm, 11 ); assert ( ss, 12.345, 1e4*eps );
Function File: [ gps, gpsns ] = utc_to_gps ( utc )
Function File: utc_to_gps utc

Convert UTC date strings to GPS times (using LAL functions)

Arguments

gps

matrix of GPS times (integer seconds)

gpsns

matrix of GPS times (nanoseconds)

utc

cell array of UTC date strings

Examples

try
  lal; lalpulsar;
catch
  disp("skipping test: LALSuite bindings not available"); return;
end_try_catch
assert(utc_to_gps("13-May-2005 06:13:07") == 800000000);
[s, ns] = utc_to_gps("2011-04-24T04:25:06.123456789");
assert(s == 987654321 && ns == 123456789);

Next: , Previous: , Up: Directory Index   [Contents][Index]