コード例 #1
0
ファイル: PlotGrid.py プロジェクト: henkjongbloed/iFlow
    def run(self):

        st.configure()

        z = ny.dimensionalAxis(self.input.slice('grid'), 'z')[:, :, 0]
        x = ny.dimensionalAxis(self.input.slice('grid'), 'x')[:, :, 0]

        print 'maximum depth: ' + str(self.input.v('H', x=0))
        print 'minimum depth: ' + str(self.input.v('H', x=1))
        print 'maximum width: ' + str(self.input.v('B', x=0))
        print 'minimum width: ' + str(self.input.v('B', x=1))

        plt.figure(1, figsize=(1, 2))
        for i in range(0, z.shape[1]):
            plt.plot(x[:, 0] / 1000., z[:, i], 'k-')

        for i in range(0, x.shape[0]):
            plt.plot(x[i, :] / 1000., z[i, :], 'k-')
        plt.xlabel('x (km)')
        plt.ylabel('z (m)')
        plt.xlim(0, np.max(x[:, 0]) / 1000.)
        plt.ylim(np.min(z), np.max(z))

        st.show()

        # twoxu1 = 2*u1
        d = {}

        return d
コード例 #2
0
    def run(self):
        ################################################################################################################
        ## Get data
        ################################################################################################################
        # grid sizes
        fmax = self.input.v('grid', 'maxIndex', 'f')
        kmax = self.input.v('grid', 'maxIndex', 'z')
        jmax = self.input.v('grid', 'maxIndex', 'x')

        # grid axes, dimensionless and with dimension
        x = self.input.v('grid', 'axis',
                         'x')  # dimensionless x axis between 0 and 1 (jmax+1)
        z = self.input.v('grid', 'axis', 'z',
                         0)  # dimensionless z axis between 0 and 1 (kmax+1)
        x_km = ny.dimensionalAxis(self.input.slice('grid'), 'x', x=x, z=0,
                                  f=0)  # x axis in m between 0 and L (jmax+1)

        L = self.input.v('grid', 'high', 'x')  # length in m (1)
        B = self.input.v('B', x=x, z=[0], f=[0])  # width (jmax+1, 1, 1)

        # variables
        Av = self.input.v('Av', x=x, z=0.5,
                          f=range(0,
                                  fmax + 1))  # Eddy viscosity (jmax+1, fmax+1)
        Roughness = self.input.v('Roughness', x=x, z=0, f=range(
            0, fmax + 1))  # Partial slip coefficient (jmax+1, fmax+1)

        zeta = self.input.v('zeta0', x=x, z=0, f=range(
            0, fmax + 1)) + self.input.v(
                'zeta1', x=x, z=0, f=range(
                    0, fmax + 1))  # water level (jmax+1, fmax+1)
        u = self.input.v('u0', x=x, z=z, f=range(0, fmax + 1)) + self.input.v(
            'u1', x=x, z=z, f=range(
                0, fmax + 1))  # horizontal velocity (jmax+1, kmax+1, fmax+1)
        c = self.input.v('c0', x=x, z=z, f=range(0, fmax + 1)) + self.input.v(
            'c1', x=x, z=z, f=range(0, fmax + 1)) + self.input.v(
                'c2', x=x, z=z, f=range(
                    0, fmax + 1))  # concentration (jmax+1, kmax+1, fmax+1)

        StotalB = ny.integrate(
            ny.integrate(B * c, 'z', kmax, 0, self.input.slice('grid')), 'x',
            0, jmax, self.input.slice('grid'))  # compute total sediment stock
        print 'Total sediment stock in domain (mln kg): ' + str(
            np.real(StotalB[0, 0, 0]) / 1.e6)

        # use data from measurements
        measurementset = self.input.v('measurementset')
        x_waterlevel = self.input.v(measurementset, 'x_waterlevel')
        x_velocity = self.input.v(measurementset, 'x_velocity')
        zeta_meas = self.input.v(measurementset,
                                 'zeta',
                                 x=x_waterlevel / L,
                                 z=0,
                                 f=range(0, 3))
        ucomp_meas = self.input.v(measurementset,
                                  'u_comp',
                                  x=x_velocity / L,
                                  z=0,
                                  f=range(0, 3))

        ################################################################################################################
        ## Plot
        ################################################################################################################
        st.configure()

        # Figure 1 - Water level amplitude
        plt.figure(1, figsize=(1, 2))
        plt.subplot2grid((1, 8), (0, 0), colspan=7)
        for n in range(0, 3):
            if n == 0:
                p = plt.plot(x_km / 1000.,
                             abs(zeta[:, n] +
                                 self.input.v('R', range(0, jmax + 1))),
                             label='$M_' + str(2 * n) + '$')
            else:
                p = plt.plot(x_km / 1000.,
                             abs(zeta[:, n]),
                             label='$M_' + str(2 * n) + '$')
            plt.plot(x_waterlevel / 1000.,
                     abs(zeta_meas[:, n]),
                     'o',
                     color=p[0].get_color())
        plt.ylabel('$|\hat{\zeta}|$ $(m)$')
        plt.xlabel('x (km)')
        plt.legend(bbox_to_anchor=(1.15, 1.05))
        plt.xlim(np.min(x_km / 1000.), np.max(x_km / 1000.))
        plt.title('Water level amplitude')

        # Figure 2 - Water level phase
        plt.figure(2, figsize=(1, 2))
        plt.subplot2grid((1, 8), (0, 0), colspan=7)
        for n in range(0, 3):
            p = plt.plot(x_km / 1000.,
                         -np.angle(zeta[:, n]) * 180 / np.pi,
                         label='$M_' + str(2 * n) + '$')
            if n == 1 or n == 2:
                plt.plot(x_waterlevel / 1000.,
                         -np.angle(zeta_meas[:, n]) * 180 / np.pi,
                         'o',
                         color=p[0].get_color())
        plt.ylabel('$\phi(\hat{\zeta})$ $(deg)$')
        plt.xlabel('x (km)')
        plt.ylim(-180, 180)
        plt.legend(bbox_to_anchor=(1.15, 1.05))
        plt.xlim(np.min(x_km / 1000.), np.max(x_km / 1000.))
        plt.title('Water level phase')

        # Figure 3 - Velocity amplitude
        plt.figure(3, figsize=(1, 2))
        plt.subplot2grid((1, 8), (0, 0), colspan=7)
        # velocity components
        for n in range(0, 3):
            p = plt.plot(x_km / 1000.,
                         abs(u[:, 0, n]),
                         label='$M_' + str(2 * n) + '$')
            plt.plot(x_velocity / 1000.,
                     abs(ucomp_meas[:, n]),
                     'o',
                     color=p[0].get_color())
        plt.ylabel('$|\hat{u}|$ $(m/s)$')
        plt.xlabel('x (km)')
        plt.title('Surface velocity amplitude')
        plt.xlim(np.min(x_km / 1000.), np.max(x_km / 1000.))
        plt.legend(bbox_to_anchor=(1.15, 1.05))

        # Figure 4 - Roughness, Eddy viscosity
        plt.figure(4, figsize=(1, 2))
        plt.subplot(1, 2, 1)
        for n in range(0, fmax + 1):
            plt.plot(x_km / 1000, abs(Av[:, n]))
        plt.ylabel(r'$|\hat{A}_{\nu}|$ $(m^2/s)$')
        plt.xlabel('x (km)')

        plt.subplot(1, 2, 2)
        for n in range(0, fmax + 1):
            plt.plot(x_km / 1000,
                     abs(Roughness[:, n]),
                     label='$M_' + str(2 * n) + '$')
        plt.ylabel(r'$|\hat{s}_{f}|$ $(m/s)$')
        plt.xlabel('x (km)')

        # Figure 5 - surface concentration
        plt.figure(5, figsize=(1, 2))
        for n in range(0, fmax + 1):
            p = plt.plot(x_km / 1000., abs(c[:, 0, n]))
        plt.xlabel('x (km)')
        plt.ylabel('|c| $(kg/m^3)$')
        plt.title('Surface sediment concentration')

        # Figure 6 - availability
        plt.figure(11, figsize=(1, 1))
        a = self.input.v('a', range(0, jmax + 1), 0, 0)
        if self.input.v('a') is not None:
            plt.plot(x_km / 1000., a)
            plt.legend()
            plt.xlabel('x (km)')
            plt.ylabel('a')
            plt.title('sediment availability')

        st.show()

        return {}
コード例 #3
0
    def run(self):

        kmax = self.input.v('grid', 'maxIndex', 'z')
        jmax = self.input.v('grid', 'maxIndex', 'x')
        smoothing = True

        st.configure()
        step = Step.Step(self.input)

        ############### Plot modeled SPM distribution ################
        if smoothing:
            c0_tmp = self.input.v('c0', range(0, jmax + 1), range(0, kmax + 1))
            c1_tmp = self.input.v('c1', range(0, jmax + 1), range(0, kmax + 1))
            c2_tmp = self.input.v('c2', range(0, jmax + 1), range(0, kmax + 1))

            ord = 1  # order of smoothing
            xstart = 0  # start smoothing from longitudinal x-axis value.
            for zi in range(0, kmax + 1):
                c0_tmp[xstart:-1, zi, 0] = ny.savitzky_golay(
                    c0_tmp[xstart:-1, zi, 0], window_size=7,
                    order=ord)  #.reshape(c0_tmp.shape[0]-1, 1)
                c1_tmp[xstart:-1, zi, 0] = ny.savitzky_golay(
                    c1_tmp[xstart:-1, zi, 0], window_size=7,
                    order=ord)  #.reshape(c1_tmp.shape[0]-1, 1)
                c2_tmp[xstart:-1, zi, 0] = ny.savitzky_golay(
                    c2_tmp[xstart:-1, zi, 0], window_size=7,
                    order=ord)  #.reshape(c2_tmp.shape[0]-1, 1)

            self.input.addData('csubt', (c0_tmp + c1_tmp + c2_tmp) * 1000)

            self.input.addData('c0', c0_tmp)
            self.input.addData('c1', c1_tmp)
            self.input.addData('c2', c2_tmp)

        else:
            self.input.addData('csubt',
                               (self.input.v('c0') + self.input.v('c1') +
                                self.input.v('c2')) * 1000)

        step.contourplot('x',
                         'z',
                         'csubt',
                         f=0,
                         sublevel=False,
                         operation=np.abs,
                         plotno=1)
        st.show()

        ############### Plot modeled settling velocity distribution ################
        self.input.addData('ws0ms', self.input.v('ws0') * 1000)
        step.contourplot('x',
                         'z',
                         'ws0ms',
                         f=0,
                         sublevel=False,
                         operation=np.abs,
                         plotno=2)
        st.show()

        ############### Plot transport capacity mechanisms ###############
        step.transportplot_mechanisms(sublevel='sublevel',
                                      concentration=True,
                                      plotno=3,
                                      display=7,
                                      legend='out',
                                      capacity=True)
        st.show()
        d = {}
        return d
コード例 #4
0
    def run(self):
        self.logger.info('Module Plot is running')

        st.configure()

        # load the STeP module
        step = Step.Step(self.input)

        ## LINEPLOT ##
        # lineplot(var1, var2, options)
        # Parameters:
        #   var1: (string) name of the variable on the horizontal axis
        #   var2: (string) name of the variable on the vertical axis
        #       either var1 or var2 should be a grid axis (x, z, f)
        #   options include:
        #       x, z, f: (float, list or 1D array) values of the other axes; either one value or a range
        #       operation: (function) any operation on the data. Simple examples are abs or np.real. This can also be a function
        #           reference doing more complex operations
        #       sublevel: (bool) use decomposition of this variable (e.g. for u, zeta, c) in its submodules
        #       subplots: (string) If this option is provided, subplots will be generated varying the variable provided.
        #            This can be 'x', 'z', 'f', or 'sublevel'
        #       plotno: number of this figure
        #   See some examples below
        step.lineplot('x',
                      'zeta0',
                      z=0,
                      f=range(0, 3),
                      operation=np.abs,
                      plotno=1)
        step.lineplot('x',
                      'zeta1',
                      z=0,
                      f=range(0, 3),
                      sublevel=True,
                      subplots='sublevel',
                      operation=np.abs,
                      plotno=2)
        # step.lineplot('x', 'B', z=0, plotno=3)
        # step.lineplot('x', 'zeta0', z=0, f=1, sublevel=True, operation=np.angle, plotno=4)
        # step.lineplot('x', 'Av', z=0, f=0, sublevel=False, operation=np.abs, plotno=5)
        # step.lineplot('x', 'zeta1', z=0, f=range(0, 3), sublevel=False, subplots='f', operation=np.abs, plotno=6)

        ## CONTOURPLOT ##
        # contourplot(var1, var2, var3, options)
        # Parameters:
        #   var1: (string) name of the variable on the horizontal axis, should be grid axis
        #   var2: (string) name of the variable on the vertical axis, should be grid axis
        #   var3: (string) name of the variable for the contour levels
        #   options: see lineplot
        #
        #   See some examples below
        step.contourplot('x',
                         'z',
                         'u0',
                         f=1,
                         subplots='f',
                         operation=np.abs,
                         plotno=10)
        # step.contourplot('x', 'z', 'hatc', f=0, sublevel=True, subplots='sublevel', operation=np.real, plotno=11)
        step.contourplot('x',
                         'z',
                         'c0',
                         f=0,
                         sublevel=True,
                         subplots='sublevel',
                         operation=np.abs,
                         plotno=12)

        ## TRANSPORTPLOT ##
        # transportplot_mechanisms(options)
        # Plots the sediment transport mechanisms
        # Parameters:
        #   sublevel: (string) can be 'sublevel' or 'subsublevel' indicating to take the first level decomposition or second (deeper) decomposition level
        #   concentration: (bool) plot subtidal leading-order concentration in the background
        #   display: (int) number of decompositon components to plot. Will select the most important contributions by their RMS value
        #   plotno: (int) number of this figure
        step.transportplot_mechanisms(sublevel='sublevel',
                                      concentration=True,
                                      plotno=20,
                                      legend='out',
                                      display=7)

        st.show()
        return
コード例 #5
0
ファイル: ws_Q_plot.py プロジェクト: henkjongbloed/iFlow
    def run(self):
        st.configure()
        data = self.input.getKeysOf('experimentdata')
        var1 = 'ws0'
        var2 = 'Q1'

        v2 = []
        v1 = []
        for dat in data:
            dc = self.input.v('experimentdata', dat)
            v1.append(dc.v(var1))
            v2.append(dc.v(var2))
        v1 = list(set(v1))
        v2 = list(set(v2))
        v1.sort()
        v2.sort()
        x = dc.v('grid', 'axis', 'x')
        xdim = ny.dimensionalAxis(dc.slice('grid'), 'x')[:, 0, 0]

        ETMloc = np.nan * np.ones((len(v1), len(v2)))
        maxc = np.nan * np.ones((len(v1), len(v2)))
        for q, dat in enumerate(data):
            print q

            dc = self.input.v('experimentdata', dat)
            i = v1.index(dc.v(var1))
            j = v2.index(dc.v(var2))

            c = dc.v('c', x=x, z=1, f=0)
            if c is None:
                c = dc.v('c0', x=x, z=1, f=0) + dc.v('c2', x=x, z=1, f=0)
            maxc[i, j] = np.max(c)

            try:
                # loc = ny.toList(self.findETM(xdim, T, Tx))
                loc = ny.toList(self.findETM(xdim, c))
                ETMloc[i, j] = np.asarray(loc)
            except:
                print 'no etm'

        plt.figure(1, figsize=(1, 1))
        log1 = 'True'
        log2 = 'False'
        if log1 == 'True':
            v1 = np.log10(np.asarray(v1))
        if log2 == 'True':
            v2 = np.log10(np.asarray(v2))

        x_up_round = np.ceil(max(xdim) / 10000.) * 10.
        ETMloc[np.where(ETMloc >= x_up_round * 1000.)] = x_up_round * 1000.
        levels = np.linspace(0., x_up_round, x_up_round / 2 + 1)
        plt.contourf(np.asarray(v1),
                     np.asarray(v2),
                     ETMloc.T / 1000.,
                     levels=levels)
        plt.title('ETM location (km)')
        if log1 == 'True':
            xmin = np.min(np.asarray(v1))
            xmax = np.max(np.asarray(v1))
            xtick = np.arange(np.ceil(xmin), np.floor(xmax) + 1)
            plt.xticks(xtick, [10.**i for i in xtick])
            plt.xlabel('$\log_{10} w_s$ (m/s)')

        plt.ylabel('Q $(m^3/s)$')

        plt.colorbar()

        # ## Fig 2
        # plt.figure(2, figsize=(1,1))
        # plt.contourf(np.asarray(v1), np.asarray(v2), maxc.T/1000., 40)
        # plt.title('Maximum near-bed\nconcentration (g/l)')
        # if log1 == 'True':
        #     xmin = np.min(np.asarray(v1))
        #     xmax = np.max(np.asarray(v1))
        #     xtick = np.arange(np.ceil(xmin),np.floor(xmax)+1)
        #     plt.xticks(xtick, [10.**i for i in xtick])
        #     plt.xlabel('$\log_{10} w_s$ (m/s)')
        #
        # plt.ylabel('Q $(m^3/s)$')

        # plt.colorbar()

        st.show()
        d = {}
        return d
コード例 #6
0
    def run(self):
        measurementset = self.input.v('measurementset')
        data = self.input.getKeysOf('experimentdata')
        calib_param = ny.toList(self.input.v('calibration_parameter'))
        label = ny.toList(self.input.v('label'))
        unit_temp = ny.toList(self.input.v('unit'))
        unit = []
        for u in unit_temp:
            if u == '-':
                unit.append('')
            else:
                unit.append('($' + u + '$)')
        if len(calib_param) == 1:
            param_range = [[]]
        elif len(calib_param) == 2:
            param_range = [[], []]
        else:
            raise KnownError(
                'ManualCalibration not implemented for calibration with more than 3 parameters.'
            )

        # inital loop to determine the parameter ranges
        for i, dat in enumerate(data):
            dc = self.input.v('experimentdata', dat)
            for j in range(0, len(calib_param)):
                param_range[j].append(dc.v(calib_param[j]))
        for j in range(0, len(calib_param)):
            param_range[j] = sorted(list(set(param_range[j])))

        # second loop to determine the values per parameter setting
        cost_range = np.nan * np.zeros([len(l) for l in param_range] + [2])
        for dat in data:
            dc = self.input.v('experimentdata', dat)
            index = [
                l.index(dc.v(calib_param[i]))
                for i, l in enumerate(param_range)
            ]

            L = dc.v('grid', 'high', 'x')
            H0 = dc.n('grid', 'high', 'z', x=0)
            dc.merge(self.input.slice(measurementset))
            x_obs = dc.v(measurementset, 'x_waterlevel') / L
            x_ext = np.zeros(len(x_obs) + 2)
            x_ext[1:-1] = x_obs
            x_ext[0] = 0
            x_ext[-1] = 1
            zeta_obs = dc.v(measurementset, 'zeta', x=x_obs, z=0, f=[1, 2])

            # Start fix
            # zeta_obs = dc.data[measurementset]['zeta'].im_self.dataContainer.data['value'][:,1:3] #fix
            # from copy import deepcopy                                                                     #fix
            # newgrid = deepcopy(dc.data['zeta0']['tide'].im_self.dataContainer.data['grid']['outputgrid']) #fix
            # i = 0
            # while i is not None:
            #     try:
            #         keys = dc.data['zeta'+str(i)].keys()
            #         for key in keys:
            #             if i<2:
            #                 dc.data['zeta'+str(i)][key].im_self.dataContainer.data['grid'] = newgrid
            #             else:
            #                 keys2 =dc.data['zeta'+str(i)][key].keys()
            #                 for key2 in keys2:
            #                     dc.data['zeta'+str(i)][key][key2].im_self.dataContainer.data['grid'] = newgrid
            #         i += 1
            #     except:
            #         i = None
            # End fix

            zeta_mod = 0
            i = 0
            while True:
                if dc.v('zeta' + str(i), x=x_obs, z=0, f=[1, 2]) is not None:
                    zeta_mod += dc.v('zeta' + str(i), x=x_obs, z=0, f=[1, 2])
                    i += 1
                else:
                    break
                if i > 3:
                    break

            cost_range[tuple(index) + (0, )] = cost_function_DJ96(
                x_ext, zeta_obs[:, 0], zeta_mod[:, 0])
            cost_range[tuple(index) + (1, )] = cost_function_DJ96(
                x_ext, zeta_obs[:, 1], zeta_mod[:, 1])

        st.configure()
        # 1D plots
        if len(calib_param) == 1:
            try:
                minlocM2 = [
                    param_range[0][np.where(
                        cost_range[:, 0] == np.min(cost_range[:, 0]))[0]]
                ]
                minlocM4 = [
                    param_range[0][np.where(
                        cost_range[:, 1] == np.min(cost_range[:, 1]))[0]]
                ]
            except:
                minlocM2 = [np.nan]
                minlocM4 = [np.nan]
            print 'Minumim $M_2$: '
            print calib_param[0] + ' ' + str(minlocM2[0])
            print 'Minumim $M_4$: '
            print calib_param[0] + ' ' + str(minlocM4[0])

            if self.input.v('axis') == 'log':
                axis = np.log10(param_range[0])
                label = '$log_{10}$($' + label[0] + '$)' + unit[0]
                minlocM2 = np.log10(minlocM2)
                minlocM4 = np.log10(minlocM4)
            else:
                axis = param_range[0]
                label = '$' + calib_param[0] + '$' + unit[0]

            plt.figure(1, figsize=(1, 1))
            plt.plot(axis, cost_range[:, 0], 'k.')
            plt.plot(minlocM2[0], np.min(cost_range[:, 0]), 'ro')
            plt.xlabel(label)
            plt.ylabel('Cost $M_2$')
            plt.yticks([], [])
            plt.ylim(0, max(cost_range[:, 0]))

            plt.figure(2, figsize=(1, 1))
            plt.plot(axis, cost_range[:, 1], 'k.')
            plt.plot(minlocM4[0], np.min(cost_range[:, 1]), 'ro')
            plt.xlabel(label)
            plt.ylabel('Cost $M_4$')
            plt.yticks([], [])
            plt.ylim(0, max(cost_range[:, 1]))

        # 2D plots
        elif len(calib_param) == 2:
            try:
                minlocM2 = [
                    param_range[0][np.where(
                        cost_range[:, :, 0] == np.min(cost_range[:, :,
                                                                 0]))[0]],
                    param_range[1][np.where(
                        cost_range[:, :, 0] == np.min(cost_range[:, :, 0]))[1]]
                ]
                minlocM4 = [
                    param_range[0][np.where(
                        cost_range[:, :, 1] == np.min(cost_range[:, :,
                                                                 1]))[0]],
                    param_range[1][np.where(
                        cost_range[:, :, 1] == np.min(cost_range[:, :, 1]))[1]]
                ]
            except:
                minlocM2 = [np.nan, np.nan]
                minlocM4 = [np.nan, np.nan]
            print 'Minumim $M_2$: '
            print calib_param[0] + ' ' + str(minlocM2[0])
            print calib_param[1] + ' ' + str(minlocM2[1])
            print 'Minumim $M_4$: '
            print calib_param[0] + ' ' + str(minlocM4[0])
            print calib_param[1] + ' ' + str(minlocM4[1])

            if self.input.v('axis') == 'log':
                axis1 = np.log10(param_range[0])
                axis2 = np.log10(param_range[1])
                label1 = '$log_{10}$($' + label[0] + '$)' + unit[0]
                label2 = '$log_{10}$($' + label[1] + '$)' + unit[1]
                minlocM2 = [np.log10(i) for i in minlocM2]
                minlocM4 = [np.log10(i) for i in minlocM4]
            else:
                axis1 = param_range[0]
                axis2 = param_range[1]
                label1 = '$' + label[0] + '$' + unit[0]
                label2 = '$' + label[1] + '$' + unit[1]
            plt.figure(1, figsize=(1, 1))
            plt.hold(True)
            plt.contourf(axis1, axis2, np.transpose(cost_range[:, :, 0]), 30)

            plt.plot(minlocM2[0], minlocM2[1], 'ro')
            # plt.plot(axis1, np.log10(0.5*10**axis2*H0), 'r')
            plt.xlim(min(axis1), max(axis1))
            plt.ylim(min(axis2), max(axis2))
            # plt.plot(np.log10(0.003), np.log10(0.061), 'yo')  # best Scheldt calibration
            # plt.plot(np.log10(0.098), np.log10(0.019), 'yo')  # best Ems1981 calibration
            plt.title('Cost $M_2$')
            plt.xlabel(label1)
            plt.ylabel(label2)
            #plt.colorbar()

            plt.figure(2, figsize=(1, 1))
            plt.hold(True)
            plt.plot(minlocM4[0], minlocM4[1], 'ro')
            plt.contourf(axis1, axis2, np.transpose(cost_range[:, :, 1]), 30)
            # plt.plot(axis1, np.log10(0.5*10**axis2*H0), 'r')
            plt.xlim(min(axis1), max(axis1))
            plt.ylim(min(axis2), max(axis2))
            plt.title('Cost $M_4$')
            plt.xlabel(label1)
            plt.ylabel(label2)
            #plt.colorbar()

        st.show()

        d = {}
        return d