-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
543a0ba
commit 1aa8ab8
Showing
7 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import sys | ||
from pyoperators import * | ||
from FMM.pipeline import PipelineEnd2End | ||
from CMM.pipeline import Pipeline | ||
|
||
|
||
simu = 'CMM' | ||
|
||
if __name__ == "__main__": | ||
|
||
### Common MPI arguments | ||
comm = MPI.COMM_WORLD | ||
|
||
|
||
if simu == 'FMM': | ||
|
||
try: | ||
file = str(sys.argv[1]) | ||
except IndexError: | ||
file = None | ||
|
||
### Initialization | ||
pipeline = PipelineEnd2End(comm) | ||
|
||
### Execution | ||
pipeline.main(specific_file=file) | ||
|
||
elif simu == 'CMM': | ||
|
||
seed_noise = int(sys.argv[1]) | ||
|
||
### Initialization | ||
pipeline = Pipeline(comm, 1, seed_noise) | ||
|
||
### Execution | ||
pipeline.main() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import sys | ||
|
||
from pyoperators import * | ||
|
||
from CMM.pipeline import Pipeline | ||
|
||
seed_noise = int(sys.argv[1]) | ||
|
||
### MPI common arguments | ||
comm = MPI.COMM_WORLD | ||
|
||
if __name__ == "__main__": | ||
|
||
pipeline = Pipeline(comm, 1, seed_noise) | ||
|
||
pipeline.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
#SBATCH --job-name=FMM | ||
|
||
# we ask for n MPI tasks with N cores each on c nodes | ||
|
||
#SBATCH --partition=htc | ||
#SBATCH --nodes=1 # c | ||
#SBATCH --ntasks-per-node=1 # n | ||
#SBATCH --cpus-per-task=4 # N | ||
#SBATCH --mem=60G | ||
#SBATCH --time=3-00:00:00 | ||
#SBATCH --output=mulitple_jobs_%j.log | ||
#SBATCH --array=1-500 | ||
|
||
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK} | ||
|
||
module load mpich | ||
|
||
mpirun -np $SLURM_NTASKS python run_cmm.py $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import os | ||
|
||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from multiprocess import Pool | ||
from pyoperators import MPI | ||
from schwimmbad import MPIPool | ||
|
||
from lib.Qfit import FitEllSpace | ||
from lib.Qfoldertools import MergeAllFiles | ||
from lib.Qspectra_component import SkySpectra | ||
|
||
comm = MPI.COMM_WORLD | ||
|
||
### Concatenate all realizations | ||
files = MergeAllFiles( | ||
"/Users/mregnier/Desktop/git/Pipeline/src/FMM/CMBDUST_nrec2_new_code/spectrum/" | ||
) | ||
|
||
nus_index = np.array([True, True, False, False, False, False, False, False, True]) | ||
NBINS = 16 | ||
|
||
ell = files._reads_one_file(0, "ell")[:NBINS] | ||
nus = files._reads_one_file(0, "nus")[nus_index] | ||
|
||
BBsignal = np.mean(files._reads_all_files("Dls"), axis=0)[:, nus_index, :NBINS][ | ||
nus_index, :, :NBINS | ||
] | ||
BBnoise = files._reads_all_files("Nl")[:, :, nus_index, :NBINS][:, nus_index, :, :NBINS] | ||
BBsignal -= np.mean(BBnoise, axis=0) | ||
|
||
sky = SkySpectra(ell, nus) | ||
fit = FitEllSpace(ell, BBsignal, BBnoise, model=sky.model) | ||
|
||
samples, samples_flat = fit.run(300, 10, discard=200, comm=comm) | ||
|
||
plt.figure() | ||
plt.plot(samples[..., 0], "-k", alpha=0.1) | ||
plt.axhline(0) | ||
plt.show() | ||
|
||
print() | ||
print(f"Average : {np.mean(samples_flat, axis=0)}") | ||
print(f"Error : {np.std(samples_flat, axis=0)}") | ||
print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import sys | ||
from pyoperators import * | ||
|
||
from ..FMM.pipeline import PipelineEnd2End | ||
#from .FMM.pipeline import PipelineEnd2End | ||
|
||
|
||
stop | ||
try: | ||
file = str(sys.argv[1]) | ||
except IndexError: | ||
file = None | ||
|
||
if __name__ == "__main__": | ||
|
||
### Common MPI arguments | ||
comm = MPI.COMM_WORLD | ||
|
||
### Initialization | ||
pipeline = PipelineEnd2End(comm) | ||
|
||
### Execution | ||
pipeline.main(specific_file=file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
#SBATCH --job-name=FMM | ||
|
||
# we ask for n MPI tasks with N cores each on c nodes | ||
|
||
#SBATCH --partition=htc | ||
#SBATCH --nodes=1 # c | ||
#SBATCH --ntasks-per-node=1 # n | ||
#SBATCH --cpus-per-task=4 # N | ||
#SBATCH --mem=60G | ||
#SBATCH --time=3-00:00:00 | ||
#SBATCH --output=mulitple_jobs_%j.log | ||
#SBATCH --array=1-500 | ||
|
||
export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK} | ||
|
||
module load mpich | ||
|
||
mpirun -np $SLURM_NTASKS python src/run_fmm.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from CMM.spectrum.get_spectra import Spectra |