We just launched rinocloud.com, it aims to make it easy to manage datasets in python. I hope some of you could take a look at it and give us some feedback. https://github.com/rinocloud/rinocloud-python

We made the library to create a better way to organize datasets and parameters from simulations and experiments

Instead of just saving files, and not recording parameters, Rinocloud is an easy way to attach essentially a dict to a file object. Meaning you can save all you parameters with your data.

With rinocloud-python you can organize your datasets locally, and if you choose too, you can upload them to Rinocloud. If you upload them you then get a fully query system.

Soon we are implementing notebooks and collaboration features –so if your working in a team, you’ll be able to discuss your results inside one central storage system.

Please, let me know if you have suggestions of questions, you can get me at helena at rinocloud.com

Cheers,

Helena. ]]>

I am trying to do a soap query from python.

I am newbee and in need for help.

I have a soap service that runs on joomla and a virtuemart extenstion.

I am tryint to do a "search" on my server.

I would like to search for a "tag" and filter on it...

My script today is:

import requests

url="http://webserver/VM_ProductWSDL.php"

headers = {'content-type': 'application/soap+xml'}

body = """<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:vm="http://www.virtuemart.net/VM_Product/">

<soapenv:Header/>

<soapenv:Body>

<vm:GetProductFromSKURequest>

<!--You may enter the following 3 items in any order-->

<loginInfo>

<!--You may enter the following 4 items in any order-->

<login>soap</login>

<password>demo</password>

<isEncrypted>?</isEncrypted>

<lang>?</lang>

</loginInfo>

<product_sku>Do1</product_sku>

<include_prices>?</include_prices>

</vm:GetProductFromSKURequest>

</soapenv:Body>

</soapenv:Envelope>"""

response = requests.post(url,data=body,headers=headers)

print response.content

I would like to search for conect "Do1" in the tag <product_sku>

Have anyone tryed to do a soap post/query from Python?

Any tips will be nice..

Tnx for all answers..

Eddie ]]>

Given a 1700 digit number, we want to store the value and perform two functions on it

with NO loss of accuracy, its ok if calc time takes longer but better if faster.

Where x = a 1700 digit long numeric value

The two calcs to be computed with be ;

X * (up to a four digit value )

then we take the modulus of this resultant of 400 ;

( x % 400 )

If we cant multiply [ X * (up to a four digit value ) ] and then take the modulus due to

processing bottlenecks, ceilings - then can this be done where we first take the

modulus of the original x = 1700 digits and then multiply this by the four digit value

and then take the modulus of this after? Ideally Id prefer to be able to do the

first scenario.

Constraints Im aware of regarding this to date ;

Firstly, Im only running on a WinXp 32 bit system and not able to upgrade currently.

Secondly, Ive been becoming aware of a lot of issues, bugs, errors with python, sympy,

etc.. in properly handling very large number calcs. These problems seem to arise

out of data loss through use of floats and related. Details on a number of different

approaches can be viewed here ;

https://groups.google.com/forum/#!to...py/eUfW6C_nHdI

https://groups.google.com/forum/#!to...py/hgoQ74iZLkk

My system will not properly handle "float128" floats, although Ive been told

by one person this would be able to handle wsuch a computation - altho the prob

is it seems that float128 is rarely actually a 128 float and certainly not on my system.

Also due to internal processing peculiarties it seems that most floats will lose

data on these kinds of computations. If I understand correctly, one of the best

candidates for getting the most accurate values returned involves the use

of arbitrary precision and representing the inputs as strings and not just straight numeroc

values? Also, ideally, Id like the formula to be able to handle rationals without

accuracy loss. So "x" starts off as a whole number, but when I multiply it

by the four digit value, Id like that value to be any numeric value such as an integer,

whole number or rational like "2243.0456".

Structure of one of the methods Ive been experimenting with ;

from sympy import mpmath

mpmath.mp.dps = 1700

x = (mpmath.mpf" INSERT 1700 DIGIT NUMBER HERE"

(x % 400)

An example with live data ;

from sympy import mpmath

mpmath.mp.dps = 1700

x = (mpmath.mpf"4224837741562986738552195234618134569391350587851527986076117152972791626026988760293885 7540687684754239199916768168607014789965397150769686494316682629415524992728519340217447037997287979 6234685948177214196472012081393478142073226015644670174040859126428974596098581128907024623835926826 7313892549883722768575435935465369820850766441187744058828599331364172396647692768693734233545999439 0714351290827643404462920579623433601144636965159508031598952386672373568872945496184892961577163844 9429515985106050005037194052338570194686096416256906737117535761514419234476387654081388210737989159 1055307476597279137714860430053785074855035948744902479909111840444834198237419177418965268614345042 6346556482378188992531162479165856867132431930746356085271602736113090519387626765205074048151807927 9370125921660931611848383521679126317290247012382111177922320473564793137702722705531294093475632561 1832463728974558417085791096461266371917752574370345933533929245534623041989305973992490523694190318 2846664647571593248660968615737045406541606447112747667595205010136339997062441176912358781234896942 6172415807372564489752772747345003761529548763733868784835144133138694641600371879541982224693578768 2977520303924734875834943985619000970655639767984458204513958680501990182471695393372003272654902387 4939558497753089229016310241990112834410508816086868567462060122708909842604248343295512812497975457 7509122643366903668046340628385841342372293529785977878694593575146804849408142768966973066466026090 8636113264573712854536295005312934569838992758429422872122606102877623867968067833225444280667381025 371705347744037508121975424674439904984528128036994803804742198422695627759844248"

(x % 400)

But I have no idea if accurate results are being returned with this, would love to hear anyones suggestions? ]]>

Hi All!

I was reading Dr Knotts entries about Binets formula on his fibonacci page

A Formula for the nth Fibonacci number

I entered the formula into an Excel spreadsheet to see how this would work ;

Binet Formula

Fib(n) = (1.6180339^n – (–0.6180339..)^n) / 2.236067977..

Its fascinating to see how I can enter any number for (n) and see the

correct fibonacci number returned!

I have a question though, I am a newbie computer programmer using

VB and Python and my math skills are average at best but I am very

interest and curious about math and especially fibonacci numbers!

Say I wanted to reverse and change the process.

I have a very large fibonacci number and I want to know what the

fibonacci number is at a specified position BEFORE it, how would

I compute this, what would the formula be?

So for example I have the 301 st fibo number of ;

359579325206583560961765665172189099052367214309267232255589801

And I want to be able to find what the fibonacci value would be (n) numbers

BEFORE this... so I might want to know what the fibo value would be 50

numbers before or the 251st fibo number. How would I do that? ]]>

I've been trying to solve a problem with numpy and other code routines

to raise a base to a large power and then take the modulus.

Precision accuracy is very important, speed isnt as much - although it would

be convenient if I didnt have to wait a long long time for processing.

Constraints Im under is that Im working on a winxp system, Im using

python 3.4 and numpy version 1.1.

When using numpy Ive been using the code lines;

import numpy

(np.longdouble(1.4142)** 6000 )%400

I am not sure how accurate the result is, and I have tried using other methods too

but recently I found a post comparing sympy to numpy and it seems someone

is claiming that sympy can return superior precision results, can anyone confirm

that this is true and do you know if this would be a good solution to run on my system?

Link with info comparing the below is shown ;

how set numpy floating point accuracy? - Stack Overflow

In normal numpy use, the numbers are double. Which means that the accuracy will be less than 16 digits. Here is a solved subject that contains the same problematic ...

If you need to increase the accuracy, you can use symbolic computation .... The library mpmath ... is a quiet good one. The advantage is that you can use limitless precision. However, calculations are slower than what numpy can do.

Here is an example:

# The library mpmath is a good solution

>>> import sympy as smp

>>> mp = smp.mpmath

>>> mp.mp.dps = 50 # Computation precision is 50 digits

# Notice that the difference between x and y is in the digit before last (47th)

>>> x = smp.mpmath.mpf("0.910221324013388510820732335560023784637451171875")

>>> y = smp.mpmath.mpf("0.910221324013388510820732335560023784637451171865")

>>> x - y # Must be equal to 1e-47 as the difference is on the 47th digit

mpf('1.000014916280995001003481719184726944958705912691304e-47')

You can't do better with numpy. You can calculate exponentials with a better accuracy.

smp.exp(x).evalf(20) = 2.4848724344693696167

how set numpy floating point accuracy? - Stack Overflow

https://github.com/sympy/sympy/releases

Welcome to SymPy ]]>

I'm a newbie to Python and still learning the basics!

I am trying to write a simple python script that I can

run from the Python3.4 command line.

What I would like to be able to do is have the script prompt

the users for four numeric outputs, then once the fourth input

is made the script runs a simple numpy formula, computes

and then spits out two resultant values to screen.

I only know very little python code but I understand language

basics, the algorithm is shown roughly below - if anyone could

show me how to structure this properly with working python code

I would honestly appreciate it very much! :)

See below ;

X = any numeric value between 1000 to 6000

Y = any numeric value between 1 to 5000

Xb = any numeric value between 1000 to 6000

Yb = any numeric value between 1 to 5000

For X, Prompt for entry with text ; Enter value for X

input X from console and store

For Y, Prompt for entry with text ; Enter value for Y

input Y from console and store

For Xb, Prompt for entry with text ; Enter value for Xb

input Xb from console and store

For Y, Prompt for entry with text ; Enter value for Yb

input Yb from console and store

import numpy as np

>>> Y * ((np.longdouble(1.4142))** X )%400

>>> Yb * ((np.longdouble(1.4142))** Xb )%400

print output to screen so that it shows something like this ;

>>>"Y gives = (display value)"

>>> Yb gives = (display value)" ]]>

I am currently a final year computing student at Staffordshire University. For my final module I am writing a report on Python frameworks and especially the Django framework. As part of this report I need some primary research and was hoping some people on this forum could take a couple of minutes to complete the following survey.

Python Frameworks Questionnaire

Any replies would be greatly appreciated.

Many thanks. ]]>

For example:

x= "hello"

print x.upper() ]]>

import math

print math.sqrt(25)

I get an error message:

Last login: Fri Mar 25 01:48:48 on ttys001

/var/folders/92/n0xpf5ld4nj8cfwr3f5ky9dr0000gn/T/math-480577894.445.py.command ; exit;

Waffle-MacBook-Air:~ waffle$ /var/folders/92/n0xpf5ld4nj8cfwr3f5ky9dr0000gn/T/math-480577894.445.py.command ; exit;

Traceback (most recent call last):

File "/Users/waffle/Dropbox/myprojects/python/math.py", line 1, in <module>

import math

File "/Users/waffle/Dropbox/myprojects/python/math.py", line 2, in <module>

print math.sqrt(25)

AttributeError: 'module' object has no attribute 'sqrt'

logout

Saving session...

...copying shared history...

...saving history...truncating history files...

...completed.

[Process completed]

But if I run in IDLE, it works.

Just cannot figure out why I cannot import the math module from TextWrangler.

Any suggestion is very much appreciated! Thank you! ]]>

]]>

I need this code running asap. Idk what to do to fix it.

import random

gamerun = 1

playername = 1

roundask = 1

topicchoice = 1

question = 1

answered = []

count = 0

p1score = 0

p2score = 0

restart = 1

while gamerun == 1:

playername = 1

roundask = 1

topicchoice = 1

question = 1

answered = []

count = 0

p1score = 0

p2score = 0

restart = 1

rounddone = 1

p1 = input (' What is your name?')

p2 = input (' What is your name?')

while roundask == 1:

roundchoice = input('How many rounds would you like to play?')

if roundchoice == '1':

roundchoice = 1

roundask = 0

elif roundchoice == '2':

roundcount = 2

roundask = 0

elif roundchoice == '3':

roundchoice = 3

roundask = 0

else:

print ('You can choose 1, 2 or 3 rounds')

while rounddone <= roundchoice:

while topicchoice == 1:

choice = input ('topic choices are: Animals, Sports Brands and Sports ')

if choice == 'Animals':

topic = open ('Animals.txt', "r")

topicchoice = 0

elif choice == 'Sports Brands':

topic = open ('Sports Brands.txt', "r")

topicchoice = 0

elif choice == 'Sports':

topic = open ('Sports.txt', "r")

topicchoice = 0

else:

print (' Please choose a valid topic ')

turn = (random.choice([p1, p2]))

while question < 5:

print ("it is",turn,"'s turn" )

playeranswer = input (' Make a guess! ')

for line in topic:

if playeranswer in answered:

print ('Answered')

elif playeranswer in line:

print ('Correct!!')

question = question + 1

count = count + 1

answered.append(playeranswer)

else:

print('Incorrct!!')

if turn == p1:

p1score = p1score + count

turn = p2

count = 0

elif turn == p2:

p2score = p2score + count

turn = p1

count = 0

if turn == p1:

p1score = p1score + count

turn = p2

count = 0

rounddone = rounddone + 1

elif turn == p2:

p2score = p2score + count

turn = p1

count = 0

rounddone = rounddone + 1

while restart == 1:

askreplay = input ('Would you like to play again?')

if askreplay == 'yes':

restart = 0

elif askreplay == 'no':

restart = 0

gamerun = 0

else:

print('yes or no')

This is an assignment I have to hand in pretty soon, and it's really hard for my level so I'm having difficulties running it, if someone could help me it'd be much appreciated. Thank you :)

Purpose/Details:

In this game you are to load a series of categories and responses based on topic. The player is then given a topic and asked to pick the top 5 responses if they get one incorrect the opposing player may guess. This continues until all 5 responses are found. The player with the most responses wins.

The game must read in the categories and responses from a specified text file. It should then allow players to enter their name and select up to 3 rounds. At the end it declares a winner.

You can use any programming language you are familiar with to complete part 3. ]]>

Heres the code with the algorithm:

Code:

`"""`

lab1.py

Lab #1

CSC1570

This program mimics interaction with a user.

Algorithm:

Set CARPET_COST to 1.20

Set ADD_MAT_COST to .33

Set LABOR_RATE to 18.00

Set MARKUP to 2.25

Output “Please enter the total dimensions of the room (without cutouts):”

Output “Width: ” Store input as width

Output “Height: ”

Store input as height

Output “Please enter the total number of cutouts: “

Store input as cutouts

Set totalArea to width * height

Set laborHours to totalArea / 10 * 15 / 60 + 4 [Note: round up to nearest sq ft increment]

Set laborCost to laborHours * LABOR_RATE

Set matCost to totalArea * (CARPET_COST + ADDCOST ) * MARKUP

Loop for count = 1 to cutouts

Output “Enter the dimensions of Cutout #count: ”

Output “Width: ”

Store input as width

Output “Height: ”

Store input as height

Set cutArea to width * height If cutArea >= 80 then

Set matCost to matCost - cutArea * (CARPET_COST + ADD_MAT_COST ) * MARKUP

Otherwise if cutArea >= 10 then

Set matCost to matCost – ( cutArea * CARPET_COST) * ( MARKUP – 1 )

Set matCost to matCost – ( cutArea * ADD_MAT_COST) * MARKUP

Else:

Set matCost to matCost – ( cutArea * CARPET_COST) * ( MARKUP – 1.5 )

Set matCost to matCost – ( cutArea * ADD_MAT_COST) * MARKUP

Set totalArea to totalArea – cutArea

Output “Cost estimate:”

Output “Carpeted area:”, totalArea

Output “Total labor hours:”, laborHours

Output “Total materials cost:”, matCost

Output “Total cost:”, ( matCost + laborCost )

by the author of the program: (7). “

"""

__author__ = "Chris Jozwiak"

carpet_cost = 1.20

add_mat_cost = .33

labor_rate = 18.00

markup = 2.25

print ("Please enter the total dimensions of the room (without cutouts):\n")

width = int(input("\tWidth: "))

length = int(input("\tLength: "))

cutouts = int(input("Please enter the total number of cutouts:"))

total_area = width * length

labor_hours = total_area // 10 * 15 // 60 + 4

labor_cost = labor_hours * labor_rate

mat_cost = 0

for count in range(0, cutouts + 1):

print("Enter the dimensions of Cutout ", count)

width = int(input("Width: "))

length = int(input("Length: "))

cut_area = width * length

if cut_area >= 80:

mat_cost = mat_cost + 0

print ("1")

elif cut_area >= 10:

mat_cost = mat_cost + (cut_area * carpet_cost)

print ("2")

else:

mat_cost = mat_cost + (cut_area * carpet_cost) * (1.5)

print ("3")

print (cut_area)

print (total_area)

total_area = total_area - cut_area

print (mat_cost)

mat_cost = mat_cost + total_area * (carpet_cost + add_mat_cost) * markup

print (mat_cost)

print (total_area)

print("Cost estimate:")

print("Carpeted area", total_area)

print("Total labor hours:", labor_hours)

print("Total materials cost:", mat_cost)

print("Total cost:", (mat_cost + labor_cost))