Radial Velocity Correction

Be careful with the fact that the date/hours recorded in the HDF file can be different than the real hours when the cube has been taken at least because there is only one date recorded in the HDF5 file but your data may have been taken over multiple nights at different hours. Is is possible to get a more precise radial velocity correction from the exact moment when each individual image of the data cube has been recorded.

[1]:
import orcs.process
[2]:
cube = orcs.process.SpectralCube('/home/thomas/M31_SN3.merged.cm1.1.0.hdf5')
master.03e73|INFO| Cube is level 3
master.03e73|INFO| shape: (2048, 2064, 840)
master.03e73|INFO| wavenumber calibration: True
master.03e73|INFO| flux calibration: True
master.03e73|INFO| wcs calibration: True

Use more precise dates

Here we have created a file (abell426.dates.list) which records all the dates at which the individual files have been taken (as supplied by the keyword DATE of each individual FITS file).

~/data/1867004o.fits 2016-01-10T05:06:02
~/data/1867005o.fits 2016-01-10T05:06:32
~/data/1867006o.fits 2016-01-10T05:07:03
~/data/1867007o.fits 2016-01-10T05:07:33
~/data/1867008o.fits 2016-01-10T05:08:06
~/data/1867009o.fits 2016-01-10T05:08:36
~/data/1867010o.fits 2016-01-10T05:09:06
~/data/1867011o.fits 2016-01-10T05:09:36
~/data/1867012o.fits 2016-01-10T05:10:08
~/data/1867013o.fits 2016-01-10T05:10:39
~/data/1867014o.fits 2016-01-10T05:11:09
~/data/1867015o.fits 2016-01-10T05:11:40
~/data/1867016o.fits 2016-01-10T05:12:11
~/data/1867017o.fits 2016-01-10T05:12:42
...
[5]:
# The results of the radial velocity correction for
# each individual file of the initial inteferometric
# cube are recorded here
fout = open('abell426.barycorr.list', 'w')

# we loop in the dates file
with open('abell426.dates.list', 'r') as f:
    for line in f:
        date = line.split()[1]

        corr = cube.get_radial_velocity_correction(
            kind='barycentric', date=date, silent=True)

        fout.write('{} {}\n'.format(date, corr))
        print(date, corr)
2016-01-10T05:06:02 -25.108024947940848
2016-01-10T05:06:32 -25.10872665532921
2016-01-10T05:07:03 -25.10945122668723
2016-01-10T05:07:33 -25.110151840441453
2016-01-10T05:08:06 -25.110921992491928
2016-01-10T05:08:36 -25.111621499831095
2016-01-10T05:09:06 -25.1123204739662
2016-01-10T05:09:36 -25.113018931539077
2016-01-10T05:10:08 -25.11376331911631
2016-01-10T05:10:39 -25.114483922797103
2016-01-10T05:11:09 -25.115180639934692
2016-01-10T05:11:40 -25.11590001158794
2016-01-10T05:12:11 -25.116618782071917
2016-01-10T05:12:42 -25.11733703466232
2016-01-10T05:13:12 -25.118031506152114
2016-01-10T05:13:43 -25.118748483745776
2016-01-10T05:14:14 -25.119464883635143
2016-01-10T05:14:45 -25.120180669374616
2016-01-10T05:15:15 -25.120872792004022
2016-01-10T05:15:45 -25.12156431299819
2016-01-10T05:16:18 -25.122324275692225
2016-01-10T05:16:48 -25.123014603733846
2016-01-10T05:17:19 -25.12372731659372
2016-01-10T05:17:49 -25.124416398329103
2016-01-10T05:18:20 -25.125127811096363
2016-01-10T05:18:51 -25.125838632280043
2016-01-10T05:19:21 -25.126525934338723
2016-01-10T05:19:51 -25.127212530351354
2016-01-10T05:20:24 -25.12796718343801
2016-01-10T05:20:54 -25.128652526953648
2016-01-10T05:21:24 -25.1293372691336
2016-01-10T05:21:54 -25.130021378657954
2016-01-10T05:22:27 -25.130773207993116
2016-01-10T05:22:57 -25.131456024946967
2016-01-10T05:23:27 -25.13213822894913
2016-01-10T05:23:57 -25.13281975925696
2016-01-10T05:24:30 -25.133568758317033
2016-01-10T05:25:00 -25.134248950355907
2016-01-10T05:25:31 -25.134951188485335
2016-01-10T05:26:01 -25.135630126596013
2016-01-10T05:26:33 -25.13635355592547
2016-01-10T05:27:03 -25.13703109149647
2016-01-10T05:27:34 -25.13773056758229
2016-01-10T05:28:06 -25.138451865526722
2016-01-10T05:28:37 -25.13914985819359
2016-01-10T05:29:07 -25.139824736597756
2016-01-10T05:29:39 -25.140543780340494
2016-01-10T05:30:09 -25.141217252909897
2016-01-10T05:30:40 -25.141912416133767
2016-01-10T05:31:10 -25.142584483933486
2016-01-10T05:31:42 -25.143300623245167
2016-01-10T05:32:13 -25.14399362692604
2016-01-10T05:32:43 -25.144663605977087
2016-01-10T05:33:14 -25.145355158557436
2016-01-10T05:33:45 -25.14604598365707
2016-01-10T05:34:15 -25.146713805461694
2016-01-10T05:34:46 -25.14740314670969
2016-01-10T05:35:17 -25.148091733683632
2016-01-10T05:35:48 -25.148779587951328
2016-01-10T05:36:18 -25.149444505358176
2016-01-10T05:36:48 -25.150108769773112
2016-01-10T05:37:20 -25.1508164504781
2016-01-10T05:37:50 -25.151479234236632
2016-01-10T05:38:21 -25.152163291705357
2016-01-10T05:38:51 -25.15282454501514
2016-01-10T05:39:23 -25.153529109538493
2016-01-10T05:39:53 -25.154188896304138
2016-01-10T05:40:23 -25.15484789840776
2016-01-10T05:40:54 -25.155528113845037
2016-01-10T05:41:26 -25.15622946669597
2016-01-10T05:41:56 -25.156886175389758
2016-01-10T05:42:26 -25.157542182098112
2016-01-10T05:42:56 -25.158197414196096
2016-01-10T05:43:29 -25.15891727272256
2016-01-10T05:43:59 -25.159570972108515
2016-01-10T05:44:29 -25.160223839037126
2016-01-10T05:45:00 -25.160897689642216
2016-01-10T05:45:32 -25.161592421742977
2016-01-10T05:46:02 -25.162242931689992
2016-01-10T05:46:33 -25.162914316043263
2016-01-10T05:47:03 -25.16356323959171
2016-01-10T05:47:35 -25.164254606216314
2016-01-10T05:48:05 -25.164901959874893
2016-01-10T05:48:35 -25.165548477814333
2016-01-10T05:49:06 -25.166215794007044
2016-01-10T05:49:38 -25.166903664750144
2016-01-10T05:50:08 -25.167547823012008
2016-01-10T05:50:38 -25.16819112884634
2016-01-10T05:51:08 -25.168833615669914
2016-01-10T05:51:40 -25.169518083958724
2016-01-10T05:52:10 -25.170158921377794
2016-01-10T05:52:41 -25.170820274338826
2016-01-10T05:53:11 -25.17145947656551
2016-01-10T05:53:43 -25.172140343829767
2016-01-10T05:54:13 -25.172777861371276
2016-01-10T05:54:43 -25.17341458782702
2016-01-10T05:55:13 -25.17405044411504
2016-01-10T05:55:45 -25.174727829876336
2016-01-10T05:56:15 -25.175361965299853
2016-01-10T05:56:45 -25.175995252223313
2016-01-10T05:57:15 -25.176627780512558
2016-01-10T05:57:47 -25.177301522845937
2016-01-10T05:58:17 -25.17793227967954
2016-01-10T05:58:47 -25.178562183652918
2016-01-10T05:59:17 -25.17919122248441
2016-01-10T05:59:49 -25.17986134728455
2016-01-10T06:00:19 -25.18048866704886
2016-01-10T06:00:49 -25.181115073110437
2016-01-10T06:01:19 -25.181740645583023
2016-01-10T06:01:51 -25.18240701518876
2016-01-10T06:02:21 -25.183030835077528
2016-01-10T06:02:51 -25.183653733275488
2016-01-10T06:03:21 -25.184275839588874
2016-01-10T06:03:53 -25.184938417121916
2016-01-10T06:04:23 -25.185558680619515
2016-01-10T06:04:53 -25.1861780712867
2016-01-10T06:05:23 -25.186796550813995
2016-01-10T06:05:56 -25.18747587434933
2016-01-10T06:06:25 -25.188071984635126
2016-01-10T06:06:55 -25.18868775780236
2016-01-10T06:07:25 -25.18930262199314
2016-01-10T06:07:57 -25.189957532005256
2016-01-10T06:08:28 -25.190590985113975
2016-01-10T06:08:58 -25.191203079972023
2016-01-10T06:09:28 -25.19181427247707
2016-01-10T06:10:00 -25.192465210351955
2016-01-10T06:10:30 -25.19307453331444
2016-01-10T06:11:00 -25.193682910189203
2016-01-10T06:11:29 -25.19427017953903
2016-01-10T06:12:02 -25.19493737923897
2016-01-10T06:12:32 -25.19554293103089
2016-01-10T06:13:01 -25.19612747794465
2016-01-10T06:13:31 -25.196731201698725
2016-01-10T06:14:04 -25.19739424074284
2016-01-10T06:14:34 -25.197996073519683
2016-01-10T06:15:04 -25.19859693707667
2016-01-10T06:15:34 -25.199196853780407
2016-01-10T06:16:06 -25.199835725866578
2016-01-10T06:16:36 -25.200433681431154
2016-01-10T06:17:06 -25.20103072925077
2016-01-10T06:17:36 -25.201626800860968
2016-01-10T06:18:08 -25.202261556491997
2016-01-10T06:18:38 -25.20285569179263
2016-01-10T06:19:08 -25.203448803554494
2016-01-10T06:19:38 -25.204040978647903
2016-01-10T06:20:10 -25.204671595723465
2016-01-10T06:20:40 -25.20526178012183
2016-01-10T06:21:10 -25.205850960652064
2016-01-10T06:21:40 -25.20643926026396
2016-01-10T06:22:12 -25.207065619428874
2016-01-10T06:22:42 -25.20765185229259
2016-01-10T06:23:12 -25.208237082186827
2016-01-10T06:23:42 -25.20882134509121
2016-01-10T06:24:14 -25.20944347606778
2016-01-10T06:24:44 -25.21002571023391
2016-01-10T06:25:14 -25.21060691277334
2016-01-10T06:25:44 -25.211187180474923
2016-01-10T06:26:16 -25.211804967003363
2016-01-10T06:26:46 -25.21238313480625
2016-01-10T06:27:16 -25.212960310523414
2016-01-10T06:27:46 -25.21353645318268
2016-01-10T06:28:18 -25.214149909441826
2016-01-10T06:28:48 -25.21472398711694
2016-01-10T06:29:18 -25.215297058128098
2016-01-10T06:29:48 -25.215869123806637
2016-01-10T06:30:21 -25.216497207197705
2016-01-10T06:30:50 -25.217048092360262
2016-01-10T06:31:20 -25.217617010603824
2016-01-10T06:31:50 -25.21818489262754
2016-01-10T06:32:23 -25.21880841040063
2016-01-10T06:32:53 -25.219374120932525
2016-01-10T06:33:23 -25.219938819375216
2016-01-10T06:33:52 -25.220483674306113
2016-01-10T06:34:25 -25.221102571043946
2016-01-10T06:34:55 -25.221664012615026
2016-01-10T06:35:24 -25.22220582844922
2016-01-10T06:35:54 -25.222765259488202
2016-01-10T06:36:27 -25.223379473982153
2016-01-10T06:36:57 -25.22393669648461
2016-01-10T06:37:27 -25.2244928687548
2016-01-10T06:37:56 -25.22502948987677
2016-01-10T06:38:29 -25.225638957323575
2016-01-10T06:38:59 -25.226191872189617
2016-01-10T06:39:29 -25.226743687996287
2016-01-10T06:39:59 -25.2272944879527
2016-01-10T06:40:31 -25.2278808527528
2016-01-10T06:41:01 -25.22842937590793
2016-01-10T06:41:31 -25.228976906977337
2016-01-10T06:42:01 -25.22952330773402
2016-01-10T06:42:33 -25.230105002871458
2016-01-10T06:43:03 -25.2306491770186
2016-01-13T07:37:27 -25.45248667171002
2016-01-13T07:37:56 -25.452845074934586
2016-01-13T07:38:26 -25.453214503401156
2016-01-13T07:38:55 -25.453570289898526
2016-01-13T07:39:27 -25.45396146466982
2016-01-13T07:39:57 -25.454326696134824
2016-01-13T07:40:26 -25.454678471453246
2016-01-13T07:40:55 -25.45502894045501
2016-01-13T07:41:27 -25.45541419726039
2016-01-13T07:41:57 -25.455773953498568
2016-01-13T07:42:26 -25.456120407793314
2016-01-13T07:42:55 -25.45646552781314
2016-01-13T07:43:27 -25.45684488399338
2016-01-13T07:43:57 -25.457199093145345
2016-01-13T07:44:26 -25.45754017971946
2016-01-13T07:44:56 -25.457891664038936
2016-01-13T07:45:27 -25.45825342218875
2016-01-13T07:45:57 -25.458602053666826
2016-01-13T07:46:26 -25.45893775048653
2016-01-13T07:46:56 -25.459283680330817
2016-01-13T07:47:27 -25.459639624559404
2016-01-13T07:47:57 -25.459982702427663
2016-01-13T07:48:26 -25.460312985096046
2016-01-13T07:48:56 -25.460653269134816
2016-01-13T07:49:27 -25.46100345282914
2016-01-13T07:49:57 -25.461340922469123
2016-01-13T07:50:26 -25.46166574801699
2016-01-13T07:50:56 -25.462000463568156
2016-01-13T07:51:28 -25.46235591097171
2016-01-13T07:51:57 -25.462676597664547
2016-01-13T07:52:27 -25.463007045419825
2016-01-13T07:52:56 -25.463325046355177
2016-01-13T07:53:28 -25.46367446196274
2016-01-13T07:53:57 -25.46398971513317
2016-01-13T07:54:26 -25.46430367629891
2016-01-13T07:54:56 -25.464627004648396
2016-01-13T07:55:28 -25.464970355575716
2016-01-13T07:55:57 -25.46528012819394
2016-01-13T07:56:27 -25.465599125475322
2016-01-13T07:56:56 -25.46590618990288
2016-01-13T07:57:28 -25.466243444929898
2016-01-13T07:57:57 -25.46654768500686
2016-01-13T07:58:27 -25.466861037148394
2016-01-13T07:58:56 -25.467162557218998
2016-01-13T07:59:28 -25.467493704796283
2016-01-13T07:59:57 -25.46779236490278
2016-01-13T08:00:27 -25.46809998150608
2016-01-13T08:00:56 -25.468395959250024
2016-01-13T08:01:28 -25.46872096253258
2016-01-13T08:01:57 -25.469014075552863
2016-01-13T08:02:27 -25.46931591434769
2016-01-13T08:02:56 -25.469606334088382
2016-01-13T08:03:28 -25.469925187351414
2016-01-13T08:03:58 -25.470222617560523
2016-01-13T08:04:27 -25.470508769405477
2016-01-13T08:04:56 -25.47079356986772
2016-01-13T08:05:28 -25.47110625776747
2016-01-13T08:05:58 -25.471397900981817
2016-01-13T08:06:27 -25.471678455482248
2016-01-13T08:06:56 -25.471957612768378
2016-01-13T08:07:28 -25.47226410757957
2016-01-13T08:07:58 -25.47254994449464
2016-01-13T08:08:27 -25.472824823300833
2016-01-13T08:08:57 -25.473107785640277
2016-01-13T08:09:28 -25.473398629547795
2016-01-13T08:09:58 -25.473678621421424
2016-01-13T08:10:27 -25.47394789855621
2016-01-13T08:10:57 -25.474224968425016
2016-01-13T08:11:28 -25.47450977644265
2016-01-13T08:11:58 -25.474783897346867
2016-01-13T08:12:27 -25.4750474646384
2016-01-13T08:12:57 -25.47531870946923
2016-01-13T08:13:29 -25.475606429706293
2016-01-13T08:13:58 -25.47586569937979
2016-01-13T08:14:28 -25.476132449287114
2016-01-13T08:14:57 -25.47638894832982
2016-01-13T08:15:29 -25.47667033026176
2016-01-13T08:15:58 -25.476923907699046
2016-01-13T08:16:28 -25.47718476869708
2016-01-13T08:16:57 -25.477435544083807
2016-01-13T08:17:29 -25.477710601589912
2016-01-13T08:17:58 -25.47795846705378
2016-01-13T08:18:28 -25.47821342213458
2016-01-13T08:18:57 -25.478458461184267
2016-01-13T08:19:29 -25.478727202685292
2016-01-13T08:19:58 -25.478969299427128
2016-01-13T08:20:27 -25.479210019657092
2016-01-13T08:20:57 -25.479457577446908
2016-01-13T08:21:29 -25.479720007169888
2016-01-13T08:21:58 -25.47995634344403
2016-01-13T08:22:28 -25.48019936260891
2016-01-13T08:22:57 -25.480432880723214
2016-01-13T08:23:29 -25.48068896814703
2016-01-13T08:23:58 -25.480919504013105
2016-01-13T08:24:28 -25.481156572660662
2016-01-13T08:24:57 -25.48138431160186
2016-01-13T08:25:29 -25.48163395607677
2016-01-13T08:25:58 -25.48185875344236

output

File abell426.barycorr.list has been created with the previous code.

2016-01-10T05:06:02 -21.4663846704
2016-01-10T05:06:32 -21.4671673847
2016-01-10T05:07:03 -21.4679767479
2016-01-10T05:07:33 -21.4687605397
2016-01-10T05:08:06 -21.4696233171
2016-01-10T05:08:36 -21.4704082077
2016-01-10T05:09:06 -21.4711936166
2016-01-10T05:09:36 -21.4719795406
2016-01-10T05:10:08 -21.4728184234
2016-01-10T05:10:39 -21.4736316427
2016-01-10T05:11:09 -21.4744191425
2016-01-10T05:11:40 -21.4752334194
2016-01-10T05:12:11 -21.4760482283
2016-01-10T05:12:42 -21.4768635658
2016-01-10T05:13:12 -21.4776531019
2016-01-10T05:13:43 -21.4784694689
2016-01-10T05:14:14 -21.4792863537
2016-01-10T05:14:45 -21.4801037528
2016-01-10T05:15:15 -21.4808952705
2016-01-10T05:15:45 -21.4816872631
2016-01-10T05:16:18 -21.4825589996
...
[6]:
# Now, we can then display the output file,
# i.e. the barycentric velocity correction

import astropy.time

dates = list() ; corrs = list()
with open('abell426.barycorr.list', 'r') as f:
    for line in f:
        line = line.split()
        dates.append(line[0])
        corrs.append(float(line[1]))

dates = astropy.time.Time(dates, format='isot', scale='utc')

import pylab as pl
pl.plot_date(dates.plot_date, corrs, ls='None', marker='+', c='orange')
pl.grid()
pl.xlabel('Date (UTC)')
pl.ylabel('Barycentric velocity correction (in km/s)')
master.03e73|WARNING| /home/thomas/miniconda2/envs/orb3/lib/python3.7/site-packages/pandas/plotting/_matplotlib/converter.py:103: FutureWarning: Using an implicitly registered datetime converter for a matplotlib plotting method. The converter was registered by pandas on import. Future versions of pandas will require you to explicitly register matplotlib converters.

To register the converters:
        >>> from pandas.plotting import register_matplotlib_converters
        >>> register_matplotlib_converters()
  warnings.warn(msg, FutureWarning)

[6]:
Text(0, 0.5, 'Barycentric velocity correction (in km/s)')
_images/script_example_heliocentric_velocity_8_2.png

How to use the computed correction

In general, for km/s precision, just add the barycentric velocity to the measured velocity. For higher precision you can refer to http://docs.astropy.org/en/stable/api/astropy.coordinates.SkyCoord.html#astropy.coordinates.SkyCoord.radial_velocity_correction