コード例 #1
0
ファイル: ymb_fieldvar.py プロジェクト: rosoba/simvisage
        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()
コード例 #2
0
ファイル: ymb_micro.py プロジェクト: rosoba/simvisage
                     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()
コード例 #3
0
ファイル: ymb_auto_correl.py プロジェクト: rosoba/simvisage
                       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 = {
#    'red':   ( ( 0.0, 1.0, 1.0 ),
#                ( 1 / max( a ) , 1.0, 1.0 ),
コード例 #4
0
 def setUp(self):
     print 'setting up'
     self.yarn_data = YMBCutData(source=S(yarn_type=yarn), cf_limit=1.0)
コード例 #5
0
 def setUp(self):
     print 'setting up'
     source = S(yarn_type=yarn, root_dir='')
     self.yarn_data = YMBCutData(source=source, cf_limit=0.0)
コード例 #6
0
ファイル: ymb_view3d.py プロジェクト: rosoba/simvisage
            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