Nantes Université

Skip to content
Extraits de code Groupes Projets
Vérifiée Valider aa65dc96 rédigé par Benoit SEIGNOVERT's avatar Benoit SEIGNOVERT
Parcourir les fichiers

Add welcome notebook

parent 2dba3133
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
%% Cell type:markdown id:0ef87507-4419-480b-9e05-2e1444af60d1 tags:
<center><img src="https://s3.glicid.fr/nuts/workshop-banner.svg"/></center>
# Welcome to the NuTS workshop praticals
Here is a list of the notebook that we will exercice during this workshop:
- [Machine learning using MNIST classification with fully connected neural network](machine-learning/notebooks/session_1a_fcnn.ipynb)
- [Machine learning using MNIST classification with a convolutional connected neural network](machine-learning/notebooks/session_1b_cnn.ipynb)
- [Machine learning using Seisbench and PhaseNet](machine-learning/notebooks/session_2_phasnet.ipynb)
This jupyter environment is already already preconfigured for you and you juste have to click on the links above to open the notebooks and play with them.
You can download the notebook manually (with the file explorer on the left) or you can clone the [source files from the NuTS Gitlab repo](https://gitlab.univ-nantes.fr/nuts/tp).
If you wish to report an [issue you can also send us an email](mailto:gitlab-incoming+nuts-tp-machine-learning-18610-issue-@univ-nantes.fr) ✉️.
%% Cell type:markdown id:096bcfe7-b208-4567-b9ee-8290b8dc325e tags:
## Test your Jupyter environement
%% Cell type:code id:87eeb059-2ba9-47b4-ad4d-3a50e9d75741 tags:
``` python
import psutil
```
%% Cell type:code id:f07d76ac-e6d0-4fe5-8130-0fdd36ac815c tags:
``` python
print('CPU core: ', psutil.cpu_count(logical=False))
print('CPU threads: ', psutil.cpu_count(logical=True))
print('RAM total: ', round(psutil.virtual_memory().total / 1024**3, 1), 'GB')
print('RAM available:', round(psutil.virtual_memory().available / 1024**3, 1), 'GB')
```
%% Output
CPU core: 32
CPU threads: 64
RAM total: 251.5 GB
RAM available: 243.2 GB
%% Cell type:markdown id:adc1930d-503c-4caf-b79a-c226b39ddf7d tags:
## Pytorch
%% Cell type:code id:54da43ac-74ed-4505-996b-0c51f8d5dbb4 tags:
``` python
import torch
```
%% Cell type:code id:7bc5a46e-caac-4ac6-94c8-efd317a9b8d2 tags:
``` python
print('Pytorch verison:', torch.__version__)
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print('Using device:', device)
if device.type == 'cuda':
print('Cuda version:', torch.version.cuda)
for i in range(torch.cuda.device_count()):
print()
print(torch.cuda.get_device_name(i))
print('Memory Usage:')
print('Allocated:', round(torch.cuda.memory_allocated(i) / 1024 ** 3, 1), 'GB')
print('Cached: ', round(torch.cuda.memory_reserved(i) / 1024 ** 3, 1), 'GB')
```
%% Output
Pytorch verison: 1.13.1
Using device: cuda
Cuda version: 11.7
NVIDIA A100-PCIE-40GB
Memory Usage:
Allocated: 0.0 GB
Cached: 0.0 GB
NVIDIA A100-PCIE-40GB
Memory Usage:
Allocated: 0.0 GB
Cached: 0.0 GB
%% Cell type:markdown id:55e02b91-907b-469a-b7e8-6de4d2c16599 tags:
## Seisbench
%% Cell type:code id:e2c6e92d-c58c-473d-bdd0-5dddc4580c0f tags:
``` python
from seisbench.data import Iquique, ETHZ
```
%% Cell type:code id:af776464-eb23-4308-bf43-8244928d5d6b tags:
``` python
# data = Iquique()
data = ETHZ()
print(data)
data.metadata.head()
```
%% Output
2023-05-19 17:45:22,994 | seisbench | WARNING | Check available storage and memory before downloading and general use of ETHZ dataset. Dataset size: waveforms.hdf5 ~22Gb, metadata.csv ~13Mb
2023-05-19 17:45:23,201 | seisbench | WARNING | Data set contains mixed sampling rate, but no sampling rate was specified for the dataset.get_waveforms will return mixed sampling rate waveforms.
ETHZ - 36743 traces
index source_id source_origin_time
0 0 2020zmwrjy 2020-12-27T02:46:42.620452Z \
1 1 2020zmwrjy 2020-12-27T02:46:42.620452Z
2 2 2020zmwrjy 2020-12-27T02:46:42.620452Z
3 3 2020zmwrjy 2020-12-27T02:46:42.620452Z
4 4 2020zmwrjy 2020-12-27T02:46:42.620452Z
source_origin_uncertainty_sec source_latitude_deg
0 NaN 47.147641 \
1 NaN 47.147641
2 NaN 47.147641
3 NaN 47.147641
4 NaN 47.147641
source_latitude_uncertainty_km source_longitude_deg
0 0.620493 6.371343 \
1 0.620493 6.371343
2 0.620493 6.371343
3 0.620493 6.371343
4 0.620493 6.371343
source_longitude_uncertainty_km source_depth_km
0 0.927755 10.965625 \
1 0.927755 10.965625
2 0.927755 10.965625
3 0.927755 10.965625
4 0.927755 10.965625
source_depth_uncertainty_km ... trace_Pn_status trace_Pn_polarity
0 2.116958 ... NaN NaN \
1 2.116958 ... NaN NaN
2 2.116958 ... NaN NaN
3 2.116958 ... NaN NaN
4 2.116958 ... NaN NaN
trace_P_arrival_sample trace_P_status trace_P_polarity
0 NaN NaN NaN \
1 NaN NaN NaN
2 NaN NaN NaN
3 NaN NaN NaN
4 NaN NaN NaN
trace_Sn_arrival_sample trace_Sn_status trace_Sn_polarity trace_chunk
0 NaN NaN NaN \
1 NaN NaN NaN
2 NaN NaN NaN
3 NaN NaN NaN
4 NaN NaN NaN
trace_component_order
0 ZNE
1 ZNE
2 ZNE
3 ZNE
4 ZNE
[5 rows x 58 columns]
%% Cell type:markdown id:bbd05dfd-14a5-4d13-bd86-bf74b3b7f009 tags:
## ObsPy API / HTTP proxy error
%% Cell type:code id:bafe58a4-396c-42da-9754-e60d31f382fa tags:
``` python
from obspy.clients.fdsn import Client
```
%% Cell type:code id:d4ff92bf-8137-4389-af95-48ff8a958e1f tags:
``` python
Client('ETH')
```
%% Output
FDSN Webservice Client (base url: http://eida.ethz.ch)
Available Services: 'dataselect' (v1.1.1), 'event' (v1.2.4), 'station' (v1.1.4), 'available_event_catalogs', 'available_event_contributors', 'eida-auth'
Use e.g. client.help('dataselect') for the
parameter description of the individual services
or client.help() for parameter description of
all webservices.
%% Cell type:markdown id:b4f41f45-c6b5-4ae1-9506-c6981f91343d tags:
<center><img src="https://s3.glicid.fr/nuts/workshop-footer.svg"/></center>
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter