Пример #1
0
    def calculateY( X_vect, coefficients, maximum, base_BP_positions, spectrum, scaling_factor, two_beams, m, D0, sigma, kappa, er_model):
      Y_vect = []
      from src import pyamtrack_SPC
      for x in X_vect:
        E_MeV_u_total = []
        particle_no_total = []
        fluence_cm2_total = []
        for i in range(len(coefficients)):
            shift = maximum - base_BP_positions[i]
            E_MeV_u, particle_no, fluence_cm2 = pyamtrack_SPC.spectrum_at_depth(x + shift, spectrum)
            fluence_cm2_coef = [f * coefficients[i] * scaling_factor for f in fluence_cm2]
            E_MeV_u_total += E_MeV_u
            particle_no_total += particle_no
            fluence_cm2_total += fluence_cm2_coef
            
            if two_beams:                
                plateau_dist = base_BP_positions[-1]
                plateau_prox = base_BP_positions[0]
                y = plateau_dist +  plateau_prox - x
                
                E_MeV_u_second, particle_no_second, fluence_cm2_second = pyamtrack_SPC.spectrum_at_depth(y + shift, spectrum)
                fluence_cm2_coef_second = [f * coefficients[i] * scaling_factor for f in fluence_cm2_second] # TODO check                                
                E_MeV_u_total += E_MeV_u_second
                particle_no_total += particle_no_second
                fluence_cm2_total += fluence_cm2_coef_second

            
        y = pyamtrack_SPC.survival(E_MeV_u_total, particle_no_total, fluence_cm2_total, m, D0, sigma, kappa, er_model)
        Y_vect.append(y)
      return Y_vect
Пример #2
0
	def prepareEmptyDict(x, spectrum, local_max, positions):
		pn = sorted([1001, 5011, 2004, 4009, 6012, 3007])
		d = dict.fromkeys(pn, {})
		
		xmin = x + local_max - max(positions)
		xmax = x + local_max - min(positions)
		
		depth_min_ind = bisect.bisect_left(sorted(spectrum.keys()), xmin)
		depth_max_ind = bisect.bisect_left(sorted(spectrum.keys()), xmax)
		
		for depth in sorted(spectrum.keys())[depth_min_ind - 1:depth_max_ind + 1]:
			E_MeV_u, particle_no, fluence_cm2 = pyamtrack_SPC.spectrum_at_depth(depth, spectrum)
			for j in range(len(fluence_cm2)):
				d[particle_no[j]][E_MeV_u[j]] = 0
		return d
Пример #3
0
	def prepareLists(x, spectrum, local_max, positions, coefficients_of_base_BPs):
		from src import pyamtrack_SPC
		particle_no_total = []
		E_MeV_u_total = []
		fluence_cm2_total = []

  
		for i in range(len(coefficients_of_base_BPs)):
			shift = local_max - positions[i]
			E_MeV_u, particle_no, fluence_cm2 = pyamtrack_SPC.spectrum_at_depth(x + shift, spectrum)
			fluence_cm2_coef = [f * coefficients_of_base_BPs[i] for f in fluence_cm2]					
			particle_no_total.extend(particle_no)
			E_MeV_u_total.extend(E_MeV_u)
			fluence_cm2_total.extend(fluence_cm2_coef)
		
		return E_MeV_u_total, particle_no_total, fluence_cm2_total
Пример #4
0
    def prepareEmptyDict(x, spectrum, local_max, positions):
        pn = sorted([1001, 5011, 2004, 4009, 6012, 3007])
        d = dict.fromkeys(pn, {})

        xmin = x + local_max - max(positions)
        xmax = x + local_max - min(positions)

        depth_min_ind = bisect.bisect_left(sorted(spectrum.keys()), xmin)
        depth_max_ind = bisect.bisect_left(sorted(spectrum.keys()), xmax)

        for depth in sorted(spectrum.keys())[depth_min_ind - 1:depth_max_ind +
                                             1]:
            E_MeV_u, particle_no, fluence_cm2 = pyamtrack_SPC.spectrum_at_depth(
                depth, spectrum)
            for j in range(len(fluence_cm2)):
                d[particle_no[j]][E_MeV_u[j]] = 0
        return d
Пример #5
0
    def prepareLists(x, spectrum, local_max, positions,
                     coefficients_of_base_BPs):
        from src import pyamtrack_SPC
        particle_no_total = []
        E_MeV_u_total = []
        fluence_cm2_total = []

        for i in range(len(coefficients_of_base_BPs)):
            shift = local_max - positions[i]
            E_MeV_u, particle_no, fluence_cm2 = pyamtrack_SPC.spectrum_at_depth(
                x + shift, spectrum)
            fluence_cm2_coef = [
                f * coefficients_of_base_BPs[i] for f in fluence_cm2
            ]
            particle_no_total.extend(particle_no)
            E_MeV_u_total.extend(E_MeV_u)
            fluence_cm2_total.extend(fluence_cm2_coef)

        return E_MeV_u_total, particle_no_total, fluence_cm2_total