Follow these steps to convert all .pkl files in the cosmopower-organization directory to .npz format using the provided Python and shell scripts.
-
Download the Python Script: Save the
convert_pkl2npz.pyscript in the root directory. -
Download the Shell Script: Save the
convert_all_pkl2npz.shscript in the same directory. -
Make the Python Script Executable: Run the following command in the terminal:
chmod +x convert_pkl2npz.py
-
Make the Shell Script Executable: Run the following command in the terminal:
chmod +x convert_all_pkl2npz.sh
-
Run the Shell Script: Execute the shell script to process all
.pklfiles in thecosmopower-organizationdirectory:./convert_all_pkl2npz.sh
This will automatically convert all .pkl files to .npz files. Note that for the TE models, the script will apply PCA as specified.
Note that the error message:
ModuleNotFoundError: No module named 'tensorflow.python.training.tracking'
may appear if a tensorflow verion >2.14 is loaded in your environment. In this case, make sure you execute this script in an environment withour tensorflow.