Esempio n. 1
0
                           label=proj.name,
                           group='Center of Gravity')

        xcog_map = HoloMap((timestamp, xsv), kdims=[features.Time])
        xcog_map.metadata = metadata
        ycog_map = HoloMap((timestamp, ysv), kdims=[features.Time])
        ycog_map.metadata = metadata

        contour_map = HoloMap((timestamp, cogmesh), kdims=[features.Time])
        contour_map.metadata = metadata

        return {'XCoG': xcog_map, 'YCoG': ycog_map, 'CoG': contour_map}


options = Store.options(backend='matplotlib')
options.Contours.Gravity = Options('style', linewidth=1.0)
options.Image.X_CoG = Options('style', cmap='gray')
options.Image.Y_CoG = Options('style', cmap='gray')
options.CFView.OnOff_CFs = Options('style',
                                   cmap='RdYlBu_r',
                                   interpolation='nearest')

import types

__all__ = list(
    set([
        k for k, v in locals().items() if isinstance(v, types.FunctionType) or
        (isinstance(v, type) and issubclass(v, ParameterizedFunction))
        and not v.__name__.startswith('_')
    ]))
Esempio n. 2
0
 def test_options_invalid_keywords2(self):
     try:
         Options('test', allowed_keywords=['kw2'], kw2='value', kw3='value')
     except OptionError as e:
         self.assertEqual(str(e), "Invalid option 'kw3', valid options are: ['kw2']")
Esempio n. 3
0
 def test_style_opts_intermediate_explicit(self):
     line = "Layout style(string='foo' test=3, b=True )"
     expected = {'Layout': {'style': Options(string='foo', test=3, b=True)}}
     self.assertEqual(OptsSpec.parse(line), expected)
Esempio n. 4
0
 def test_options_keys(self):
     opts = Options('test', allowed_keywords=['kw3', 'kw2'],
                    kw2='value', kw3='value')
     self.assertEqual(opts.keys(), ['kw2', 'kw3'])
Esempio n. 5
0
 def test_options_valid_keywords1(self):
     Options('test', allowed_keywords=['kw1'], kw1='value')
Esempio n. 6
0
 def test_norm_opts_simple_explicit_2(self):
     line = "Layout norm{+axiswise +framewise}"
     expected = {'Layout': {'norm': Options(axiswise=True, framewise=True)}}
     self.assertEqual(OptsSpec.parse(line), expected)
Esempio n. 7
0
 def test_options_any_keywords3(self):
     opts = Options('test', kw1='value1', kw2='value3')
     self.assertEquals(opts.kwargs, {'kw1':'value1', 'kw2':'value3'})
Esempio n. 8
0
 def test_options_keys(self):
     opts = Options('test', allowed_keywords=['kw3', 'kw2'],
                    kw2='value', kw3='value')
     self.assertEqual(opts.keys(), ['kw2', 'kw3'])
Esempio n. 9
0
 def test_options_valid_keywords1(self):
     opts = Options('test', allowed_keywords=['kw1'], kw1='value')
     self.assertEquals(opts.kwargs, {'kw1':'value'})
Esempio n. 10
0
 def test_options_valid_keywords3(self):
     opts = Options('test', allowed_keywords=['kw1', 'kw2'], kw1='value1', kw2='value2')
     self.assertEquals(opts.kwargs, {'kw1':'value1', 'kw2':'value2'})
Esempio n. 11
0
 def initialize_option_tree(self):
     Store.options(val=OptionTree(groups=['plot', 'style']))
     options = Store.options()
     options.Image = Options('style', cmap='hot', interpolation='nearest')
     return options
Esempio n. 12
0
 def test_cyclic_property_false(self):
     opts = Options('test', one='one', two='two')
     self.assertEqual(opts.cyclic, False)
Esempio n. 13
0
 def test_cyclic_property_true(self):
     cycle1 = Cycle(values=['a', 'b', 'c'])
     opts = Options('test', one=cycle1, two='two')
     self.assertEqual(opts.cyclic, True)
Esempio n. 14
0
 def test_options_get_options(self):
     opts = Options('test', allowed_keywords=['kw2', 'kw3'],
                    kw2='value', kw3='value').options
     self.assertEqual(opts, dict(kw2='value', kw3='value'))
Esempio n. 15
0
 def test_options_invalid_keywords_skip2(self):
     with options_policy(skip_invalid=True, warn_on_skip=False):
         opts = Options('test', allowed_keywords=['kw1'], kw1='value', kw2='val')
     self.assertEqual(opts.kwargs, {'kw1':'value'})
Esempio n. 16
0
 def test_options_get_options_cyclic1(self):
     opts = Options('test', allowed_keywords=['kw2', 'kw3'],
                    kw2='value', kw3='value')
     for i in range(16):
         self.assertEqual(opts[i], dict(kw2='value', kw3='value'))
Esempio n. 17
0
 def test_optiontree_setter_getter(self):
     options = OptionTree(groups=['group1', 'group2'])
     opts = Options('group1', kw1='value')
     options.MyType = opts
     self.assertEqual(options.MyType['group1'], opts)
     self.assertEqual(options.MyType['group1'].options, {'kw1':'value'})
Esempio n. 18
0
 def test_options_init(self):
     Options('test')
Esempio n. 19
0
 def test_combined_multiple_paths_merge_precedence(self):
     line = "Image (s=0, c='b') Image (s=3)"
     expected = {'Image': {'style': Options(c='b', s=3)}}
     self.assertEqual(OptsSpec.parse(line), expected)
Esempio n. 20
0
                Segments: GeoSegmentsPlot,
                Path: GeoPathPlot,
                Shape: GeoShapePlot,
                Image: GeoRasterPlot,
                RGB: GeoRGBPlot,
                LineContours: LineContourPlot,
                FilledContours: FilledContourPlot,
                Feature: FeaturePlot,
                HexTiles: HexTilesPlot,
                Text: GeoTextPlot,
                Overlay: GeoOverlayPlot,
                NdOverlay: GeoOverlayPlot,
                Graph: GeoGraphPlot,
                TriMesh: GeoTriMeshPlot,
                Nodes: GeoPointPlot,
                EdgePaths: GeoPathPlot,
                QuadMesh: GeoQuadMeshPlot}, 'bokeh')

options = Store.options(backend='bokeh')

options.Feature = Options('style', line_color='black')
options.Feature.Coastline = Options('style', line_width=0.5)
options.Feature.Borders = Options('style', line_width=0.5)
options.Feature.Rivers = Options('style', line_color='blue')
options.Feature.Land   = Options('style', fill_color='#efefdb', line_color='#efefdb')
options.Feature.Ocean  = Options('style', fill_color='#97b6e1', line_color='#97b6e1')
options.Feature.Lakes  = Options('style', fill_color='#97b6e1', line_color='#97b6e1')
options.Feature.Rivers = Options('style', line_color='#97b6e1')
options.Feature.Grid = Options('style', line_width=0.5, alpha=0.5, line_color='gray')
options.Shape = Options('style', line_color='black', fill_color='#30A2DA')
Esempio n. 21
0
 def test_plot_opts_nested_brackets(self):
     line = "Curve [title_format=', '.join(('A', 'B'))]"
     expected = {'Curve': {'plot': Options(title_format='A, B')}}
     self.assertEqual(OptsSpec.parse(line), expected)
Esempio n. 22
0
 def test_style_opts_simple_explicit(self):
     line = "Layout style(string='foo')"
     expected = {'Layout': {'style': Options(string='foo')}}
     self.assertEqual(OptsSpec.parse(line), expected)
Esempio n. 23
0
 def test_optiontree_init(self):
     options = OptionTree(groups={'group1':  Options(),
                                  'group2': Options()})
Esempio n. 24
0
                      horizontalalignment=horizontalalignment,
                      verticalalignment=verticalalignment,
                      rotation=rotation,
                      **opts)
        ]


# Register plots with HoloViews
Store.register(
    {
        LineContours: LineContourPlot,
        FilledContours: FilledContourPlot,
        Image: GeoImagePlot,
        Feature: FeaturePlot,
        WMTS: WMTSPlot,
        Tiles: TilePlot,
        Points: GeoPointPlot,
        Text: GeoTextPlot,
        Layout: LayoutPlot,
        NdLayout: LayoutPlot,
        Overlay: OverlayPlot,
        Polygons: GeoPolygonPlot,
        Path: GeoPathPlot,
        Shape: GeoShapePlot
    }, 'matplotlib')

# Define plot and style options
options = Store.options(backend='matplotlib')

options.Shape = Options('style', edgecolor='black', facecolor='#30A2DA')
Esempio n. 25
0
 def test_options_any_keywords3(self):
     Options('test', kw1='value', kw2='value')
Esempio n. 26
0
 def test_options_keys(self):
     opts = Options("test", allowed_keywords=["kw3", "kw2"], kw2="value", kw3="value")
     self.assertEqual(opts.keys(), ["kw2", "kw3"])
Esempio n. 27
0
                                           doc="""
        Slice indices of the embedded view into the situated matrix.""")

    @property
    def situated(self):
        if self.bounds.lbrt() == self.situated_bounds.lbrt():
            self.warning("CFView is already situated.")
            return self
        l, b, r, t = self.bounds.lbrt()
        xd = int(np.round(self.data.shape[1] / (r - l)))
        yd = int(np.round(self.data.shape[0] / (t - b)))

        scs = SheetCoordinateSystem(self.situated_bounds, xd, yd)

        data = np.zeros(scs.shape, dtype=np.float64)
        r1, r2, c1, c2 = self.input_sheet_slice
        data[r1:r2, c1:c2] = self.data

        return CFView(data,
                      self.situated_bounds,
                      roi_bounds=self.bounds,
                      situated_bounds=self.situated_bounds,
                      label=self.label,
                      group=self.group)


Store.register({CFView: RasterPlot}, 'matplotlib')

options = Store.options(backend='matplotlib')
options.CFView = Options('style', cmap='gray', interpolation='nearest')