Skip to content

Commit 6c1d937

Browse files
committed
fixes load_iod_data format.
fixes load_iod_data format. added. I accidentally deleted parts from the dictioray, that was used later in get_observations_data_sat()
1 parent a83c240 commit 6c1d937

File tree

1 file changed

+44
-18
lines changed

1 file changed

+44
-18
lines changed

orbitdeterminator/kep_determination/gauss_method.py

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,12 @@ def load_iod_data(fname):
236236
"""
237237

238238
# dt is the dtype for IOD-formatted text files
239-
dt = 'S15, i8, S1, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, S8, S7, i8, i8, S1, S1, i8, i8, i8'
239+
dt = 'S15, i8, S1,' \
240+
' i8, i8, i8,' \
241+
' i8, i8, i8, i8, i8, i8,' \
242+
' i8, i8,' \
243+
' S8, S7, i8, i8,' \
244+
' S1, S1, i8, i8, i8'
240245

241246
# iod_names correspond to the dtype names of each field
242247
iod_names = ['object', 'station', 'stationstatus',
@@ -254,30 +259,53 @@ def load_iod_data(fname):
254259
8, 7, 2, 1,
255260
2, 1, 3, 3, 9]
256261

262+
257263
iod_input_lines = np.genfromtxt(fname, dtype=dt, names=iod_names, delimiter=iod_delims, autostrip=True)
258264

259265
right_ascension = []
260266
declination = []
261267
azimuth = []
262268
elevation = []
263269

270+
# work in progress. get_observations_data_sat() needs it still.
271+
# should be cleaned and centrally handled.
272+
raHH = []
273+
raMM = []
274+
rammm = []
275+
decDD = []
276+
decMM = []
277+
decmmm = []
278+
279+
264280
for i in range(len(iod_input_lines)):
265281

282+
RAAZ = iod_input_lines["raaz"][i]
283+
raHH.append(RAAZ[0:3])
284+
raMM.append(RAAZ[3:5])
285+
rammm.append(RAAZ[5:7])
286+
RAAZ = RAAZ.decode()
287+
288+
DECEL = iod_input_lines["decel"][i]
289+
decDD.append(DECEL[0:3])
290+
decMM.append(DECEL[3:5])
291+
decmmm.append(DECEL[5:7])
292+
DECEL = DECEL.decode()
293+
294+
295+
266296
RA = -1.0
267297
DEC = -1.0
268298
AZ = -1.0
269299
EL = -1.0
270300

271301
if iod_input_lines["angformat"][i] == 1:
272302
# 1: RA/DEC = HHMMSSs+DDMMSS MX (MX in seconds of arc)
273-
RAAZ = iod_input_lines["raaz"][i].decode()
274303
HH = float(RAAZ[0:2])
275304
MM = float(RAAZ[2:4])
276305
SS = float(RAAZ[4:6])
277306
s = float(RAAZ[6])
278307
RA = (HH + (MM + (SS + s / 10.0) / 60.0) / 60.0) / 24.0 * 360.0
279308

280-
DECEL = iod_input_lines["decel"][i].decode()
281309
DD = float(DECEL[1:3])
282310
MM = float(DECEL[3:5])
283311
SS = float(DECEL[5:7])
@@ -287,13 +315,11 @@ def load_iod_data(fname):
287315

288316
elif iod_input_lines["angformat"][i] == 2:
289317
# 2: RA/DEC = HHMMmmm+DDMMmm MX (MX in minutes of arc)
290-
RAAZ = iod_input_lines["raaz"][i].decode()
291318
HH = float(RAAZ[0:2])
292319
MM = float(RAAZ[2:4])
293320
mmm = float(RAAZ[4:7])
294321
RA = (HH + (MM + mmm / 1000.0) / 60.0) / 24.0 * 360.0
295322

296-
DECEL = iod_input_lines["decel"][i].decode()
297323
DD = float(DECEL[1:3])
298324
MM = float(DECEL[3:5])
299325
mm = float(DECEL[5:7])
@@ -303,13 +329,11 @@ def load_iod_data(fname):
303329

304330
elif iod_input_lines["angformat"][i] == 3:
305331
# 3: RA/DEC = HHMMmmm+DDdddd MX (MX in degrees of arc)
306-
RAAZ = iod_input_lines["raaz"][i].decode()
307332
HH = float(RAAZ[0:2])
308333
MM = float(RAAZ[2:4])
309334
mmm = float(RAAZ[4:7])
310335
RA = (HH + (MM + mmm / 1000.0) / 60.0) / 24.0 * 360.0
311336

312-
DECEL = iod_input_lines["decel"][i].decode()
313337
DD = float(DECEL[1:3])
314338
dddd = float(DECEL[3:7])
315339
DEC = (DD + (dddd / 1000.0))
@@ -318,13 +342,11 @@ def load_iod_data(fname):
318342

319343
elif iod_input_lines["angformat"][i] == 4:
320344
# 4: AZ/EL = DDDMMSS+DDMMSS MX (MX in seconds of arc)
321-
RAAZ = iod_input_lines["raaz"][i].decode()
322345
DDD = float(RAAZ[0:3])
323346
MM = float(RAAZ[3:5])
324347
SS = float(RAAZ[5:7])
325348
AZ = DDD + (MM + SS / 60.0) / 60.0
326349

327-
DECEL = iod_input_lines["decel"][i].decode()
328350
DD = float(DECEL[1:3])
329351
MM = float(DECEL[3:5])
330352
SS = float(DECEL[5:7])
@@ -336,13 +358,11 @@ def load_iod_data(fname):
336358

337359
elif iod_input_lines["angformat"][i] == 5:
338360
# 5: AZ/EL = DDDMMmm+DDMMmm MX (MX in minutes of arc)
339-
RAAZ = iod_input_lines["raaz"][i].decode()
340361
DDD = float(RAAZ[0:3])
341362
MM = float(RAAZ[3:5])
342363
SS = float(RAAZ[5:7])
343364
AZ = DDD + (MM + SS / 60.0) / 60.0
344365

345-
DECEL = iod_input_lines["decel"][i].decode()
346366
DD = float(DECEL[1:3])
347367
MM = float(DECEL[3:5])
348368
mm = float(DECEL[5:7])
@@ -354,12 +374,10 @@ def load_iod_data(fname):
354374

355375
elif iod_input_lines["angformat"][i] == 6:
356376
# 6: AZ/EL = DDDdddd+DDdddd MX (MX in degrees of arc)
357-
RAAZ = iod_input_lines["raaz"][i].decode()
358377
DDD = float(RAAZ[0:3])
359378
dddd = float(RAAZ[3:7])
360379
AZ = DDD + dddd / 1000.0
361380

362-
DECEL = iod_input_lines["decel"][i].decode()
363381
DD = float(DECEL[1:3])
364382
dddd = float(DECEL[3:7])
365383
EL = DD + dddd / 1000.0
@@ -370,14 +388,12 @@ def load_iod_data(fname):
370388

371389
elif iod_input_lines["angformat"][i] == 7:
372390
# 7: RA/DEC = HHMMSSs+DDdddd MX (MX in degrees of arc)
373-
RAAZ = iod_input_lines["raaz"][i].decode()
374391
HH = float(RAAZ[0:2])
375392
MM = float(RAAZ[2:4])
376393
SS = float(RAAZ[4:6])
377394
s = float(RAAZ[6])
378395
RA = (HH + (MM + (SS + s / 10.0) / 60.0) / 60.0) / 24.0 * 360.0
379396

380-
DECEL = iod_input_lines["decel"][i].decode()
381397
DD = float(DECEL[1:3])
382398
dddd = float(DECEL[3:7])
383399
DEC = (DD + (dddd / 1000.0))
@@ -402,6 +418,14 @@ def load_iod_data(fname):
402418
iod["azimuth"] = azimuth
403419
iod["elevation"] = elevation
404420

421+
iod["raHH"] = raHH
422+
iod["raMM"] = raMM
423+
iod["rammm"] = rammm
424+
425+
iod["decDD"] = decDD
426+
iod["decMM"] = decMM
427+
iod["decmmm"] = decmmm
428+
405429
return iod
406430

407431
def observerpos_mpc(long, parallax_s, parallax_c, t_utc):
@@ -1911,7 +1935,6 @@ def gauss_iterator_sat(iod_object_data, sat_observatories_data, inds, refiters=0
19111935
mu = mu_Earth
19121936
r1_est, r2_est, r3_est, v2_est, D_est, R_est, rho1_est, rho2_est, rho3_est, tau1_est, tau3_est, f1_est, g1_est, f3_est, g3_est, rho_1_sr_est, rho_2_sr_est, rho_3_sr_est, obs_t_est = \
19131937
gauss_estimate_sat(iod_object_data, sat_observatories_data, inds, r2_root_ind=r2_root_ind)
1914-
19151938
r1, r2, r3, v2, D, R, rho1, rho2, rho3, tau1, tau3, f1, g1, f3, g3, rho_1_sr, rho_2_sr, rho_3_sr, obs_t = r1_est, r2_est, r3_est, v2_est, D_est, R_est, rho1_est, rho2_est, rho3_est, tau1_est, tau3_est, f1_est, g1_est, f3_est, g3_est, rho_1_sr_est, rho_2_sr_est, rho_3_sr_est, obs_t_est
19161939

19171940

@@ -2381,7 +2404,7 @@ def gauss_method_mpc(filename, bodyname, obs_arr=None, r2_root_ind_vec=None, ref
23812404
xyz_Ea_orb_vec_eclip = np.matmul(rot_equat_to_eclip, xyz_Ea_orb_vec_equat)
23822405
x_Ea_orb_vec[i], y_Ea_orb_vec[i], z_Ea_orb_vec[i] = xyz_Ea_orb_vec_eclip
23832406

2384-
ax = plt.axes(aspect='equal', projection='3d')
2407+
ax = plt.axes(aspect='auto', projection='3d')
23852408

23862409
# Sun-centered orbits: Computed orbit and Earth's
23872410
ax.scatter3D(0.0, 0.0, 0.0, color='yellow', label='Sun')
@@ -2480,7 +2503,10 @@ def gauss_method_sat_passes(filename, obs_arr=None, bodyname=None, r2_root_ind_v
24802503
# Apply Gauss method to three elements of data
24812504
inds = [obs_arr[j]-1, obs_arr[j+1]-1, obs_arr[j+2]-1]
24822505
print('Processing observation #', j)
2483-
r1, r2, r3, v2, R, rho1, rho2, rho3, rho_1_sr, rho_2_sr, rho_3_sr, obs_t = gauss_iterator_sat(iod_object_data, sat_observatories_data, inds, refiters=refiters, r2_root_ind=r2_root_ind_vec[j])
2506+
r1, r2, r3, v2, R, rho1, rho2, rho3, rho_1_sr, rho_2_sr, rho_3_sr, obs_t, refinement_success= \
2507+
gauss_iterator_sat(iod_object_data, sat_observatories_data, inds,
2508+
refiters=refiters,
2509+
r2_root_ind=r2_root_ind_vec[j])
24842510

24852511
# Consider light propagation time
24862512
if(check=='y'):

0 commit comments

Comments
 (0)