0
$\begingroup$

I'm trying to code such that I can import a table of DR3 data, including radial velocity, update the table using SkyCoord codes so that I can plot the velocity vs distance that I am expecting to show me how the velocity does not taper off with the furthest stars in my data set. I'm getting stuck with a code block that does not like the units on my ra and dec data. I have done the following:

  1. imported DR3 table that includes the following measures, but not their units: ra, dec, parallax, pmra, pmdec, radial_velocity.
  2. I have calculated and included columns for distance, l and b, and the xyz (through ra_dec_gal.cartesian)
  3. In my third block, I have declared the units for my column data as well as calculated the distance between sun and galactic center, set the Z value for the Sun above the galactic plane in pc and assigned the velocity of the sun at the galactic center to be (CartesianDifferential([12.9, 245.6, 7.78]*u.km/u.s)
  4. Here is where I am trying to figure out my mistakes. First, I'm not sure I have a straight path outlined to plot the velocity vs distance (I think I am misunderstanding something and making it more complicated than I need to), Second, I have tried to run the following code and continue to get an error.

Create the SkyCoord object for equatorial coordinates (RA/Dec)

eq_coord = SkyCoord(ra=DR3B['ra']*u.degree, dec = DR3B['dec']*u.degree, distance = DR3B['distance']*u.mas/u.yr, pm_ra_cosdec = DR3B['pmra']*u.mas/u.yr, pm_dec = DR3B['pmdec'], radial_velocity = DR3B['radial_velocity']*u.km/u.s, galcen_distance = 8.122*u.kpc, z_sun = 20.8*u.pc, frame='icrs') 

When I run it, I get an error that the d_lon_coslat and d_lat should have equivalent units. I suspect there is an issue between degrees and rads, however, I can't seem to fix it. I have tried it with/without the units assigned. It errors out on the first code line...thoughts?

I appreciate the assistance. Strueb I can provide my ipynb file if needed for assistance.

$\endgroup$
6
  • $\begingroup$ "Equivalent units" just means that they can be converted to each other, not that they must necessarily be equal to each other. So e.g. deg and rad would be okay, but deg and parsec wouldn't. Your example is missing bunch of *, but that's not the issue. I think your problem is that your value for pm_dec is taken from the table without being multiplied by a unit, e.g. u.mas/u.yr. However, you also multiply distance by a proper motion unit; I suppose this should be a distance unit. $\endgroup$ Commented Feb 22 at 21:00
  • $\begingroup$ Is the code you provided all of your code? It will be easier for us to troubleshoot if you provide a minimal, reproducible example. $\endgroup$ Commented Feb 22 at 22:49
  • $\begingroup$ How would I do this? I'm happy to provide my troubleshooting code with a small data table I'm using. How do I attach an .ipynb and .csv file? $\endgroup$ Commented Feb 23 at 22:54
  • $\begingroup$ Did it not help putting a unit on your pm_dec, like you've done for all the other parameters? $\endgroup$ Commented Feb 25 at 22:52
  • $\begingroup$ @RoySmart...thanks Roy...I was trying to figure out how to load a sample code and figured it out...it's helpful to ask sometimes while continuing to work it through. I appreciate you. Strueb $\endgroup$ Commented Feb 27 at 13:44

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.