3
$\begingroup$

I have a list of star names:

stan = Select[#, Last[#] < Quantity[153.5, "LightYears"] &] &@
  StarData[StarData[], {"Name", "DistanceFromEarth"}]  

generated 7882 stars.

stan2 = Take[ Sort[stan, #1[[2]] > #2[[2]] &], 91]  

picked the ones that were one light year from the limit.

I transposed the list to get just the starnames.

stan3 = First[Transpose[stan2]]

Now I want to list the starname, Right Ascension, Declination.

StarData[StarData[stan3], {"RightAscension", "Declination", 
  "DistanceFromEarth"}]

but this generates the error:

StarData::notent: {{HIP 99969,\[Zeta] 1 Lyrae,HIP 77083,HIP 61505,HIP 22142,HIP 20492,HIP 2824,HIP 108859,\[Rho] Aquilae,HIP 99695,HIP 78923,HIP 67501,HIP 26563,HIP 25523,<<24>>,HIP 105906,HIP 77269,HIP 53106,HIP 35437,HIP 104351,HIP 96725,HIP 70677,HIP 52682,HIP 20850,\[Delta] 1 Tauri,HIP 4482,HIP 89000,<<41>>},<<1>>} is not a known entity, class, or tag for StarData. Use StarData[] for a list of entities. >>

Ctrl+= will "discover" the name and turn it into an entity, but I can't Map Ctrl+= onto a list. I tried mapping Entity["Star" #]& onto the list but this did not work. How do I get the starnames to act like StarData entities and not simply text?

$\endgroup$
2
$\begingroup$

Load some example data

s1 = StarData[EntityClass["Star", "StarNearest10"]]

enter image description here

The necessary steps now are

s2 = StarData[s1, {"Name", "DistanceFromEarth"}];
s3 = Reverse@SortBy[Last][Select[s2, Last[#] < Quantity[5, "LightYears"] &]]

enter image description here

It's important to remove the spaces from the star names!

s4 = Map[Entity["Star", #] &, StringReplace[s3[[All, 1]], " " -> ""]]

enter image description here

StarData[s4, {"Name", "RightAscension", "Declination", "DistanceFromEarth"}] // TableForm

enter image description here

$\endgroup$
  • $\begingroup$ This procedure works with english characters, and fails when the star name has a greek letter. {Entity["Star", "HIP99969"], Entity["Star", "[Zeta]1Lyrae"], Entity["Star", "HIP77083"], Entity["Star", "HIP61505"], Entity["Star", "HIP22142"], Entity["Star", "HIP20492"], Entity["Star", "HIP2824"], Entity["Star", "HIP108859"], Entity["Star", "[Rho]Aquilae"]} $\endgroup$ – finkh Jan 15 '16 at 1:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.