<commit_before><commit_msg>Added readposhist<commit_after>#!/usr/bin/env python

## READ POSITION HISTORY FILE FOR GBM ###################################
#
#
# REQUIRES: pyfits, numpy
#
# INPUT: date in formate dd/mm/yy
#
#
#
#

import pyfits
import numpy
import sys
import time as tsys

def poshist(filename):
    tstart = tsys.clock()
    hdulist=pyfits.open(filename)
    mjdrefi=hdulist[0].header['MJDREFI']
    mjdreff=hdulist[0].header['MJDREFF']
    sec_offset = mjdreff*8.64e4
    data=hdulist[1].data
    phtime=data.field(0)	#contains sclk_utc = mission elapsed time in seconds
    position=[data.field('pos_x'), data.field('pos_y'), data.field('pos_z')]
    jdlimits=[]
    for i in [-1, 2]:
        jdlimits.append(phtime[0]/8.64e4 + i + mjdreff + mjdrefi + 2400000.5)
    tbase = mjdrefi+2400000.5
    time=(phtime + sec_offset)/8.64e4
    phlist = {'phtime':phtime, 'time':time, 'basejd':tbase, 'mjdrefi':mjdrefi, 'mjdreff':mjdreff, 'sec_offset':sec_offset, 'position':position, 'jdlimits':jdlimits}
    tend = tsys.clock()
    print "POSHIST Execution Time: " + str(tend-tstart)
    return phlist
 

def main():
    date=str(sys.argv[1])
    dateno=date[8:]+date[3:5]+date[:2]
    print "You chose position information for date: " + date
    filename='glg_poshist_all_' + dateno + '_v00.fit'
    print filename
    mjdrefi, mjdreff, sec_offset, phlist, nph, jdlimits = poshist(filename)
    print str(mjdrefi) + " " + str(mjdreff) 
    print "jdlimits: " + str(jdlimits)
    return


if __name__ == "__main__":
    main()



{'fraction_non_alphanumeric': 0.16753246753246753, 'fraction_numerical': 0.02727272727272727, 'mean_word_length': 4.085808580858086, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7079630', 'n_tokens_mistral': 636, 'n_tokens_neox': 602, 'n_words': 116}