model_utilities.py   model_utilities.py 
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import numpy as np import numpy as np
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
from astropy.table import Table
# LOGGING CONFIGURATION # LOGGING CONFIGURATION
from .galpak3d import * from .galpak3d import *
from .galaxy_parameters import GalaxyParameters from .galaxy_parameters import GalaxyParameters
import logging import logging
logging.basicConfig(level=logging.INFO) logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('GalPaK: DiskUtilities:') logger = logging.getLogger('GalPaK: DiskUtilities:')
################################################################# #################################################################
# #
class ModelExt: class ModelExt:
##Methods to update galaxy parameters ##Methods to update galaxy parameters
def set_v22(self, galaxy): def set_v22(self, galaxy):
""" """
Computes velocity at 2.2 Re Computes velocity at 2.2 Rd
:param galaxy: GalaxyParameters | Table :param galaxy: GalaxyParameters | Table
:return: return V(2.2 Re) :return: return V(2.2 Rd)
This Model method will add/update the galaxy property This Model method will add/update the galaxy property
""" """
#V at 2.2 x Rd #V at 2.2 x Rd
x = 2.2 * galaxy['radius'] / 1.68 x = 2.2 * galaxy['radius'] / 1.68
_v22 = self.set_velocity_profile(galaxy, x) _v22 = self.set_velocity_profile(galaxy, x)
#set v22 for galaxy #set v22 for galaxy
if isinstance(galaxy, GalaxyParameters): if isinstance(galaxy, GalaxyParameters):
logger.info("Adding v22 property to GalaxyParameters class") logger.info("Adding v22 property to GalaxyParameters class")
galaxy.set_v22(_v22) galaxy.set_v22(_v22)
elif isinstance(galaxy, Table): elif isinstance(galaxy, Table):
logger.info("Adding v22 property to Table class") logger.info("Adding v22 property to Table class")
if 'v22' not in galaxy.colnames: if 'v22' not in galaxy.colnames:
galaxy.add_column(_v22,name='v22') galaxy.add_column(_v22, name='v22')
else: else:
galaxy['v22']=_v22 galaxy['v22']=_v22
else: else:
raise Exception("set_v22 must use a GalaxyParameters or a Table ") raise Exception("set_v22 must use a GalaxyParameters or a Table ")
def set_dvdx(self, galaxy): def set_dvdx(self, galaxy):
""" """
Computes Velocity inner slope at R=0 Computes Velocity inner slope at R=0
:param galaxy: GalaxyParameters | Table :param galaxy: GalaxyParameters | Table
:return: dv/dx(r=0) using the units of GalaxyParameters (km/s / pix ) :return: dv/dx(r=0) using the units of GalaxyParameters (km/s / pix )
 End of changes. 4 change blocks. 
3 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/