Unix/Linux Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

A straightforward Python question.

Programming


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 04-17-2017
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 24 July 2017, 10:18 AM EDT
Location: Loughborough
Posts: 1,213
Thanks: 364
Thanked 322 Times in 252 Posts
A straightforward Python question.

Hi all...

Simple yes or no answer question for the big guns with a qualifier if YES.

I can possibly do FFT for my needs in AudioScope using python.

Q: Is python now considered part of the /usr/bin or other command paths for ALL current *NIX style OSes?

IF YES which version(s) should I go to?
A: Python 2.7.x <- current OSX 10.12.x.

OR

B: Python 3.x.x

(Perl can also do it but I am brain dead to Perl.)


TIA...
Sponsored Links
    #2  
Old Unix and Linux 04-17-2017
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 28 July 2017, 9:20 AM EDT
Location: NM
Posts: 11,123
Thanks: 550
Thanked 1,079 Times in 1,000 Posts
IF I understand: no. Python is not a standard part of some UNIX packages, you have to add it on later. Solaris 10 is an example.

And if python is out there already it may well be 2.7. FFT algorithms in perl are absolutely all over the place on the net. You could certainly find one to use close to as is.

A google for 'fft perl example' finds lots of code. perl has had it in MATH:: since 2002.
Note: there are linux distributions like DSL that have almost nothing extra, just bash and gcc and c runtime. No perl, no python.

IMO your question may not be so easy to answer well. Your perl assumption has problems.

You can do some math in shell only -

:: phodd.net :: GNU bc FAQ ::
The Following User Says Thank You to jim mcnamara For This Useful Post:
wisecracker (04-18-2017)
Sponsored Links
    #3  
Old Unix and Linux 04-18-2017
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 24 July 2017, 10:18 AM EDT
Location: Loughborough
Posts: 1,213
Thanks: 364
Thanked 322 Times in 252 Posts
Hi JM...

Hmmm, I thought not.

I have searched high and low for a demo awk version as I assume awk IS part of any default *NIX like flavour. I can't find one so........

Instead I will at least try to create one.

If successful I will post it on here.

Thanks for your time.

(It is relatively easy in Python.)

Bazza.
    #4  
Old Unix and Linux 04-18-2017
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 28 July 2017, 9:20 AM EDT
Location: NM
Posts: 11,123
Thanks: 550
Thanked 1,079 Times in 1,000 Posts
Consider the phedd link - there are a lot of sites with command line bc formulas, for example fft solutions. bc originally was meant to do extended precision floating point from extensive scripts, as well as one-off fp math operations. Don't sell it short.

If you want portability and you do not want to have to verify/install perl's MATH:: for every UNIX installation, bc is the correct approach, IMO.
Sponsored Links
    #5  
Old Unix and Linux 04-18-2017
wisecracker's Unix or Linux Image
wisecracker wisecracker is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 24 July 2017, 10:18 AM EDT
Location: Loughborough
Posts: 1,213
Thanks: 364
Thanked 322 Times in 252 Posts
Hi JM...

I can't use 'ksh', 'bc' or 'dc' for floating point stuff as CygWin does not have them as of the current release.

It also does not have Python or Perl but DOES have AWK by default.

I have a working FFT demo using Python 2.7.x but it needs a thorough shakeup before I make a text mode AF Spec-An. I will not be using this inside AudioScope.
I haven't worked out how to get a bash array into a Numpy array yet without using a file but it won't be long. A little further thought is needed for an alternative approach.

Many thanks.

Bazza.
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Question about Strings in Python mohtashims Shell Programming and Scripting 1 05-17-2016 04:39 PM
Python question cstsang Shell Programming and Scripting 1 07-07-2014 05:26 AM
Capslock and Python Question mrm5102 UNIX for Dummies Questions & Answers 0 06-30-2014 03:26 PM
modify ls -l (long listing format output) strictly using SED only straightforward goalhard 4 me doh wolf@=NK Shell Programming and Scripting 1 06-12-2012 09:15 PM
NEWBIE QUESTION: python 3 or 2.6.x guptaxpn Programming 2 12-15-2008 11:04 PM



All times are GMT -4. The time now is 10:49 AM.