Commit e6576692 authored by Theo Steininger's avatar Theo Steininger
Browse files

Added RG1DPlotter.

parent fd98d2f4
Pipeline #13981 passed with stages
in 12 minutes and 21 seconds
......@@ -2,4 +2,5 @@
from healpix_plotter import HealpixPlotter
from gl_plotter import GLPlotter
from power_plotter import PowerPlotter
from rg1d_plotter import RG1DPlotter
from rg2d_plotter import RG2DPlotter
......@@ -87,8 +87,8 @@ class PlotterBase(Loggable, object):
for slice_list in utilities.get_slice_list(data_list[0].shape, axes):
plots_list += \
for (current_data, field) in zip(data_list, fields)]]
figures = [ for plots in plots_list]
# -*- coding: utf-8 -*-
import numpy as np
from nifty.spaces import RGSpace
from nifty.plotting.descriptors import Axis
from nifty.plotting.figures import Figure2D
from nifty.plotting.plots import Cartesian2D
from .plotter_base import PlotterBase
class RG1DPlotter(PlotterBase):
def __init__(self, interactive=False, path='.', title="",
line=None, marker=None):
super(RG1DPlotter, self).__init__(interactive, path, title)
self.line = line
self.marker = marker
def domain_classes(self):
return (RGSpace, )
def _initialize_plot(self):
return Cartesian2D(data=None)
def _initialize_figure(self):
xaxis = Axis()
yaxis = Axis()
return Figure2D(plots=None, xaxis=xaxis, yaxis=yaxis)
def _parse_data(self, data, field, spaces):
y_data = data
rgspace = field.domain[spaces[0]]
xy_data = np.empty((2, y_data.shape[0]))
xy_data[1] = y_data
num = rgspace.shape[0]
length = rgspace.distances[0]*num
xy_data[0] = np.linspace(start=0,
if rgspace.zerocenter[0]:
xy_data[0] -= np.floor(length/2)
return xy_data
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment