Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aakash525 committed Jul 15, 2018
1 parent dcb0866 commit fabc38c
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 69 deletions.
78 changes: 39 additions & 39 deletions orbitdeterminator/kep_determination/gibbsMethod.py
Expand Up @@ -20,11 +20,11 @@ class Gibbs(object):
@classmethod
def convert_list(self, vec):
'''
Converts the values of a vector of datatype str into float
Converts the values of a vector of datatype str into float.
Args:
self : class variables
vec : input vector
self: class variables
vec: input vector
Returns:
vector converted to float values
Expand All @@ -40,11 +40,11 @@ def find_length(self, path):
will get removed.
Args:
self : class variables
path : file path
self: class variables
path: file path
Returns:
size : length of file
size: length of file
'''
length = open(path, 'r')
length.readline() # it is used to remove the header line
Expand All @@ -58,14 +58,14 @@ def find_length(self, path):
def read_file(self, path):
'''
Read the data of the file in a set of three position vectors and
then applies gibbsMethod on it and stores it to a final vector
then applies gibbsMethod on it and stores it to a final vector.
Args:
self : class variables
path : path to input file
self: class variables
path: path to input file
Returns:
final : list of all pair of position and velocity vector
final: list of all pair of position and velocity vector
'''
myfile = open(path, 'r')
myfile.readline() # it is used to remove the header line
Expand All @@ -82,7 +82,7 @@ def read_file(self, path):
v2 = self.gibbs(r1, r2, r3)

data = [r2[0], r2[1], r2[2], v2[0], v2[1], v2[2]]
final[i, :] = data
final[i,:] = data

r1 = r2
r2 = r3
Expand All @@ -93,11 +93,11 @@ def read_file(self, path):
@classmethod
def magnitude(self, vec):
'''
Computes magnitude of the vector
Computes magnitude of the vector.
Args:
self : class variables
vec : vector
self: class variables
vec: vector
Returns:
magnitude of vector
Expand All @@ -112,9 +112,9 @@ def dot_product(self, a, b):
other and then add them. Returns a single value.
Args:
self : class variables
a : first vector
b : second vector
self: class variables
a: first vector
b: second vector
Returns:
dot product
Expand All @@ -127,27 +127,27 @@ def cross_product(self, a, b):
Cross product of two vectors. Returns a vector.
Args:
self : class variables
a : first vector
b : second vector
self: class variables
a: first vector
b: second vector
Returns:
cross product
'''
return [a[1]*b[2] - b[1]*a[2], (-1)*(a[0]*b[2] - b[0]*a[2]), a[0]*b[1] - b[0]*a[1]]

@classmethod
def vector_sum(self, a, b, flag):
def operate_vector(self, a, b, flag):
'''
If flag is 1 then add both vectors with corresponding values else if
flag is 0 (zeros) then subtract two vectors with corresponding values.
Returns a vector.
Args:
self : class variables
a : first vector
b : second vector
flag : checks for operation
self: class variables
a: first vector
b: second vector
flag: checks for operation (addition/subtraction)
Returns:
sum/difference of vector based on flag value
Expand All @@ -164,8 +164,8 @@ def unit(self, vec):
its magnitude. Returns a vector.
Args:
self : class variables
vec : input vector
self: class variables
vec: input vector
Returns:
unit vector
Expand All @@ -181,13 +181,13 @@ def gibbs(self, r1, r2, r3):
Both combined forms state vector.
Args:
self : class variables
r1 : first position vector
r2 : second position vector
r3 : third position vector
self: class variables
r1: first position vector
r2: second position vector
r3: third position vector
Returns:
v2 : velocity vector
v2: velocity vector
'''
mag_r1 = self.magnitude(r1)
mag_r2 = self.magnitude(r2)
Expand All @@ -208,18 +208,18 @@ def gibbs(self, r1, r2, r3):
N = [r1c23[0]+r2c31[0]+r3c12[0], r1c23[1]+r2c31[1]+r3c12[1], r1c23[2]+r2c31[2]+r3c12[2]]
mag_N = self.magnitude(N)

D = self.vector_sum(c12, self.vector_sum(c23, c31, 1), 1)
D = self.operate_vector(c12, self.operate_vector(c23, c31, 1), 1)
mag_D = self.magnitude(D)

vec1 = [(mag_r2-mag_r3)*i for i in r1]
vec2 = [(mag_r3-mag_r1)*i for i in r2]
vec3 = [(mag_r1-mag_r2)*i for i in r3]
S = self.vector_sum(vec1, self.vector_sum(vec2, vec3, 1), 1)
S = self.operate_vector(vec1, self.operate_vector(vec2, vec3, 1), 1)

term1 = math.sqrt(meu/(mag_N*mag_D))
var1 = self.cross_product(D, r2)
var2 = [i/mag_r2 for i in var1]
term2 = self.vector_sum(var2, S, 1)
term2 = self.operate_vector(var2, S, 1)
v2 = [term1*i for i in term2]

return v2
Expand All @@ -231,9 +231,9 @@ def orbital_elements(self, r, v):
veclocity vector).
Args:
self : class variables
r : position vector
v : velocity vector
self: class variables
r: position vector
v: velocity vector
Returns:
set of six orbital elements
Expand All @@ -254,7 +254,7 @@ def orbital_elements(self, r, v):

var1 = [(mag_v**2 - meu/mag_r)*i for i in r]
var2 = [self.dot_product(r, v)*i for i in v]
vec = self.vector_sum(var1, var2, 0)
vec = self.operate_vector(var1, var2, 0)
eccentricity = [i/meu for i in vec]
mag_e = self.magnitude(eccentricity)

Expand Down
60 changes: 30 additions & 30 deletions orbitdeterminator/kep_determination/sgp4.py
Expand Up @@ -24,8 +24,8 @@ def find_year(self, year):
correspond to years in the range 1957 to 1999.
Args:
self : class variables
year : last 2 digits of the year
self: class variables
year: last 2 digits of the year
Returns:
whole year number
Expand All @@ -42,8 +42,8 @@ def find_date(self, date):
Finds date of the year from number of days.
Args:
self : class variables
date : Number of days
self: class variables
date: Number of days
Returns:
date in a tuple with value as (year, month, day)
Expand Down Expand Up @@ -74,8 +74,8 @@ def find_time(self, time):
Finds the time of the day from the input in milliseconds.
Args:
self : class variables
time : Time in milliseconds
self: class variables
time: Time in milliseconds
Returns:
time in a tuple with value as (hour, minute, second)
Expand All @@ -96,13 +96,13 @@ def julian_day(self, year, mon, day, hr, mts, sec):
Converts given timestamp into Julian format.
Args:
self : class variables
year : year number
mon : month in year
day : date in the month
hr : hour
mts : minutes in the hour
sec : seconds in minute
self: class variables
year: year number
mon: month in year
day: date in the month
hr: hour
mts: minutes in the hour
sec: seconds in minute
Returns:
time in Julian format
Expand All @@ -117,12 +117,12 @@ def propagate(self, line1, line2):
a vector and returns the final vector.
Args:
self : class variables
line1 : line 1 in TLE
line2 : line 2 in TLE
self: class variables
line1: line 1 in TLE
line2: line 2 in TLE
Returns:
final : vector containing all state vectors for 8 hours
final: vector containing all state vectors for 8 hours
'''
year, month, day = self.find_date(''.join(line1[18:23]))
hour, minute, second = self.find_time(''.join(line1[24:32]))
Expand Down Expand Up @@ -152,7 +152,7 @@ def propagate(self, line1, line2):
pos, vel = self.propagation_model(tsince)
data = [pos[0], pos[1], pos[2], vel[0], vel[1], vel[2]]
data = [float("{0:.5f}".format(i)) for i in data]
final[i, :] = data
final[i,:] = data
yr, mth, day, hr, mts, sec = self.update_epoch(yr, mth, day, hr, mts, sec)
i = i + 1

Expand All @@ -161,16 +161,16 @@ def propagate(self, line1, line2):
@classmethod
def update_epoch(self, yr, mth, day, hr, mts, sec):
'''
Adds one second to the given time
Adds one second to the given time.
Args:
self : class variables
yr : year
mth : month
day : date
hr : hour
mts : minutes
sec : seconds
self: class variables
yr: year
mth: month
day: date
hr: hour
mts: minutes
sec: seconds
Returns:
updated timestamp epoch in a tuple with value as (year, month, day,
Expand Down Expand Up @@ -209,12 +209,12 @@ def propagation_model(self, tsince):
Computes state vectors at a given time epoch.
Args:
self : class variables
tsince : time epoch
self: class variables
tsince: time epoch
Returns:
pos : position vector
vel : velocity vector
pos: position vector
vel: velocity vector
'''
ae = 1
tothrd = 2.0/3.0
Expand Down

0 comments on commit fabc38c

Please sign in to comment.