Welcome
Username or Email:

Password:


Missing Code




[ ]
[ ]
Online
  • Guests: 17
  • Members: 0
  • Newest Member: omjtest
  • Most ever online: 396
    Guests: 396, Members: 0 on 12 Jan : 12:51
Members Birthdays:
No birthdays today

Next birthdays
05/14 hvguy (41)
05/14 thehappyelectron (14)
05/14 Justin (2024)
Contact
If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.


Special Thanks To:
  • Aaron Holmes
  • Aaron Wheeler
  • Adam Horden
  • Alan Scrimgeour
  • Andre
  • Andrew Haynes
  • Anonymous000
  • asabase
  • Austin Weil
  • barney
  • Barry
  • Bert Hickman
  • Bill Kukowski
  • Blitzorn
  • Brandon Paradelas
  • Bruce Bowling
  • BubeeMike
  • Byong Park
  • Cesiumsponge
  • Chris F.
  • Chris Hooper
  • Corey Worthington
  • Derek Woodroffe
  • Dalus
  • Dan Strother
  • Daniel Davis
  • Daniel Uhrenholt
  • datasheetarchive
  • Dave Billington
  • Dave Marshall
  • David F.
  • Dennis Rogers
  • drelectrix
  • Dr. John Gudenas
  • Dr. Spark
  • E.TexasTesla
  • eastvoltresearch
  • Eirik Taylor
  • Erik Dyakov
  • Erlend^SE
  • Finn Hammer
  • Firebug24k
  • GalliumMan
  • Gary Peterson
  • George Slade
  • GhostNull
  • Gordon Mcknight
  • Graham Armitage
  • Grant
  • GreySoul
  • Henry H
  • IamSmooth
  • In memory of Leo Powning
  • Jacob Cash
  • James Howells
  • James Pawson
  • Jeff Greenfield
  • Jeff Thomas
  • Jesse Frost
  • Jim Mitchell
  • jlr134
  • Joe Mastroianni
  • John Forcina
  • John Oberg
  • John Willcutt
  • Jon Newcomb
  • klugesmith
  • Leslie Wright
  • Lutz Hoffman
  • Mads Barnkob
  • Martin King
  • Mats Karlsson
  • Matt Gibson
  • Matthew Guidry
  • mbd
  • Michael D'Angelo
  • Mikkel
  • mileswaldron
  • mister_rf
  • Neil Foster
  • Nick de Smith
  • Nick Soroka
  • nicklenorp
  • Nik
  • Norman Stanley
  • Patrick Coleman
  • Paul Brodie
  • Paul Jordan
  • Paul Montgomery
  • Ped
  • Peter Krogen
  • Peter Terren
  • PhilGood
  • Richard Feldman
  • Robert Bush
  • Royce Bailey
  • Scott Fusare
  • Scott Newman
  • smiffy
  • Stella
  • Steven Busic
  • Steve Conner
  • Steve Jones
  • Steve Ward
  • Sulaiman
  • Thomas Coyle
  • Thomas A. Wallace
  • Thomas W
  • Timo
  • Torch
  • Ulf Jonsson
  • vasil
  • Vaxian
  • vladi mazzilli
  • wastehl
  • Weston
  • William Kim
  • William N.
  • William Stehl
  • Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Forums
4hv.org :: Forums :: Computer Science
« Previous topic | Next topic »   

Python users?

Move Thread LAN_403
Dr. Slack
Fri Nov 23 2012, 12:24PM Print
Dr. Slack Registered Member #72 Joined: Thu Feb 09 2006, 08:29AM
Location: UK St. Albans
Posts: 1659
How many users of this board are using Python?

I only started because it's being used at work as a rapid prototyping glue language to build GUIs and wrap C calls, but the more I do with it the more hooked I get.

After starting programming 40 years ago with Basic, then Fortran and assembler, I never really did get into C. When I met my first dynamic language VB through work, I treated it with great suspicion, it just felt ugly.

You *can* use Python as a procedural language, but to ride the horse in the direction it's going, you've got to get chest-deep into OO. It runs native under both 'nux and 'doze, I hate all the wine/bash mucking about.

It has a gazillion libraries, which all use consistent syntax. I was pleasantly surprised to 'import httplib', and within a few minutes be downloading Dilbert cartoons automatically, 'import scipy' and be doing FFTs, 'import matplotlib' and be generating plots as easily as with matlab, 'import reportlab' and create .pdfs from a program (so have finally moved my calendar generator off Excel). The community seems incredibly helpful, the folk at StackOverflow are very patient with my n00b questions.

I'm steadily building up a set of utilities tailored for what I want to do. I've just written a signal generator for the audio output, and am presently writing an oscilloscope for the audio input. This is to eventually allow the use of the audio I/O as a network analyser, component analyser, synchro resolver, and general capacitive transducer measurer for some physics projects I have on the stocks. I've bought some ftdi USB interface modules, but not breathed any life into them yet.

While there are programming forums out there, I can't find any focussed on scientific oriented programming or equipment control. StackOverflow for instance is where the language gurus hang out, rather than the applications. I wonder if there are enough people on this forum doing the same sort of measurement/control thing, with specifically Python, to make it worth sharing modules or tips, perhaps via the wiki?

This is not an invitation to compare languages, or slag off its speed or use of whitespace, fanboys only!
Back to top
Steve Conner
Fri Nov 23 2012, 01:17PM
Steve Conner Registered Member #30 Joined: Fri Feb 03 2006, 10:52AM
Location: Glasgow, Scotland
Posts: 6706
Never tried it, but after your writeup, I am tempted smile I've seen it used with wxWindows to make GUI applications running under Windows.
Back to top
Dr. Slack
Fri Nov 23 2012, 07:10PM
Dr. Slack Registered Member #72 Joined: Thu Feb 09 2006, 08:29AM
Location: UK St. Albans
Posts: 1659
It may be specifically Python (the consistency helps) or it may be that the new (to me) OO paradigm suits where I am at the moment. I'm a very lazy programmer, and will move heaven and earth to not have to write the same thing from scratch twice.

You might be amused at this general purpose module I've written. It comes from the oscilloscope requirement. I want the graph Y axis autoscale to work with only 1, 2, 5 increments (how many times have you seen software that autoscales a graph with stupid impossible to mentally interpolate spacing?) Which means I want to quantise numbers onto that sequence. But then how many other very similar requirements are there to do that, like when I'm choosing resistors and want the nearest in the E24 series.

It shows a few features of the language, it should be more or less comprehensible to non python users. """ is the documentation string delimiter. Block scope is by indentation only; it's a Marmite feature, you either love it, or you hate it so much you don't use Python.

Module for arbitrary quantisation of numbers
OK, it's not a particularly scientific share, but it's a start.
Back to top
Carbon_Rod
Sat Nov 24 2012, 02:54AM
Carbon_Rod Registered Member #65 Joined: Thu Feb 09 2006, 06:43AM
Location:
Posts: 1155
If you need to wrap C/C++ than your design is in trouble.

Python is the "new" Java, so has many of the same strengths and weaknesses.

In terms of memory usage and raw speed... C/C++ is about as good as it gets...
In terms of usability for non-entrant member function calls... python is trickier than most...

Like the splice op though [:]
Back to top
Dr. Slack
Mon Nov 26 2012, 09:05AM
Dr. Slack Registered Member #72 Joined: Thu Feb 09 2006, 08:29AM
Location: UK St. Albans
Posts: 1659
AudioIO module that gives the pyAudio module a synchronous queue interface and makes it easier to use, and a multi-component sig-gen that makes use of it. Tone_gen is a small module that's used in the self-test of AudioIO. pyAudio wraps the common PortAudio module.






Back to top
Steve Conner
Mon Nov 26 2012, 10:54AM
Steve Conner Registered Member #30 Joined: Fri Feb 03 2006, 10:52AM
Location: Glasgow, Scotland
Posts: 6706
IO, IO, it's off to work we go... smile

You can't really compare C++ with Python. C++ is statically typed with no garbage collection. Fast, but lots of thought and pre-planning required to make a program that even compiles, let alone runs without mysterious memory leaks and crashes.

The new-school languages like Python, Java, and the .NET family are much better for quickly bashing out prototype code. Computers are now so fast that these languages are often perfectly good for delivering the final product too.

PS: here is how I did graph axis scaling before Python was invented smile
void FrontEndGain::SetScaler(Scaler* pMyScaler)
{
	static const float RoundFSDs[15] =
	{2000, 1000, 500, 250, 
	120, 60, 30, 15, 
	8, 4, 2, 1, 
	0.5, 0.25, 0.1};

	static const int NumDivs[15] =
	{5, 5, 5, 5, 
	6, 6, 6, 3, 
	4, 4, 4, 5, 
	5, 5, 5};

	pMyScaler->SetAnalogGain((float)(1 << MyValue));
	pMyScaler->SetRoundFSD(RoundFSDs[MyValue]);
	pMyScaler->SetNumDivs(NumDivs[MyValue]);

	// Display scales will change, so request a screen redraw.
	InvalidateRect(g_MainWindowHandle, NULL, TRUE);
}
Back to top
Duality
Fri Jan 11 2013, 12:56AM
Duality Registered Member #1951 Joined: Sun Feb 01 2009, 01:59PM
Location:
Posts: 105
I use python, started about almost two years ago :)
Back to top
Shrad
Fri Jan 11 2013, 08:48AM
Shrad Registered Member #3215 Joined: Sun Sept 19 2010, 08:42PM
Location:
Posts: 780
python + scipy + numpy + matplotlib = better than matlab and FREE

I plotted IASI satellite data with this bundle for 2 years concerning gas traces and atmospheric pollutants, and the quality was enough to be printed on Nature... it tells enough I think
Back to top

Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob

Go to:

Powered by e107 Forum System
 
Legal Information
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.