Mohammadreza Hadizadeh

Importing colormaps from python (matplotlib) into Matlab on Macbook

This post shows step-by-step instructions on importing different classes of colormaps from python (Matplotlib) into Matlab using PyColormap4Matlab.
  1. Download the PyColormap4Matlab library from the following link: https://www.mathworks.com/matlabcentral/fileexchange/68239-pycolormap4matlab
  2. Rename the package to PyColormap4Matlab,
  3. Copy & paste the new folder in your Documents as /Documents/MATLAB/PyColormap4Matlab,
  4. Open the MATLAB application and link the new folder PyColormap4Matlab to it using the "Home > Set Path" tab in the top menu. Next, click "Add Folder" and select /Documents/MATLAB/PyColormap4Matlab, then click on Open, Save, and Close.
  5. Install the “Matplotlib" library. To do so, enter the command "pip3 install matplotlib" in the terminal. For other options, check https://www.geeksforgeeks.org/how-to-install-matplotlib-on-macos/
  6. Now, you can import the colormaps from Matplotlib to MATLAB. The following MATLAB script imports the colormap Greys from Matplotlib to MATLAB. The name of the new colormap in MATLAB is cl_Greys:
  • # set the Python path
  • path_python = '/usr/bin/python3';
  • # importing Greys colormap from Matplotlib
  • cl_Greys = getPyPlot_cMap('Greys', [], [], path_python);
  • Hint: to find the Python path (for variable "path_python") enter the "which python3" command in the terminal.

Matplotlib1
Matplotlib2
Matplotlib3
Matplotlib4
Matplotlib5
Matplotlib6
Matlab


Obituary for Shahriar Bayegan

Shahriar Bayeganhttp://www.phy.ohio.edu/~hadizade/Bayegan.html

Hadizadeh, M.R., Radin, M., Moeini Arani, M.
et al.
Obituary for Shahriar Bayegan.
Few-Body Syst. 62, 74 (2021).
https://doi.org/10.1007/s00601-021-01644-x


Set up CSU email on Apple Mail (Mac)


After setting up your Office 365 email account, you can add your email address to Apple Mail on your Mac. Then you can send and receive business emails from your phone. Alternatively, you can download Outlook 2016 and add your Office 365 email.

  • Open Apple Mail and click Mail.
  • Click Add Account.
  • Select Exchange and click Continue.

1

  • Enter your name, CSU email address and password.

2

  • Click Sign In.
  • Click Done (you can come back and edit these settings at any point).
  • If Microsoft cannot verify your account, you will be asked to enter your details manually:
Email Address: your CSU email address
User Name: your CSU email address
Password: your CSU email password
Internal URL: outlook.office365.com
External URL: outlook.office365.com
Domain: leave blank

3

  • Click Sign In, your account will display and emails will start to load, this can take a few minutes. Test your Apple Mail by sending yourself an email from your Office 365 web portal and responding to it from Apple Mail.

4

Source: GoDaddy Help

How to Allow Apps from Anywhere in macOS Gatekeeper

allow_apps_anywhere_macos
  1. Quit out of System Preferences
  2. Open the Terminal app from the /Applications/Utilities/ folder and then enter the following command syntax: sudo spctl --master-disable
  3. Hit return and authenticate with an admin password
  4. Relaunch System Preferences and go to “Security & Privacy” and the “General” tab. You will now see the "Anywhere" option under "Allow apps downloaded from:".

How to run multiple programs in a sequence using a bash script?

How to write a bash script that goes through each subdirectory inside a parent_directory and executes a command in each subdirectory?

Suppose there are 10 subdirectories inside a parent_directory with the following structure:

***parent_directory (name could be anything - doesn't follow a pattern)

— subdir1 (subdirectory names follow a specific pattern, e.g. fixed characters + number)
input.data (input of the code)
code.f (main code, here is a Fortran code)
Makefile (makefile to execute and run the code)
— subdir2
input files + codes + Makefile
— subdir3
input files + codes + Makefile
.
.
.
— subdir10

Suppose we want to run the codes in the first five subdirectories, i.e. subdir1-subdir5, wait for the processes to finish and then continue running the codes in the next five subdirectories, i.e. subdir6-subdir10.

The example of the bash script is as (
download the bash script file ):

#!/bin/bash
## exit on the first error.
set -e

# Add the full path of parent_directory to run the codes in the subdirectories
path=$(pwd)
## just for checking the path of the parent_directory
echo path= $path

## the min and the max values of the int variable i, changing from 1 to 5
i=1
imax=5

## do loop from i to imax
while [ $i -le $imax ]; do
## path of each subdirectory defined as "subdir" + integer i
pathi=$path/subdir$i
## just for checking the path of each subdirectory
echo pathi= $pathi
## cd to each subdirectory of the loop
cd $pathi
## compile and run the code in each subdirectory using Makefile ("Main" is the executable file)
make -f Makefile
nohup ./Main &
## adding the counter
let i=i+1
done

## Wait for the processes to finish
wait

i=6
imax=10

## do loop from i to imax
while [ $i -le $imax ]; do
## path of each subdirectory defined as "subdir" + integer i
pathi=$path/subdir$i
## just for checking the path of each subdirectory using Makefile ("Main" is the executable file)
echo pathi= $pathi
## cd to each subdirectory of the loop
cd $pathi
## compile and run the code in each subdirectory
make -f Makefile
nohup ./Main &
## adding the counter
let i=i+1
done

You can run the bash script (called "run.sh") by:
$ bash run.sh