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:
- imported DR3 table that includes the following measures, but not their units: ra, dec, parallax, pmra, pmdec, radial_velocity.
- I have calculated and included columns for distance, l and b, and the xyz (through ra_dec_gal.cartesian)
- 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)
- 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.
*, but that's not the issue. I think your problem is that your value forpm_decis taken from the table without being multiplied by a unit, e.g.u.mas/u.yr. However, you also multiplydistanceby a proper motion unit; I suppose this should be a distance unit. $\endgroup$pm_dec, like you've done for all the other parameters? $\endgroup$