Esempio n. 1
0
File: main.py Progetto: ktaebum/SSV
def main():
  #  write plot configuration
  """
  Possible Configurations
    1. log_time (bool): log scale of time in contour if True
    2. log_mass (bool): log (M_tot - M_r) if True
    3. photosphere (bool): plot photosphere if True
    4. magnitude (bool): plot Mbol, Mu... magnitude if True
    5. log_time_mag (bool): log scale of time in magnitude plot if True
    6. transparency (0.0 - 1.0): transparency of contour (default 0.6)
        0.0 is the most transparent
    7. title: title of plot
        if empty, it automatically parse from target key
        if you use arithmetic operation like SWD.V * 2,
          you must type title (cannot auto-inference)
  """
  configuration = {
      'log_time': False,
      'log_mass': False,
      'photosphere': True,
      'magnitude': True,
      'log_time_mag': False,
      'transparency': 0.6,
      'title': r'$0.5 V^{2}$',
  }

  plotter = get_plotter(root='./data/p600_PolyEnv_alpha3.0_2')
  plotter.plot(0.5 * SWD.V**2, **configuration)
  plotter.plot_abn_data(ABN.H, threshold=0.2, **configuration)
  plotter.plot_abn_data((ABN.C, ABN.O), threshold=0.1, **configuration)
  plotter.plot_abn_data((ABN.Ni, ABN.O, ABN.C), threshold=0.7, **configuration)

  input('Press Enter to exit ')
Esempio n. 2
0
def main(args):
    #  write plot configuration
    """
  Possible Configurations
    1. log_time (bool): log scale of time in contour if True
    2. log_mass (bool): log (M_tot - M_r) if True
    3. photosphere (bool): plot photosphere if True
    4. magnitude (bool): plot Mbol, Mu... magnitude if True
    5. log_time_mag (bool): log scale of time in magnitude plot if True
    6. transparency (0.0 - 1.0): transparency of contour (default 0.6)
        0.0 is the most transparent
    7. title: title of plot
        if empty, it automatically parse from target key
        if you use arithmetic operation like SWD.V * 2,
          you must type title (cannot auto-inference) in latex format
  """

    # this is example configuration
    # actually, you do not have to type all configurations
    #   (can skip some keywords or leave just empty dictionary)
    configuration = {
        'log_time': False,
        'log_mass': False,
        'photosphere': True,
        'magnitude': True,
        'log_time_mag': False,
        'transparency': 0.6,
        'title': r'$0.5 V^{2}$',
        # do not modify below configurations
        'save': args.save,
    }

    if not args.save:
        plt.ion()

    if args.path is None:
        raise ValueError('Must pass path')
    elif args.path[-1] == '/':
        args.path = args.path[:-1]

    if args.prefix is None:
        args.prefix = args.path.split('/')[-1]

    plotter = get_plotter(root=args.path, prefix=args.prefix)
    plotter.plot(0.5 * SWD.V**2, **configuration)
    plotter.plot_abn_data(ABN.H, threshold=0.2, **configuration)
    plotter.plot_abn_data((ABN.C, ABN.O), threshold=0.1, **configuration)
    plotter.plot_abn_data((ABN.Ni, ABN.O, ABN.C),
                          threshold=0.7,
                          **configuration)

    if not args.save:
        input('Press Enter to exit ')
    else:
        figname = args.figname
        if figname is None:
            figname = args.path.split('/')[-1] + '.png'

        plotter.save(figname)
Esempio n. 3
0
    def __add__(self, other):
        _valid_operation(SWD, other)

        plotter = stella_plot.get_plotter()
        self_data = plotter._swd.get_value_of_key(self)
        if isinstance(other, SWD):
            other_data = plotter._swd.get_value_of_key(other)
            return self_data + other_data
        else:
            return self_data + other