0

I keep getting KeyError: 'd_ρ' on my d_rho = ... line. I am trying to run the differentials so that I can put them in a table column (or single column per variable), to use for calculating velocity. Any thoughts on why I keep getting the KeyError?

# Accessing the differentials in table format
eq_cyl_diffs = eq_coord.cylindrical.differentials

# Extract differentials from the cylindrical coordinates
d_rho = eq_coord.cylindrical.differentials['d_ρ']
d_phi = eq_coord.cylindrical.differentials['d_ϕ']
d_z = eq_coord.cylindrical.differentials['d_z']

GAIA1A['d_ρ'] = d_rho
GAIA1A['d_ϕ'] = d_phi
GAIA1A['d_z'] = d_z
GAIA1A['d_ρ', 'd_ϕ', 'd_z'][0:1]

#d_rho, d_phi, d_z = eq_coord.cylindrical.differentials.d_rho, eq_coord.cylindrical.differentials.d_phi, eq_coord.cylindrical.differentials.d_z
1
  • Without knowing what exactly is eq_coord and eq_coord.cylindrical (provide at least the class names), and without seeing the exact error (i.e., the traceback), this is hard to answer. Commented Jul 21 at 12:20

1 Answer 1

0

From looking at the documentation for the CylindricalDifferential class, my educated guess would be that you need to use:

d_rho = eq_coord.cylindrical.differentials['d_rho']
d_phi = eq_coord.cylindrical.differentials['d_phi']
d_z = eq_coord.cylindrical.differentials['d_z']

as the classes attributes do not use the Greek symbols ρ and ϕ in their names.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.