See https://gfdyn.bitbucket.io for the slides
Ashwin Vishnu Mohanan
Ph.D. student in Geophysical Fluid Dynamics
Linné FLOW Centre, KTH Mechanics
Supervisors: Erik Lindborg, Pierre Augier
Transparency in scientific methods and results
Ease of reproducibility
Openness to full scrutiny
No more "reinventing the wheel" - particularly in code development
Open science: Open-data, Open-source, Open-access, Open-courseware, Open-methodology, Open-peer-review ...
Reusable code in sciences
No "code decay": benefit from recent and future software and hardware developments
Versatile programming language with gentle learning curve
Easy to migrate. Very similar to MATLAB/Octave syntax
Interpreted, not compiled language
Automatic documentation, testing, code-coverage analysis
Performance can be improved by offloading CPU intensive tasks to C++ or Fortran
We should continue to move to higher levels of abstraction, just like we've done before. We should trade application speed for increased productivity, stability and maintainability. Programmer time is almost always more expensive than CPU time. We aren't writing applications in assembler anymore for the same reason we shouldn't be writing applications in C anymore. - From Haskell wiki
Note: without using any one-line functions
v = .01; f = 100; fs = 5000; t = 0:1/fs:.03
x = sin(2 * pi * f * t); %original signal
r = sqrt(v) * randn(1, length(t)); %noise
Xw = x + r; %signal plus noise (filter input)
y = zeros(___,'like',x)
for n = 3:length(Xw),
y(n) = sum(Xw(n - 2:n)) / 3; %y[n] is the filtered signal
end
plot(y); hold; plot(x,'r'); %plot the original signal over filtered signal
from pylab import *
v = .01; f = 100; fs = 5000; t = arange(0, .03, 1 /fs)
x = sin(2 * pi * f * t) # original signal
r = sqrt(v) * random(len(t)) # noise
Xw = x + r # signal plus noise (filter input)
y = zeros_like(x)
for n in range(3, len(Xw)):
y[n] = sum(Xw[n - 2:n]) / 3 # y[n] is the filtered signal
plot(y); plot(x,'r'); show() # plot the original signal over filtered signal
Open-source, documented, tested, continuous integration
Main developers: Pierre Augier (LEGI), Cyrille Bonamy (LEGI), Antoine Campagne (LEGI), Ashwin Vishnu (KTH), Julien Salort (ENS Lyon).
%%capture
import fluidsim as fls
sim = fls.load_state_phys_file('/scratch/avmo/13KTH/toy_model_potential/SW1Lexmod_noise_c=12_Bu=1.0_L=50.x50._1920x1920_2017-05-13_05-03-26/')
%%capture --no-display
sim.output.spectra.plot2d(tmin=100, delta_t=0, coef_compensate=0.)
sim.output.phys_fields --no-display
sim.output.physkey_field=elds.plot(key_field='q')
(Pierre Augier, LEGI & Julien Salors, ENS Lyon)
rcpy
motor.py
position_sensor.py
position_sensor_server.py
position_sensor_client.py
carriage.py
carriage_server.py
carriage_client.py
A collaboration between KTH, Stockholm, Sweden and LEGI, University of Grenoble, France
Used by international researchers through European projects (Euhit, Hydralab).
(Pierre Augier, Cyrille Bonamy & Antoine Campagne, LEGI; and Ashwin Vishnu, KTH)
Software for images preprocessing and Particle Image Velocimetry (PIV) computation
Many images (~ 20 To of raw data): embarrassingly parallel problem
Example of scripts to launch a PIV computation:
from fluidimage.topologies.piv import TopologyPIV
params = TopologyPIV.create_default_params()
params.series.path = '../../image_samples/Karman/Images'
params.series.ind_start = 1
params.piv0.shape_crop_im0 = 32
params.multipass.number = 2
params.multipass.use_tps = True
params.saving.how = 'complete'
params.saving.postfix = 'piv_complete'
topology = TopologyPIV(params, logging_level='info')
topology.compute()
Remark: parameters in an instance of fluiddyn.util.paramcontainer.ParamContainer
. Much better than in text files or free Python variables!
Remark: launching computations on cluster is highly simplified by using fluiddyn:
from fluiddyn.clusters.snic import Beskow
cluster = Beskow()
cluster.submit_script(
'piv_complete.py', name_run='fluidimage',
nb_nodes=1, nb_cores_per_node=8, email='johndoe@kth.se')
Partial conclusion: Open-data, data in auto-descriptive formats (hdf5, netcdf, ...) + code to use and understand the data.
Science in fluid mechanics with open-source methods and Python
Development of open-source, clean, reusable codes (fluiddyn project)
Issues