Example #1
0
    def test_basic_generators(self):
        with test.temp_workspace():
            tp.new_layout()
            tp.data.load_tecplot([
                test.data_item_path('spec_data/ds1.dat'),
                test.data_item_path('spec_data/ds2.dat'),
            ])
            default_page = tp.active_page()
            page = gen.add_page()
            default_frame = page.active_frame()
            frame = gen.add_frame(
                position=[2., 1.],
                width=7,
                height=5,
            )
            plot = frame.plot(tpc.PlotType.XYLine)
            plot.activate()
            plot.delete_linemaps()
            gen.add_xylinemap(
                name='T (ds1)',
                zone='stag[0]',
                x_variable='x',
                y_variable='T',
            )
            gen.add_xylinemap(
                name='T (ds2)',
                zone='stag[1]',
                x_variable='x',
                y_variable='T',
            )
            tp.delete_page(default_page)
            page.delete_frame(default_frame)
            tp.save_layout('test.lay')

            # Note: we can't really test for much more than simple success
            # creating the layout file. The fine details of the layout will
            # depend on whether the user has a tecplot.cfg file available
            # and we can't force factory settings in PyTecplot at this time.
            # Therefore, trying to establish a "reference output" is
            self.assertTrue(exists('test.lay'))
Example #2
0
]

for infile, outfile in zip(infiles, outfiles):
    tp.load_layout(infile)
    frame = tp.active_frame()
    plt = frame.plot()
    for lmapid in plt.active_linemap_indices:
        lmap = plt.linemap(lmapid)
        zonename = lmap.zone.name
        line = lmap.line
        if 'ROT' in zonename or 'rot' in zonename:
            print(zonename)
            line.color = Color.Green
            line.line_pattern = LinePattern.LongDash
            line.pattern_length = 0.8
        elif 'MF' in zonename:
            print(zonename + '  2')
            line.color = Color.Blue
            line.line_pattern = LinePattern.Dashed
            line.pattern_length = 2.0
    save_eps(outfile)

    epsdir = os.path.split(os.path.dirname(outfile))[-1]
    fname = os.path.basename(outfile)
    filename2 = re.sub('[\+=]', '', epsdir + fname)
    filename2 = os.path.join(cwd, 'Figs', filename2)
    save_eps(filename2)

    print('%s is exported' % (outfile, ))
    tp.save_layout(infile)
Example #3
0
import os
import tecplot

examples_dir = tecplot.session.tecplot_examples_directory()
infile = os.path.join(examples_dir, 'SimpleData', 'F18.lay')

tecplot.load_layout(infile)
#{DOC:highlight}[
tecplot.save_layout('output.lpk')
#]
Example #4
0
def generate(args):
    ''' Generate a layout file from a YAML specification file '''
    import tecplot as tp
    tec_util.configure_layout(args.spec_file)
    tp.save_layout(args.layout_file, use_relative_paths=True)
    if export_lay:
        import logging
        import tecplot as tp
        logging.basicConfig(level=logging.INFO)
        tp.new_layout()
        frame = tp.active_frame()

        dset = frame.create_dataset(
            'data', var_names=['x', 'z', 'prms_tauw_vs_x', 'prms_tauw_vs_z'])

        zone_x = dset.add_ordered_zone('prms_tauw_vs_x', x.shape)
        zone_x.values('x')[:] = x.ravel(order='F')
        zone_x.values('prms_tauw_vs_x')[:] = prms_tauw_vs_x.ravel(order='F')
        zone_z = dset.add_ordered_zone('prms_tauw_vs_z', z.shape)
        zone_z.values('z')[:] = z.ravel(order='F')
        zone_z.values('prms_tauw_vs_z')[:] = prms_tauw_vs_z.ravel(order='F')

        from tecplot.constant import PlotType, FillMode
        plot = frame.plot(PlotType.XYLine)
        plot.activate()
        plot.add_linemap(zone=zone_x,
                         x=dset.variable('x'),
                         y=dset.variable('prms_tauw_vs_x'))
        plot.add_linemap(zone=zone_z,
                         x=dset.variable('z'),
                         y=dset.variable('prms_tauw_vs_z'))

        tp.data.save_tecplot_plt(dir_out + 'prms_tauw')
        tp.save_layout(dir_out + 'prms_tauw.lay')

    plt.show()