As it's time for my morning coffee (the coffee not the biscuits), it's as good a time as any to share my one of my favourite #programming analogies
_(narrated from a #Python-viewpoint but general enough for #coding in general)_
**The Coffee Machine - Function analogy**
Let's make some coffee…
_[read on]_
/1
I'm going to tweet about one of my projects every day until I run out, using the #projects hashtag
I encourage others to do the same. Let's talk about (and boost) our projects together!
sqlite-utils is a combined Python library and CLI tool for creating and manipulating SQLite databases: https://sqlite-utils.datasette.io/
It can do a lot of different things! I have a series of blog posts talking about the most interesting features here: https://simonwillison.net/series/sqlite-utils-features/
@peterdrake and yes, the article linked later has the full code etc…
@peterdrake I have been doing this (on Twitter) for a few months now, but this is an old post (from Twitter, recycled here) so the images didn’t have them. I now autogenerate these snippets which makes adding the code in ALT text easy
#Python is for serious stuff, sure, but one of the most fun modules is the `turtle` module, but…
I know, I can hear you say: "That's just for drawing simple, boring drawings, right"
Think again! Here's a great learning project that is not merely a "boring set of squares!"
You can follow the detailed step-by-step tutorial here [WARNING: game is addictive and may adversely affect your productivity!]
https://thepythoncodingbook.com/2022/04/24/python-lunar-landing-game-using-turtle-tutorial/
You'll find me easily on Twitter too if you're on there as well. That's a bigger account and get's a lot of interesting conversations going with others in the #Python world
You can see the sort of things I'm interested it there (until this timeline fills up a bit): https://twitter.com/s_gruppetta_ct
So, this thread could serve as my my #introduction
I'm Stephen. I used to be a physicist (as you can guess from the thread above) but now I focus on communicating about Python and programming and teaching coding
You can expect more varied content from me, all related to #programming in #Python, from science-y stuff like this, to fun animations using the `turtle` module (no not those boring ones!) and general Python for those learning to code at beginner and intermediate levels
There's a lot more than can fit in a single thread.
If you want to read more detail, and go through the step-by-step writing of the code to decompose & recostruct *any* image, read full article here:
#coding #2dfourierimages #2dfouriertransform #fourier
/16
And therefore, you can reconstruct the image by adding all of those sinusoidal gratings together.
The more gratings you add, the closer the result is to the actual image
/13
Now, here's the "magical" part of #Fourier theory.
*Any* image is made up of lots of sinusoidal gratings. So, the 2D Fourier Transform of an image gives you thousands of pairs of dots, and each pair represent a sinusoidal grating.
/12
Now, if you have lots of gratings superimposed on each other, the #FourierTransform gives you a pair of dots for each of the components
/11
You can find the parameters of a sinusoidal grating by using the 2D #FourierTransform.
The dots shown contain the amplitude and phase of the grating. Their position from the centre gives the frequency, and their orientation represents the orientation of the grating.
/10
You can create a 2D sinusoidal grating in #Python using #NumPy and display it using #matplotlib
/8
There's one more parameter that defines a sinusoidal grating: the phase. Gratings with a different phase are shifted with respect to each other…
/7
• Rethinking how to teach programming – I prefer the friendly, relaxed approach when communicating about Python programming
• I write about Python on The Python Coding Book blog and on Real Python
• Former Physicist
• Expect posts on scientific and numerical programming –> NumPy, Matplotlib and friends!