Beispiel #1
0
    def __init__(self, shot):

        self.shot = shot
        # load the geometry
        self._geometry()
        # open the shotfile
        self.Ioc = dd.shotfile('IOC', self.shot)
        # read and create the attribute dictionary
        self._read()
        # close all the stuff
        self.Ioc.close()
        # open and read available gas information
        self.Uvs = dd.shotfile('UVS', self.shot)
        self._valves()
        self._readGas()
        self.Uvs.close()
        # now the directory where eventually the neutrals resides
        try:
            _path = os.path.abspath(
                os.path.join(
                    os.path.join(__file__, '../../../..'),
                    'Experiments/AUG/analysis/data/neutrals/%5i' % self.shot))
            data = numpy.load(_path + '/n0_avg.npy')
            self.n0 = data[:, 0]
            self.n0Err = data[:, 1]
            self.n0Time = numpy.loadtxt(_path + '/time_brillanza.txt')
        except:
            logging.warning('File not found')
            pass

        # now also the equilibrium since it will be useful for
        # the plot of gauges and valves location
        self.Eq = equilibrium.equilibrium(device='AUG', time=2, shot=self.shot)
        self.rg, self.zg = map_equ.get_gc()
	def __init__(self,**kwargs):
		""" initialize base class 
		
		keywords:
			shot = int		if given, read in data for shot on initialization
			gfile = file or str	if given, read in data from gfile
			tind = int		if reading from idam use tind
			machine = str		state which machine to read data for
		"""
		
		self.eq = equilibrium()		#Stored details of the efit equilibrium

		

		if 'shot' in kwargs and 'gfile' not in kwargs or kwargs['gfile'] is None:
			shot = kwargs['shot']
			if 'machine' not in kwargs:
				print("\nWARNING: No machine given, assuming MAST")
				machine = 'MAST'
			else:
				machine = kwargs['machine']
			if 'time' not in kwargs:
				print("\nWarning: No time given, setting to 0.25")
				time = 0.25
			else:
				time = kwargs['time']
			if 'mdsport' not in kwargs:
				mdsport = None
			else:
				mdsport = kwargs['mdsport']
				
			self.get_equilibrium(shot=shot,machine=machine,time=time,mdsport=mdsport)
		
			
		elif 'gfile' in kwargs:
			#If a gfile is found use it by default
			gfile = kwargs['gfile']
			if gfile != None:
				self.get_equilibrium(gfile)
	
		else:
			print("WARNING: No gfile, or shot number given, returning.")
Beispiel #3
0
 def test_regular_input(self):
     self.assertEqual(
         equilibrium([0, -3, 5, -4, -2, 3, 1, 0]), [0, 3, 7]
     )
Beispiel #4
0
 def test_no_balance_input3(self):
     self.assertEqual(
         equilibrium([0, 1, 2, 3, 4]), []
     )
Beispiel #5
0
 def test_full_zero_input(self):
     self.assertEqual(
         equilibrium([0, 0, 0, 0]), [0, 1, 2, 3]
     )
Beispiel #6
0
 def test_empty_input(self):
     self.assertEqual(
         equilibrium([]), []
     )
Beispiel #7
0
    def __init__(self, shot, time=3):

        self.shot = shot
        self.time = time
        self._Dcn = dd.shotfile('DCN', self.shot)
        self._Uvs = dd.shotfile('UVS', self.shot)
        # load the equilibrium
        self.Eq = equilibrium.equilibrium(device='AUG',
                                          shot=self.shot,
                                          time=self.time)
        # we use M. Cavedon routine to restore
        # the data.
        self._xvs = XVL('Ne', 'ROV', self.shot)
        self.time = self._xvs.idl.time
        self._Ne = self._xvs.idl.data
        self._LosInfo = self._xvs.idl.los_info
        # we build an appropriate dictionary which for each name save the
        # diagnostic the channel and the LoS information. For plottin the
        # lines we use a general dictionary and then we math it according to self._Los['losname']
        self._AllLos = {
            'ROV-01': {
                'R1': 1.440,
                'Z1': -1.192,
                'Phi1': 112.453,
                'R2': 1.581,
                'Z2': -1.201,
                'Phi2': 112.464
            },
            'ROV-02': {
                'R1': 1.440,
                'Z1': -1.192,
                'Phi1': 112.453,
                'R2': 1.584,
                'Z2': -1.190,
                'Phi2': 112.461
            },
            'ROV-03': {
                'R1': 1.440,
                'Z1': -1.192,
                'Phi1': 112.453,
                'R2': 1.587,
                'Z2': -1.177,
                'Phi2': 112.458
            },
            'ROV-04': {
                'R1': 1.440,
                'Z1': -1.192,
                'Phi1': 112.453,
                'R2': 1.591,
                'Z2': -1.164,
                'Phi2': 112.451
            },
            'ROV-05': {
                'R1': 1.440,
                'Z1': -1.192,
                'Phi1': 112.453,
                'R2': 1.595,
                'Z2': -1.150,
                'Phi2': 112.451
            },
            'ROV-06': {
                'R1': 1.440,
                'Z1': -1.192,
                'Phi1': 112.453,
                'R2': 1.599,
                'Z2': -1.135,
                'Phi2': 112.447
            },
            'ROV-07': {
                'R1': 1.440,
                'Z1': -1.192,
                'Phi1': 112.453,
                'R2': 1.603,
                'Z2': -1.118,
                'Phi2': 112.424
            },
            'ROV-08': {
                'R1': 1.405,
                'Z1': -1.151,
                'Phi1': 112.282,
                'R2': 1.604,
                'Z2': -1.115,
                'Phi2': 112.440
            },
            'ROV-09': {
                'R1': 1.405,
                'Z1': -1.151,
                'Phi1': 112.282,
                'R2': 1.609,
                'Z2': -1.096,
                'Phi2': 112.440
            },
            'ROV-10': {
                'R1': 1.405,
                'Z1': -1.151,
                'Phi1': 112.282,
                'R2': 1.615,
                'Z2': -1.074,
                'Phi2': 112.440
            },
            'ROV-11': {
                'R1': 1.405,
                'Z1': -1.151,
                'Phi1': 112.282,
                'R2': 1.621,
                'Z2': -1.050,
                'Phi2': 112.434
            },
            'ROV-12': {
                'R1': 1.405,
                'Z1': -1.151,
                'Phi1': 112.282,
                'R2': 1.629,
                'Z2': -1.021,
                'Phi2': 112.450
            },
            'ROV-13': {
                'R1': 1.405,
                'Z1': -1.151,
                'Phi1': 112.282,
                'R2': 1.639,
                'Z2': -0.987,
                'Phi2': 112.436
            },
            'ROV-14': {
                'R1': 1.405,
                'Z1': -1.151,
                'Phi1': 112.282,
                'R2': 1.656,
                'Z2': -0.941,
                'Phi2': 112.444
            }
        }
        self.Los = {}
        for name, i in zip(self._LosInfo['losname'],
                           range(len(self._LosInfo['losname']))):
            self.Los[name] = {
                'R1': self._AllLos[name]['R1'],
                'Z1': self._AllLos[name]['Z1'],
                'Phi1': self._AllLos[name]['Phi1'],
                'R2': self._AllLos[name]['R2'],
                'Z2': self._AllLos[name]['Z2'],
                'Phi2': self._AllLos[name]['Phi2'],
                'S': self._LosInfo['x'][i],
                'data': self._Ne[i]
            }
Beispiel #8
0
def BGKCollide(fin, rho, u, omega):
    feq = equilibrium(rho, u)
    return fin - omega * (fin - feq)