diff --git a/postprocessor.py b/postprocessor.py index d0f7520..65a1927 100644 --- a/postprocessor.py +++ b/postprocessor.py @@ -463,7 +463,7 @@ class PostProcessor(HDF5Container): Returns the position in normalized units centered on the position of the star """ 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 def oct_getter_vect_r(self, dset, name_vect): @@ -891,23 +891,15 @@ class PostProcessor(HDF5Container): # Get coordinates im_extent = np.array(self.save.root.maps._v_attrs.im_extent) * self.lbox 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 dx = (im_extent[1] - im_extent[0]) / map_size dy = (im_extent[3] - im_extent[2]) / map_size # 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] - ) - y = ( - np.linspace(im_extent[2], im_extent[3], map_size) - + 0.5 * dy - - pos_star[1] - ) + 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 - center[1] xx, yy = np.meshgrid(x, y) rr = np.sqrt(xx ** 2 + yy ** 2) @@ -926,14 +918,12 @@ class PostProcessor(HDF5Container): """ 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 # radius of the corner of the box plus a margin rad_of_box = ( - np.sqrt( - (im_extent[1] - pos_star[0]) ** 2 + (im_extent[3] - pos_star[1]) ** 2 - ) + np.sqrt((im_extent[1] - center[0]) ** 2 + (im_extent[3] - center[1]) ** 2) + 0.1 ) @@ -969,7 +959,7 @@ class PostProcessor(HDF5Container): """ im_extent = np.array(self.save.root.maps._v_attrs.im_extent) * self.lbox 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 dx = (im_extent[1] - im_extent[0]) / map_size @@ -982,7 +972,7 @@ class PostProcessor(HDF5Container): xx, yy = np.meshgrid(x, y) # 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 def _bins_on_map(self, ax_los="z"): @@ -1306,15 +1296,15 @@ class PostProcessor(HDF5Container): # Get coordinates im_extent = np.array(self.save.root.maps._v_attrs.im_extent) * self.lbox 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 dx = (im_extent[1] - im_extent[0]) / map_size dy = (im_extent[3] - im_extent[2]) / map_size # 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] - y = np.linspace(im_extent[2], im_extent[3], map_size) + 0.5 * dy - pos_star[1] + 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 - center[1] xx, yy = np.meshgrid(x, y) rr = np.sqrt(xx ** 2 + yy ** 2) diff --git a/pp_params.yml b/pp_params.yml index 798b23b..6a62655 100644 --- a/pp_params.yml +++ b/pp_params.yml @@ -11,7 +11,7 @@ plot : # Plot parameters disk: # Disk speficic parameters 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) mass_star : 1. # Mass of the central star nb_bin : 100 # Number of bins for averaged quantities