示例#1
0
 def test_get_Bfield(self):
     """test get_Bfield"""
     expected = {'Blocal': array([ 1031.00899,  3451.98937]),
     'Bvec': array([[    3.49178,  -172.79037 ,  1016.4206],
                    [  335.0928,  -553.03591,  3390.88406]])}
     actual = ib.get_Bfield(self.ticks, self.loci, omnivals=self.omnivals)
     for key in expected.keys():
         numpy.testing.assert_almost_equal(actual[key], expected[key], decimal=5)
示例#2
0
 def test_get_Bfield(self):
     """test get_Bfield"""	
     expected = {'Blocal': array([ 1031.05446706,  3451.97910165]),
     'Bvec': array([[    3.50593418,  -172.8235171 ,  1016.46104422],
                    [  335.08938682,  -553.04743515,  3390.87206416]])}
     actual = ib.get_Bfield(self.ticks, self.loci, omnivals=self.omnivals)
     for key in expected.keys():
         numpy.testing.assert_almost_equal(actual[key], expected[key], decimal=5)
示例#3
0
def to_equatorial(position, time, pitch):
    """
    take in spacepy coord class and ticktock class
    """

    blocal = irb.get_Bfield(time, position, extMag='T89')['Blocal']
    beq = irb.find_magequator(time, position, extMag='T89')['Bmin']
    eq_pitch = np.arcsin(np.sqrt(np.sin(np.deg2rad(pitch))**2 * beq / blocal))
    return np.rad2deg(eq_pitch)
示例#4
0
def get_bfield_irbem(x, dtime, bmodel, extfield):

    pos = spc.Coords([x[0], x[1], x[2]], 'GEO', 'car')
    tv = spt.Ticktock(dtime)
    B = irbem.get_Bfield(tv,
                         pos,
                         extMag=extfield,
                         options=[1, 0, 0, 0, bmodel],
                         omnivals=None)

    Bmag = B['Blocal']

    return Bmag
示例#5
0
 def test_get_Bfield(self):
     """test get_Bfield"""
     expected = {
         'Blocal':
         array([1031.05446706, 3451.97910165]),
         'Bvec':
         array([[3.50593418, -172.8235171, 1016.46104422],
                [335.08938682, -553.04743515, 3390.87206416]])
     }
     actual = ib.get_Bfield(self.ticks, self.loci, omnivals=self.omnivals)
     for key in expected.keys():
         numpy.testing.assert_almost_equal(actual[key],
                                           expected[key],
                                           decimal=5)
示例#6
0
def B_dir_3D(t, x, dtime, bmodel, extfield, direction):
    # p0 must be in GEO car in RE
    # dtime must be a datetime object

    pos = spc.Coords([x[0], x[1], x[2]], 'GEO', 'car')
    tv = spt.Ticktock(dtime)
    B = irbem.get_Bfield(tv,
                         pos,
                         extMag=extfield,
                         options=[1, 0, 0, 0, bmodel],
                         omnivals=None)

    Bmags = direction * B['Bvec'] / B['Blocal']

    return [Bmags[0][0], Bmags[0][1], Bmags[0][2]]
示例#7
0
data3 = pd.read_csv('/home/wyatt/Documents/SAMPEX/generated_Data/burst_Mar93.csv',header=None,index_col=0,names=cols)
data = data.append(data2)
data = data.append(data3)
data = data.loc[~data.index.duplicated(keep='first')]
length = len(data.index.values)
times = data.index
print(length)
X = data['GEI_X'].to_numpy() / Re
Y = data['GEI_Y'].to_numpy() / Re
Z = data['GEI_Z'].to_numpy() / Re
position = np.stack((X,Y,Z),axis=1)
ticks = Ticktock(times)
coords = spc.Coords(position,'GEI','car')

#find B based on position
bField = irb.get_Bfield(ticks,coords,extMag='T89')
Field_GEO = bField['Bvec'] #b field comes out in xyz
#convert to GEIcar, because the direction cosines take GEI to body fixed
Field_GEO_coords = spc.Coords(Field_GEO,'GEO','car')
Field_GEO_coords.ticks = Ticktock(times)
Field_GEI = irb.coord_trans(Field_GEO_coords,'GEI','car')
Field_Mag = bField['Blocal']
#rotate b to body fixed
BX = Field_GEI[:,0]
BY = Field_GEI[:,1]
BZ = Field_GEI[:,2]

A11 = data['A11']
A12 = data['A12']
A13 = data['A13']
A21 = data['A21']