#-------------------------------------------------------------------------------
#  [1] Python3 initialization:
#
#      Follow "MacStdUser-ReadMeFirst.txt" to set up the OS-standard Python3.
#-------------------------------------------------------------------------------
Monterey1{kazzz-s} ~ (1)% which python3
/usr/bin/python3

Monterey1{kazzz-s} ~ (2)% python3 --version
Python 3.9.6


#-------------------------------------------------------------------------------
#  [2] Installation process of different Python modules using 'pip':
#      Let's install [pandas, scipy, matplotlib], for example.
#-------------------------------------------------------------------------------
Monterey1{kazzz-s} ~ (3)% python3 -m pip list
                          ^^^^^^^^^^^^^^^^^^^
Package    Version
---------- -------
altgraph   0.17.2
future     0.18.2
macholib   1.15.2
pip        21.2.4
setuptools 58.0.4
six        1.15.0
wheel      0.37.0
WARNING: You are using pip version 21.2.4; however, version 24.0 is available.
You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command.

Monterey1{kazzz-s} ~ (4)% sudo python3 -m pip install pandas scipy matplotlib
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Password:
WARNING: The directory '/Users/kazzz-s/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting pandas
  Downloading pandas-2.2.0-cp39-cp39-macosx_10_9_x86_64.whl (12.5 MB)
     |████████████████████████████████| 12.5 MB 6.1 MB/s
Collecting scipy
  Downloading scipy-1.12.0-cp39-cp39-macosx_10_9_x86_64.whl (38.9 MB)
     |████████████████████████████████| 38.9 MB 3.5 MB/s
Collecting matplotlib
  Downloading matplotlib-3.8.3-cp39-cp39-macosx_10_12_x86_64.whl (7.6 MB)
     |████████████████████████████████| 7.6 MB 6.0 MB/s
Collecting numpy<2,>=1.22.4
  Downloading numpy-1.26.4-cp39-cp39-macosx_10_9_x86_64.whl (20.6 MB)
     |████████████████████████████████| 20.6 MB 9.4 MB/s
Collecting pytz>=2020.1
  Downloading pytz-2024.1-py2.py3-none-any.whl (505 kB)
     |████████████████████████████████| 505 kB 7.5 MB/s
Collecting python-dateutil>=2.8.2
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     |████████████████████████████████| 247 kB 5.4 MB/s
Collecting tzdata>=2022.7
  Downloading tzdata-2024.1-py2.py3-none-any.whl (345 kB)
     |████████████████████████████████| 345 kB 4.6 MB/s
Collecting packaging>=20.0
  Downloading packaging-23.2-py3-none-any.whl (53 kB)
     |████████████████████████████████| 53 kB 9.7 MB/s
Collecting fonttools>=4.22.0
  Downloading fonttools-4.49.0-cp39-cp39-macosx_10_9_x86_64.whl (2.3 MB)
     |████████████████████████████████| 2.3 MB 5.6 MB/s
Collecting importlib-resources>=3.2.0
  Downloading importlib_resources-6.1.1-py3-none-any.whl (33 kB)
Collecting pillow>=8
  Downloading pillow-10.2.0-cp39-cp39-macosx_10_10_x86_64.whl (3.5 MB)
     |████████████████████████████████| 3.5 MB 4.3 MB/s
Collecting cycler>=0.10
  Downloading cycler-0.12.1-py3-none-any.whl (8.3 kB)
Collecting pyparsing>=2.3.1
  Downloading pyparsing-3.1.1-py3-none-any.whl (103 kB)
     |████████████████████████████████| 103 kB 6.4 MB/s
Collecting kiwisolver>=1.3.1
  Downloading kiwisolver-1.4.5-cp39-cp39-macosx_10_9_x86_64.whl (68 kB)
     |████████████████████████████████| 68 kB 13.3 MB/s
Collecting contourpy>=1.0.1
  Downloading contourpy-1.2.0-cp39-cp39-macosx_10_9_x86_64.whl (257 kB)
     |████████████████████████████████| 257 kB 7.1 MB/s
Collecting zipp>=3.1.0
  Downloading zipp-3.17.0-py3-none-any.whl (7.4 kB)
Requirement already satisfied: six>=1.5 in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages (from python-dateutil>=2.8.2->pandas) (1.15.0)
Installing collected packages: zipp, numpy, tzdata, pytz, python-dateutil, pyparsing, pillow, packaging, kiwisolver, importlib-resources, fonttools, cycler, contourpy, scipy, pandas, matplotlib
Successfully installed contourpy-1.2.0 cycler-0.12.1 fonttools-4.49.0 importlib-resources-6.1.1 kiwisolver-1.4.5 matplotlib-3.8.3 numpy-1.26.4 packaging-23.2 pandas-2.2.0 pillow-10.2.0 pyparsing-3.1.1 python-dateutil-2.8.2 pytz-2024.1 scipy-1.12.0 tzdata-2024.1 zipp-3.17.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 24.0 is available.
You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command.

Monterey1{kazzz-s} ~ (5)% python3 -m pip list
                          ^^^^^^^^^^^^^^^^^^^
Package             Version
------------------- -------
altgraph            0.17.2
contourpy           1.2.0
cycler              0.12.1
fonttools           4.49.0
future              0.18.2
importlib-resources 6.1.1
kiwisolver          1.4.5
macholib            1.15.2
matplotlib          3.8.3
numpy               1.26.4
packaging           23.2
pandas              2.2.0
pillow              10.2.0
pip                 21.2.4
pyparsing           3.1.1
python-dateutil     2.8.2
pytz                2024.1
scipy               1.12.0
setuptools          58.0.4
six                 1.15.0
tzdata              2024.1
wheel               0.37.0
zipp                3.17.0
WARNING: You are using pip version 21.2.4; however, version 24.0 is available.
You should consider upgrading via the '/Library/Developer/CommandLineTools/usr/bin/python3 -m pip install --upgrade pip' command.

Note that these packages are located under "/Library/Python/3.9/site-packages" like:
```
Monterey1{kazzz-s} site-packages (5)% pwd
/Library/Python/3.9/site-packages

Monterey1{kazzz-s} site-packages (6)% ll
total 8
drwxr-xr-x   39 root  wheel  1248 Feb 16 15:10 .
drwxr-xr-x    5 root  wheel   160 Feb 16 15:10 ..
drwxr-xr-x  107 root  wheel  3424 Feb 16 14:36 PIL
drwxr-xr-x   15 root  wheel   480 Feb 16 14:36 contourpy
drwxr-xr-x    7 root  wheel   224 Feb 16 14:36 contourpy-1.2.0.dist-info
drwxr-xr-x    4 root  wheel   128 Feb 16 14:36 cycler
drwxr-xr-x    8 root  wheel   256 Feb 16 14:36 cycler-0.12.1.dist-info
drwxr-xr-x   13 root  wheel   416 Feb 16 14:36 dateutil
drwxr-xr-x   32 root  wheel  1024 Feb 16 14:36 fontTools
drwxr-xr-x    9 root  wheel   288 Feb 16 14:36 fonttools-4.49.0.dist-info
drwxr-xr-x   12 root  wheel   384 Feb 16 14:36 importlib_resources
drwxr-xr-x    8 root  wheel   256 Feb 16 14:36 importlib_resources-6.1.1.dist-info
drwxr-xr-x    7 root  wheel   224 Feb 16 14:36 kiwisolver
drwxr-xr-x    8 root  wheel   256 Feb 16 14:36 kiwisolver-1.4.5.dist-info
drwxr-xr-x  149 root  wheel  4768 Feb 16 14:36 matplotlib
drwxr-xr-x   20 root  wheel   640 Feb 16 14:36 matplotlib-3.8.3.dist-info
drwxr-xr-x    5 root  wheel   160 Feb 16 14:36 mpl_toolkits
drwxr-xr-x   42 root  wheel  1344 Feb 16 14:36 numpy
drwxr-xr-x    8 root  wheel   256 Feb 16 14:36 numpy-1.26.4.dist-info
drwxr-xr-x   17 root  wheel   544 Feb 16 14:36 packaging
drwxr-xr-x    9 root  wheel   288 Feb 16 14:36 packaging-23.2.dist-info
drwxr-xr-x   22 root  wheel   704 Feb 16 14:36 pandas
drwxr-xr-x    9 root  wheel   288 Feb 16 14:36 pandas-2.2.0.dist-info
drwxr-xr-x    9 root  wheel   288 Feb 16 14:36 pillow-10.2.0.dist-info
drwxr-xr-x    3 root  wheel    96 Feb 16 15:10 pya
-rw-r--r--    1 root  wheel    90 Feb 16 14:36 pylab.py
drwxr-xr-x   14 root  wheel   448 Feb 16 14:36 pyparsing
drwxr-xr-x    7 root  wheel   224 Feb 16 14:36 pyparsing-3.1.1.dist-info
drwxr-xr-x    9 root  wheel   288 Feb 16 14:36 python_dateutil-2.8.2.dist-info
drwxr-xr-x    9 root  wheel   288 Feb 16 14:36 pytz
drwxr-xr-x    9 root  wheel   288 Feb 16 14:36 pytz-2024.1.dist-info
drwxr-xr-x   30 root  wheel   960 Feb 16 14:36 scipy
drwxr-xr-x    8 root  wheel   256 Feb 16 14:36 scipy-1.12.0.dist-info
drwxr-xr-x    5 root  wheel   160 Feb 16 14:36 tzdata
drwxr-xr-x    9 root  wheel   288 Feb 16 14:36 tzdata-2024.1.dist-info
drwxr-xr-x    5 root  wheel   160 Feb 16 14:36 zipp
drwxr-xr-x    8 root  wheel   256 Feb 16 14:36 zipp-3.17.0.dist-info
```


#-------------------------------------------------------------------------------
#  [3] Python module import test:
#
#      Run this sample python from "Macro Development" with such a sample CSV.
#-------------------------------------------------------------------------------
'''
# Enter your Python code here
import os
import numpy as np
import scipy
import matplotlib
import pandas as pd

sampleCSV = os.environ["HOME"] + "/KLayout/sampleCSV.csv"
df = pd.read_csv( sampleCSV, comment='#' )
print(df)
'''

== Output ==
      X[mm]  Y[mm]   Ratio[]
0       0.0    3.1  1.006617
1       2.7   -1.5  1.006607
2      -2.7   -1.5  1.006321
3       0.0    9.2  1.006651
4       5.9    7.0  1.006211
...     ...    ...       ...
1805  -30.3  140.7  0.994904
1806  -24.3  141.9  0.994266
1807  -18.3  142.8  0.994888
1808  -12.2  143.4  0.994146
1809   -6.1  143.11  0.993552

[1810 rows x 3 columns]

#------------------
# End of File
#------------------
