mirror of
https://github.com/Findus23/halo_comparison.git
synced 2024-09-19 16:03:50 +02:00
Merge branch 'main' of github.com:Findus23/halo_comparison
This commit is contained in:
commit
a372db4284
1 changed files with 19 additions and 6 deletions
|
@ -11,16 +11,21 @@ from paths import base_dir, spectra_dir
|
|||
|
||||
|
||||
def run_spectra(waveform: str, resolution_1: int, resolution_2: int, Lbox: int, time: str):
|
||||
|
||||
print("starting")
|
||||
setup_1 = f'{waveform}_{resolution_1}_{Lbox}'
|
||||
setup_2 = f'{waveform}_{resolution_2}_{Lbox}'
|
||||
|
||||
# #For ICs: time == 'ics'
|
||||
if time == 'ics':
|
||||
output_file = base_dir / f'spectra/{waveform}_{Lbox}/{waveform}_{Lbox}_ics_{resolution_1}_{resolution_2}_cross_spectrum.txt'
|
||||
if output_file.exists():
|
||||
print(f'{output_file} already exists, skipping.')
|
||||
return
|
||||
subprocess.run([
|
||||
str(spectra),
|
||||
'--ngrid',
|
||||
'1024',
|
||||
'2048',
|
||||
'--format=4', # This seems to work, but is not as readable
|
||||
'--output',
|
||||
str(base_dir / f'spectra/{waveform}_{Lbox}/{waveform}_{Lbox}_ics_{resolution_1}_{resolution_2}'),
|
||||
|
@ -30,8 +35,12 @@ def run_spectra(waveform: str, resolution_1: int, resolution_2: int, Lbox: int,
|
|||
str(base_dir / f'{setup_2}/ics_{setup_2}.hdf5')
|
||||
], check=True)
|
||||
|
||||
# #For evaluation of results at redshift z=1: time == 'z=1'
|
||||
# #For evaluation of results at redshift z=1: time == 'z=1' | NOT ADAPTED FOR VSC5 YET!
|
||||
elif time == 'z=1':
|
||||
output_file = base_dir / f'spectra/{waveform}_{Lbox}/{waveform}_{Lbox}_a2_{resolution_1}_{resolution_2}_cross_spectrum.txt'
|
||||
if output_file.exists():
|
||||
print(f'{output_file} already exists, skipping.')
|
||||
return
|
||||
subprocess.run([
|
||||
str(spectra),
|
||||
'--ngrid',
|
||||
|
@ -47,10 +56,14 @@ def run_spectra(waveform: str, resolution_1: int, resolution_2: int, Lbox: int,
|
|||
|
||||
# #For evaluation of final results: time == 'end'
|
||||
elif time == 'end':
|
||||
output_file = base_dir / f'spectra/{waveform}_{Lbox}/{waveform}_{Lbox}_a4_{resolution_1}_{resolution_2}_cross_spectrum.txt'
|
||||
if output_file.exists():
|
||||
print(f'{output_file} already exists, skipping.')
|
||||
return
|
||||
subprocess.run([
|
||||
str(spectra),
|
||||
'--ngrid',
|
||||
'1024',
|
||||
'2048',
|
||||
'--format=3',
|
||||
'--output',
|
||||
str(base_dir / f'spectra/{waveform}_{Lbox}/{waveform}_{Lbox}_a4_{resolution_1}_{resolution_2}'),
|
||||
|
@ -93,9 +106,9 @@ def cross_run(waveforms: list, resolutions: list, Lbox: int, time: str):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
input("are you sure you want to run this? This might need a large amount of memory")
|
||||
# input("are you sure you want to run this? This might need a large amount of memory")
|
||||
Lbox = 100
|
||||
resolutions = [128, 256, 512]
|
||||
resolutions = [128, 256, 512, 1024]
|
||||
waveforms = ["DB2", "DB4", "DB8", "shannon"]
|
||||
|
||||
spectra = spectra_dir / 'spectra'
|
||||
|
@ -108,5 +121,5 @@ if __name__ == '__main__':
|
|||
args = cross_run(waveforms=waveforms, resolutions=resolutions, Lbox=Lbox, time=time)
|
||||
else:
|
||||
raise ValueError("missing argv[2] (power|cross)")
|
||||
with Pool(processes=3) as p:
|
||||
with Pool(processes=1) as p:
|
||||
p.starmap(run_spectra, args)
|
||||
|
|
Loading…
Reference in a new issue