Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify return-format for dat-datasets #2

Open
haraldp271 opened this issue Jan 10, 2023 · 0 comments
Open

Simplify return-format for dat-datasets #2

haraldp271 opened this issue Jan 10, 2023 · 0 comments

Comments

@haraldp271
Copy link
Collaborator

ImportRun presently returns a dat-dataset with a separate dictionary entry for each column:

Lev2=segment_utils.ImportRun(SRC, 2)
centerB = Lev2['Horizons']['AhB']['CoordCenterInertial']
print(centerB)

{'time': array([[0.0000e+00, 0.0000e+00],
        [5.0000e-01, 5.0000e-01],
        [1.0000e+00, 1.0000e+00],
        ...,
        [4.1385e+03, 4.1385e+03],
        [4.1390e+03, 4.1390e+03],
        [4.1395e+03, 4.1395e+03]]),
 'x': array([[ 0.00000000e+00, -3.97135358e+01],
        [ 5.00000000e-01, -3.97135217e+01],
        [ 1.00000000e+00, -3.97134437e+01],
        ...,
        [ 4.13850000e+03, -3.12849015e+01],
        [ 4.13900000e+03, -3.12940663e+01],
        [ 4.13950000e+03, -3.13031083e+01]]),
 'y': array([[ 0.00000000e+00,  2.08095432e-03],
        [ 5.00000000e-01, -3.84157027e-02],
        [ 1.00000000e+00, -7.86382932e-02],
        ...,
        [ 4.13850000e+03,  1.14077851e+01],
        [ 4.13900000e+03,  1.13613565e+01],
        [ 4.13950000e+03,  1.13148841e+01]]),
 'z': array([[ 0.00000000e+00,  2.81790998e-08],
        [ 5.00000000e-01,  2.81702228e-08],
        [ 1.00000000e+00,  2.81619053e-08],
        ...,
        [ 4.13850000e+03, -3.30562543e-06],
        [ 4.13900000e+03, -3.30750271e-06],
        [ 4.13950000e+03, -3.30937792e-06]])}

This generality is needed if the number of columns in a dat-file change between segments. However, it comes with significant inconvenience for the many cases where where the column-count is known to be constant.

Switch the code, such that by default it returns simple formats (i.e., one 4-column numpy array for this example). And explicitly hardcode into segment_utils.ImportRun the one case where the generality is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant