Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
-------
hyper_phase
A copy of the original phase with a modified name and path
"""
phase = copy.deepcopy(self.phase)
phase.paths.zip()
phase.optimizer = phase.optimizer.copy_with_name_extension(
extension=self.hyper_name + "_" + phase.paths.phase_tag,
remove_phase_tag=True,
)
phase.optimizer.const_efficiency_mode = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_const_efficiency_mode", bool
)
phase.optimizer.sampling_efficiency = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_sampling_efficiency", float
)
phase.optimizer.n_live_points = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_n_live_points", int
)
phase.optimizer.multimodal = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_multimodal", bool
)
phase.optimizer.evidence_tolerance = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_evidence_tolerance", float
)
phase.optimizer.terminate_at_acceptance_ratio = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_terminate_at_acceptance_ratio", bool
)
phase.optimizer.acceptance_ratio_threshold = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_acceptance_ratio_threshold", float
def make_hyper_phase(self):
phase = super().make_hyper_phase()
phase.const_efficiency_mode = af.conf.instance.non_linear.get(
'MultiNest',
'extension_inversion_const_efficiency_mode',
bool
)
phase.optimizer.sampling_efficiency = af.conf.instance.non_linear.get(
'MultiNest',
'extension_inversion_sampling_efficiency',
float
)
phase.optimizer.n_live_points = af.conf.instance.non_linear.get(
'MultiNest',
'extension_inversion_n_live_points',
int
)
return phase
def make_hyper_phase(self) -> abstract.AbstractPhase:
"""
Returns
-------
hyper_phase
A copy of the original phase with a modified name and path
"""
phase = copy.deepcopy(self.phase)
phase.paths.zip()
phase.optimizer = phase.optimizer.copy_with_name_extension(
extension=self.hyper_name + "_" + phase.paths.phase_tag,
remove_phase_tag=True,
)
phase.optimizer.const_efficiency_mode = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_const_efficiency_mode", bool
)
phase.optimizer.sampling_efficiency = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_sampling_efficiency", float
)
phase.optimizer.n_live_points = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_n_live_points", int
)
phase.optimizer.multimodal = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_multimodal", bool
)
phase.optimizer.evidence_tolerance = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_evidence_tolerance", float
)
phase.is_hyper_phase = True
def make_hyper_phase(self):
phase = super().make_hyper_phase()
phase.const_efficiency_mode = af.conf.instance.non_linear.get(
'MultiNest',
'extension_inversion_const_efficiency_mode',
bool
)
phase.optimizer.sampling_efficiency = af.conf.instance.non_linear.get(
'MultiNest',
'extension_inversion_sampling_efficiency',
float
)
phase.optimizer.n_live_points = af.conf.instance.non_linear.get(
'MultiNest',
'extension_inversion_n_live_points',
int
)
return phase
"""
phase = copy.deepcopy(self.phase)
phase.paths.zip()
phase.optimizer = phase.optimizer.copy_with_name_extension(
extension=self.hyper_name + "_" + phase.paths.phase_tag,
remove_phase_tag=True,
)
phase.optimizer.const_efficiency_mode = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_const_efficiency_mode", bool
)
phase.optimizer.sampling_efficiency = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_sampling_efficiency", float
)
phase.optimizer.n_live_points = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_n_live_points", int
)
phase.optimizer.multimodal = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_multimodal", bool
)
phase.optimizer.evidence_tolerance = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_evidence_tolerance", float
)
phase.is_hyper_phase = True
phase.customize_priors = self.customize_priors
return phase
def make_hyper_phase(self) -> abstract.AbstractPhase:
"""
Returns
-------
hyper_phase
A copy of the original phase with a modified name and path
"""
phase = copy.deepcopy(self.phase)
phase.paths.zip()
phase.optimizer = phase.optimizer.copy_with_name_extension(
extension=self.hyper_name + "_" + phase.paths.phase_tag,
remove_phase_tag=True,
)
phase.optimizer.const_efficiency_mode = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_const_efficiency_mode", bool
)
phase.optimizer.sampling_efficiency = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_sampling_efficiency", float
)
phase.optimizer.n_live_points = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_n_live_points", int
)
phase.optimizer.multimodal = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_multimodal", bool
)
phase.optimizer.evidence_tolerance = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_evidence_tolerance", float
)
phase.optimizer.terminate_at_acceptance_ratio = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_terminate_at_acceptance_ratio", bool
)
optimizer.phase_tag = ''
# TODO : This is a HACK :O
optimizer.variable.lens_galaxies = []
optimizer.variable.source_galaxies = []
optimizer.variable.galaxies = []
phase.const_efficiency_mode = af.conf.instance.non_linear.get(
'MultiNest',
'extension_hyper_galaxy_const_efficiency_mode',
bool
)
phase.optimizer.sampling_efficiency = af.conf.instance.non_linear.get(
'MultiNest',
'extension_hyper_galaxy_sampling_efficiency',
float
)
phase.optimizer.n_live_points = af.conf.instance.non_linear.get(
'MultiNest',
'extension_hyper_galaxy_n_live_points',
int
)
optimizer.variable.hyper_galaxy = g.HyperGalaxy
if self.include_sky_background:
optimizer.variable.hyper_image_sky = hd.HyperImageSky
if self.include_noise_background:
remove_phase_tag=True,
)
phase.optimizer.const_efficiency_mode = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_const_efficiency_mode", bool
)
phase.optimizer.sampling_efficiency = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_sampling_efficiency", float
)
phase.optimizer.n_live_points = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_n_live_points", int
)
phase.optimizer.multimodal = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_multimodal", bool
)
phase.optimizer.evidence_tolerance = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_evidence_tolerance", float
)
phase.is_hyper_phase = True
phase.customize_priors = self.customize_priors
return phase
phase.optimizer = phase.optimizer.copy_with_name_extension(
extension=self.hyper_name + "_" + phase.paths.phase_tag,
remove_phase_tag=True,
)
phase.optimizer.const_efficiency_mode = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_const_efficiency_mode", bool
)
phase.optimizer.sampling_efficiency = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_sampling_efficiency", float
)
phase.optimizer.n_live_points = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_n_live_points", int
)
phase.optimizer.multimodal = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_multimodal", bool
)
phase.optimizer.evidence_tolerance = af.conf.instance.non_linear.get(
"MultiNest", "extension_combined_evidence_tolerance", float
)
phase.is_hyper_phase = True
phase.customize_priors = self.customize_priors
return phase