-
Notifications
You must be signed in to change notification settings - Fork 3
Inertia tensor #55
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
Inertia tensor #55
Conversation
…ed_aperture_properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a couple of comments. Also could you please run the formatter?
kinematic_properties.py
Outdated
|
|
||
| # 3x3 inertia tensor | ||
| Itensor = (mass[:, None, None] * position[:, None:, None] * position[:, None]).sum( | ||
| Itensor = (mass[:, None, None]/mass.sum() * position[:, None:, None] * position[:, None]).sum( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you changing the units of the inertia tensor (not saying you shouldn't, I'm just curious as to why)? Do you know of anyone else who uses this property that will need to be informed of the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because of the convention of the inertia tensor in intrinsic alignment context. In general physics, people the inertia tensor as m*r^2 but in the context of intrinsic alignment, we usually divide by the total mass of the object. (see e.g. eq. 7,8 of https://arxiv.org/abs/2309.08605). I am only aware of Aniruddh currently working on IA and I already informed him.
| ) | ||
| return Itensor | ||
|
|
||
| def get_reduced_inertia_tensor(mass, position): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is quite a lot of duplicated code shared with get_inertia_tensor. Could you combine these functions by passing a keyword argument, e.g. get_inertia_tensor(mass, position, reduce=False)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will make the changes
| Itensor = np.concatenate([np.diag(Itensor), Itensor[np.triu_indices(3, 1)]]) | ||
| return Itensor | ||
|
|
||
| def get_reduced_projected_inertia_tensor(mass, position, axis): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also pass a keyword argument to get_projected_inertia_tensor
kinematic_properties.py
Outdated
| ) | ||
| Itensor = Itensor.sum(axis=0) | ||
| Itensor = ( | ||
| np.array((Itensor[0, 0], Itensor[1, 1], Itensor[0, 1])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to multiply by units here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reduced projected inertia tensor is unitless
Included reduced inertia and reduced projected inertia tensors. Changed the inertia tensor calculation by dividing by the total mass.