示例#1
0
                     id='ymb_tree',
                     editor=tree_editor,
                     show_label=False,
                     resizable=True),
                orientation='vertical',
                show_labels=True,
                show_left=True,
            ),
            dock='tab',
            id='qdc.ymb.split',
        ),
        id='qdc.ymb',
        dock='horizontal',
        drop_class=HasTraits,
        #            handler = TreeHandler(),
        resizable=True,
        scrollable=True,
        title='Yarn-Matrix-Bond Microstructure Lab',
        handler=TitleHandler(),
        width=.8,
        height=.5)


if __name__ == '__main__':
    from matresdev.db.simdb import SimDB
    simdb = SimDB()
    yarn_type = 'MAG'
    data = YMBCutData(source=YMBSource(yarn_type=yarn_type), cf_limit=0.5)
    ymbmicro = YMBMicro(data=data)
    ymbmicro.configure_traits()
示例#2
0
    traits_view_mpl = View(
        Group(
            #                       Group( Item( 'figure', style = 'custom',
            #                              editor = MPLFigureEditor(),
            #                              show_label = False )
            #                              , id = 'figure.view' ),
            Item('corr_arr',
                 show_label=False,
                 style='readonly',
                 editor=TabularEditor(adapter=ArrayAdapter()))),
        resizable=True,
    )

    traits_view = View(Item('corr_arr',
                            editor=tabular_editor,
                            show_label=False),
                       resizable=True,
                       scrollable=True,
                       buttons=['OK', 'Cancel'],
                       width=1.0,
                       height=0.5)


if __name__ == '__main__':

    yarn_type = 'VET'
    data = YMBSegmentData(source=YMBSource(yarn_type=yarn_type))
    corr = YMBCrossCorrel(data=data)
    corr.configure_traits()
示例#3
0
        scat = axes.scatter(x,
                            y,
                            marker='o',
                            c=z,
                            s=20,
                            linewidths=0,
                            cmap=my_cmap_lin)
        figure.colorbar(scat)

        self.data_changed = True

    view = View('var_enum',
                'sorted_on',
                Item('figure',
                     style='custom',
                     editor=MPLFigureEditor(),
                     show_label=False),
                id='yarn_structure_view',
                resizable=True,
                scrollable=True,
                dock='tab',
                width=0.8,
                height=0.4)


if __name__ == '__main__':
    yarn_type = 'VET'
    my_model = YMBFieldVar(data=YMBCutData(source=YMBSource(
        yarn_type=yarn_type)))
    my_model.configure_traits()
示例#4
0
                       Item('vcut_slider', show_label=False, springy=True, enabled_when='cut_slider_on == True'),
                       ),
                       Group(Item('figure', style='custom',
                              editor=MPLFigureEditor(),
                              show_label=False)
                              , id='figure.view'),
                       ),
                       resizable=True,
                        )



if __name__ == '__main__':

    yarn_type = 'MAG'
    source = YMBSource(yarn_type=yarn_type)

    data = YMBCutData(source=source, cf_limit=.2)
    corr = YMBAutoCorrelView(correl_data=YMBAutoCorrel(data=data))
    corr.configure_traits()

#    from matplotlib.colors import LinearSegmentedColormap
#
#    from numpy import mgrid, max
#    mg = mgrid[0:100:36j, 0:100:36j]
#    d = corr.data.cf
#    d2 = d[:, 0:2][prod( d[:, 0:2] >= 0, axis = 1, dtype = bool )]
#    a, b, c = histogram2d( d2[:, 0], d2[:, 1], bins = 36 )
#
#    # my own colormap
#    cdict = {
示例#5
0
        axes.legend()
        figure.colorbar(scat)

        if self.underlay == True:
            axes.text(axes.get_xlim()[0],
                      axes.get_ylim()[0],
                      'That\'s all at this moment :-)',
                      color='red',
                      fontsize=20)
        self.data_changed = True

    traits_view = View(
        Group(
            Item('var_enum'),
            Item('cut_slider', springy=True),
            Item('circle_diameter', springy=True),
            Item('underlay', springy=True),
        ),
        Item('figure',
             style='custom',
             editor=MPLFigureEditor(),
             show_label=False),
        resizable=True,
    )


if __name__ == '__main__':
    yarn_type = 'VET'
    cut = YMBView2D(data=YMBSegmentData(source=YMBSource(yarn_type=yarn_type)))
    cut.configure_traits()
示例#6
0
            axes.label_text_property.color = (0.0, 0.0, 0.0)
            axes.axes.corner_offset = .1
            axes.axes.x_label = 'x'
            axes.axes.y_label = 'y'
            axes.axes.z_label = 'z'
        else:
            print 'plot 3d -- 2'
            # self.plot.mlab_source.dataset.reset()
            # self.plot.mlab_source.set( x = x, y = y, z = z, scalars = scalar )
            # self.plot.mlab_source.dataset.points = array( [x, y, z] ).T
            self.plot.mlab_source.scalars = scalar
            self.plot.mlab_source.dataset.lines = connection
            self.plot.module_manager.scalar_lut_manager.data_name = self.var_enum

    # The layout of the dialog created
    view = View(Item('scene', editor=SceneEditor(scene_class=MayaviScene),
                     height=250, width=300, show_label=False),
                Group(
                        '_', 'start_fib', 'end_fib', 'var_enum',
                     ),
                resizable=True,
                )



if __name__ == '__main__':

    yarn_type = 'MAG'
    my_model = YMBView3D(data=YMBCutData(source=YMBSource(yarn_type=yarn_type)))
    my_model.configure_traits()
示例#7
0
    def pdf(self, x):
        return self.distr.interp_pdf(x)

    def ppf(self, x):
        return self.distr.interp_ppf(x)

    def rvs(self, x):
        return self.distr.interp_ppf(random.random(x))


if __name__ == '__main__':

    from ymb_data import YMBData, YMBSlider, YMBSource

    data = YMBCutData(source=YMBSource())

    slider = YMBSlider(data=data, var_enum='contact fraction')

    ymb_pd = YMBDistrib(slider=slider, n_int=20)

    print ymb_pd.x_array.shape
    print ymb_pd.pdf_array.shape
    print ymb_pd.interp_pdf(-1)
    print ymb_pd.interp_pdf(0.1)

    import pylab as p
    x = np.linspace(0, ymb_pd.x_array[-1], 10000)
    y = ymb_pd.interp_pdf(x)
    p.plot(x, y)
    x = ymb_pd.x_array
示例#8
0
        #                Group(
        #                Item( 'pdf_theta@', show_label = False ),
        #                Item( 'pdf_l@', show_label = False ),
        #                ),
        #                Group(
        #                Item( 'pdf_phi@', show_label = False ),
        #                Item( 'pdf_xi@', show_label = False ),
        #                ),
        #                label = 'pdf',
        #                id = 'report.pdf',
        #                #scrollable = True,
        #                ),
        Group(Item('plot3d@', show_label=False),
              label='plot3d',
              id='report.plot3d'),
        resizable=True,
        title=u"Yarn name",
        handler=TitleHandler(),
        id='report.main',
    )


if __name__ == '__main__':

    source = YMBSource(yarn_type='MAG')

    data = YMBCutData(source=source, cf_limit=0.5)

    ymbreport = YMBReport(data=data)
    ymbreport.configure_traits()