๐Ÿ”ง UTILS#

๐Ÿ’ก TIPS #

  • Install python and pip3

  • If you are new to python and jupyter notebooks check this references:

  • If you need to take data you may find useful our following repositories:

  • To update the repository you have cloned you can run the following commands in a terminal:

    git status                         # Changes in your files. You can choose to add them (commit them) or ignore them (checkout)
    git fetch                          # Updates the working tree with the repository in GitHub
    git pull                           # Dowloads the updates to your local copy
    git checkout -b <your_branch_name> # Creates a new branch
    

    More commands and info in the web (git-cheat_sheet)

Mounting/umounting a /pnfs/ or /pc/ folder in your local computer (from macros folder)#

โ˜ ๏ธโ˜ ๏ธ DANGERโ˜ ๏ธโ˜ ๏ธ

DO NOT RUN THIS COMMANDS IF YOU DO NOT KNOW WHAT THEY DO โ€“> you could delete data accidentally

sshfs USER@pcaeXYZ.ciemat.es:/pnfs/ciemat.es/data/neutrinos/your_folder ../data
sshfs pcaeXYZ:/pc/choozdsk01/palomare/SCINT/ ../data

sudo umount ../data
fusermount -u data/ # If sudo not available, use fusermount

Setup ROOT environment#

source /cvmfs/sft.cern.ch/lcg/app/releases/ROOT/6.24.08/x86_64-centos7-gcc48-opt/bin/thisroot.sh 

Changing permissions on files#

sudo sshfs -o allow_other USER@pcaeXYZ.ciemat.es:/pnfs/ciemat.es/data/neutrinos/your_folder ../data
chmod o=rwx */*.npz
chmod -R ugo=+rwx folder #POWERFUL: everything in the folder will have all permissions for everyone

Transform the npx files to another format#

import numpy as np
data = np.load(filename)
for key, value in data.items(): np.savetxt("somepath" + key + ".csv", value)

Optionals#

  • Specify correct Python version when creating virtual environment

    python -m venv venv
    
  • Activate on Unix or MacOS

    source venv/bin/activate
    
  • Deactivate virtual environment

    deactivate
    
  • Activate on Windows (cmd.exe)

    venv\Scripts\activate.bat
    
  • Activate on Windows (PowerShell)

    venv\Scripts\Activate.ps1
    
  • Install the modules in your requirements.txt file (optional)

    pip install -r requirements.txt
    
  • Update your requirements.txt file

    pip freeze > requirements.txt
    
  • Remove the old virtual environment folder: macOS and Linux

    rm -rf venv
    
  • Remove the old virtual environment folder: Windows

    rd /s /q "venv"