[pp_params] rename disk.pos_star in disk.center, in box units

This commit is contained in:
Noe Brucy
2021-04-01 16:19:36 +02:00
parent 5f57429972
commit 69c685ba14
2 changed files with 12 additions and 22 deletions
+11 -21
View File
@@ -463,7 +463,7 @@ class PostProcessor(HDF5Container):
Returns the position in normalized units centered on the position of the star Returns the position in normalized units centered on the position of the star
""" """
pos = dset.get_cell_centers() pos = dset.get_cell_centers()
pos = pos - (np.array(self.pp_params.disk.pos_star) / self.lbox) pos = pos - np.array(self.pp_params.disk.center)
return pos return pos
def oct_getter_vect_r(self, dset, name_vect): def oct_getter_vect_r(self, dset, name_vect):
@@ -891,23 +891,15 @@ class PostProcessor(HDF5Container):
# Get coordinates # Get coordinates
im_extent = np.array(self.save.root.maps._v_attrs.im_extent) * self.lbox im_extent = np.array(self.save.root.maps._v_attrs.im_extent) * self.lbox
map_size = self.pp_params.pymses.map_size map_size = self.pp_params.pymses.map_size
pos_star = self.pp_params.disk.pos_star center = self.pp_params.disk.center * self.lbox
# Physical size of cells # Physical size of cells
dx = (im_extent[1] - im_extent[0]) / map_size dx = (im_extent[1] - im_extent[0]) / map_size
dy = (im_extent[3] - im_extent[2]) / map_size dy = (im_extent[3] - im_extent[2]) / map_size
# Physical coordinates of the center of the cells # Physical coordinates of the center of the cells
x = ( x = np.linspace(im_extent[0], im_extent[1], map_size) + 0.5 * dx - center[0]
np.linspace(im_extent[0], im_extent[1], map_size) y = np.linspace(im_extent[2], im_extent[3], map_size) + 0.5 * dy - center[1]
+ 0.5 * dx
- pos_star[0]
)
y = (
np.linspace(im_extent[2], im_extent[3], map_size)
+ 0.5 * dy
- pos_star[1]
)
xx, yy = np.meshgrid(x, y) xx, yy = np.meshgrid(x, y)
rr = np.sqrt(xx ** 2 + yy ** 2) rr = np.sqrt(xx ** 2 + yy ** 2)
@@ -926,14 +918,12 @@ class PostProcessor(HDF5Container):
""" """
Computes radial bins (for disk) Computes radial bins (for disk)
""" """
pos_star = self.pp_params.disk.pos_star center = self.pp_params.disk.center * self.lbox
im_extent = np.array(self.save.root.maps._v_attrs.im_extent) * self.lbox im_extent = np.array(self.save.root.maps._v_attrs.im_extent) * self.lbox
# radius of the corner of the box plus a margin # radius of the corner of the box plus a margin
rad_of_box = ( rad_of_box = (
np.sqrt( np.sqrt((im_extent[1] - center[0]) ** 2 + (im_extent[3] - center[1]) ** 2)
(im_extent[1] - pos_star[0]) ** 2 + (im_extent[3] - pos_star[1]) ** 2
)
+ 0.1 + 0.1
) )
@@ -969,7 +959,7 @@ class PostProcessor(HDF5Container):
""" """
im_extent = np.array(self.save.root.maps._v_attrs.im_extent) * self.lbox im_extent = np.array(self.save.root.maps._v_attrs.im_extent) * self.lbox
map_size = self.pp_params.pymses.map_size map_size = self.pp_params.pymses.map_size
pos_star = self.pp_params.disk.pos_star center = self.pp_params.disk.center * self.lbox
# Physical size of cells # Physical size of cells
dx = (im_extent[1] - im_extent[0]) / map_size dx = (im_extent[1] - im_extent[0]) / map_size
@@ -982,7 +972,7 @@ class PostProcessor(HDF5Container):
xx, yy = np.meshgrid(x, y) xx, yy = np.meshgrid(x, y)
# Physical radius # Physical radius
rr = np.sqrt((xx - pos_star[0]) ** 2 + (yy - pos_star[1]) ** 2) rr = np.sqrt((xx - center[0]) ** 2 + (yy - center[1]) ** 2)
return rr return rr
def _bins_on_map(self, ax_los="z"): def _bins_on_map(self, ax_los="z"):
@@ -1306,15 +1296,15 @@ class PostProcessor(HDF5Container):
# Get coordinates # Get coordinates
im_extent = np.array(self.save.root.maps._v_attrs.im_extent) * self.lbox im_extent = np.array(self.save.root.maps._v_attrs.im_extent) * self.lbox
map_size = self.pp_params.pymses.map_size map_size = self.pp_params.pymses.map_size
pos_star = self.pp_params.disk.pos_star center = self.pp_params.disk.center * self.lbox
# Physical size of cells # Physical size of cells
dx = (im_extent[1] - im_extent[0]) / map_size dx = (im_extent[1] - im_extent[0]) / map_size
dy = (im_extent[3] - im_extent[2]) / map_size dy = (im_extent[3] - im_extent[2]) / map_size
# Physical coordinates of the center of the cells # Physical coordinates of the center of the cells
x = np.linspace(im_extent[0], im_extent[1], map_size) + 0.5 * dx - pos_star[0] x = np.linspace(im_extent[0], im_extent[1], map_size) + 0.5 * dx - center[0]
y = np.linspace(im_extent[2], im_extent[3], map_size) + 0.5 * dy - pos_star[1] y = np.linspace(im_extent[2], im_extent[3], map_size) + 0.5 * dy - center[1]
xx, yy = np.meshgrid(x, y) xx, yy = np.meshgrid(x, y)
rr = np.sqrt(xx ** 2 + yy ** 2) rr = np.sqrt(xx ** 2 + yy ** 2)
+1 -1
View File
@@ -11,7 +11,7 @@ plot : # Plot parameters
disk: # Disk speficic parameters disk: # Disk speficic parameters
enable : False # Enable specific disk analysis enable : False # Enable specific disk analysis
pos_star : [1., 1., 1.] # Position of the central star center : [0.5, 0.5, 0.5] # Position of the center of the disk (in fraction of lbox)
binning : "log" # Kind of binning (lin : linear, log : logarithmic) binning : "log" # Kind of binning (lin : linear, log : logarithmic)
mass_star : 1. # Mass of the central star mass_star : 1. # Mass of the central star
nb_bin : 100 # Number of bins for averaged quantities nb_bin : 100 # Number of bins for averaged quantities