astro-datalab / notebooks-latest

Default set of Data Lab notebooks, by DL team and contributed by users
BSD 3-Clause "New" or "Revised" License
57 stars 48 forks source link

Exploring SMASH DR2 - ValueError: setting an array element with a sequence #151

Closed JosephKarpinski closed 1 year ago

JosephKarpinski commented 1 year ago

Exploring SMASH DR2 receiving multiple errors.

https://github.com/astro-datalab/notebooks-latest/blob/master/03_ScienceExamples/GalacticStructure/ExploringSMASHDR2.ipynb

See attached screen prints

Screen Shot 2023-01-26 at 1 54 29 PM Screen Shot 2023-01-26 at 1 54 59 PM Screen Shot 2023-01-26 at 1 55 16 PM
jacquesalice commented 1 year ago

Hi @JosephKarpinski, thanks for reporting this. While I was able to run this notebook without issue, I see that there is a deprecation warning for setting an array element with a sequence for the rot variable:

DeprecationWarning: setting an array element with a sequence. This was supported in some cases where the elements are arrays with a single element. For example np.array([1, np.array([2])], dtype=int). In the future this will raise the same ValueError as np.array([1, [2]], dtype=int). rot = np.array(rot,np.float64).flatten()

Try replacing rot=(f4['ra'],f4['dec'],0) with rot=(f4['ra'].array[0],f4['dec'].array[0],0)

Let me know if this works for you, and I will update the notebook accordingly.

JosephKarpinski commented 1 year ago

That worked. Thank you!

Screen Shot 2023-01-29 at 9 10 18 AM Screen Shot 2023-01-29 at 9 11 05 AM Screen Shot 2023-01-29 at 9 11 40 AM