amusecode / amuse

Astrophysical Multipurpose Software Environment. This is the main repository for AMUSE
http://www.amusecode.org
Apache License 2.0
158 stars 99 forks source link

Creating and plotting grid in supernova/hydrodynamics example #915

Closed dnrgodilano7 closed 1 year ago

dnrgodilano7 commented 1 year ago

Hello and good day. We were trying to run supernova_grid.py and we are having this error on the plot_grid function:

   Grid.create deprecated, use new_regular_grid instead
   Grid.create deprecated, use new_regular_grid instead
   Traceback (most recent call last):
     File "/Users/dnrgodilano7/Documents/AMUSE/trial/supernova/supernova_grid.py", line 190, in <module>
       main(**o.__dict__)
     File "/Users/dnrgodilano7/Documents/AMUSE/trial/supernova/supernova_grid.py", line 77, in main
       run_grid_code(hydro, grid, t_end, dt)
     File "/Users/dnrgodilano7/Documents/AMUSE/trial/supernova/supernova_grid.py", line 153, in run_grid_code
       plot_grid(grid)
     File "/Users/dnrgodilano7/Documents/AMUSE/trial/supernova/supernova_grid.py", line 17, in plot_grid
      rho = grid.rho[:,:,halfway].value_in(units.g/units.cm**3)
     File "/Users/dnrgodilano7/Amuse-env/lib/python3.9/site-packages/amuse/units/quantities.py", line 604, in __getitem__
      return new_quantity(self._number[index], self.unit)
   IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

on another note, is it possible to use supernova_grid.py to the output of molecular_cloud_collapse_with_sinks.py if we detect SN candidates in longer timescales by using the candidate SN output as initial condition to supernova_grid.py?

Thank you.

spzwart commented 1 year ago

dear Nico,

I'll have a look at the ..._grid.py function to see what is wrong. regarding your second question,: I am not sure that that would be the best solution, but in principle what you suggest is possible. i would simply make a contour plot in pyplot, or convert it to an image.

cheers, Simon

On Mon, Dec 12, 2022, 20:19 --Niko-- @.***> wrote:

Hello and good day. We were trying to run supernova_grid.py and we are having this error on the plot_grid function:

Grid.create deprecated, use new_regular_grid instead Grid.create deprecated, use new_regular_grid instead Traceback (most recent call last): File "/Users/dnrgodilano7/Documents/AMUSE/trial/supernova/supernova_grid.py", line 190, in main(o.dict) File "/Users/dnrgodilano7/Documents/AMUSE/trial/supernova/supernova_grid.py", line 77, in main run_grid_code(hydro, grid, t_end, dt) File "/Users/dnrgodilano7/Documents/AMUSE/trial/supernova/supernova_grid.py", line 153, in run_grid_code plot_grid(grid) File "/Users/dnrgodilano7/Documents/AMUSE/trial/supernova/supernova_grid.py", line 17, in plot_grid rho = grid.rho[:,:,halfway].value_in(units.g/units.cm3) File "/Users/dnrgodilano7/Amuse-env/lib/python3.9/site-packages/amuse/units/quantities.py", line 604, in getitem return new_quantity(self._number[index], self.unit) IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

on another note, is it possible to use supernova_grid.py to the output of molecular_cloud_collapse_with_sinks.py if we detect SN candidates in longer timescales by using the candidate SN output as initial condition to supernova_grid.py?

Thank you.

— Reply to this email directly, view it on GitHub https://github.com/amusecode/amuse/issues/915, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCPFTCYUMB23VOOCAOQAMTWM53D3ANCNFSM6AAAAAAS4J6VH4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

dnrgodilano7 commented 1 year ago

Ok, thank you for the help and advice Dr. S. Zwart!

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 28 days if no further activity occurs. Thank you for your contributions.