5
$\begingroup$

The help menu for StarData has many examples such as

StarData[EntityClass[
  "Star", {EntityProperty["Star", "DistanceFromEarth"] -> 
    TakeSmallest[10]}]]

which are great. However, I'd like to select not the smallest, but stars that fall in a specific distance range, i.e., 100 - 200 ly from Earth (or range of any other property). I tried various options, but could not get it to work with a range.

$\endgroup$
7
$\begingroup$

You can use:

StarData[
    EntityClass[
        "Star",
        "DistanceFromEarth" -> Between[{Quantity[100,"ly"],Quantity[200,"ly"]}]
    ]
]

or:

EntityList @ EntityClass[
    "Star",
    "DistanceFromEarth" -> Between[{Quantity[100,"ly"],Quantity[200,"ly"]}]
]
$\endgroup$
  • $\begingroup$ Great – works. I tried Between, but forgot I need the Quantity. Thanks for this heads up. $\endgroup$ – Mockup Dungeon Mar 8 at 19:54

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.