From e44d64ca1fde7df0b6971d2bd1dfa6e71d788e46 Mon Sep 17 00:00:00 2001 From: Taygun Bulmus Date: Thu, 15 Dec 2022 15:46:24 +0300 Subject: [PATCH] v1.2 --- .vscode/settings.json | 20 +- CHANGELOG | 7 + parameters/physicalParameters.dat | 40 +- .../analyze_random_ri_magPolDecDist.py | 423 ++++++++++++++++++ .../run_random_ri_magPolDecDist.py | 102 +++-- scripts/slurmTRUBA/submitTRUBA_collNuPy.sh | 88 ++++ ...submitTRUBA_run_random_ri_magPolDecDist.sh | 126 ++++++ scripts/tryChangeNames_SimulationNumber.py | 100 +++++ 8 files changed, 839 insertions(+), 67 deletions(-) create mode 100644 scripts/random_ri_magPolDecDist/analyze_random_ri_magPolDecDist.py create mode 100644 scripts/slurmTRUBA/submitTRUBA_collNuPy.sh create mode 100644 scripts/slurmTRUBA/submitTRUBA_run_random_ri_magPolDecDist.sh create mode 100644 scripts/tryChangeNames_SimulationNumber.py diff --git a/.vscode/settings.json b/.vscode/settings.json index b2c1584..2c1f5df 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -42,14 +42,32 @@ "ytick" ], "cSpell.words": [ + "arctan", + "axvline", + "ebeb", "hamilt", "Hamiltionian", "hamiltonians", + "imxer", + "infow", "interp", + "leniw", + "lenrw", + "linestyle", "loadtxt", + "loglog", + "Mbar", + "Msqr", "Neutrinosphere", "newaxis", + "nonstiff", + "rtol", "Sasaki", - "savetxt" + "savetxt", + "tayguns", + "tcur", + "thetabar", + "tolsf", + "xbxb" ], } \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG index fd06a27..58f84ec 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +# v1.2 +- Spell check. +- Create `analyze_random_ri_magPolDecDist.py` script. +- Change `run_random_ri_magPolDecDist.py` script. + - Add `-b` option to specify the number of number of energy mod for each energy. +- Add SLURM scripts `submitTRUBA_collNuPy.sh` and `submitTRUBA_run_random_ri_magPolDecDist.sh`. + # v1.1 - Updated gitignore. - Converted `plotgraphsScript.sh` to python script (`plotGraphsAfterSimulation.py`). Remove `plotgraphsScript.sh`. diff --git a/parameters/physicalParameters.dat b/parameters/physicalParameters.dat index 80dedfa..f05838d 100644 --- a/parameters/physicalParameters.dat +++ b/parameters/physicalParameters.dat @@ -31,16 +31,16 @@ deltaM_square41=0 # [MeV^2] Valid for (flavor_number=4) # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ -neutrino_MagneticMoment=5e-15 # [Bohr Magneton] Valid for (hamiltonian_electromagnetic=1) +neutrino_MagneticMoment=5e-14 # [Bohr Magneton] Valid for (hamiltonian_electromagnetic=1) # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ -numberOf_energyMode=1 # Valid for only integer -energy_initial=1.0 # [MeV] -energy_final=1.0 # [MeV] -distance_initial=49.972151143341506 # [km] -distance_final=54 # [km] -neutrino_distributionParameter=7 # Valid only (1,2,3,4,5,6,7), For profiles see below +numberOf_energyMode=21 # Valid for only integer +energy_initial=1.0 # [MeV] +energy_final=20.0 # [MeV] +distance_initial=50 # [km] +distance_final=200 # [km] +neutrino_distributionParameter=1 # Valid only (1,2,3,4,5,6,7), For profiles see below # ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------ @@ -60,14 +60,14 @@ luminosity_sterileb=1e+52 # [erg/s] Valid for (flavor_number=4, neutrino_density # ------------------------------------------------------------------------------ # Neutrinos temperature_e=3 # [MeV] Valid for (flavor_number=2,3,4, neutrino_densityParameter=1,2) -temperature_mu=6 # [MeV] Valid for (flavor_number=2,3,4, neutrino_densityParameter=1,2) -temperature_tau=6 # [MeV] Valid for (flavor_number=3,4, neutrino_densityParameter=1,2) +temperature_mu=7 # [MeV] Valid for (flavor_number=2,3,4, neutrino_densityParameter=1,2) +temperature_tau=7 # [MeV] Valid for (flavor_number=3,4, neutrino_densityParameter=1,2) temperature_sterile=0 # [MeV] Valid for (flavor_number=4, neutrino_densityParameter=1,2) # Antineutrinos -temperature_eb=4 # [MeV] Valid for (flavor_number=2,3,4, neutrino_densityParameter=1,2) -temperature_mub=6 # [MeV] Valid for (flavor_number=2,3,4, neutrino_densityParameter=1,2) -temperature_taub=6 # [MeV] Valid for (flavor_number=3,4, neutrino_densityParameter=1,2) +temperature_eb=5 # [MeV] Valid for (flavor_number=2,3,4, neutrino_densityParameter=1,2) +temperature_mub=7 # [MeV] Valid for (flavor_number=2,3,4, neutrino_densityParameter=1,2) +temperature_taub=7 # [MeV] Valid for (flavor_number=3,4, neutrino_densityParameter=1,2) temperature_sterileb=0 # [MeV] Valid for (flavor_number=4, neutrino_densityParameter=1,2) # ------------------------------------------------------------------------------ @@ -88,7 +88,7 @@ magneticField_profile=2 # Valid for only (0,1,2) => (Constant, magneticField_initial=1e+15 # [Gauss] Valid for (hamiltonian_electromagnetic=1, use_defaultMagneticProfile=1) magneticField_exponentialDecay=200 # [km] Valid for (use_defaultMagneticProfile=1, magneticField_profile=1) magneticField_polynomialDecayPower=2 # Valid for (use_defaultMagneticProfile=1, magneticField_profile=2) -magneticField_polynomialDecayDistance=49.9954430063595 # [km] Valid for (use_defaultMagneticProfile=1, magneticField_profile=2) +magneticField_polynomialDecayDistance=50 # [km] Valid for (use_defaultMagneticProfile=1, magneticField_profile=2) magneticField_fileName=magneticField_profile.dat # Valid for (use_defaultMagneticProfile=0). # ------------------------------------------------------------------------------ @@ -116,12 +116,12 @@ couplingConstant_sterile=1 # [Fermi_Constant] Valid for (flavor_number=4, hamilt # - For 1 || 2 => Diagonal_Term is for normalization. # - For 2 => alpha = 3 # -# [1] Fermi-Dirac [1/MeV] : (1/(T^3))*(1/F2)*(E^2/(1+exp(E/T))) [Duan:2006an] -# [2] Pinched [1/MeV] : (((alpha+1)/)^alpha)*(E^alpha/Gamma(alpha+1))*exp(-(alpha+1)*E/) [Keil:2002in] -# [3] eBox [] : Electron neutrino and electron antineutrino box spectrum -# [4] muBox [] : Muon neutrino and muon antineutrino box spectrum -# [5] Fermi, Zero [1/MeV] : Actives: Fermi-Dirac Dist., Sterile: Zero -# [6] Only eBox [] : Electron neutrino box spectrum -# [7] Only ebarBox [] : Anti Electron neutrino box spectrum +# [1] Fermi-Dirac [1/MeV] : (1/(T^3))*(1/F2)*(E^2/(1+exp(E/T))) [Duan:2006an] +# [2] Pinched [1/MeV] : (((alpha+1)/)^alpha)*(E^alpha/Gamma(alpha+1))*exp(-(alpha+1)*E/) [Keil:2002in] +# [3] eBox [] : Electron neutrino and electron antineutrino box spectrum +# [4] muBox [] : Muon neutrino and muon antineutrino box spectrum +# [5] Fermi, Zero [1/MeV] : Actives: Fermi-Dirac Dist., Sterile: Zero +# [6] Only eBox [] : Electron neutrino box spectrum +# [7] Only ebarBox [] : Anti Electron neutrino box spectrum # ----------------------------------------------------------------------------- # ============================================================================== diff --git a/scripts/random_ri_magPolDecDist/analyze_random_ri_magPolDecDist.py b/scripts/random_ri_magPolDecDist/analyze_random_ri_magPolDecDist.py new file mode 100644 index 0000000..5e71b05 --- /dev/null +++ b/scripts/random_ri_magPolDecDist/analyze_random_ri_magPolDecDist.py @@ -0,0 +1,423 @@ +import matplotlib.pyplot as plt +import numpy as np +import os as osCommand # File operations + +# Current Directory +currDir = osCommand.getcwd() + "/" +from pathlib import Path +# collNuPy main directory +COLLECTIVE_NU_OSC_DIR= str(Path(str(Path(currDir).parent)+ "/").parent) + '/' +# ============================ + +# ============================ +# Constants +G_f_MeV_2 = 1.1663786999999999e-11 # [MeV^-2] +km_1__MeV = 1.973269804593025e-16 +MeV__km_1 = 5067730716156395.0 +MeV_1_TO_km = 1.973269804593025e-16 +erg_s_TO_MeV_km = 2.0819433270935597 +# ============================ + +# ============================ +# Colors For Printing +class tLog: + INFO = '\033[94m'+'[INFO] '+'\033[0m' + OK = '\033[92m'+'[OK] '+'\033[0m' + WARNING = '\033[93m'+'[WARNING] '+'\033[0m' + ERROR = '\033[91m'+'[ERROR] '+'\033[0m' + EXIT = '\033[91m'+'[EXIT] analyze_random_ri_magPolDecDist.py' + '\033[0m' +# ============================ + +# ============================ +# MSW Resonance Variables +def mswResonanceVariablesCreate(hierarchy, E_MeV, distAll_km, deltaMsqr_MeV2, theta, Vcc_km_1, Vnc_km_1, hamTot_km_1): + # ============================ + # Shortcuts + Delta_MeV= deltaMsqr_MeV2/ (4* E_MeV) + Vcc__MeV= Vcc_km_1* km_1__MeV + Vnc_MeV= Vnc_km_1* km_1__MeV + # ============================ + + # ============================ + # M and M bar [MeV] for All Distance + M_MeV = np.sqrt( ((Delta_MeV* np.sin(2* theta))**2)+ ((Delta_MeV* np.cos(2* theta) - Vcc__MeV/2)**2) ) + Mbar_MeV = np.sqrt( ((Delta_MeV* np.sin(2* theta))**2)+ ((Delta_MeV* np.cos(2* theta) + Vcc__MeV/2)**2) ) + # Eigenvalues of Matter Basis (omega's) for All Distance [MeV] + eigValMat_MeV = np.array([\ + (- M_MeV+ Vnc_MeV +(Vcc__MeV/ 2) )\ + , (+ M_MeV+ Vnc_MeV +(Vcc__MeV/ 2) )\ + , (+ Mbar_MeV- Vnc_MeV -(Vcc__MeV/ 2) )\ + , (- Mbar_MeV- Vnc_MeV -(Vcc__MeV/ 2) )]) + # ThetaM, ThetaBar_M, gamma and Theta_Tilde for All Distance + theta_M = np.pi/2 + np.arctan2(Delta_MeV* np.sin(2* theta), (Delta_MeV* np.cos(2* theta)- Vcc__MeV/2))/2 + thetabar_M= np.arctan2(Delta_MeV* np.sin(2* theta), (Delta_MeV* np.cos(2* theta)+ Vcc__MeV/2))/2 + gamma_AllDist= theta_M - thetabar_M + # ============================ + + # ============================ + # Find locations of MSW resonance + if hierarchy == 1: + # For Normal Hierarchy + tmp= np.array(np.where((((np.roll(np.sign(hamTot_km_1[:,0,0,0]- hamTot_km_1[:,0,1,1]), 1) - np.sign(hamTot_km_1[:,0,0,0]- hamTot_km_1[:,0,1,1])) != 0)) == 1)).flatten() + else: + # For Inverted Hierarchy + tmp= np.array(np.where((((np.roll(np.sign(hamTot_km_1[:,0,2,2]- hamTot_km_1[:,0,3,3]), 1) - np.sign(hamTot_km_1[:,0,2,2]- hamTot_km_1[:,0,3,3])) != 0)) == 1)).flatten() + # if tmp is empty (NO MSW resonance) + if tmp.size == 0: + print(tLog.ERROR + "No MSW resonance found!") + return None,None,None,None + else: + # Remove the element which is zero + if tmp[0] == 0: + tmp= tmp[1:] + else: + exit(tLog.EXIT + "The first element of tmp is not zero. It is " + str(tmp[0])) + # Create Zero Arrays + r_resMSWs_km_idx= np.zeros(len(tmp), dtype=int); r_resMSWs_km=np.zeros(len(tmp)); + adiabaticity_MSW= np.zeros(len(tmp)); P_LZ_MSW= np.zeros(len(tmp)); itTmp=0 + # Assign Resonance Index and Distance + for it1 in range(len(tmp)): + if tmp[it1] == 0: + continue + r_resMSWs_km_idx[itTmp]= tmp[it1] + r_resMSWs_km[itTmp]= distAll_km[tmp[it1]] + itTmp= itTmp+1 + # If neutrino oscillation is not considered + if theta == 0: + r_resMSWs_km_idx=0; r_resMSWs_km=0 + # ============================ + + # ============================ + # Adiabaticity (Bulmus:2022gyz, eqn (48)) + Vcc_gradient_km_2= np.abs(np.gradient(Vcc_km_1, distAll_km[1]-distAll_km[0])) + Vcc_gradient_MeV2= Vcc_gradient_km_2* (km_1__MeV**2) + for it1 in range(len(adiabaticity_MSW)): + adiabaticity_MSW[it1]= (((deltaMsqr_MeV2/ (2* E_MeV))* np.sin(2* theta))**2)/ Vcc_gradient_MeV2[r_resMSWs_km_idx[it1]] + # ============================ + + # ============================ + # Landau Zener Transition Probability + P_LZ_MSW= np.exp((-2)* np.pi* adiabaticity_MSW) + # ============================ + + # ============================ + # Printing + print(tLog.INFO + "MSW resonance is at " + str(r_resMSWs_km) + " km(s).") + print(tLog.INFO + "Adiabaticity is(are) " + str(adiabaticity_MSW) + ".") + print(tLog.INFO + "Landau Zener Transition Probability is(are) " + str(P_LZ_MSW) + ".") + # ============================ + + return r_resMSWs_km_idx, r_resMSWs_km, adiabaticity_MSW, P_LZ_MSW +# ============================ + +# ============================ +# SFP Resonance Variables +def sfpResonanceVariables(hierarchy, E_MeV, distAll_km, deltaMsqr_MeV2, Vcc_km_1, Vnc_km_1, muB_km_1, hamTot_km_1): + # ============================ + # Shortcuts + Delta_MeV= deltaMsqr_MeV2/ (4* E_MeV) + Vcc__MeV= Vcc_km_1* km_1__MeV + Vnc_MeV= Vnc_km_1* km_1__MeV + # ============================ + + # ============================ + # Find locationS of SFP resonance + if hierarchy == 1: + # For Normal Hierarchy + tmp= np.array(np.where((((np.roll(np.sign(hamTot_km_1[:,0,1,1]- hamTot_km_1[:,0,2,2]), 1) - np.sign(hamTot_km_1[:,0,1,1]- hamTot_km_1[:,0,2,2])) != 0)) == 1)).flatten() + else: + # For Inverted Hierarchy + tmp= np.array(np.where((((np.roll(np.sign(hamTot_km_1[:,0,0,0]- hamTot_km_1[:,0,3,3]), 1) - np.sign(hamTot_km_1[:,0,0,0]- hamTot_km_1[:,0,3,3])) != 0)) == 1)).flatten() + # if tmp is empty (NO SFP resonance) + if tmp.size == 0: + print(tLog.ERROR + "No SFP resonance found!") + return None,None,None,None + else: + # Remove the element which is zero + if tmp[0] == 0: + tmp= tmp[1:] + else: + exit(tLog.EXIT + "The first element of tmp is not zero. It is " + str(tmp[0])) + for it1 in range(len(tmp)): + if tmp[it1] == 0: + continue + if distAll_km[tmp[it1]] > 5e+4: + continue + else: + r_resSFP_km_idx= tmp[it1] + r_resSFP_km= distAll_km[r_resSFP_km_idx] + break + # ============================ + + # ============================ + # Adiabaticity (Bulmus:2022gyz, eqn (38)) + # We need (1-2*Ye) in the denominator + # (-2* Vnc - Vcc) = A*(1-Ye) - A*Ye = A* (1- 2*Ye) + denominator_km_2= np.real(np.abs(np.gradient(((-2* Vnc_km_1)- Vcc_km_1), distAll_km[1]-distAll_km[0]))) + adiabaticity_SFP = (np.real(muB_km_1[r_resSFP_km_idx])**2)/denominator_km_2[r_resSFP_km_idx] + # ============================ + + # ============================ + # Landau Zener Transition Probability + P_LZ_SFP= np.exp((-2)* np.pi* adiabaticity_SFP) + # ============================ + + # ============================ + # Printing + print(tLog.INFO + "SFP resonance is at " + str(r_resSFP_km) + " km.") + print(tLog.INFO + "SFP adiabaticity is " + str(adiabaticity_SFP)) + print(tLog.INFO + "SFP Landau Zener Transition Probability is " + str(P_LZ_SFP)) + # ============================ + + return r_resSFP_km_idx, r_resSFP_km, adiabaticity_SFP, P_LZ_SFP +# ============================ + +# ============================ +def analyzeAllResults(): + RESULTS_DIR = COLLECTIVE_NU_OSC_DIR+'results/' + noOfSim=len(next(osCommand.walk(RESULTS_DIR))[1]) # https://stackoverflow.com/questions/29769181/count-the-number-of-folders-in-a-directory-and-subdirectories + print(tLog.INFO+'Number of simulations is '+str(noOfSim)+'.') + # ============================ + + # ============================ + E_MeV= np.zeros(noOfSim); TraceTerm= np.zeros(noOfSim); distINIT_km= np.zeros(noOfSim) + # ============================ + + # ============================ + # Similar for all simulations + # First Data Load + DATA_DIR= RESULTS_DIR+'simulation1/data/' + DATA_rhoFlavAll= np.load(DATA_DIR+'rhoFlavAll.npz', allow_pickle=True) + DATA_hamiltonians= np.load(DATA_DIR+'hamiltonians.npz', allow_pickle=True) + DATA_parametersDic= np.load(DATA_DIR+'parametersDic.npz', allow_pickle=True) + #print(DATA_parametersDic.files); exit() + # ============================ + # Variables + totFlav = DATA_rhoFlavAll['totFlav'] + dim_rho_2totFlav_Bool = DATA_rhoFlavAll['dim_rho_2totFlav_Bool'] + #hamBoolAll_OscMatEMSelfSA = DATA_hamiltonians['hamBoolAll_OscMatEMSelfSA'] + use_defaultMatterProfile = DATA_parametersDic['use_defaultMatterProfile'] + deltaMsqr_MeV2 = DATA_parametersDic['deltaM_square21'] + theta = DATA_parametersDic['theta12'] + hierarchy = DATA_parametersDic['neutrino_hierarchy'] + neutrino_MagneticMoment = DATA_parametersDic['neutrino_MagneticMoment'] + print(tLog.INFO+'Neutrino Magnetic Moment is '+str(neutrino_MagneticMoment)+'.') + #if not use_defaultMatterProfile: + # matterProfile_fileName= str(DATA_parametersDic['matterProfile_fileName'])[:-1] + #else: + # #TODO Create function for default matter profile + # pass + #DATA_matterProfile= np.loadtxt(DATA_DIR+ matterProfile_fileName) + #matterProfile_distAll_km= DATA_matterProfile[:,0]* 1e-5 + #matterProfile_baryonDens_g_cm3= DATA_matterProfile[:,2] + #matterProfile_Ye= DATA_matterProfile[:,1] + # If all elements of matterProfile_Ye are same, then took only one of them + #if np.all(matterProfile_Ye == matterProfile_Ye[0]): + # matterProfile_Ye= matterProfile_Ye[0] + print(tLog.INFO+'============================\n') + # ============================ + + # Create Zero Arrays + rhoFlavAll_finalAveragedDiag= np.zeros((noOfSim, 4)); avIndex= 50 + rhoFlavAll_initialDiag= np.zeros((noOfSim, 4)) + rhoFlavAll_initialMat= np.zeros((noOfSim,4,4)) + energySpec= np.zeros((2,noOfSim, 4)) + # ============================ + # Combine all the results + for it_sim in range(1, noOfSim+1): + # ============================ + DATA_DIR = RESULTS_DIR+'simulation'+str(it_sim)+'/data/' + DATA_rhoFlavAll = np.load(DATA_DIR+'rhoFlavAll.npz', allow_pickle=True) + DATA_hamiltonians = np.load(DATA_DIR+'hamiltonians.npz', allow_pickle=True) + if use_defaultMatterProfile: + exit(tLog.ERROR+'use_defaultMatterProfile is True.') + # ============================ + + # ============================ + # Load Variables + E_MeV[it_sim-1]= DATA_rhoFlavAll['E_MeV'] + print(tLog.INFO+ 'Energy='+str(E_MeV[it_sim-1]) +' MeV is starting.') + rhoFlavAll = DATA_rhoFlavAll['rhoFlavAll'] + distAll_km = DATA_rhoFlavAll['distAll_km'] + #hamOsc_km_1= DATA_hamiltonians['hamOsc_km_1'] + hamMat_km_1= DATA_hamiltonians['hamMat_km_1'] + hamEM_km_1 = DATA_hamiltonians['hamEM_km_1'] + hamTot_km_1= DATA_hamiltonians['hamTot_km_1'] + Vcc_km_1= np.real(hamMat_km_1[:,0,0]- hamMat_km_1[:,1,1]) + Vnc_km_1= np.real(hamMat_km_1[:,1,1]) + muB_km_1= hamEM_km_1[:,0,-1] + # ============================ + + # ============================ + ''' + r_resMSWs_km_idx, r_resMSWs_km, adiabaticity_MSW, P_LZ_MSW_tmpArray=\ + mswResonanceVariablesCreate(hierarchy, E_MeV[it_sim-1], distAll_km, deltaMsqr_MeV2, theta, Vcc_km_1, Vnc_km_1, hamTot_km_1) + print(tLog.INFO+ '============================') + r_resSFP_km_idx, r_resSFP_km, adiabaticity_SFP, P_LZ_SFP=\ + sfpResonanceVariables(hierarchy, E_MeV[it_sim-1], distAll_km, deltaMsqr_MeV2, Vcc_km_1, Vnc_km_1, muB_km_1, hamTot_km_1) + print(tLog.INFO+ '============================\n') + ''' + # ============================ + + # ============================ + # Last Elements of rhoFlavAll + #rhoFlavAll_finalDiag[it_sim-1]= np.real(np.diag(rhoFlavAll[-1,0])) + rhoFlavAll_finalAveragedDiag[it_sim-1,0]= np.real(rhoFlavAll[-avIndex:,0,0,0].mean()) + rhoFlavAll_finalAveragedDiag[it_sim-1,1]= np.real(rhoFlavAll[-avIndex:,0,1,1].mean()) + rhoFlavAll_finalAveragedDiag[it_sim-1,2]= np.real(rhoFlavAll[-avIndex:,0,2,2].mean()) + rhoFlavAll_finalAveragedDiag[it_sim-1,3]= np.real(rhoFlavAll[-avIndex:,0,3,3].mean()) + + rhoFlavAll_initialDiag[it_sim-1,0]= np.real(rhoFlavAll[0,0,0,0]) + rhoFlavAll_initialDiag[it_sim-1,1]= np.real(rhoFlavAll[0,0,1,1]) + rhoFlavAll_initialDiag[it_sim-1,2]= np.real(rhoFlavAll[0,0,2,2]) + rhoFlavAll_initialDiag[it_sim-1,3]= np.real(rhoFlavAll[0,0,3,3]) + + rhoFlavAll_initialMat[it_sim-1]= np.real(rhoFlavAll[0,0]) + # ============================ + + # ============================ + # Test Averaged Results For Last + #flavType= 0 + #plt.plot(distAll_km, np.real(rhoFlavAll[:,0,flavType,flavType]), label='rho11') + #plt.plot(distAll_km, rhoFlavAll_finalAveragedDiag[it_sim-1,flavType]* np.ones(len(distAll_km)), label='rho11_Final_Averaged') + #plt.legend() + #plt.show() + #plt.close('all') + # ============================ + + # ============================ + # If Fermi Dirac Distribution is used + # Multiply with trace terms + ''' + # Calculate Constant Term + if totFlav == 2: + if dim_rho_2totFlav_Bool: # TraceTerm = TraceTermb + if DATA_parametersDic['neutrino_distributionParameter'] == 1: + luminosityArray_MeV_km= np.zeros(4); tempArray_MeV= np.zeros(4) + luminosityArray_MeV_km[0]= DATA_parametersDic['luminosity_e']* erg_s_TO_MeV_km + luminosityArray_MeV_km[1]= DATA_parametersDic['luminosity_mu']* erg_s_TO_MeV_km + luminosityArray_MeV_km[2]= DATA_parametersDic['luminosity_eb']* erg_s_TO_MeV_km + luminosityArray_MeV_km[3]= DATA_parametersDic['luminosity_mub']* erg_s_TO_MeV_km + tempArray_MeV[0]= DATA_parametersDic['temperature_e'] + tempArray_MeV[1]= DATA_parametersDic['temperature_mu'] + tempArray_MeV[2]= DATA_parametersDic['temperature_eb'] + tempArray_MeV[3]= DATA_parametersDic['temperature_mub'] + for i3 in range(totFlav*2): + constant= (km_1__MeV**2)*(DATA_parametersDic['TraceTerm'][0] * (1 / (4 * (distAll_km[0]**2) * np.pi**2))* luminosityArray_MeV_km[i3] / (3.1514 * tempArray_MeV[i3])) + rhoFlavAll_initialDiag[it_sim-1,i3] = rhoFlavAll_initialDiag[it_sim-1,i3]/ constant + rhoFlavAll_finalAveragedDiag[it_sim-1,i3]= rhoFlavAll_finalAveragedDiag[it_sim-1,i3]/ constant + print(constant) + input('') + ''' + TraceTerm[it_sim-1]= np.real(DATA_parametersDic['TraceTerm'][0]) + + energySpec[0,it_sim-1,0]= np.real(rhoFlavAll[0,0,0,0])#* TraceTerm[it_sim-1] + energySpec[0,it_sim-1,1]= np.real(rhoFlavAll[0,0,1,1])#* TraceTerm[it_sim-1] + energySpec[0,it_sim-1,2]= np.real(rhoFlavAll[0,0,2,2])#* TraceTerm[it_sim-1] + energySpec[0,it_sim-1,3]= np.real(rhoFlavAll[0,0,3,3])#* TraceTerm[it_sim-1] + + energySpec[1,it_sim-1,0]= np.real(rhoFlavAll[-1,0,0,0])#* TraceTerm[it_sim-1] + energySpec[1,it_sim-1,1]= np.real(rhoFlavAll[-1,0,1,1])#* TraceTerm[it_sim-1] + energySpec[1,it_sim-1,2]= np.real(rhoFlavAll[-1,0,2,2])#* TraceTerm[it_sim-1] + energySpec[1,it_sim-1,3]= np.real(rhoFlavAll[-1,0,3,3])#* TraceTerm[it_sim-1] + + distINIT_km[it_sim-1]= distAll_km[0] + if totFlav == 2: + if dim_rho_2totFlav_Bool: # TraceTerm = TraceTermb + if DATA_parametersDic['neutrino_distributionParameter'] == 1: + luminosityArray_MeV_km= np.zeros(4); tempArray_MeV= np.zeros(4) + luminosityArray_MeV_km[0]= DATA_parametersDic['luminosity_e']* erg_s_TO_MeV_km + luminosityArray_MeV_km[1]= DATA_parametersDic['luminosity_mu']* erg_s_TO_MeV_km + luminosityArray_MeV_km[2]= DATA_parametersDic['luminosity_eb']* erg_s_TO_MeV_km + luminosityArray_MeV_km[3]= DATA_parametersDic['luminosity_mub']* erg_s_TO_MeV_km + tempArray_MeV[0]= DATA_parametersDic['temperature_e'] + tempArray_MeV[1]= DATA_parametersDic['temperature_mu'] + tempArray_MeV[2]= DATA_parametersDic['temperature_eb'] + tempArray_MeV[3]= DATA_parametersDic['temperature_mub'] + + distributionInit_nu_flav= np.zeros((len(E_MeV),totFlav*2, totFlav*2)) + rho= np.zeros((len(E_MeV),totFlav*2, totFlav*2)) + + for i2 in range(len(E_MeV)): + for i3 in range(totFlav*2): + distributionInit_nu_flav[i2, i3, i3]= (1/ (1.803 * (tempArray_MeV[i3]**3)))* (E_MeV[i2]**2) / (1 + np.exp(E_MeV[i2] / tempArray_MeV[i3])) + + rho[i2, i3, i3] = (1/ (4 * (distINIT_km[i2]**2) * np.pi**2))* distributionInit_nu_flav[i2,i3, i3]* luminosityArray_MeV_km[i3] / (3.1514 * tempArray_MeV[i3]) + # TraceTerm => np.trace(rho[i2]) + energySpec[0,i2]= energySpec[0,i2]* np.trace(rho[i2]) + energySpec[1,i2]= energySpec[1,i2]* np.trace(rho[i2]) + ''' + plt.plot(E_MeV, energySpec[0,:,0], label= 'e', linewidth= 3) + plt.plot(E_MeV, rho[:,0,0], label= 'eRho') + plt.plot(E_MeV, energySpec[0,:,1], label= 'mu', linewidth= 3) + plt.plot(E_MeV, rho[:,1,1], label= 'muRho') + plt.plot(E_MeV, energySpec[0,:,2], label= 'eb', linewidth= 3) + plt.plot(E_MeV, rho[:,2,2], label= 'ebRho') + plt.plot(E_MeV, energySpec[0,:,3], label= 'mub', linewidth= 3) + plt.plot(E_MeV, rho[:,3,3], label= 'mubRho') + plt.legend();plt.show();exit('') + ''' + + hold_E= np.zeros(int(noOfSim/3)); hold_energySpec= np.zeros((int(noOfSim/3), 4, 2)) + for it in range(int(noOfSim/3)): + hold_E[it]= E_MeV[it*3] + for it2 in range(4): + hold_energySpec[it,it2]= ([np.min(energySpec[1,it*3:(it+1)*3,it2]), np.max(energySpec[1,it*3:(it+1)*3,it2])]) + + plt.plot(E_MeV, energySpec[0,:,0], color='r', linestyle='dashed', label=r'$\rho_{i,ee}$') + plt.plot(E_MeV, energySpec[0,:,1], color='k', linestyle='dashed', label=r'$\rho_{i,xx}$') + plt.plot(E_MeV, energySpec[0,:,2], color='b', linestyle='dashed', label=r'$\rho_{i,ebeb}$') + plt.plot(E_MeV, energySpec[0,:,3], color='g', linestyle='dashed', label=r'$\rho_{i,xbxb}$') + + plt.scatter(E_MeV, energySpec[1,:,0], color='r', s=1, label=r'$\rho_{ee}$') + plt.scatter(E_MeV, energySpec[1,:,1], color='k', s=1, label=r'$\rho_{xx}$') + plt.scatter(E_MeV, energySpec[1,:,2], color='b', s=1, label=r'$\rho_{ebeb}$') + plt.scatter(E_MeV, energySpec[1,:,3], color='g', s=1, label=r'$\rho_{xbxb}$') + + #plt.fill_between(hold_E, hold_energySpec[:,0,0], hold_energySpec[:,0,1], color='r', alpha=0.6) + #plt.fill_between(hold_E, hold_energySpec[:,1,0], hold_energySpec[:,1,1], color='k', alpha=0.6) + #plt.fill_between(hold_E, hold_energySpec[:,2,0], hold_energySpec[:,2,1], color='b', alpha=0.6) + #plt.fill_between(hold_E, hold_energySpec[:,3,0], hold_energySpec[:,3,1], color='g', alpha=0.6) + plt.legend() + plt.show(); plt.close('all'); exit() + + #plt.plot(E_MeV, energySpec[0,:,0], label='e');plt.show();exit('') + # If Fermi Dirac Distribution is used + if DATA_parametersDic['neutrino_distributionParameter'] == 1: + plt.plot(E_MeV, rhoFlavAll_initialDiag[:,0]* TraceTerm, color='r', linestyle='dashed', label=r'$\rho_{i,ee}$') + plt.plot(E_MeV, rhoFlavAll_initialDiag[:,1]* TraceTerm, color='k', linestyle='dashed', label=r'$\rho_{i,xx}$') + plt.plot(E_MeV, rhoFlavAll_initialDiag[:,2]* TraceTerm, color='b', linestyle='dashed', label=r'$\rho_{i,ebeb}$') + plt.plot(E_MeV, rhoFlavAll_initialDiag[:,3]* TraceTerm, color='g', linestyle='dashed', label=r'$\rho_{i,xbxb}$') + + plt.scatter(E_MeV, rhoFlavAll_finalAveragedDiag[:,0]* TraceTerm, color='r', s=0.3, label=r'$\rho_{ee}$') + plt.scatter(E_MeV, rhoFlavAll_finalAveragedDiag[:,1]* TraceTerm, color='k', s=0.3, label=r'$\rho_{xx}$') + plt.scatter(E_MeV, rhoFlavAll_finalAveragedDiag[:,2]* TraceTerm, color='b', s=0.3, label=r'$\rho_{ebeb}$') + plt.scatter(E_MeV, rhoFlavAll_finalAveragedDiag[:,3]* TraceTerm, color='g', s=0.3, label=r'$\rho_{xbxb}$') + plt.legend() + plt.show() + plt.close() + exit() + + # Scattering Graph + plt.scatter(E_MeV, rhoFlavAll_finalAveragedDiag[:,0], color='k', s=0.3, label=r'$\rho_{ee}$') + plt.legend() + plt.show() + plt.close() + + plt.scatter(E_MeV, rhoFlavAll_finalAveragedDiag[:,1], color='k', s=0.3, label=r'$\rho_{xx}$') + plt.legend() + plt.show() + plt.close() + + plt.scatter(E_MeV, rhoFlavAll_finalAveragedDiag[:,2], color='k', s=0.3, label=r'$\rho_{ebeb}$') + plt.legend() + plt.show() + plt.close() + + plt.scatter(E_MeV, rhoFlavAll_finalAveragedDiag[:,3], color='k', s=0.3, label=r'$\rho_{xbxb}$') + plt.legend() + plt.show() + plt.close() + +if __name__ == '__main__': + analyzeAllResults() diff --git a/scripts/random_ri_magPolDecDist/run_random_ri_magPolDecDist.py b/scripts/random_ri_magPolDecDist/run_random_ri_magPolDecDist.py index 50fd84b..87125fe 100644 --- a/scripts/random_ri_magPolDecDist/run_random_ri_magPolDecDist.py +++ b/scripts/random_ri_magPolDecDist/run_random_ri_magPolDecDist.py @@ -39,29 +39,36 @@ class tLog: parser.add_argument("-i", "--Ei_MeV", help= "Initial Energy", type= float) parser.add_argument("-f", "--Ef_MeV", help= "Final Energy", type= float) parser.add_argument("-m", "--NumberOfMod", help= "Number of Mod", type= int) + parser.add_argument("-b", "--NumberOfMod_EachE", help= "Number of Mod For Each Energy", type= int) # Read arguments from command line args = parser.parse_args() # Check for --Ei_MeV if args.Ei_MeV: Ei_MeV= float(args.Ei_MeV) - print(tLog.INFO+'Initial Energy is ', Ei_MeV, ' MeV.') + print(tLog.INFO+'Initial energy is ', Ei_MeV, ' MeV.') else: - print(tLog.INFO+'Initial Energy is not given. Using default value of 1.0 MeV.') + print(tLog.INFO+'Initial energy is not given. Using default value of 1.0 MeV.') Ei_MeV= 1.0 # Check for --Ef_MeV if args.Ef_MeV: Ef_MeV= float(args.Ef_MeV) - print(tLog.INFO+'Final Energy is ', Ef_MeV, ' MeV.') + print(tLog.INFO+'Final energy is ', Ef_MeV, ' MeV.') else: - print(tLog.INFO+'Final Energy is not given. Using default value of 50.0 MeV.') + print(tLog.INFO+'Final energy is not given. Using default value of 50.0 MeV.') Ef_MeV= 1.0 # Check for --NumberOfMod if args.NumberOfMod: Emod= int(args.NumberOfMod) - print(tLog.INFO+'Number of Energy Mod is ', Emod, '.') + print(tLog.INFO+'Number of energy mod is ', Emod, '.') else: - print(tLog.INFO+'Number of Energy Mod is not given. Using default value of 500.') + print(tLog.INFO+'Number of energy mod is not given. Using default value of 500.') Emod= 500 + if args.NumberOfMod_EachE: + Emod_EachE= int(args.NumberOfMod_EachE) + print(tLog.INFO+'Number of energy mod for each energy is ', Emod_EachE, '.') + else: + print(tLog.INFO+'Number of energy mod for each energy is not given. Using default value of 1.') + Emod= 1 # ============================ # Energies @@ -85,49 +92,52 @@ class tLog: for i1 in range(1, int(Emod)): # Create Energy energy[i1]= float(Ei_MeV) + ((float(Ef_MeV)- float(Ei_MeV))/ (Emod- 1))* i1 - - # Assign Random ri_km and magneticField_polynomialDecayDistance - ri_km[i1]= ri_randStart_km+ 0.1* random.random() - magneticField_polynomialDecayDistance[i1]= 49.95+ 0.1* random.random() # Start Doing The Simulation for it_do in range(Emod): - # ============================ - # Modify New ri_km and magneticField_polynomialDecayDistance in physicalParameters.dat - file= open(COLLECTIVE_NU_OSC_DIR+ 'parameters/physicalParameters.dat', 'r') - fileWrite= open(COLLECTIVE_NU_OSC_DIR+ 'parameters/physicalParameters2.dat', 'w') - for line in file.readlines(): - # Energy - if (line.startswith('numberOf_energyMode')): - line= 'numberOf_energyMode=1 # Valid for only integer\n' - fileWrite.write(line) - elif (line.startswith('energy_initial')): - line= 'energy_initial='+ str(energy[it_do])+ ' # [MeV]\n' - fileWrite.write(line) - elif (line.startswith('energy_final')): - line= 'energy_final='+ str(energy[it_do])+ ' # [MeV]\n' - fileWrite.write(line) - # ri_km - elif (line.startswith('distance_initial')): - line= 'distance_initial='+ str(ri_km[it_do])+ ' # [km]\n' - fileWrite.write(line) - # magneticField_polynomialDecayDistance - elif (line.startswith('magneticField_polynomialDecayDistance')): - line= 'magneticField_polynomialDecayDistance='+ str(magneticField_polynomialDecayDistance[it_do])+ ' # [km] Valid for (use_defaultMagneticProfile=1, magneticField_profile=2)\n' - fileWrite.write(line) - else: - fileWrite.write(line) - file.close() - fileWrite.close() - # Remove and Rename - osCommand.remove(COLLECTIVE_NU_OSC_DIR+ 'parameters/physicalParameters.dat') - osCommand.rename(COLLECTIVE_NU_OSC_DIR+ 'parameters/physicalParameters2.dat', COLLECTIVE_NU_OSC_DIR+ 'parameters/physicalParameters.dat') - # ============================ - osCommand.chdir(COLLECTIVE_NU_OSC_DIR) - #! ============================ - #! WORKS ONLY FOR UNIX SYSTEMS - osCommand.system('python3 '+COLLECTIVE_NU_OSC_DIR+'collNuPy.py') - #! ============================ + for it_do_EachE in range(Emod_EachE): + # ============================ + # Assign Random ri_km and magneticField_polynomialDecayDistance + ri_km= ri_randStart_km+ 0.1* random.random() + magneticField_polynomialDecayDistance= 49.95+ 0.1* random.random() + # ============================ + + # ============================ + # Modify New ri_km and magneticField_polynomialDecayDistance in physicalParameters.dat + file= open(COLLECTIVE_NU_OSC_DIR+ 'parameters/physicalParameters.dat', 'r') + fileWrite= open(COLLECTIVE_NU_OSC_DIR+ 'parameters/physicalParameters2.dat', 'w') + for line in file.readlines(): + # Energy + if (line.startswith('numberOf_energyMode')): + line= 'numberOf_energyMode=1 # Valid for only integer\n' + fileWrite.write(line) + elif (line.startswith('energy_initial')): + line= 'energy_initial='+ str(energy[it_do])+ ' # [MeV]\n' + fileWrite.write(line) + elif (line.startswith('energy_final')): + line= 'energy_final='+ str(energy[it_do])+ ' # [MeV]\n' + fileWrite.write(line) + # ri_km + elif (line.startswith('distance_initial')): + line= 'distance_initial='+ str(ri_km)+ ' # [km]\n' + fileWrite.write(line) + # magneticField_polynomialDecayDistance + elif (line.startswith('magneticField_polynomialDecayDistance')): + line= 'magneticField_polynomialDecayDistance='+ str(magneticField_polynomialDecayDistance)+ ' # [km] Valid for (use_defaultMagneticProfile=1, magneticField_profile=2)\n' + fileWrite.write(line) + else: + fileWrite.write(line) + file.close() + fileWrite.close() + # Remove and Rename + osCommand.remove(COLLECTIVE_NU_OSC_DIR+ 'parameters/physicalParameters.dat') + osCommand.rename(COLLECTIVE_NU_OSC_DIR+ 'parameters/physicalParameters2.dat', COLLECTIVE_NU_OSC_DIR+ 'parameters/physicalParameters.dat') + # ============================ + osCommand.chdir(COLLECTIVE_NU_OSC_DIR) + #! ============================ + #! WORKS ONLY FOR UNIX SYSTEMS + osCommand.system('python3 '+COLLECTIVE_NU_OSC_DIR+'collNuPy.py') + #! ============================ exit() diff --git a/scripts/slurmTRUBA/submitTRUBA_collNuPy.sh b/scripts/slurmTRUBA/submitTRUBA_collNuPy.sh new file mode 100644 index 0000000..774438d --- /dev/null +++ b/scripts/slurmTRUBA/submitTRUBA_collNuPy.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +# Add Python3.6 +module load centos7.3/comp/python/3.6.5-gcc + +# User Name +USR_NAM="ibulmus" +# User Email +USR_EMAIL="taygun.bulmus@msgsu.edu.tr" + +# Simulation Name (Also Job Name) +# if no arguments are given, print usage +if [ $# -eq 0 ]; then + echo "Argument is missing, please give initial energy as first argument." + echo "Usage: $0 " + exit 0 +fi +SIM_NAM=$1 + +# Orjinal Code Directory +ORJ_DIR="/truba/home/${USR_NAM}/collNuPy" +# Code Dir in Scratch +WORK_DIR="/truba_scratch/${USR_NAM}/collNuPy_${SIM_NAM}" + +# Check if a directory does exist. If so, exit +if [ -f "${WORK_DIR}" ]; then + echo "Simulation $WORK_DIR DOES NOT exists." + exit 0 # die with error code 0 +fi + +# Copy collnu Orjinal Code to Job Folder execpt git folder +rsync -av ${ORJ_DIR}/ ${WORK_DIR}/ --exclude .git + +# Change folder to script +cd ${WORK_DIR} + +# slurm file location +SLURM_FILE="${WORK_DIR}/collnu_${SIM_NAM}.slurm" + +echo "#!/bin/bash + +#SBATCH --job-name=${SIM_NAM} # Job name +#SBATCH --partition=single # Partition requested +#SBATCH --account=${USR_NAM} # Charge job to specified account +#SBATCH --ntasks=1 # Number Of Task +#SBATCH --cpus-per-task=1 # Number of cpus required per task +#SBATCH --time=15-00:00:00 # Time limit, MANDATORY (Format:days-hours:minutes:seconds). +#SBATCH --workdir=${WORK_DIR} +#SBATCH --output=output.log # Output File Name +#SBATCH --error=errors.log # Error File Name +#SBATCH --qos=normal # Quality of service +#SBATCH --mail-type=ALL # Mail events (NONE, BEGIN, END, FAIL, ALL) +#SBATCH --mail-user=${USR_EMAIL} # Where to send mail +#SBATCH --no-requeue # Not continue, Required for non-resumable codes. + +echo '======================================================' +echo HOST : \$SLURM_SUBMIT_HOST +echo JOB ID : \$SLURM_JOB_ID +echo JOB NAME : \$SLURM_SIM_NAME +echo NODE LIST : \$SLURM_NODELIST +echo '======================================================' + +# Python Script +cd ${WORK_DIR} + +# Run the main code +python3.6 collNuPy.py + +# Time limit for levrek cluster +# Kuyruklar (Partitions) +# Partition Node Cekirdek Is Suresi Sunucular +# single 38 5x16 15-00:00:00 levrek[2-12,102-128] +# short 38 10x16 0-4:00:00 levrek[2-12,102-128] +# mid1 38 20x16 4-00:00:00 levrek[2-12,102-128] +# mid2 38 20x16 8-00:00:00 levrek[2-12,102-128] +# long 38 50x16 15-00:00:00 levrek[2-12,102-128] +# Minimum amount of real memory +# #SBATCH --mem=12000 +# Maximum amount of real memory per allocated cpu required by the job +# #SBATCH --mem-per-cpu=100 + +" > $SLURM_FILE + +# Run the code +sbatch $SLURM_FILE + +# Create Backup at Home +cp -r ${WORK_DIR} ${HOME} \ No newline at end of file diff --git a/scripts/slurmTRUBA/submitTRUBA_run_random_ri_magPolDecDist.sh b/scripts/slurmTRUBA/submitTRUBA_run_random_ri_magPolDecDist.sh new file mode 100644 index 0000000..f57aa9d --- /dev/null +++ b/scripts/slurmTRUBA/submitTRUBA_run_random_ri_magPolDecDist.sh @@ -0,0 +1,126 @@ +#!/bin/bash + +# Add Python3.6 +module load centos7.3/comp/python/3.6.5-gcc + +# User Name +USR_NAM="ibulmus" +# User Email +USR_EMAIL="taygun.bulmus@msgsu.edu.tr" + +# ---------------------------- +# Argument Check +SIM_NAM=$1 +# if no arguments are given, print usage +if [ $# -eq 0 ]; then + echo "Argument is missing, please give initial energy as first argument." + echo "Usage: $0 " + exit 0 +fi + +# Second Argument is Initial Energy, Ei_MeV +Ei_MeV=$2 +# If $2 is missing, exit +if [ -z "$Ei_MeV" ]; then + echo "Argument is missing, please give initial energy as second argument." + echo "Usage: $0 " + exit 0 +fi + +# Third Argument is Final Energy, Ef_MeV +Ef_MeV=$3 +# If $3 is missing, exit +if [ -z "$Ef_MeV" ]; then + echo "Argument is missing, please give final energy as third argument." + echo "Usage: $0 " + exit 0 +fi + +# Fourth Argument is Number of Energy Points or Energy Bin Emod +Emod=$4 +# If $4 is missing, exit +if [ -z "$Emod" ]; then + echo "Argument is missing, please give number of energy points as fourth argument." + echo "Usage: $0 " + exit 0 +fi + +# Fifth Argument is Number of energy mod for each energy Emod_EachE +Emod_EachE=$5 +# If $5 is missing, exit +if [ -z "$Emod_EachE" ]; then + echo "Argument is missing, please give number of energy mod for each energy as fifth argument." + echo "Usage: $0 " + exit 0 +fi +# ---------------------------- + +# Orjinal Code Directory +ORJ_DIR="/truba/home/${USR_NAM}/collNuPy" +# Code Dir in Scratch +WORK_DIR="/truba_scratch/${USR_NAM}/collNuPy_${SIM_NAM}" + +# Check if a directory does exist. If so, exit +if [ -f "${WORK_DIR}" ]; then + echo "Simulation $WORK_DIR DOES NOT exists." + exit 0 # die with error code 0 +fi + +# Copy collnu Orjinal Code to Job Folder execpt git folder +rsync -av ${ORJ_DIR}/ ${WORK_DIR}/ --exclude .git + +# Change folder to script +cd ${WORK_DIR} + +# slurm file location +SLURM_FILE="${WORK_DIR}/collnu_${SIM_NAM}.slurm" + +echo "#!/bin/bash + +#SBATCH --job-name=${SIM_NAM} # Job name +#SBATCH --partition=single # Partition requested +#SBATCH --account=${USR_NAM} # Charge job to specified account +#SBATCH --ntasks=1 # Number Of Task +#SBATCH --cpus-per-task=1 # Number of cpus required per task +#SBATCH --time=15-00:00:00 # Time limit, MANDATORY (Format:days-hours:minutes:seconds). +#SBATCH --workdir=${WORK_DIR} +#SBATCH --output=output.log # Output File Name +#SBATCH --error=errors.log # Error File Name +#SBATCH --qos=normal # Quality of service +#SBATCH --mail-type=ALL # Mail events (NONE, BEGIN, END, FAIL, ALL) +#SBATCH --mail-user=${USR_EMAIL} # Where to send mail +#SBATCH --no-requeue # Not continue, Required for non-resumable codes. + +echo '======================================================' +echo HOST : \$SLURM_SUBMIT_HOST +echo JOB ID : \$SLURM_JOB_ID +echo JOB NAME : \$SLURM_SIM_NAME +echo NODE LIST : \$SLURM_NODELIST +echo '======================================================' + +# Go Python Script +cd ${WORK_DIR}/scripts/random_ri_magPolDecDist/ + +# Run code +python3.6 run_random_ri_magPolDecDist.py -i ${Ei_MeV} -f ${Ef_MeV} -m ${Emod} -b ${Emod_EachE} + +# Time limit for levrek cluster +# Kuyruklar (Partitions) +# Partition Node Cekirdek Is Suresi Sunucular +# single 38 5x16 15-00:00:00 levrek[2-12,102-128] +# short 38 10x16 0-4:00:00 levrek[2-12,102-128] +# mid1 38 20x16 4-00:00:00 levrek[2-12,102-128] +# mid2 38 20x16 8-00:00:00 levrek[2-12,102-128] +# long 38 50x16 15-00:00:00 levrek[2-12,102-128] +# Minimum amount of real memory +# #SBATCH --mem=12000 +# Maximum amount of real memory per allocated cpu required by the job +# #SBATCH --mem-per-cpu=100 + +" > $SLURM_FILE + +# Run the code +sbatch $SLURM_FILE + +# Create Backup at Home +cp -r ${WORK_DIR} ${HOME} diff --git a/scripts/tryChangeNames_SimulationNumber.py b/scripts/tryChangeNames_SimulationNumber.py new file mode 100644 index 0000000..0745d9f --- /dev/null +++ b/scripts/tryChangeNames_SimulationNumber.py @@ -0,0 +1,100 @@ +# import OS module +import os as osCommand +import shutil + +def listOfFoldersInDirectory(path): + return [f for f in osCommand.listdir(path) if osCommand.path.isdir(osCommand.path.join(path, f))] +if __name__ == '__main__': + # Current directory + currentDir = osCommand.getcwd() + for it_sim in listOfFoldersInDirectory(currentDir): + if 'E6_11' in it_sim: # Second 30 Simulation + resultsFolder= it_sim+'/results' + resultsFolder_inside = listOfFoldersInDirectory(resultsFolder) + # Sort the list + resultsFolder_inside.sort(key=lambda x: int(x.split('simulation')[-1])) + + # Remove simulation1, simulation2 and simulation3 folders + for it in resultsFolder_inside[0:3]: + shutil.rmtree(resultsFolder+'/'+it) + # Remove simulation1, simulation2 and simulation3 from the list + resultsFolder_inside = resultsFolder_inside[3:] + + for it_sim_inside in resultsFolder_inside: + # Rename the folder + osCommand.rename(resultsFolder+'/'+it_sim_inside,resultsFolder+'/simulation'+str(int(it_sim_inside.split('simulation')[-1])+87)) + elif 'E11_17' in it_sim: # Third 30 Simulation + resultsFolder= it_sim+'/results' + resultsFolder_inside = listOfFoldersInDirectory(resultsFolder) + # Sort the list + resultsFolder_inside.sort(key=lambda x: int(x.split('simulation')[-1])) + + # Remove simulation1, simulation2 and simulation3 folders + for it in resultsFolder_inside[0:3]: + shutil.rmtree(resultsFolder+'/'+it) + # Remove simulation1, simulation2 and simulation3 from the list + resultsFolder_inside = resultsFolder_inside[3:] + + for it_sim_inside in resultsFolder_inside: + # Rename the folder + osCommand.rename(resultsFolder+'/'+it_sim_inside,resultsFolder+'/simulation'+str(int(it_sim_inside.split('simulation')[-1])+174)) + elif 'E17_23' in it_sim: # Fourth 30 Simulation + resultsFolder= it_sim+'/results' + resultsFolder_inside = listOfFoldersInDirectory(resultsFolder) + # Sort the list + resultsFolder_inside.sort(key=lambda x: int(x.split('simulation')[-1])) + # Remove simulation1, simulation2 and simulation3 folders + for it in resultsFolder_inside[0:3]: + shutil.rmtree(resultsFolder+'/'+it) + # Remove simulation1, simulation2 and simulation3 from the list + resultsFolder_inside = resultsFolder_inside[3:] + + for it_sim_inside in resultsFolder_inside: + # Rename the folder + osCommand.rename(resultsFolder+'/'+it_sim_inside,resultsFolder+'/simulation'+str(int(it_sim_inside.split('simulation')[-1])+261)) + elif 'E23_29' in it_sim: # Fifth 30 Simulation + resultsFolder= it_sim+'/results' + resultsFolder_inside = listOfFoldersInDirectory(resultsFolder) + # Sort the list + resultsFolder_inside.sort(key=lambda x: int(x.split('simulation')[-1])) + + # Remove simulation1, simulation2 and simulation3 folders + for it in resultsFolder_inside[0:3]: + shutil.rmtree(resultsFolder+'/'+it) + # Remove simulation1, simulation2 and simulation3 from the list + resultsFolder_inside = resultsFolder_inside[3:] + + for it_sim_inside in resultsFolder_inside: + # Rename the folder + osCommand.rename(resultsFolder+'/'+it_sim_inside,resultsFolder+'/simulation'+str(int(it_sim_inside.split('simulation')[-1])+348)) + elif 'E29_35' in it_sim: # Sixth 30 Simulation + resultsFolder= it_sim+'/results' + resultsFolder_inside = listOfFoldersInDirectory(resultsFolder) + # Sort the list + resultsFolder_inside.sort(key=lambda x: int(x.split('simulation')[-1])) + + # Remove simulation1, simulation2 and simulation3 folders + for it in resultsFolder_inside[0:3]: + shutil.rmtree(resultsFolder+'/'+it) + # Remove simulation1, simulation2 and simulation3 from the list + resultsFolder_inside = resultsFolder_inside[3:] + + for it_sim_inside in resultsFolder_inside: + # Rename the folder + osCommand.rename(resultsFolder+'/'+it_sim_inside,resultsFolder+'/simulation'+str(int(it_sim_inside.split('simulation')[-1])+435)) + elif 'E35_41' in it_sim: # Seventh 30 Simulation + resultsFolder= it_sim+'/results' + resultsFolder_inside = listOfFoldersInDirectory(resultsFolder) + # Sort the list + resultsFolder_inside.sort(key=lambda x: int(x.split('simulation')[-1])) + + # Remove simulation1, simulation2 and simulation3 folders + for it in resultsFolder_inside[0:3]: + shutil.rmtree(resultsFolder+'/'+it) + # Remove simulation1, simulation2 and simulation3 from the list + resultsFolder_inside = resultsFolder_inside[3:] + + for it_sim_inside in resultsFolder_inside: + # Rename the folder + osCommand.rename(resultsFolder+'/'+it_sim_inside,resultsFolder+'/simulation'+str(int(it_sim_inside.split('simulation')[-1])+522)) + \ No newline at end of file