def handle_next_fragment_for_monitors(self, context, rendering_rules, current_monitor, next_monitor, is_noise_form, form_action_url, if_bold_url): simulator, _, _, is_branch = context.get_common_params() if isinstance(current_monitor, BoldViewModel) and is_noise_form is False: return self._prepare_next_fragment_if_bold(current_monitor, rendering_rules, if_bold_url) if not next_monitor: rendering_rules.is_branch = is_branch return SimulatorFinalFragment.prepare_final_fragment( simulator, context.burst_config, context.project.id, rendering_rules, SimulatorWizzardURLs.SETUP_PSE_URL) next_form = get_form_for_monitor(type(next_monitor))(simulator, is_branch) next_form = AlgorithmService().prepare_adapter_form( form_instance=next_form, project_id=context.project.id) next_form.fill_from_trait(next_monitor) monitor_name = self.prepare_monitor_legend( simulator.is_surface_simulation, next_monitor) rendering_rules.form = next_form rendering_rules.form_action_url = form_action_url rendering_rules.monitor_name = monitor_name return rendering_rules.to_dict()
def prepare_stimulus_fragment(simulator, rendering_rules, is_surface_simulation, form_action_url, project_id): form = SimulatorStimulusFragment(is_surface_simulation) stimuli_fragment = AlgorithmService().prepare_adapter_form( form_instance=form, project_id=project_id) stimuli_fragment.fill_from_trait(simulator) rendering_rules.form = stimuli_fragment rendering_rules.form_action_url = form_action_url return rendering_rules.to_dict()
def prepare_cortex_fragment(simulator, rendering_rules, form_action_url, project_id): surface_index = load_entity_by_gid(simulator.surface.surface_gid) form = SimulatorRMFragment(surface_index, simulator.connectivity) rm_fragment = AlgorithmService().prepare_adapter_form( form_instance=form, project_id=project_id) rm_fragment.fill_from_trait(simulator.surface) rendering_rules.form = rm_fragment rendering_rules.form_action_url = form_action_url return rendering_rules.to_dict()
def get_fragment_after_monitors(simulator, burst_config, project_id, is_branch, rendering_rules, setup_pse_url): first_monitor = simulator.first_monitor if first_monitor is None: rendering_rules.is_branch = is_branch return SimulatorFinalFragment.prepare_final_fragment( simulator, burst_config, project_id, rendering_rules, setup_pse_url) form = get_form_for_monitor(type(first_monitor))(simulator, is_branch) form = AlgorithmService().prepare_adapter_form(form_instance=form) form.fill_from_trait(first_monitor) monitor_name = MonitorsWizardHandler.prepare_monitor_legend( simulator.is_surface_simulation, first_monitor) rendering_rules.monitor_name = monitor_name rendering_rules.form = form return rendering_rules.to_dict()