コード例 #1
0
ファイル: romannet.py プロジェクト: basuparth/ICERM_Workshop
    def __init__(self, max_init_len=1000, **kwargs):

        SchwarzschildEccentric.__init__(self, **kwargs)
        AmplitudeBase.__init__(self, **kwargs)

        self.few_dir = dir_path + "/../../"

        # check if user has the necessary data
        # if not, the data will automatically download
        self.data_file = fp = "SchwarzschildEccentricInput.hdf5"
        check_for_file_download(fp, self.few_dir)

        # get information about this specific model from the file
        with h5py.File(self.few_dir + "few/files/" + self.data_file,
                       "r") as fp:
            num_teuk_modes = fp.attrs["num_teuk_modes"]
            transform_factor = fp.attrs["transform_factor"]
            self.break_index = fp.attrs["break_index"]

        # adjust c++ classes based on gpu usage
        if self.use_gpu:
            self.neural_layer = neural_layer_wrap
            self.transform_output = transform_output_wrap

        else:
            self.neural_layer = neural_layer_wrap_cpu
            self.transform_output = transform_output_wrap_cpu

        self.num_teuk_modes = num_teuk_modes
        self.transform_factor_inv = 1 / transform_factor

        self.max_init_len = max_init_len

        self._initialize_weights()
コード例 #2
0
    def __init__(self, **kwargs):

        SchwarzschildEccentric.__init__(self, **kwargs)
        AmplitudeBase.__init__(self, **kwargs)

        # check if you have the necessary file
        # it will download from Zenodo if the user does not have it.
        few_dir = dir_path + "/../../"

        fp = "Teuk_amps_a0.0_lmax_10_nmax_30_new.h5"
        check_for_file_download(fp, few_dir)

        self.amplitude_generator = pyAmplitudeGenerator(self.lmax, self.nmax, few_dir)
コード例 #3
0
    def __init__(self, *args, **kwargs):

        GPUModuleBase.__init__(self, *args, **kwargs)
        SchwarzschildEccentric.__init__(self, *args, **kwargs)
        SummationBase.__init__(self, *args, **kwargs)

        self.kwargs = kwargs

        if self.use_gpu:
            self.get_waveform = get_waveform_wrap

        else:
            self.get_waveform = get_waveform_wrap_cpu
コード例 #4
0
    def __init__(
        self,
        inspiral_module,
        amplitude_module,
        sum_module,
        inspiral_kwargs={},
        amplitude_kwargs={},
        sum_kwargs={},
        Ylm_kwargs={},
        mode_selector_kwargs={},
        use_gpu=False,
        normalize_amps=True,
    ):

        GPUModuleBase.__init__(self, use_gpu=use_gpu)
        SchwarzschildEccentric.__init__(self, use_gpu=use_gpu)

        amplitude_kwargs, sum_kwargs = self.adjust_gpu_usage(
            use_gpu, [amplitude_kwargs, sum_kwargs])

        # normalize amplitudes to flux at each step from trajectory
        self.normalize_amps = normalize_amps

        # kwargs that are passed to the inspiral call function
        self.inspiral_kwargs = inspiral_kwargs

        # function for generating the inpsiral
        self.inspiral_generator = inspiral_module()

        # function for generating the amplitude
        self.amplitude_generator = amplitude_module(**amplitude_kwargs)

        # summation generator
        self.create_waveform = sum_module(**sum_kwargs)

        # angular harmonics generation
        self.ylm_gen = GetYlms(use_gpu=use_gpu, **Ylm_kwargs)

        # selecting modes that contribute at threshold to the waveform
        self.mode_selector = ModeSelector(self.m0mask,
                                          **mode_selector_kwargs,
                                          use_gpu=use_gpu)
コード例 #5
0
    def __init__(self, *args, **kwargs):

        TrajectoryBase.__init__(self, *args, **kwargs)
        SchwarzschildEccentric.__init__(self, *args, **kwargs)
        few_dir = dir_path + "/../../"

        fp = "AmplitudeVectorNorm.dat"
        check_for_file_download(fp, few_dir)
        fp = "FluxNewMinusPNScaled_fixed_y_order.dat"
        check_for_file_download(fp, few_dir)

        self.flux_generator = pyFluxGenerator(few_dir)

        self.specific_kwarg_keys = [
            "T",
            "dt",
            "err",
            "DENSE_STEPPING",
            "max_init_len",
            "use_rk4",
        ]
コード例 #6
0
    def __init__(self, *args, use_gpu=False, **kwargs):

        GPUModuleBase.__init__(self, *args, **kwargs)
        SchwarzschildEccentric.__init__(self, *args, **kwargs)
        SummationBase.__init__(self, *args, **kwargs)