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

Docs: New First Steps #473

Merged
merged 1 commit into from Feb 16, 2019
Merged

Docs: New First Steps #473

merged 1 commit into from Feb 16, 2019

Conversation

ax3l
Copy link
Member

@ax3l ax3l commented Feb 16, 2019

A new, simple, step-by-step "first steps" section with detailed instructions. Cheat-sheet like.

@ax3l ax3l requested a review from C0nsultant February 16, 2019 15:35
@ax3l ax3l force-pushed the doc-newFirstSteps branch 2 times, most recently from 73233a9 to c13ab34 Compare February 16, 2019 16:33
auto E_unitDim = E.getUnitDimension();

// ...
// api::UnitDimension::M
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: add pretty handlers, maybe some lookup DBs for typical quanitites, make useful.

E_unitDim = E.unit_dimension

# ...
# api.Unit_Dimension.M
Copy link
Member Author

@ax3l ax3l Feb 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: add pretty handlers, maybe some lookup DBs for typical quanitites, make useful.

Maybe couple to pint:

import pint

ureg = pint.UnitRegistry()

# [E] = M L^2 T^-3 I^-1
E_pint = 1 * E_unitDim[api.Unit_Dimension.L] * ureg.m + \
E_unitDim[api.Unit_Dimension.M] * ureg.kg + \
E_unitDim[api.Unit_Dimension.T] * ureg.s + \
E_unitDim[api.Unit_Dimension.I] * ureg.A + \
E_unitDim[api.Unit_Dimension.theta] * ureg.K + \
E_unitDim[api.Unit_Dimension.N] * ureg.mol + \
E_unitDim[api.Unit_Dimension.J] * ureg.cd

# length L, mass M, time T, electric current I, thermodynamic temperature theta, amount of substance N, luminous intensity J

E_pint.check('[length]')
# False
E_pint.check('[length] * [mass] / [current] / [time]^3')
# True
E_pint.check('V/m')
# True

E_x.dimensionality
# <UnitsContainer({'[current]': -1.0, '[length]': 1.0, '[mass]': 1.0, '[time]': -3.0})>
# ^-- access just like a regular dictionary

# create:
pint.context.UnitsContainer({'[current]': -1.0, '[length]': 1.0, '[mass]': 1.0, '[time]': -3.0})
# <UnitsContainer({'[current]': -1.0, '[length]': 1.0, '[mass]': 1.0, '[time]': -3.0})>

A new, simple, step-by-step "first steps" section
with detailed instructions. Cheat-sheet like.
@ax3l ax3l mentioned this pull request Feb 16, 2019
@ax3l ax3l merged commit b4ddf6f into openPMD:dev Feb 16, 2019
@ax3l ax3l deleted the doc-newFirstSteps branch February 16, 2019 19:26
@ax3l ax3l mentioned this pull request Feb 17, 2019
Data
-----

We can not work with the newly loaded data in ``x_data``:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo (?) not -> now

@ax3l ax3l mentioned this pull request Feb 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants