Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video saving multi-cloud #112

Open
giadarol opened this issue Aug 11, 2019 · 1 comment
Open

Video saving multi-cloud #112

giadarol opened this issue Aug 11, 2019 · 1 comment

Comments

@giadarol
Copy link
Collaborator

In pyeclsaver.py. This looks quite messy (with lots of duplicated code). Needs to be cleaned up before introducing arbitrary time-step for video:

def _rho_video_save(self, spacech_ele, beamtim, rho_cloud):
        #save rho video
        if self.flag_video and self.flag_last_cloud:
            if not os.path.exists(self.folder_outp + '/rho_video'):
                os.makedirs(self.folder_outp + '/rho_video')
            if self.rho_video is None:
                self.rho_video = []
                self.t_video = []
            if spacech_ele.last_recomputation_check:
                self.rho_video.append(spacech_ele.rho)
                self.t_video.append(beamtim.tt_curr)
            if beamtim.flag_new_bunch_pass:
                self.rho_video = np.array(self.rho_video)
                self.t_video = np.array(self.t_video)
                filename_rho = self.folder_outp + '/rho_video/rho_pass%d.mat'%(beamtim.pass_numb - 1)
                print('Saving %s'%filename_rho)
                sio.savemat(filename_rho, {'xg_sc': spacech_ele.xg, 'yg_sc': spacech_ele.yg, 't_video': self.t_video, 'rho_video': self.rho_video}, oned_as='row')
                print('Done')
                self.rho_video = []
                self.t_video = []

        # save rho video for cloud
        if self.flag_video and self.flag_multiple_clouds:
            if not os.path.exists(self.folder_outp + '/rho_video_%s'%(self.cloud_name)):
                os.makedirs(self.folder_outp + 'rho_video_%s'%(self.cloud_name))
            if self.rho_video_cloud is None:
                    self.rho_video_cloud = []
                    self.t_video_cloud = []
            if spacech_ele.last_recomputation_check:
                if rho_cloud is None:
                    print('Warning! No rho provided for saving.')
                else:
                    self.rho_video_cloud.append(rho_cloud)
                self.t_video_cloud.append(beamtim.tt_curr)
            if beamtim.flag_new_bunch_pass:
                self.rho_video_cloud = np.array(self.rho_video_cloud)
                self.t_video_cloud = np.array(self.t_video_cloud)
                filename_rho = self.folder_outp + 'rho_video_%s/rho_pass%d.mat'%(self.cloud_name, beamtim.pass_numb - 1)
                print('Saving %s'%filename_rho)
                sio.savemat(filename_rho, {'xg_sc': spacech_ele.xg, 'yg_sc': spacech_ele.yg, 't_video': self.t_video_cloud, 'rho_video': self.rho_video_cloud}, oned_as='row')
                print('Done')
                self.rho_video_cloud = []
                self.t_video_cloud = []
@giadarol
Copy link
Collaborator Author

In buildup_simulation.py, probably smarter to pass cloud instead of this:

cloud.impact_man = cloud.pyeclsaver.witness(cloud.MP_e, beamtim, spacech_ele, cloud.impact_man, cloud.dynamics,
                                                            cloud.gas_ion_flag, cloud.resgasion, cloud.t_ion, t_sc_ON,
                                                            cloud.photoem_flag, cloud.phemiss, flag_presence_sec_beams,
                                                            sec_beams_list, cloud_list, buildup_sim=self, rho_cloud=cloud.rho)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant