Beispiel #1
0
    PXTAL_UI["tacticity"],
    PXTAL_UI["chiriality"],
    PXTAL_UI["defect"],
])

PXTAL_UI["a2"] = VBox([PXTAL_UI["lmpdata_file"]])
PXTAL_UI["a"] = Accordion(children=[PXTAL_UI["a1"], PXTAL_UI["a2"]])
PXTAL_UI["a"].set_title(0, "Structure")
PXTAL_UI["a"].set_title(1, "Output")

PXTAL_UI["l1"] = VBox(
    [PXTAL_UI["a"], PXTAL_UI["button"], PXTAL_UI["sim_progress"]])
PXTAL_UI["l2"] = Tab(children=[])
PXTAL_UI["bs"] = HBox([PXTAL_UI["l1"], PXTAL_UI["l2"]])
PXTAL_UI["l1"].layout = Layout(width="500px", border="1px")
PXTAL_UI["l2"].layout = Layout(width="100%", border="1px")
PXTAL_UI["bs"].layout = Layout(width="100%", border="1px")

PXTAL_UI["display"] = ui.Form([PXTAL_UI["bs"]],
                              name="PolymerXtal - Polymer Helix Chain Builder")


def fig_Structure(execution):
    pdbFile = execution.read("PDBview", raw=True)
    return imolecule.draw(pdbFile[7:])
    # helix_name = execution.db.read('Helix Name')
    # return imolecule.draw(execution.outdir + "/" + helix_name + ".pdb")  #, camera_type="orthographic")


def fig_PDB(execution):
    pdbFile = execution.read("PDB", raw=True)
Beispiel #2
0
    def show(self):
        """ """
        # display()
        about = VBox([HTML("<a href=\"https://github.com/bengranett/pypelidcalc\" target=\"_blank\">Pypelid-calc</a> version: %s"%pypelidcalc.__version__)])

        tab = Tab([self.galaxy.widget, self.foreground.widget, self.instrument.widget, self.survey.widget, self.analysis.widget, self.config.widget, about])
        tab.set_title(0, "Source")
        tab.set_title(1, "Foreground")
        tab.set_title(2, "Instrument")
        tab.set_title(3, "Survey")
        tab.set_title(4, "Analysis")
        tab.set_title(5, "Config")
        tab.set_title(6, "About")
        tab.layout={'height': '300px'}

        tab.observe(self.tab_event)

        display(tab)

        for group in [self.galaxy, self.foreground, self.instrument, self.survey, self.analysis]:
            for key, w in group.widgets.items():
                w.observe(self.render, names='value')

        self.figs = {}
        self.figs['spec'] = go.FigureWidget()
        self.figs['spec'].update_layout(xaxis_title=u'Wavelength (\u03BCm)',
                                  height=200,
                                  yaxis_title='Flux density',
                                  margin=dict(l=0, r=0, t=0, b=0, pad=0))
        self.figs['spec'].add_scatter(x=[], y=[], name='Noise', line_color='grey')
        self.figs['spec'].add_scatter(x=[], y=[], name='Realization', line_color='dodgerblue')
        self.figs['spec'].add_scatter(x=[], y=[], name='Signal', line_color='black')


        self.figs['image'] = go.FigureWidget()
        self.figs['image'].update_layout(height=200, width=200, margin=dict(l=0, r=0, t=0, b=0, pad=0))

        self.figs['image'].add_trace(go.Heatmap(z=[[]], showscale=False))

        self.widgets['render_button'] = Button(description="Update realization", layout={'border':'solid 1px black', 'width': '200px'})
        self.widgets['render_button'].on_click(self.render)

        self.widgets['seed_checkbox'].observe(self.seed_checkbox, names='value')

        self.widgets['signal_on'].observe(self.hideshow_line, names='value')
        self.widgets['real_on'].observe(self.hideshow_line, names='value')
        self.widgets['noise_on'].observe(self.hideshow_line, names='value')

        checkboxes = HBox([self.widgets['signal_on'], self.widgets['noise_on'], self.widgets['real_on']])
        display(HTML('<h3>Spectrum</h3>'))
        display(HBox([self.widgets['seed_checkbox'], self.widgets['seed']]))
        display(HBox([HTML('SNR:'), self.widgets['snrbox'], self.widgets['render_button'], checkboxes]))
        display(HBox([self.figs['spec'], self.figs['image']]))

        self.reset_button(self.widgets['button'])
        self.widgets['button'].on_click(self.click_start)

        elements = [HTML("<h3>Redshift measurement</h3>")]
        elements +=  [HBox([self.widgets['nreal'], self.widgets['button'], self.widgets['progress'], self.widgets['timer']])]

        horiz = [HTML('<b>Statistics:</b>')]
        horiz += [HTML('Mean z:'), self.widgets['zmeas']]
        horiz += [HTML('Error:'), self.widgets['zerr']]
        horiz += [HTML('68% limit:'), self.widgets['zerr_68']]
        horiz += [HTML('Fractional systematic:'), self.widgets['zerr_sys']]
        horiz += [HTML('Outlier rate:'), self.widgets['zerr_cat']]

        elements += [HBox(horiz)]

        display(VBox(elements))

        self.figs['pdf'] = go.FigureWidget()
        self.figs['pdf'].update_layout(xaxis_title='Redshift', height=200,
                              yaxis_title='Distribution',margin=dict(l=0, r=0, t=0, b=0, pad=0))

        self.figs['pdf'].add_scatter(x=[], y=[], name='Measured redshift')

        display(self.figs['pdf'])

        self.render_lock.acquire()
        self.param_lock.acquire()
        self._render((self.render_lock, self.param_lock))