def __init__(self, filename, header):
        FileReader.__init__(self, filename, header)

        """ Keep track of number of locations and cost of prescriptions
        """
        self.__prescription_location_count = 0
        self.__prescription_total_cost = 0.0

        """ Plugin a method to lookup postcode from practice code
            Maintain a dictionary with outer postcodes as keys and actual spend as values
        """
        self.__postcode_lookup_method = None
        self.__post_codes_by_actual_spend = {}

        """ Plugin a method to lookup region from postcode
            Compile a regex to look for a particular prescription
            Track the cost and prescription count nationally
        """
        self.__region_lookup_method = None
        self.__average_price_per_region = {}
        self.__prescription_count_by_region = {}
        self.__prescription_regex = re.compile(r'^Flucloxacillin\s*\w*')
        self.__cost_per_prescription = 0
        self.__prescription_count = 0

        """ Keep track of various anti-depressant prescriptions
        """
        self.__antidepressant_prescriptions = 'Fluoxetine Hydrochloride Citalopram Hydrobromide Paroxetine' \
                                              ' Hydrochloride Sertraline Hydrochloride Duloxetine Hydrochloride' \
                                              ' Venlafaxine Mirtazapine'
        self.__antidepressant_prescription_count_by_region = {}
Exemplo n.º 2
0
	def __init__(self, path):
		FileReader.__init__(self, path)

		acqs_name = glob.glob( os.path.join(os.path.dirname(path), 'acqu*s') ) 
		self.npts = 1
		#First build a dictonary for each dimension in the experiment
		self.acq={}
 
		for dim in acqs_name:
			if 'acqus'  in dim: n = 1 
			if 'acqu2s' in dim: n = 2
			if 'acqu3s' in dim: n = 3
			if 'acqu4s' in dim: n = 4
			if 'acqu5s' in dim: n = 5

	
			dic = {}	
			for line in open( dim, 'r' ):
				if   'TD='       in line:
					dic['TD'] = int(split(line)[-1])
					if n==1:
						dic['TD'] /= 2
						self.pts_in_fid = dic['TD']
					else: self.npts *= dic['TD']

				elif 'SW_h='     in line: dic['SW_h'] = float(split(line)[-1])
				elif 'PULPROG='  in line: dic['PULPROG']= split(line)[-1]
				elif 'DTYPA='    in line: dic['DTYPA'] = { 0:'i', 1:'d'}[ int(split(line)[-1])]
				elif 'BYTORDA='  in line: dic['BYTORDA']={ 0:'<', 1:'>'}[ int(split(line)[-1])]	
				elif 'GRPDLY='   in line: dic['GRPDLY']= int(split(line)[-1])
				elif 'DECIM='    in line: dic['DECIM']=  int(split(line)[-1])
				elif 'DSPFVS='   in line: dic['DSPFVS']= int(split(line)[-1])

			self.acq[n]=dic
			
		#Now build the format string for reading in the data
		self.fmt = '%s%d%s' % (self.acq[1]['BYTORDA'],self.pts_in_fid*2, self.acq[1]['DTYPA'])

		#In bruker ser, each block must end at integer of 1024 
		#check to see what correction is needed
		blk_sz = calcsize(self.fmt)
		if blk_sz % 1024:  self.cor = 1024 - (blk_sz % 1024)   #correction needed
		else: self.cor = 0			                  #no correction

		#Now prepare for the dreaded digital filtering
		if ('GRPDLY' in self.acq[1] ) and self.acq[1]['GRPDLY'] != -1:
			digshift = acq[1]['GRPDLY'] 
	
		else:
			indx1,indx2 = self.acq[1]['DECIM'], self.acq[1]['DSPFVS'] - 10
			digshift = _brukdigital[indx1][indx2]
		
		self.roll_npts  = int(floor(digshift))+1 
		self.phase = digshift - self.roll_npts 
Exemplo n.º 3
0
	def __init__(self, path):
		FileReader.__init__(self, path)

		self.binary = open( self.path, 'r' )

		self._glb_header_sz    = struct.unpack( 'I', self.binary.read(struct.calcsize('I')))[0]
		self._local_header_sz  = 128

		self.binary.seek( self._glb_header_sz )		
			
		self.read_headers( )
Exemplo n.º 4
0
    def __init__(self, path):
        FileReader.__init__(self, path)

        self.binary = open(self.path, 'r')

        self._glb_header_sz = struct.unpack(
            'I', self.binary.read(struct.calcsize('I')))[0]
        self._local_header_sz = 128

        self.binary.seek(self._glb_header_sz)

        self.read_headers()
Exemplo n.º 5
0
    def __init__(self, path):
        FileReader.__init__(self, path)

        acqs_name = glob.glob(os.path.join(os.path.dirname(path), 'acqu*s'))
        self.npts = 1
        #First build a dictonary for each dimension in the experiment
        self.acq = {}

        for dim in acqs_name:
            if 'acqus' in dim: n = 1
            if 'acqu2s' in dim: n = 2
            if 'acqu3s' in dim: n = 3
            if 'acqu4s' in dim: n = 4
            if 'acqu5s' in dim: n = 5

            dic = {}
            for line in open(dim, 'r'):
                if 'TD=' in line:
                    dic['TD'] = int(split(line)[-1])
                    if n == 1:
                        dic['TD'] /= 2
                        self.pts_in_fid = dic['TD']
                    else:
                        self.npts *= dic['TD']

                elif 'SW_h=' in line:
                    dic['SW_h'] = float(split(line)[-1])
                elif 'PULPROG=' in line:
                    dic['PULPROG'] = split(line)[-1]
                elif 'DTYPA=' in line:
                    dic['DTYPA'] = {0: 'i', 1: 'd'}[int(split(line)[-1])]
                elif 'BYTORDA=' in line:
                    dic['BYTORDA'] = {0: '<', 1: '>'}[int(split(line)[-1])]
                elif 'GRPDLY=' in line:
                    dic['GRPDLY'] = int(split(line)[-1])
                elif 'DECIM=' in line:
                    dic['DECIM'] = int(split(line)[-1])
                elif 'DSPFVS=' in line:
                    dic['DSPFVS'] = int(split(line)[-1])

            self.acq[n] = dic

        #Now build the format string for reading in the data
        self.fmt = '%s%d%s' % (self.acq[1]['BYTORDA'], self.pts_in_fid * 2,
                               self.acq[1]['DTYPA'])

        #In bruker ser, each block must end at integer of 1024
        #check to see what correction is needed
        blk_sz = calcsize(self.fmt)
        if blk_sz % 1024: self.cor = 1024 - (blk_sz % 1024)  #correction needed
        else: self.cor = 0  #no correction

        #Now prepare for the dreaded digital filtering
        if ('GRPDLY' in self.acq[1]) and self.acq[1]['GRPDLY'] != -1:
            digshift = acq[1]['GRPDLY']

        else:
            indx1, indx2 = self.acq[1]['DECIM'], self.acq[1]['DSPFVS'] - 10
            digshift = _brukdigital[indx1][indx2]

        self.roll_npts = int(floor(digshift)) + 1
        self.phase = digshift - self.roll_npts
Exemplo n.º 6
0
 def __init__(self, fn):
     FileReader.__init__(self, fn)
     self.state = self.STATE_NORMAL
 def __init__(self, filename, header):
     FileReader.__init__(self, filename, header)
    def __init__(self, filename, header):
        FileReader.__init__(self, filename, header)

        self.__location_to_search = None
        self.__location_count = 0
        self.__practice_code_to_postcode = {}
 def __init__(self, header, filename):
     FileReader.__init__(self, header, filename)
     self.__postcode_to_region_lookup = {}
     self.__regions = []
Exemplo n.º 10
0
 def __init__(self, fn):
     FileReader.__init__(self, fn)
     self.state = self.STATE_NORMAL