def _make_subviews(self, an): view = HistoryView() self.groups.append(view) view = MetaView(interference=InterferencesView(an), spectrometer=SpectrometerView(an)) self.groups.append(view) view = RegressionView() self.groups.append(view) if an.measured_response_stream: ev = ExtractionView() if ev.setup_graph(an.measured_response_stream, an.requested_output_stream, an.setpoint_stream): self.groups.append(ev) if an.snapshots: snapshot_view = SnapshotView(an.snapshots) self.groups.append(snapshot_view) if an.analysis_type == DETECTOR_IC: det_view = DetectorICView(an) self.groups.append(det_view) if an.analysis_type in (UNKNOWN, COCKTAIL): ecv = ErrorComponentsView(an) self.groups.append(ecv) pch = PeakCenterView() if pch.load(an): self.groups.append(pch)
def load(self, an): analysis_type = an.analysis_type analysis_id = an.record_id self.analysis_id = analysis_id history_view = self.history_view if history_view is None: history_view = HistoryView(an) self.history_view = history_view history_view.on_trait_change(self.handle_blank_right_clicked, 'blank_right_clicked') views = self._make_subviews(an) main_view = self.main_view if main_view is None: main_view = MainView(an, analysis_type=analysis_type, analysis_id=analysis_id) self.main_view = main_view else: self.main_view.load(an, refresh=True) subviews = [main_view, history_view] + views if analysis_type in ('unknown', 'cocktail'): subviews.append(ErrorComponentsView(an)) pch = PeakCenterView() if pch.load(an): subviews.append(pch) self.selection_tool = ViewSelection(subviews=subviews, selected_view=main_view)
def _make_subviews(self, an): view = HistoryView() self.groups.append(view) view = MetaView(interference=InterferencesView(an), spectrometer=SpectrometerView(an)) self.groups.append(view) view = RegressionView() self.groups.append(view) if an.measured_response_stream: ev = ExtractionView() if ev.setup_graph(an.measured_response_stream, an.requested_output_stream): self.groups.append(ev) if an.snapshots: snapshot_view = SnapshotView(an.snapshots) self.groups.append(snapshot_view) if an.analysis_type == DETECTOR_IC: det_view = DetectorICView(an) self.groups.append(det_view) if an.analysis_type in (UNKNOWN, COCKTAIL): ecv = ErrorComponentsView(an) self.groups.append(ecv) pch = PeakCenterView() if pch.load(an): self.groups.append(pch)
def _make_subviews(self, an): for args in ( ('history', HistoryView), # ('blanks', BlanksView), # ('fits', FitsView), ('experiment', ExperimentView, 'experiment_txt'), ('extraction', ExtractionView, 'extraction_script_blob'), ('measurement', MeasurementView, 'measurement_script_blob'), ('interference', InterferencesView, 'interference_corrections'), ('spectrometer', SpectrometerView, 'source_parameters')): if len(args) == 2: vname, klass = args tattr = None else: vname, klass, tattr = args if tattr: if not getattr(an, tattr): continue name = '{}_view'.format(vname) # view = getattr(self, name) # if view is None: view = klass(an) setattr(self, name, view) if an.snapshots: snapshot_view = SnapshotView(an.snapshots) self.snapshot_view = snapshot_view if an.analysis_type == 'detector_ic': det_view = DetectorICView(an) self.detector_ic_view = det_view if an.analysis_type in ('unknown', 'cocktail'): self.error_comp_view = ErrorComponentsView(an) pch = PeakCenterView() if pch.load(an): self.peak_center_view = pch
def test_load_peakcenter(self): pc=PeakCenterView() ret=pc.load(self.analysis_no_pc) self.assertTrue(ret)