Initial commit with previous content
|
@ -0,0 +1 @@
|
|||
public
|
|
@ -0,0 +1,3 @@
|
|||
[submodule "hugo-mus-theme"]
|
||||
path = hugo-mus-theme
|
||||
url = https://forge.s1gm4.eu/sortion/hugo-mus-theme.git
|
170
LICENSE
|
@ -1,170 +0,0 @@
|
|||
Creative Commons Attribution-ShareAlike 4.0 International
|
||||
|
||||
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
|
||||
|
||||
Using Creative Commons Public Licenses
|
||||
|
||||
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
|
||||
|
||||
Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors.
|
||||
|
||||
Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described.
|
||||
|
||||
Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public.
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
|
||||
|
||||
Section 1 – Definitions.
|
||||
|
||||
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
|
||||
|
||||
b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
|
||||
|
||||
c. BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
|
||||
|
||||
d. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
|
||||
|
||||
e. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
|
||||
|
||||
f. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
|
||||
|
||||
g. License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike.
|
||||
|
||||
h. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
|
||||
|
||||
i. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
|
||||
|
||||
j. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
|
||||
|
||||
k. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
|
||||
|
||||
l. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
|
||||
|
||||
m. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
|
||||
|
||||
Section 2 – Scope.
|
||||
|
||||
a. License grant.
|
||||
|
||||
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
|
||||
|
||||
A. reproduce and Share the Licensed Material, in whole or in part; and
|
||||
|
||||
B. produce, reproduce, and Share Adapted Material.
|
||||
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
|
||||
|
||||
3. Term. The term of this Public License is specified in Section 6(a).
|
||||
|
||||
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
|
||||
|
||||
5. Downstream recipients.
|
||||
|
||||
A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
|
||||
|
||||
B. Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
|
||||
|
||||
C. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
|
||||
|
||||
6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
b. Other rights.
|
||||
|
||||
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
|
||||
|
||||
2. Patent and trademark rights are not licensed under this Public License.
|
||||
|
||||
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
|
||||
|
||||
Section 3 – License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
|
||||
|
||||
a. Attribution.
|
||||
|
||||
1. If You Share the Licensed Material (including in modified form), You must:
|
||||
|
||||
A. retain the following if it is supplied by the Licensor with the Licensed Material:
|
||||
|
||||
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
|
||||
|
||||
ii. a copyright notice;
|
||||
|
||||
iii. a notice that refers to this Public License;
|
||||
|
||||
iv. a notice that refers to the disclaimer of warranties;
|
||||
|
||||
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
|
||||
|
||||
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
|
||||
|
||||
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
|
||||
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
|
||||
|
||||
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
|
||||
|
||||
b. ShareAlike.In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
|
||||
|
||||
1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License.
|
||||
|
||||
2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
|
||||
|
||||
3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
|
||||
|
||||
Section 4 – Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
|
||||
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
|
||||
|
||||
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
|
||||
|
||||
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
|
||||
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
|
||||
|
||||
Section 5 – Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
|
||||
|
||||
b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
|
||||
|
||||
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
|
||||
|
||||
Section 6 – Term and Termination.
|
||||
|
||||
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
|
||||
|
||||
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
|
||||
|
||||
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
|
||||
|
||||
2. upon express reinstatement by the Licensor.
|
||||
|
||||
c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
|
||||
|
||||
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
|
||||
|
||||
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
|
||||
|
||||
Section 7 – Other Terms and Conditions.
|
||||
|
||||
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
|
||||
|
||||
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
|
||||
|
||||
Section 8 – Interpretation.
|
||||
|
||||
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
|
||||
|
||||
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
|
||||
|
||||
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
|
||||
|
||||
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
|
||||
|
||||
Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
|
||||
|
||||
Creative Commons may be contacted at creativecommons.org.
|
|
@ -1,3 +1,3 @@
|
|||
# org-blog
|
||||
# [blog.samuel.ortion.fr](https://blog.samuel.ortion.fr/)
|
||||
|
||||
My Emacs/Org-Mode powered blog
|
||||
A Hugo powered blog.
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
title: "{{ replace .Name "-" " " | title }}"
|
||||
date: {{ .Date }}
|
||||
draft: true
|
||||
---
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
---
|
||||
baseURL: 'https://blog.samuel.ortion.fr/'
|
||||
languageCode: en-us
|
||||
title: A blog from a juvenile Geekus biologicus
|
||||
theme: 'mus'
|
||||
paginate: 10
|
||||
|
||||
params:
|
||||
author: Samuel Ortion
|
||||
email: samuel@ortion.fr
|
||||
avatar: /images/me.png
|
||||
description: ""
|
||||
# Uncomment if you need this
|
||||
# images:
|
||||
# - images/og-featured.png # relative path to "static" directory
|
||||
# customCSS:
|
||||
# - css/my.css # relative path to "assets" directory (don't use main.css filename)
|
||||
# customJS:
|
||||
# - js/main.js # relative path to "assets" directory
|
||||
dateFormat: "2006-01-02"
|
||||
paginationSinglePost: true
|
||||
style: light-without-switcher
|
||||
mainSections: [ "posts" ] # which sections should be on index/main page
|
||||
sectionsWithFullContentOnListPage: [ "notes" ] # for which sections content should be displayed on list pages
|
||||
readMore: false # show read more button
|
||||
readNextPosts: 5 # show 5 related posts, 0 by default
|
||||
disableSummary: false
|
||||
toc: true # display Table of Contents
|
||||
tocWordCount: 300 # ...when a post is longer than 300 words
|
||||
copyCodeButton: true # true by default
|
||||
rssAsSocialIcon: true
|
||||
mathjax: true # https://www.mathjax.
|
||||
|
||||
languages:
|
||||
fr:
|
||||
languagedirection: fr
|
||||
title: Le blog d'un <i>Geekus biologicus</i> juvénile
|
||||
weight: 1
|
||||
en:
|
||||
title: The blog of a juvenile <i>Geekus biologicus</i>
|
||||
languagedirection: en
|
||||
weight: 2
|
||||
markup:
|
||||
highlight:
|
||||
style: nord
|
||||
goldmark:
|
||||
renderer:
|
||||
unsafe: true # enable raw HTML in Markdown
|
||||
extensions:
|
||||
passthrough:
|
||||
delimiters:
|
||||
block:
|
||||
- - \[
|
||||
- \]
|
||||
- - $$
|
||||
- $$
|
||||
inline:
|
||||
- - \(
|
||||
- \)
|
||||
- - $
|
||||
- $
|
||||
enable: true
|
||||
|
||||
params:
|
||||
math: true
|
||||
repo: https://forge.s1gm4.eu/sortion/blog/
|
||||
|
||||
# mediaTypes:
|
||||
# text/gemini:
|
||||
# suffixes:
|
||||
# - "gmi"
|
||||
|
||||
outputFormats:
|
||||
# GEMINI:
|
||||
# name: GEMINI
|
||||
# isPlainText: true
|
||||
# isHTML: false
|
||||
# mediatype: text/gemini
|
||||
# protocol: "gemini://"
|
||||
# permalinkable: true
|
||||
|
||||
outputs:
|
||||
home: ["HTML", "RSS", "GEMINI"]
|
||||
page: ["HTML", "GEMINI"]
|
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 95 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 8.9 KiB |
After Width: | Height: | Size: 111 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 334 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 516 KiB |
After Width: | Height: | Size: 484 KiB |
After Width: | Height: | Size: 24 KiB |
|
@ -0,0 +1,158 @@
|
|||
---
|
||||
title: Analyse Sound on GNU/Linux using Wine
|
||||
author: Samuel Ortion
|
||||
date: 2021-03-25
|
||||
tags: [audio, bat, bird, ultrasound, syrinx, batsound]
|
||||
lang: en
|
||||
---
|
||||
|
||||
After recording bats, orthoptera or birds, it is often necesserary to see the spectrograms of the sounds, for instance while analysing [Vigie-Chiro Program](http://www.vigienature.fr/fr/chauves-souris) bat records
|
||||
|
||||
The software needed to do so are often only for Windows, in the present article, we will learn how to install these softwares (i.e. Kaleidoscope, Syrinx, Batsound 4, 7-zip, Lupas-Rename).
|
||||
|
||||
Install Wine
|
||||
------------
|
||||
|
||||
Wine is a software that enable .exe software to run on UNIX systems such as Linux or Mac OS.
|
||||
|
||||
### On Debian and derivatives (Ubuntu...)
|
||||
|
||||
Enable 32 bit packages (if you haven't already):
|
||||
```bash
|
||||
sudo dpkg --add-architecture i386
|
||||
```
|
||||
|
||||
Download and install the repository key:
|
||||
|
||||
```bash
|
||||
wget -nc https://dl.winehq.org/wine-builds/winehq.key
|
||||
sudo apt-key add winehq.key
|
||||
```
|
||||
|
||||
Add the repository to /etc/apt/sources.list or create a wine.list under /etc/apt/sources.list.d/ with the following content:
|
||||
|
||||
```textile
|
||||
deb https://dl.winehq.org/wine-builds/debian/ buster main
|
||||
```
|
||||
|
||||
Update packages
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
```
|
||||
|
||||
Install Wine stable
|
||||
|
||||
```bash
|
||||
sudo apt install --install-recommends winehq-stable
|
||||
```
|
||||
|
||||
### On Fedora, RHEL, and derivatives
|
||||
|
||||
Add repository :
|
||||
```bash
|
||||
dnf config-manager --add-repo https://dl.winehq.org/wine-builds/fedora/33/winehq.repo
|
||||
```
|
||||
|
||||
Install stable package :
|
||||
```bash
|
||||
dnf install winehq-stable
|
||||
```
|
||||
|
||||
Install Kaleidoscope
|
||||
--------------------
|
||||
|
||||
Kaleidoscope is available on both fedora and debian based distros at [wildlife acoustics](https://www.wildlifeacoustics.com/).
|
||||
|
||||
Install Syrinx
|
||||
--------------
|
||||
|
||||
As all following softwares, Syrinx is not available for GNU/Linux, we need Wine to execute the `.exe`.
|
||||
Syrinx-PC is available at [Google Drive](https://drive.google.com/file/d/0B5ZM90wrDzUOM0ZfYlpDR2l1cU0/view).
|
||||
You will also need the config files available at [Google Drive](https://drive.google.com/file/d/0B5ZM90wrDzUOQnBhRjNVRFM1Rkk/view).
|
||||
|
||||
You have almost two options :
|
||||
You can either right click on the `.exe` installer and select `Open with other application` and `Wine Windows Program Loader`, or either run `wine syrinxalphainst.exe` in Terminal.
|
||||
|
||||
### Set up app launcher
|
||||
|
||||
You have to create a new file `.local/share/applications/syrinx.desktop`:
|
||||
```textile
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Name=Syrinx
|
||||
Comment=Acoustic analysis
|
||||
Exec=/usr/bin/wine /home/<USER>/.wine/drive_c/Program\ Files\ (x86)/syrinx/Syrinx.exe
|
||||
Icon=/home/<USER>/.wine/drive_c/Program Files (x86)/syrinx/img/vigie-chiro.png
|
||||
Terminal=false
|
||||
```
|
||||
Change `<USER>` by your username. To have the icon, you can download [`vigie-chiro.png`](/images/vigie-chiro.png).
|
||||
To analyse ultrasound, with a 384 kHz sampling frequency, we have to open `Configs_syrinx/exp384.dsp`; and next Load sound file (`Ctrl+L`). To switch to other sound file in same folder, we can use `alt+arrows`. For more tips, you can view [the video of Charlotte ROEMER (Fr)](https://www.youtube.com/watch?v=BPPSw2FSLxs).
|
||||
|
||||
Install and Configure Batsound 4
|
||||
--------------------------------
|
||||
|
||||
The procedure is quite similar with Syrinx-PC installation.
|
||||
|
||||
### Set up app launcher
|
||||
|
||||
Create a new file `.local/share/applications/batsound.desktop`:
|
||||
|
||||
```textile
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Name=Batsound
|
||||
Comment=Acoustic analysis
|
||||
Exec=/usr/bin/wine /home/<USER>/.wine/drive_c/Program\ Files\ (x86)/Pettersson/Batsound4/BatSound.exe
|
||||
Icon=/home/<USER>/.wine/drive_c/Program Files (x86)/Pettersson/Batsound4/img/batsound.png
|
||||
Terminal=false
|
||||
```
|
||||
(Do not forget to change `<USER>` to your username.)
|
||||
|
||||
To have the icon, you can download [`batsound.png`](/images/batsound.png).
|
||||
|
||||
### Configure Batsound to analyse ultrasounds
|
||||
* Enter the `Sound/Sound Format` menu.
|
||||
|
||||
![Entering `Sound/Sound Forma` menu](/images/batsound/enter-sound-format-menu.png)
|
||||
|
||||
* Change `Time expansion` value to 10 (according to your recorder settings)
|
||||
* Keep 44 100 as `Samples per second` value.
|
||||
|
||||
* Enter the `Analysis/Spectrogram Settings - Defaults` menu.
|
||||
|
||||
![Entering `Spectrogram Setting - Defaults` menu](/images/batsound/spectrogram-settings-default-values.png)
|
||||
|
||||
|
||||
* Change `Max frequency` to `150000`;
|
||||
* Set `Amplitude color mapping` to `Yellow, Red & Blue`;
|
||||
* Adapt `Threshold` to sound intensity.
|
||||
|
||||
* You can zoom in.
|
||||
|
||||
With a *Pipistrellus kuhlii* record, I obtain the following spectrogram with the above settings :
|
||||
![pipkuh spectro](/images/batsound/pipkuh-spectro-batsound.png)
|
||||
|
||||
Install 7-zip
|
||||
-------------
|
||||
|
||||
7-zip is useful in Vigie-Chiro process to compress audio files for faster upload to [https://vigiechiro.herokuapp.com](https://vigiechiro.herokuapp.com).
|
||||
|
||||
1. Download `.exe` installer at [https://www.7-zip.org/](https://www.7-zip.org/)
|
||||
2. Execute `7z1900.exe` with wine.
|
||||
|
||||
Install Lupas-Rename
|
||||
--------------------
|
||||
|
||||
Lupas-Rename is used in Vigie-Chiro protocole to batch rename audio file to add protocoles informations such as pass and square.
|
||||
|
||||
1. Dowload `.exe` installer at [https://rename.lupasfreeware.org/download.php](https://rename.lupasfreeware.org/download.php)
|
||||
2. Execute installer with wine
|
||||
3. Batch rename audio files...
|
||||
|
||||
Conclusion
|
||||
----------
|
||||
|
||||
With all these functionnal softwares, you are able to perform Vigie-Chiro protocole and sound analysis on GNU/Linux. I look forward to see your participation at [https://vigiechiro.herokuapp.com](https://vigiechiro.herokuapp.com) !
|
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
title: Draw a Plot in C with GNU plotutils
|
||||
author: Samuel Ortion
|
||||
date: 2022-06-12
|
||||
tags: [math]
|
||||
lang: en
|
||||
---
|
||||
|
||||
## Install plotutils
|
||||
|
||||
### Debian
|
||||
```bash
|
||||
$ sudo apt-get install plotutils-dev
|
||||
```
|
||||
### Fedora
|
||||
```bash
|
||||
$ sudo dnf install plotutils-devel
|
||||
```
|
||||
|
||||
## Use PlotUtils to plot a graph
|
||||
|
||||
Let us draw the $sin(x)$ function using math library.
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#define RANGE 100
|
||||
|
||||
// Export data to stdout
|
||||
void plot(double *x, double *y, size_t len)
|
||||
{
|
||||
for (unsigned int i = 0; i < len; i++)
|
||||
printf("%lf %lf\n", x[i], y[i]);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
double x[RANGE], y[RANGE];
|
||||
// Compute sin(x)
|
||||
for (i = 0; i < RANGE; i++)
|
||||
{
|
||||
x[i] = i * 0.1;
|
||||
y[i] = sin(x[i]);
|
||||
}
|
||||
|
||||
plot(x, y, 100);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
$ gcc -o plot plot.c -lm
|
||||
$ ./plot # Show data on screen
|
||||
```
|
||||
|
||||
### Use graph utility to plot the data
|
||||
```bash
|
||||
$ ./plot | graph -T X -T PNG -L "sin(x)" > output.png
|
||||
```
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: How to render LaTeX formula in Pelican
|
||||
date: 2022-06-14
|
||||
lastmod: 2022-06-14
|
||||
tags: [math, latex, pelican]
|
||||
slug: rendering-latex-pelican
|
||||
author: Samuel Ortion
|
||||
lang: en
|
||||
---
|
||||
|
||||
Rendering $\LaTeX$ formulas in Pelican is easy.
|
||||
|
||||
Firstly import the pelican plugin in the proper python environment:
|
||||
|
||||
```bash
|
||||
pip install pelican-render-math
|
||||
```
|
||||
|
||||
Add `render_math` to PLUGINS list in your `pelicanconf.py` file:
|
||||
|
||||
```python
|
||||
PLUGINS = ['render_math']
|
||||
```
|
||||
|
||||
Then type formula in your blog post markdown documents:
|
||||
|
||||
|
||||
```tex
|
||||
$$
|
||||
\frac{1}{2}
|
||||
$$
|
||||
```
|
||||
$$
|
||||
\frac{1}{2}
|
||||
$$
|
||||
|
||||
And that's it !
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
---
|
||||
title: How to make automatic documentation using Doxygen, breathe and Sphinx
|
||||
date: 2022-06-15
|
||||
lastmod: 2022-06-15
|
||||
tags: documentation
|
||||
Tags: [C++, Doxygen, Sphinx]
|
||||
slug: automatized-code-documentation
|
||||
author: Samuel Ortion
|
||||
Summary: Doing documentation is required, to allow people to use your project. Here I present a rather easy solution.
|
||||
lang: en
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
I recently wrote a C++ Library, and I wanted to document how to use it. I searched for a solution to extract the documentation from the code, and I found [Doxygen](https://www.doxygen.org/). It works well, but produces an ugly html output.
|
||||
|
||||
So I decided, with advices from the [JeBif](https://jebif.fr/) discord, to use Sphinx, to render the documentation.
|
||||
|
||||
Sphinx does not extract documentation from source code, it rather generates the documentation from Markdown or ReStructuredText files, so I still use Doxygen to do this job, and thanks to breathe, we can use its xml output to render documentation using Sphinx.
|
||||
|
||||
## Let's go !
|
||||
|
||||
### Setting all the stuff up
|
||||
|
||||
First of all, Install Doxygen.
|
||||
```bash
|
||||
apt-get install doxygen
|
||||
```
|
||||
|
||||
Let us create a dummy example:
|
||||
|
||||
```bash
|
||||
mkdir myawesomelibrary
|
||||
cd myawesomelibrary
|
||||
mkdir include
|
||||
cd include
|
||||
```
|
||||
|
||||
And create a dummy header file:
|
||||
|
||||
```c++
|
||||
// myawesomelibrary/include/cat.hpp
|
||||
|
||||
/**
|
||||
* @brief This is a cat
|
||||
*/
|
||||
class Cat {
|
||||
public:
|
||||
Cat() {
|
||||
say("I'm a cat");
|
||||
}
|
||||
/**
|
||||
* @brief the cat is saying meow
|
||||
*/
|
||||
void meow()
|
||||
{
|
||||
say("meow");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief the cat is saying something
|
||||
*/
|
||||
void say(const std::string& message)
|
||||
{
|
||||
std::cout << message << std::endl;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
Let's generate the doxygen cofiguration file:
|
||||
|
||||
```bash
|
||||
cd ..
|
||||
doxygen -g Doxyfile
|
||||
```
|
||||
|
||||
Then in this file, we have to set the path to the header files source directory, and allow doxygen to look up to source code files recursively. It is also time to set the output directory.
|
||||
|
||||
```text
|
||||
INPUT = "./include"
|
||||
|
||||
EXTRACT_ALL = YES
|
||||
|
||||
RECURSIVE = YES
|
||||
|
||||
OUTPUT_DIRECTORY = "./doc/"
|
||||
```
|
||||
|
||||
We need to tell doxygen to generate the xml output.
|
||||
|
||||
```text
|
||||
GENERATE_XML = YES
|
||||
```
|
||||
|
||||
And, we can disable html and $\LaTeX$ output.
|
||||
|
||||
```tex
|
||||
GENERATE_HTML = NO
|
||||
|
||||
GENERATE_LATEX = NO
|
||||
```
|
||||
|
||||
Now let's set up Sphinx
|
||||
|
||||
```bash
|
||||
mkdir doc
|
||||
cd doc
|
||||
sudo apt install python-sphinx
|
||||
sphinx-quickstart
|
||||
```
|
||||
|
||||
In the `conf.py` file, we need to add the following lines:
|
||||
```python
|
||||
extensions = ['breathe']
|
||||
breathe_projects = {'myawesomelibrary': '../xml'}
|
||||
breathe_default_project = 'myawesomelibrary'
|
||||
```
|
||||
|
||||
Of course we also need to install the `breathe` package.
|
||||
|
||||
```bash
|
||||
pip install breathe
|
||||
```
|
||||
|
||||
We need to tell Sphinx to render the class documentation:
|
||||
|
||||
```rst
|
||||
// in `index.rst`
|
||||
.. doxygenclass:: Cat
|
||||
:members:
|
||||
```
|
||||
|
||||
We can use the theme from ReadTheDocs:
|
||||
|
||||
```bash
|
||||
pip install sphinx_rtd_theme
|
||||
```
|
||||
```python
|
||||
# in conf.py
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
```
|
||||
|
||||
### Generating the documentation
|
||||
|
||||
```bash
|
||||
cd .. # go back to the root of the project
|
||||
doxygen Doxyfile
|
||||
cd doc
|
||||
make html
|
||||
```
|
||||
|
||||
That's it !
|
||||
|
||||
The output is in the `doc/build/html` directory.
|
||||
|
||||
Here is the result I got:
|
||||
|
||||
![sphinx dummy documentation](/images/sphinx/make_documentation_sphinx.png)
|
|
@ -0,0 +1,56 @@
|
|||
---
|
||||
title: Install Gephi on Linux
|
||||
date: 2022-06-19
|
||||
lastmod: 2022-06-19
|
||||
tags: [graph, visualization, linux]
|
||||
slug: install-gephi-on-linux
|
||||
author: Samuel Ortion
|
||||
lang: en
|
||||
---
|
||||
|
||||
Gephi is a software package for graph visualization. Let's install it on Linux.
|
||||
|
||||
## Install Gephi
|
||||
|
||||
```bash
|
||||
su - # Switch to root
|
||||
cd /opt/
|
||||
wget https://github.com/gephi/gephi/releases/download/v0.9.5/gephi-0.9.5-linux-x64.tar.gz -o
|
||||
tar -xzf gephi-0.9.5-linux-x64.tar.gz
|
||||
rm gephi-0.9.5-linux-x64.tar.gz
|
||||
cd gephi-0.9.5
|
||||
```
|
||||
|
||||
Now you could use it by running `./bin/gephi` in the terminal.
|
||||
|
||||
## Setup desktop entry
|
||||
|
||||
For an easier access, you could add a desktop entry to your menu.
|
||||
|
||||
```text
|
||||
// /home/$USER/.local/share/applications/gephi.desktop
|
||||
[Desktop Entry]
|
||||
Name=Gephi
|
||||
Comment=Launch Gephi
|
||||
Path=/opt/gephi-0.9.5/
|
||||
Exec=/opt/gephi-0.9.5/bin/gephi
|
||||
Terminal=true
|
||||
Type=Application
|
||||
Icon=gephi.jpg
|
||||
StartupNotify=true
|
||||
Categories=Development;Education;
|
||||
Keywords=graph;
|
||||
```
|
||||
|
||||
And download a logo for your application.
|
||||
|
||||
```bash
|
||||
cd /opt/gephi-0.9.5/
|
||||
wget https://dighumlab.org/wp-content/uploads/2020/03/gephi-tool-icon-200x200-1.jpg -o gephi.jpg
|
||||
```
|
||||
|
||||
That's it !
|
||||
|
||||
## References
|
||||
|
||||
- [Gephi](https://gephi.org/)
|
|
@ -0,0 +1,126 @@
|
|||
---
|
||||
title: How to use virtual environments
|
||||
date: 2022-06-19
|
||||
lastmod: 2022-06-19
|
||||
tags: code
|
||||
Tags: [python, R, julia]
|
||||
slug: using-virtual-environments
|
||||
author: Samuel Ortion
|
||||
lang: en
|
||||
status: published
|
||||
---
|
||||
|
||||
To not interfere with your os configuration and keep your project reproducible, you should use a virtual environment as long as possible.
|
||||
|
||||
Virtual environment are a way to isolate your project from the rest of the system, and to avoid dependencies conflicts.
|
||||
|
||||
## Python Virtualenv
|
||||
|
||||
Lets start by installing the virtualenv package.
|
||||
|
||||
```bash
|
||||
sudo apt install python3-venv
|
||||
```
|
||||
|
||||
And now you can create venvs for your project:
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv/myproject
|
||||
```
|
||||
|
||||
It is a good practice not to create a virtualenv with name "venv", but to use a name that reflects the project you are working on, in order to see directly in which venv you are working.
|
||||
|
||||
Now you can activate the virtualenv:
|
||||
|
||||
```bash
|
||||
source .venv/myproject/bin/activate
|
||||
```
|
||||
|
||||
And deactivate it when you are done:
|
||||
|
||||
```bash
|
||||
deactivate
|
||||
```
|
||||
|
||||
One other way to create a virtualenv is to use the `virtualenv` command.
|
||||
|
||||
Once you installed python packages, you should create a snapshot of your project dependencies using:
|
||||
|
||||
```bash
|
||||
pip freeze > requirements.txt
|
||||
```
|
||||
|
||||
That way, you can allow other people to use your project and installi its dependencies with the following command:
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
You could also use conda, as a package manager, to create a virtualenv.
|
||||
|
||||
## R Virtualenv
|
||||
|
||||
R also has its own virtualenv gestionnal system named packrat.
|
||||
|
||||
First install packrat with R.
|
||||
```R
|
||||
install.packages("packrat")
|
||||
```
|
||||
|
||||
And create your virtual environment with:
|
||||
|
||||
```R
|
||||
packrat::init("myproject")
|
||||
```
|
||||
|
||||
Similarly, you can then install packages:
|
||||
|
||||
```R
|
||||
install.packages("dplyr")
|
||||
```
|
||||
|
||||
And create a snapshot of your dependencies with:
|
||||
|
||||
```R
|
||||
packrat::snapshot()
|
||||
```
|
||||
|
||||
The dependency list is available in `packrat/packrat.lock`.
|
||||
|
||||
## Julia Virtualenv
|
||||
|
||||
Julia venv is very similar to Python venv.
|
||||
|
||||
First, you install the VirtualEnv package:
|
||||
|
||||
```bash
|
||||
julia -e 'using Pkg; Pkg.add("VirtualEnv")'
|
||||
```
|
||||
|
||||
And add `~/.julia/bin` to your path:
|
||||
|
||||
```bash
|
||||
julia -e 'using VirtualEnv; VirtualEnv.comonicon_install_path()'
|
||||
```
|
||||
|
||||
Then you can use `venv` to create a virtualenv for your project:
|
||||
|
||||
```bash
|
||||
venv .venv/myproject
|
||||
```
|
||||
|
||||
And you can activate/deactivate it:
|
||||
|
||||
```bash
|
||||
source .venv/myproject/bin/activate
|
||||
|
||||
deactivate
|
||||
```
|
||||
|
||||
That's it !
|
||||
|
||||
## References
|
||||
|
||||
- [Python venv documentation](https://docs.python.org/3/library/venv.html)
|
||||
- [Packrat documentation](https://rstudio.github.io/packrat/)
|
||||
- [Julia venv documentation](https://juliapackages.com/p/virtualenv)
|
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
title: How to mount a shared folder between Linux KVM Host and Guests
|
||||
date: 2022-06-21
|
||||
lastmod: 2022-06-21
|
||||
tags: [qemu, kvm, linux]
|
||||
slug: kvm-shared-folder
|
||||
author: Samuel Ortion
|
||||
lang: en
|
||||
---
|
||||
|
||||
Sharing folder between KVM virtual machines and host, may be useful. Here is a way found in fedora forum.
|
||||
|
||||
## Quickstart
|
||||
|
||||
Change `vm` to your vm hostname.
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /mnt/shared
|
||||
sudo chmod -R a+rwX /mnt/shared
|
||||
sudo semanage fcontext -a -t svirt_home_t "/mnt/shared(/.*)?"
|
||||
sudo restorecon -R /mnt/shared
|
||||
tee fs.xml << EOF > /dev/null
|
||||
<filesystem type='mount' accessmode='mapped'>
|
||||
<source dir='/mnt/shared'/>
|
||||
<target dir='shared'/>
|
||||
</filesystem>
|
||||
EOF
|
||||
virsh shutdown vm
|
||||
virsh attach-device vm fs.xml --config
|
||||
virsh start vm
|
||||
ssh vm
|
||||
sudo mkdir -p /mnt/shared
|
||||
sudo tee -a /etc/fstab << EOF > /dev/null
|
||||
shared /mnt/shared 9p trans=virtio 0 0
|
||||
EOF
|
||||
sudo mount -a
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- [Virt-manager and shared folder host/guest permission issue?](https://ask.fedoraproject.org/t/virt-manager-and-shared-folder-host-guest-permission-issue/10938/5)
|
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
title: Faire tourner Stable Diffusion sur Google Colab
|
||||
date: 2022-10-01
|
||||
lastmod: 2022-10-01
|
||||
tags: [ia, machine learning, python, notebook]
|
||||
author: Samuel Ortion
|
||||
slug: run-stable-diffusion-on-colab
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
Stable Diffusion est un modèle de deep learning permettant de générer des images photoréalistes à partir d'un *prompt* texte
|
||||
|
||||
J'ai récemment découver ce modèle via [lexica.art](https://lexica.art/), après avoir entendu parler des concurents DALL-E, Imagen et consorts.
|
||||
|
||||
Stable Diffusion a l'avantage d'être open source: tout le monde peut l'utiliser, et il fonctionne bien de surcroît.
|
||||
|
||||
## Prérequis
|
||||
|
||||
J'utilise un compte Google dédié, avec [Google Colab](https://colab.research.google.com/) pour faire tourner Stable Diffusion.
|
||||
|
||||
Le modèle devrait pouvoir tourner sur n'importe quelle plateforme Python, pourvu qu'il y ai assez de ressources GPU.
|
||||
|
||||
## Comment lancer Stable Diffusion
|
||||
|
||||
Sur Colab, importez le notebook [Art_Stable_Diffusion](/upload/stablediff/Art_Stable_Diffusion.ipynb) et lancer le.
|
||||
|
||||
Il faudra sans doute modifier le prompt dans le formulaire prévu à cet effet.
|
||||
|
||||
Ensuite vous pouvez générer les images et si les résultats vous plaisent, les télécharger ou les téléverser directement sur Drive.
|
||||
|
||||
Vous pouvez aussi utiliser le notebook original de Stable Diffusion comme expliqué dans l'[article Geekculture](https://medium.com/geekculture/2022-how-to-run-stable-diffusion-on-google-colab-5dc10804a2d7) en référence.
|
||||
|
||||
J'ai juste supprimé des bouts de codes qui ne me servaient pas et ajouté une cellule d'export sur Google Drive, avec édition des métadonnées (auteur, licence et surtout prompt utilisé).
|
||||
|
||||
## Résultats
|
||||
|
||||
Voici quelques images que j'ai obtenu avec Stable Diffusion:
|
||||
|
||||
<img src="/images/stablediff/fox_monet.png" alt="StableDiffusion's prompt: 'a painting of a fox sitting in a field at sunrise in the style of Claude Monet'" title="StableDiffusion's prompt: 'a painting of a fox sitting in a field at sunrise in the style of Claude Monet'">
|
||||
<img src="/images/stablediff/horse.png" alt="StableDiffusion's prompt: 'A horse riding an astronaut'">
|
||||
|
||||
## References
|
||||
|
||||
- [Article Tuto Medium Geekculture (en)](https://medium.com/geekculture/2022-how-to-run-stable-diffusion-on-google-colab-5dc10804a2d7)
|
|
@ -0,0 +1,90 @@
|
|||
---
|
||||
title: Générer le code LaTeX/chemfig d'une réaction chimique avec Zyme
|
||||
date: 2022-10-02
|
||||
lastmod: 2022-10-02
|
||||
tags: [chimie]
|
||||
slug: zyme-chemical-scheme-with-chemfig-and-pubchem
|
||||
author: Samuel Ortion
|
||||
status: published
|
||||
---
|
||||
|
||||
Durant les trois années de licence bioinformatique, nous avons des cours de biochimie, et ceux ci viennent avec leur lots de structure chimiques à connaître.
|
||||
|
||||
En L1, j'avais réalisé un document pdf avec LaTeX/chemfig des [acides aminées protéinogènes](/upload/chemical/acides_aminées_protéinogènes.pdf) en représentation de FISCHER, et j'avais trouvé ça plutôt sympa, bien que ça m'avait pris pas mal de temps à rédiger.
|
||||
|
||||
Ajourd'hui, j'améliore ma méthode: fini le code de la structure en chemfig (extension LaTeX) *a la mano*, vive le code généré par du code !
|
||||
|
||||
## Zyme
|
||||
|
||||
[Zyme](https://framagit.org/BioloGeeks/bioinfo/zyme) est un petit script python basé sur [mol2chemfig](https://pypi.org/project/mol2chemfigPy3/), permettant à partir d'une représentation simplifiée d'une réaction chimique du type:
|
||||
|
||||
```text
|
||||
{Glucose} + ATP -> {Glucose-6-phosphate} + ADP + P_i
|
||||
```
|
||||
|
||||
de générer le code chemfig correspondant, permettant le rendu de la structure chimique en utilisant la base de données [PubChem](https://pubchem.ncbi.nlm.nih.gov/).
|
||||
|
||||
Un fois que le fichier `.tex` est générer, il est possible de générer un pdf, ou un svg par exemple.
|
||||
|
||||
## Installation
|
||||
|
||||
Rendez vous sur le [dépôt git de zyme](https://framagit.org/BioloGeeks/bioinfo/zyme), et suivez les instructions d'installation.
|
||||
|
||||
Globalement, il suffit de cloner le dépôt et d'ajouter le dossier `./zyme` au `PATH` de votre système (sous Linux). Je n'ai pas testé sous Windows, mais ça devrait fonctionner (🤞).
|
||||
|
||||
## Utilisation
|
||||
|
||||
Pour générer le code LaTeX/chemfig d'une réaction chimique, il suffit de lancer la commande `zyme` avec en argument le fichier contenant la réaction chimique, et eventuellement le fichier de sortie.
|
||||
|
||||
Exemple:
|
||||
```bash
|
||||
zyme.py -i reaction.scheme -o reaction.tex
|
||||
```
|
||||
|
||||
Le fichier `reaction.scheme` contient la réaction chimique au format texte, et le fichier `reaction.tex` contient le code LaTeX/chemfig généré.
|
||||
|
||||
### Format du fichier de la réaction chimique
|
||||
|
||||
Le fichier de la réaction est un simple fichier texte contenant les réactifs, produits et flêches de la réaction chimique.
|
||||
|
||||
Un ';' permet de séparer deux réactions différentes (plusieurs `\schemestart[...]\schemestop` seront générés).
|
||||
|
||||
Un mot entre accolades `{}` sera remplacé par le code chemfig de la structure correspondante (en faisant appel à l'API PubChem des formats SMILES).
|
||||
|
||||
Exemple, pour le tryacilglycérol:
|
||||
```text
|
||||
{triacylglycerol}
|
||||
```
|
||||
|
||||
Donne dans un premier temps:
|
||||
|
||||
```tex
|
||||
\schemestart
|
||||
\chemfig{--[:60]--[:60]--[:60]--[:60]--[:60]--[:60]--[:60]--[:60]-(=[:300]O%
|
||||
)-[:60]O--[:60](-[:120]O-[:60](-[:120]-[:60]-[:120]-[:60]-[:120]-[:60]%
|
||||
-[:120]-[:60]-[:120]-[:60]-[:120]-[:60]-[:120]-[:60]-[:120]-[:60]-[:120])=O%
|
||||
)--[:300]O-(=[:60]O)-[:300]--[:300]--[:300]--[:300]--[:300]--[:300]--[:300]%
|
||||
--[:300]--[:300]}
|
||||
\schemestop
|
||||
```
|
||||
|
||||
Qui peut être compilé en pdf, en donnant:
|
||||
|
||||
![triacylglycérol générer avec Zyme, PubChem, LaTeX/chemfig](/images/chemical/triacylglycerol_zyme_chemfig.png)
|
||||
|
||||
|
||||
Zyme accepte d'autres arguments, tel que `+standalone` pour générer un fichier `.tex` compilable directement (instruction `\documentclass[]{standalone}`).
|
||||
|
||||
### Générer un `.svg`
|
||||
|
||||
Pour générer un fichier `.svg` à partir du fichier `.pdf` généré, il suffit d'utiliser la commande `pdf2svg` (à installer avec votre gestionnaire de paquet préféré).
|
||||
|
||||
```bash
|
||||
pdf2svg reaction.pdf reaction.svg all
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
|
||||
Et voilà, j'espère que ce petit outil vous sera utile.
|
||||
|
||||
N'hésitez pas à me remonter des bugs ou des suggestions d'améliorations, par exemple sur [le dépôt git de zyme](https://framagit.org/BioloGeeks/bioinfo/zyme/issues).
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
title: 'Astuce: Copier du texte dans le presse-papier depuis un terminal Linux'
|
||||
date: 2023-02-05
|
||||
lastmod: 2023-02-05
|
||||
tags: [tip]
|
||||
slug: xclip-clipboard-depuis-terminal
|
||||
author: Samuel Ortion
|
||||
---
|
||||
|
||||
Il suffit d'installer `xclip`:
|
||||
|
||||
```bash
|
||||
sudo dnf install xclip # sur fedora par exemple
|
||||
```
|
||||
|
||||
Puis, c'est tout simple:
|
||||
|
||||
```bash
|
||||
echo "Coucou !" | xclip -selection c
|
||||
```
|
||||
|
||||
Un exemple d'utilisation: copier une clé publique ssh dans le presse papier depuis le terminal:
|
||||
|
||||
```bash
|
||||
cat ~/.ssh/id_ecdsa.pub | xclip -selection c
|
||||
```
|
|
@ -0,0 +1,175 @@
|
|||
---
|
||||
title: Analyze projects programming languages using github-linguist
|
||||
date: 2023-03-29
|
||||
lastmod: 2023-03-29
|
||||
tags: [code]
|
||||
slug: github-linguist-for-programming-languages-usage-analysis
|
||||
author: Samuel Ortion
|
||||
lang: en
|
||||
---
|
||||
|
||||
|
||||
github-linguist is a Ruby library and command line tool for detecting the programming languages used in a project. It is used by GitHub to detect the language of a project and to generate language statistics.
|
||||
|
||||
We can use it through the command line, in order to analyze the programming languages used in a project.
|
||||
|
||||
During my application to bioinformatics master degree, I had to say which programming languages I commend. So here is some quick tips to use `github-linguist` as I learned to do for this purpose.
|
||||
|
||||
## Installation
|
||||
|
||||
### Requirements
|
||||
|
||||
- Ruby, `gem` and `ruby-devel` packages
|
||||
|
||||
### Install
|
||||
|
||||
```bash
|
||||
$ gem install github-linguist
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
$ github-linguist
|
||||
```
|
||||
|
||||
For instance on my [blog source code](https://forge.chapril.org/sortion/blog/) I get:
|
||||
|
||||
```text
|
||||
65.80% 945252 Jupyter Notebook
|
||||
17.12% 245876 CSS
|
||||
14.37% 206405 HTML
|
||||
1.29% 18478 Less
|
||||
0.77% 11019 Python
|
||||
0.43% 6212 Shell
|
||||
0.17% 2472 Makefile
|
||||
0.06% 879 JavaScript
|
||||
```
|
||||
|
||||
Let's use a script to get the result for all my projects:
|
||||
|
||||
Let's assume you have a directory with all your projects, say in `~/Documents/Projects/`:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# linguist.sh
|
||||
# Usage: ./linguist.sh ~/Documents/Projects/
|
||||
#
|
||||
# Recursively search for git repositories in the given directory
|
||||
# and print the programming languages used in each of them.
|
||||
|
||||
# Get the directory to search for git repositories
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <directory>"
|
||||
exit 1
|
||||
fi
|
||||
DIR=$1
|
||||
for REPO in $(find $DIR -name .git -type d); do
|
||||
echo -e "repo: $REPO"
|
||||
github-linguist $REPO/
|
||||
echo -e "\n"
|
||||
done
|
||||
```
|
||||
|
||||
```bash
|
||||
$ ./linguist.sh ~/Documents/Projects/
|
||||
```
|
||||
|
||||
This has the disadventage to print the result of each repository, including included dependencies.
|
||||
|
||||
Let's assume that a project is a git repository root, and that the other git repositories in subdirectories are dependencies:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# linguist.sh
|
||||
# Usage: ./linguist.sh ~/Documents/Projects/
|
||||
#
|
||||
# Recursively search for git repositories in the given directory
|
||||
# and print the programming languages used in each of them.
|
||||
|
||||
recurse_directory() {
|
||||
local directory
|
||||
directory="$1"
|
||||
if [[ -d "$directory" ]]; then
|
||||
if [[ -d "$directory/.git" ]]; then
|
||||
echo -e "repo: $directory"
|
||||
github-linguist $directory/
|
||||
echo -e "\n"
|
||||
else
|
||||
for subdirectory in "$directory"/*; do
|
||||
recurse_directory "$subdirectory"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
local directory
|
||||
directory="$1"
|
||||
if [[ -z "$directory" ]]; then
|
||||
echo "Usage: $0 <directory>"
|
||||
exit 1
|
||||
fi
|
||||
recurse_directory "$directory"
|
||||
```
|
||||
|
||||
### Let's have fun with some statistics
|
||||
|
||||
One we have our report for all our projects, we can use some tools to get some statistics.
|
||||
|
||||
First, let's transform the output of `linguist.sh` into a CSV file using `awk`:
|
||||
|
||||
1. Counting the number of projects using a programming language:
|
||||
|
||||
```awk
|
||||
#!/bin/awk -f
|
||||
# linguist-count.awk
|
||||
BEGIN {
|
||||
OFS = ";"
|
||||
}
|
||||
|
||||
/^[0-9]/ {
|
||||
languages[$3]++
|
||||
}
|
||||
|
||||
END {
|
||||
for (language in languages) {
|
||||
print language, languages[language]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```bash
|
||||
$ ./linguist.sh ~/Documents/Projects/ | ./linguist-count.awk
|
||||
```
|
||||
|
||||
Now that we have our first data let's use R to plot it:
|
||||
|
||||
```r
|
||||
#!/usr/bin/Rscript
|
||||
# linguist-count.R
|
||||
# Usage: ./linguist-count.R <csv>
|
||||
#
|
||||
# Plot the number of projects using a programming language.
|
||||
|
||||
library(ggplot2)
|
||||
|
||||
# Parse the command line arguments
|
||||
|
||||
args <- commandArgs(trailingOnly = TRUE)
|
||||
if (length(args) != 1) {
|
||||
stop("Usage: ./linguist-count.R <csv>")
|
||||
}
|
||||
csv <- args[1]
|
||||
|
||||
languages_count_df <- read.csv(file = csv, header = FALSE, sep = ";")
|
||||
colnames(languages_count_df) <- c("language", "count")
|
||||
|
||||
ggplot(data = languages_count_df, aes(x = reorder(language, count), y = count)) +
|
||||
geom_bar(stat = "identity") +
|
||||
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5)) +
|
||||
labs(x = "Programming language", y = "Number of projects")
|
||||
|
||||
ggsave("linguist-project-count.png", width = 10, height = 5)
|
||||
```
|
||||
|
||||
<img src="/images/R/linguist-project-count.png" alt="bar plots of languages I used, according to github-linguist">
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
title: How to Classify Blood Cells Using Neural Networks
|
||||
date: 2022-06-18
|
||||
lastmod: 2022-06-18
|
||||
tags: [machine learning, biology]
|
||||
slug: classify-blood-cells-using-neural-networks
|
||||
author: Samuel Ortion
|
||||
Summary: Machine Learning is widely used for image recognition. Here, we tried to perform blood cell classification using Convolutional Neural Networks.
|
||||
lang: en
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
Machine Learning is widely used for image recognition. Here, we tried to perform blood cell classification using Convolutional Neural Networks.
|
||||
|
||||
There is a dataset of blood cells that can be used for training and testing [[2, 3]](#ref2).
|
||||
|
||||
According to the paper [[1]](#ref1), the model that performed the best is the Regionnal Convolutional Neural Network (R-CNN).
|
||||
|
||||
We tried to reproduce their results.
|
||||
|
||||
## The dataset
|
||||
|
||||
The dataset is a set of images of white blood cells and platelets sorted in 8 classes: immature granulocytes (ig), monocytes, basophils, neutrophils, eosinophils, erythroblasts and platelets.
|
||||
|
||||
The dataset contains 17092 images.
|
||||
|
||||
|
||||
## The model
|
||||
|
||||
Firstly, we tried to use a classic Convolutional Neural Network (CNN).
|
||||
|
||||
|
||||
|
||||
## References
|
||||
<span id="references"></span>
|
||||
|
||||
[1] [White blood cells detection and classification based on regional convolutional neural networks](https://www.sciencedirect.com/science/article/abs/pii/S0306987719310680?via%3Dihub) <span id="ref1"></span>
|
||||
|
||||
[2] [A dataset of microscopic peripheral blood cell images for development of automatic recognition systems](https://www.sciencedirect.com/science/article/pii/S2352340920303681?via%3Dihub) <span id="ref2"></span>
|
||||
|
||||
[3] [The precedent dataset, download page](https://data.mendeley.com/datasets/snkd93bnjr/1)
|
|
@ -0,0 +1,45 @@
|
|||
#+title: Unixfu
|
||||
#+date: <2024-01-14 Sun>
|
||||
#+category: linux
|
||||
|
||||
A bin for some useful UNIX command.
|
||||
|
||||
* Add two hours
|
||||
|
||||
This could be useful for nocmig fan, to ease the hour computation of a bird contact.
|
||||
|
||||
#+begin_src bash
|
||||
hour() {
|
||||
start=$1
|
||||
duration=$2
|
||||
IFS=":" read -r duration_hour duration_minute <<< $duration
|
||||
date -d "$start $(($duration_hour * 60 + $duration_minute)) minutes" +"%H:%M"
|
||||
}
|
||||
hour 17:00 5:43
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: 22:43
|
||||
|
||||
* WAV creation datetime
|
||||
Here is a small snippet that demonstrates how to get the creation date-time of a WAV file with =ffprobe=
|
||||
|
||||
#+begin_src bash
|
||||
wav_creation_date() {
|
||||
wav="$1"
|
||||
date_key="date"
|
||||
time_key="creation_time"
|
||||
for key in $date_key $time_key; do
|
||||
ffprobe "${wav}" -v quiet -select_streams v:0 -of default=noprint_wrappers=1:nokey=1 -show_entries stream=codec_type=stream_tags=creation_time:format_tags=${key}
|
||||
done
|
||||
}
|
||||
#+end_src
|
||||
|
||||
Then, on the WAV file =example.wav=:
|
||||
#+begin_src bash
|
||||
echo $(wav_creation_date example.wav)
|
||||
#+end_src
|
||||
|
||||
#+begin_example
|
||||
2024-01-12 18:56:28
|
||||
#+end_example
|
|
@ -0,0 +1,23 @@
|
|||
#+title: ortion.fr.eu.org - A journey towards domain self-hosting on a budget
|
||||
#+status: draft
|
||||
#+category: self-hosting
|
||||
#+draft: true
|
||||
#+date: 2024-02-10
|
||||
|
||||
[[https://nic.eu.org]] provides free domain registring, provided once has its own domain name servers.
|
||||
|
||||
* Steps
|
||||
** Contact record
|
||||
|
||||
**
|
||||
|
||||
** FDN primary zone record
|
||||
|
||||
* The bill
|
||||
|
||||
- FDN VPN subscription (1€ / month (student));
|
||||
- <name>.fr.eu.org record (0€)
|
||||
|
||||
* References
|
||||
[[- https://www.domainepublic.net/Creer-et-heberger-un-sous-domaine.html]]
|
||||
-
|
|
@ -0,0 +1,99 @@
|
|||
---
|
||||
title: How to render pseudocode in Hugo with pseudocode.js
|
||||
slug: pseudocodejs-hugo
|
||||
pseudocode: true
|
||||
date: 2024-03-09
|
||||
---
|
||||
|
||||
To render pseudocode in Hugo, you can use the `pseudocode.js` library.
|
||||
|
||||
Here is what I did to make this working on my blog.
|
||||
|
||||
## Theme configuration
|
||||
In your theme files, you will first need to add link to the library CDN.
|
||||
```html
|
||||
<!-- in themes/<theme>/layouts/partials/pseucodode.html -->
|
||||
<script>
|
||||
MathJax = {
|
||||
tex: {
|
||||
inlineMath: [['$','$'], ['\\(','\\)']],
|
||||
displayMath: [['$$','$$'], ['\\[','\\]']],
|
||||
processEscapes: true,
|
||||
processEnvironments: true,
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/mathjax@3.2.2/es5/tex-chtml-full.js"
|
||||
integrity="sha256-kbAFUDxdHwlYv01zraGjvjNZayxKtdoiJ38bDTFJtaQ="
|
||||
crossorigin="anonymous">
|
||||
</script>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pseudocode@latest/build/pseudocode.min.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/pseudocode@latest/build/pseudocode.min.js"></script>
|
||||
```
|
||||
|
||||
And render all element with `pseudocode` HTMl class.
|
||||
```html
|
||||
<!-- in themes/<theme>layouts/partials/pseudocode-render.html -->
|
||||
<script>
|
||||
let pseudocodeElements = document.getElementsByClassName("pseudocode");
|
||||
for (let element of pseudocodeElements) {
|
||||
pseudocode.renderElement(element);
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
```html
|
||||
<!-- in themes/<theme>/layouts/_default/baseof.html -->
|
||||
<head>
|
||||
|
||||
...
|
||||
|
||||
{{ if .Param "pseudocode" }}
|
||||
{{ partialCached "pseudocode" . }}
|
||||
{{ end }}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
...
|
||||
|
||||
<main>
|
||||
{{ block "main" . }}{{ end }}
|
||||
{{ if .Param "pseudocode" }}
|
||||
{{ partialCached "pseudocode-render" . }}
|
||||
{{ end }}
|
||||
<main>
|
||||
</body>
|
||||
```
|
||||
|
||||
## Writing
|
||||
|
||||
Then, in your Markdown article, add the following in your frontmatter:
|
||||
```yaml
|
||||
---
|
||||
pseudocode: true
|
||||
---
|
||||
```
|
||||
|
||||
And write your pseudocode, using the `algorithmic` $\LaTeX$ syntax.
|
||||
|
||||
````markdown
|
||||
<pre id="hello-world-code" class="pseudocode">
|
||||
\begin{algorithmic}
|
||||
\PRINT \texttt{'hello world'}
|
||||
\end{algorithmic}
|
||||
</pre>
|
||||
|
||||
````
|
||||
Which willl be rendered as:
|
||||
<pre id="hello-world-code" class="pseudocode">
|
||||
\begin{algorithmic}
|
||||
\PRINT \texttt{'hello world'}
|
||||
\end{algorithmic}
|
||||
</pre>
|
||||
|
||||
|
||||
## References
|
||||
|
||||
- `pseudocode.js` <https://github.com/SaswatPadhi/pseudocode.js>
|
||||
- Mathematics in Markdown (Hugo documentation) <https://gohugo.io/content-management/mathematics/>
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
title: 'Piège Photo Raspberry Pi avec Motion'
|
||||
slug: 'piege-photo-raspberry-pi-motion'
|
||||
date: 2022-10-04T22:14:23+02:00
|
||||
lang: fr
|
||||
---
|
||||
|
||||
Après avoir réalisé un piège photo avec un caméra déclenchée par un détecteur de mouvement infrarouge et Arduino, j'ai eu envie d'essayer de faire le même type de système avec un Raspberry Pi.
|
||||
|
||||
L'avantage de Raspberry Pi est que c'est un vrai ordinateur (pas un simple microcontrolleur comme l'ATMega de l'Arduino). De ce fait il a une plus grande capacité de calculs, et on peut se passer du PIR sensor en utilisant de l'analyse d'image pour détecter le mouvement.
|
||||
|
||||
J'ai donc utilisé le logiciel [Motion](https://motion-project.github.io/), qui permet de détecter le mouvement dans une vidéo, et de déclencher une action (ici la prise de vue).
|
||||
|
||||
## Matériel
|
||||
|
||||
- Raspberry Pi;
|
||||
- Alimentation pour Raspberry Pi;
|
||||
- Batterie externe USB (optionnel, utile pour obtenir un piège photo autonome);
|
||||
- Caméra Raspberry Pi (avec sa nâpe de câblage), ou une caméra USB;
|
||||
- Carte SD (avec assez de stockage pour les photos et l'OS);
|
||||
- Une boîte (étanche de préférence).
|
||||
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
---
|
||||
title: 'Piège Photo Arduino'
|
||||
slug: 'piege-photo-arduino'
|
||||
date: 2022-09-18T18:15:49+02:00
|
||||
lang: fr
|
||||
---
|
||||
|
||||
Il y a maintenant quelques années, j'ai eu l'occasion de créer un piège photo basé sur une carte Arduino. Ce projet avait pour but de capturer des photos d'animaux sauvages, et de m'amuser un peu en électronique et programmation.
|
||||
|
||||
À l'époque, j'avais réalisé un site web en html, pour présenter le projet; mais je ne retrouve plus le code source... C'est con.
|
||||
|
||||
Je vais tout de même essayer de présenter ce vieux projet, à nouveau, en espérant que cela puisse intéresser quelqu'un.
|
||||
|
||||
## Principe
|
||||
|
||||
Une caméra automatique du commerce se base généralement sur un détecteur de chaleur (capteur infrarouge), et prends des images au moment où celui-ci détecte un mouvement.
|
||||
|
||||
Ces détecteur sont similaires aux détecteurs de présence qu'on peut trouver dans des toilettes publiques, par exemple.
|
||||
|
||||
Le projet consiste donc simplement à utiliser un détecteur de mouvement infrarouge (PIR sensor) pour déclencher la prise de vue, réalisée par une caméra numérique.
|
||||
|
||||
L'interface entre la caméra et le détecteur est la carte Arduino (dans mon cas une Arduino UNO).
|
||||
|
||||
## Matériel
|
||||
|
||||
- Arduino UNO (ou autre carte programmable, avec des entrées/sorties)
|
||||
- Détecteur infrarouge (PIR sensor)
|
||||
- Spy Camera (ici une Spy Camera AdaFruit) avec slot pour carte SD, est des connecteurs pour le trigger (déclenchement) et l'alimentation
|
||||
- Carte SD
|
||||
- Shield RTC pour Arduino (optionel mais utile pour enregistrer la date et l'heure des prises de vue)
|
||||
- Un peu de câble
|
||||
|
||||
## Montage
|
||||
|
||||
Le montage est très simple: il suffit de brancher le détecteur infrarouge sur l'Arduino, avec la pin analogique du PIR sensor, sur un port analogique de l'Arduino. Il faut aussi brancher le port trigger de la caméra sur une des pins de l'Arduino, de même que pour l'alimentation.
|
||||
|
||||
Attention: il ne faut surtout pas brancher la caméra sur son alimentation (câble USB) en même temps que sur l'Arduino; car sinon, votre caméra cramme (c'est du vécu 😢).
|
||||
|
||||
![Schema Fritzing](https://framagit.org/BioloGeeks/WildBytes/CameraTraps/www/-/raw/main/static/media/images/arduino/schema-fritzing-montage-camera-trap-arduino.jpg)
|
||||
|
||||
## Code
|
||||
|
||||
Le code est assez simple. Il suffit, dans la function loop, de vérifier l'état du détecteur de mouvement. Si celui-ci est actif, alors on déclenche la prise de vue (et on peux aussi enregistrer la date et l'heure de la prise de vue, dans le shield RTC).
|
||||
|
||||
```ino
|
||||
/*
|
||||
* piege_photographique.ino
|
||||
* Take a photo when motion is detected
|
||||
* and record the date of shooting on SD card
|
||||
* Samuel ORTION feb2019
|
||||
*/
|
||||
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
#include <Wire.h> //required for the next library
|
||||
#include "RTClib.h"
|
||||
|
||||
File myFile;
|
||||
RTC_Millis rtc;
|
||||
|
||||
//declare the pins of the compenents:
|
||||
#define pirPin 3//The PIR motion sensor
|
||||
#define trigCamera 4//The camera's trigger
|
||||
|
||||
|
||||
int photoNumber;
|
||||
|
||||
/*
|
||||
* Functions:
|
||||
*/
|
||||
void photo(){//function for shooting pictures
|
||||
// "Hold HIGH and trigger quick (<250ms) LOW to take a photo."
|
||||
digitalWrite(trigCamera, LOW);
|
||||
delay(50);
|
||||
digitalWrite(trigCamera, HIGH);
|
||||
}
|
||||
|
||||
void printDate (){
|
||||
DateTime now = rtc.now(); //define "now" as object containing the date produced by the RTC
|
||||
//the following instruction print the date on the SerialMonitor
|
||||
myFile.print("Photo n°");
|
||||
myFile.print(photoNumber);
|
||||
myFile.print(" : ");
|
||||
myFile.print(now.day(), DEC);
|
||||
myFile.print('/');
|
||||
myFile.print(now.month(), DEC);
|
||||
myFile.print('/');
|
||||
myFile.print(now.year(), DEC);
|
||||
myFile.print('/');
|
||||
myFile.print(now.hour(), DEC);
|
||||
myFile.print(':');
|
||||
myFile.print(now.minute(), DEC);
|
||||
myFile.print(':');
|
||||
myFile.print(now.second(), DEC);
|
||||
myFile.println();//skip a line
|
||||
}
|
||||
|
||||
void setup() {
|
||||
//define pinMode:
|
||||
pinMode(pirPin, INPUT);
|
||||
pinMode(trigCamera, OUTPUT);
|
||||
digitalWrite(trigCamera, HIGH);
|
||||
|
||||
//following line sets the RTC to the date & time this sketch was compiled
|
||||
rtc.begin(DateTime(F(__DATE__), F(__TIME__)));
|
||||
// This line sets the RTC with an explicit date & time, for example to set
|
||||
// January 21, 2014 at 3am you would call:
|
||||
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
|
||||
|
||||
photoNumber = 0;//initialization of the number of pictures
|
||||
|
||||
if(!SD.begin(10)){
|
||||
while (1);
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
myFile = SD.open("TIMEDATA.txt", FILE_WRITE);//open the file "TIMEDATA" to write in it
|
||||
if(digitalRead(pirPin)){//if motion is detected:
|
||||
photo();//camera takes a photograph
|
||||
photoNumber++;//a new picture has been taken
|
||||
printDate();//write the date of shooting on SD card
|
||||
delay(1000);//pause between each photo
|
||||
}
|
||||
myFile.close();// close the file after editing
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Résultats
|
||||
|
||||
J'ai eu la chance, cette année là d'avoir une famille de mésange charbonières qui a fait son nid dans un nichoir que j'avais installé à la maison.
|
||||
|
||||
Voici deux images prise par le piège photo Arduino, à l'occasion:
|
||||
|
||||
![Mésange Charbonière au nichoir - Photo 1 prise par le piège photo Arduino](https://framagit.org/BioloGeeks/WildBytes/CameraTraps/www/-/raw/main/static/media/images/arduino/photo-mesange-1.jpg)
|
||||
|
||||
![Mésange Charbonière au nichoir - Photo 1 prise par le piège photo Arduino](https://framagit.org/BioloGeeks/WildBytes/CameraTraps/www/-/raw/main/static/media/images/arduino/photo-mesange-2.jpg)
|
|
@ -0,0 +1,143 @@
|
|||
---
|
||||
title: 'Arduino Camera Trap'
|
||||
slug: 'arduino-camera-trap'
|
||||
date: 2022-09-18T18:15:49+02:00
|
||||
lang: en
|
||||
category: camera-trap
|
||||
---
|
||||
|
||||
Some years ago, I had the opportunity to create a camera trap based on an Arduino board. The goal of this project was to capture photos of wild animals, and to have fun with electronics and programming.
|
||||
|
||||
At the time, I created a website in html, to present the project; but I can't find the source code anymore... That's a shame.
|
||||
|
||||
I will try to present this old project again, hoping that it may interest someone.
|
||||
|
||||
## Principle
|
||||
|
||||
A commercial automatic camera is usually based on a heat sensor (infrared sensor), and takes pictures when it detects movement.
|
||||
|
||||
These sensors are similar to the presence detectors that can be found in public toilets, for example.
|
||||
|
||||
The project consists simply in using an infrared motion detector (PIR sensor) to trigger the shooting, performed by a digital camera.
|
||||
|
||||
The interface between the camera and the sensor is the Arduino board (in my case an Arduino UNO).
|
||||
|
||||
## Hardware
|
||||
|
||||
- Arduino UNO (or other programmable board, with inputs / outputs)
|
||||
- Infrared sensor (PIR sensor)
|
||||
- Spy Camera (here an AdaFruit Spy Camera) with slot for SD card, and connectors for the trigger and the power supply
|
||||
- SD card
|
||||
- RTC shield for Arduino (optional but useful to record the date and time of the shots)
|
||||
|
||||
## Assembly
|
||||
|
||||
The assembly is very simple. The PIR sensor output is connected on the pin 3 of the Arduino board, where the VCC (+5V) et GND (ground) are also connected to the board.
|
||||
|
||||
The camera trigger is connected to the pin 4 of the Arduino board, and both the VCC and GND are connected to the board as well.
|
||||
|
||||
We can use a 9V battery to power the Arduino board, and the camera, with an adapter. (This way, the system can be autonomous for some hours).
|
||||
|
||||
Warning, it is important not to connnect the spy cammera to the computer when it's powered by the Arduino; else it will burn... (I made this mistake, and I had to buy a new camera).
|
||||
|
||||
![Fritzing Schema](https://framagit.org/BioloGeeks/WildBytes/CameraTraps/www/-/raw/main/static/media/images/arduino/schema-fritzing-montage-camera-trap-arduino.jpg)
|
||||
|
||||
## Code
|
||||
|
||||
The code is rather simple. In the loop function, we check the state of the PIR sensor, and if it is HIGH, we trigger the camera.
|
||||
|
||||
We also save the date and time of shooting in the RTC shield SD card.
|
||||
|
||||
```ino
|
||||
/*
|
||||
* piege_photographique.ino
|
||||
* Take a photo when motion is detected
|
||||
* and record the date of shooting on SD card
|
||||
* Samuel ORTION feb2019
|
||||
*/
|
||||
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
#include <Wire.h> //required for the next library
|
||||
#include "RTClib.h"
|
||||
|
||||
File myFile;
|
||||
RTC_Millis rtc;
|
||||
|
||||
//declare the pins of the compenents:
|
||||
#define pirPin 3//The PIR motion sensor
|
||||
#define trigCamera 4//The camera's trigger
|
||||
|
||||
|
||||
int photoNumber;
|
||||
|
||||
/*
|
||||
* Functions:
|
||||
*/
|
||||
void photo(){//function for shooting pictures
|
||||
// "Hold HIGH and trigger quick (<250ms) LOW to take a photo."
|
||||
digitalWrite(trigCamera, LOW);
|
||||
delay(50);
|
||||
digitalWrite(trigCamera, HIGH);
|
||||
}
|
||||
|
||||
void printDate (){
|
||||
DateTime now = rtc.now(); //define "now" as object containing the date produced by the RTC
|
||||
//the following instruction print the date on the SerialMonitor
|
||||
myFile.print("Photo n°");
|
||||
myFile.print(photoNumber);
|
||||
myFile.print(" : ");
|
||||
myFile.print(now.day(), DEC);
|
||||
myFile.print('/');
|
||||
myFile.print(now.month(), DEC);
|
||||
myFile.print('/');
|
||||
myFile.print(now.year(), DEC);
|
||||
myFile.print('/');
|
||||
myFile.print(now.hour(), DEC);
|
||||
myFile.print(':');
|
||||
myFile.print(now.minute(), DEC);
|
||||
myFile.print(':');
|
||||
myFile.print(now.second(), DEC);
|
||||
myFile.println();//skip a line
|
||||
}
|
||||
|
||||
void setup() {
|
||||
//define pinMode:
|
||||
pinMode(pirPin, INPUT);
|
||||
pinMode(trigCamera, OUTPUT);
|
||||
digitalWrite(trigCamera, HIGH);
|
||||
|
||||
//following line sets the RTC to the date & time this sketch was compiled
|
||||
rtc.begin(DateTime(F(__DATE__), F(__TIME__)));
|
||||
// This line sets the RTC with an explicit date & time, for example to set
|
||||
// January 21, 2014 at 3am you would call:
|
||||
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
|
||||
|
||||
photoNumber = 0;//initialization of the number of pictures
|
||||
|
||||
if(!SD.begin(10)){
|
||||
while (1);
|
||||
}
|
||||
}
|
||||
|
||||
void loop() {
|
||||
myFile = SD.open("TIMEDATA.txt", FILE_WRITE);//open the file "TIMEDATA" to write in it
|
||||
if(digitalRead(pirPin)){//if motion is detected:
|
||||
photo();//camera takes a photograph
|
||||
photoNumber++;//a new picture has been taken
|
||||
printDate();//write the date of shooting on SD card
|
||||
delay(1000);//pause between each photo
|
||||
}
|
||||
myFile.close();// close the file after editing
|
||||
}
|
||||
```
|
||||
|
||||
## Results
|
||||
|
||||
I had the change to have a family of great tit, that were in a birdhouse I made.
|
||||
|
||||
Here are two images taken by the Arduino Camera Trap.
|
||||
|
||||
![Great tit - Photo 1 taken by the Arduino Camera Trap](/images/cameratraps/photo-mesange-1.jpg)
|
||||
|
||||
![Great tit - Photo 2 taken by the Arduino Camera Trap](/images/cameratraps/photo-mesange-2.jpg)
|
After Width: | Height: | Size: 24 KiB |
|
@ -0,0 +1,5 @@
|
|||
module forge.s1gm4.eu/sortion/org-blog
|
||||
|
||||
go 1.21.5
|
||||
|
||||
require github.com/Mitrichius/hugo-theme-anubis v0.0.0-20231204175953-57eb2998cf2e // indirect
|
|
@ -0,0 +1,2 @@
|
|||
github.com/Mitrichius/hugo-theme-anubis v0.0.0-20231204175953-57eb2998cf2e h1:oCnqB3lB2ZwWA8lDsCPWHrArSGx+/g4lqR1rX33hm/E=
|
||||
github.com/Mitrichius/hugo-theme-anubis v0.0.0-20231204175953-57eb2998cf2e/go.mod h1:FKD3NbdsQzL+cXsC3x99XD/t/Rd5EyhDlNBAxQhULbo=
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 77fdac90ad06d76c8e5b42db74fc2cfbb513e185
|
|
@ -0,0 +1 @@
|
|||
{"Target":"/ananke/css/main.min.css","MediaType":"text/css","Data":{}}
|
|
@ -0,0 +1 @@
|
|||
{"Target":"ananke/css/main.min.css","MediaType":"text/css","Data":{}}
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env bash
|
||||
rsync -avzu --delete ./public/ root@samuel.ortion.fr:/var/www/blog.samuel.ortion.fr/
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 77fdac90ad06d76c8e5b42db74fc2cfbb513e185
|