Home >


  • Correcting for offsetMay 21

    I have a shape file with RTK measurements as a line feature, which more or less corresponds with visible features in a raster layer (shaped as lines). These measurements however are not accurate enough, they show about a 1-3 m offset with the feature

  • Reading cell array of vectors with h5pyMay 10

    I have a data stored in .mat files, each .mat contains a cell array of vectors of length ~70. I'm trying to read these .mat files in to Python with h5py, but reading just 1000 cells takes about 7 seconds, and I have in total about 10^8 cells to read.

  • How to create a monkey patch of a method inside a method? May 6

    A 3rd party library we use contains a rather long function that uses a nested function inside it. Our use of that library triggers a bug in that function, and we very much would like to solve that bug. Unfortunately, the library maintainers are somew

  • Python: architecture implications of using external subprocess or APIApril 20

    I maintain a Python 3 package (ocrmypdf) that works with other programs primarily by making subprocess calls. This is partly for historical reasons – it is shell script that grew up. I have since added the amazing CFFI to access a C library that does

  • How to convert "ASCII" to "hex" in pythonApril 3

    How to convert "ASCII" to "HEX" in python i have one file need to read . but use below code it only can show ASCII with open('Hello.DAT','rb') as f: data= f.read() print(data) it can print data information like this 0120160218000002000

  • I can't get my first else statement to print its output and even though it is simple i'm stuck, please show me how to solve thisApril 3

    score = int(raw_input('Enter a score: ')) if score >20: print 'You achieved an A' else: if score <=10 and score >= 19: print 'You achieved a C' else: if score <10: print 'You failed' --------------Solutions------------- This condition if score

  • Multithreading : defining thread as a classMarch 31

    I have the following program that I wrote to implement thread as a class. import threading import time class MyThread(threading.Thread): def __init__(self,i): threading.Thread.__init__(self) self.i=i def prints(self): while(self.i>0): print "i=&qu

  • How to find unique elements in a list in python? (Without using set)March 10

    Write a function that accepts an input list and returns a new list which contains only the unique elements (Elements should only appear one time in the list and the order of the elements must be preserved as the original list. ). def unique_elements

  • Pack 4 chars into an int (Python)?March 8

    Is it possible to pack 4 chars into an int in python and have it be represented as one value in a bytearray? I'm looking into packing it into a struct, but run into an error if I try something like characters = b'abcd' struct.pack('i',characters) ---

  • Simplegui installationFebruary 18

    So... 1) sudo apt-get install python-setuptools 2) sudo apt-get install python-tk 3)sudo easy_install simplegui But the 3rd step doesn't work for me...it says this. Searching for simplegui Reading https://pypi.python.org/simple/simplegui/ No local pa

  • Pattern for requests with long response times?February 8

    We are currently maintaining a homegrown python "web server" where generating the response for some requests can take a very long time mostly due to heavy computations - these requests are basically posts with very long timeouts (think minutes t

  • Python: making a graph of lists [on hold]January 16

    I have this csv file which contains data. It is an upper triangular matrix in the case that the diagonal and all values below the diagonal are zero, the others are positive. I converted this csv file to a list of lists. Now I want to create a weighte

  • Multiple terminals, multiple commands, lxterminalJanuary 9

    I am working with Python. Writing a script, I am attempting to use os.system() to open a new terminal, create new tabs and run different commands in each respective tab (which appear to run simultaneously). I am familiar with gnome-terminal as it is

  • Resolving ascii codec can't decode byte in position ordinal not in rangeJanuary 8

    I've seen all of the other posts and done quite a bit of research but I am still scratching my head. Illustrating the problem: $ python Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type "help", "copyright", "

  • How to make a turtle object look at where the mouse has clickedJanuary 7

    I want a program so that the turtle goes to where you click. So far I have this: from turtle import * screen = Screen() turtle = Turtle() screen.onscreenclick(turtle.goto) But the problem is the turtle object just stays facing in the same direction.

  • How do I downgrade sdl_image to 1.2.10?January 6

    I am using pygame to try and make a game. The graphics do not show up right and are distorted. I am using OSX El Capitan. People say that there is a bug that happens on El Capitan. The solution is to downgrade sdl_image to 1.2.10, which is what a lot

  • Response from before_requestJanuary 6

    In my app I am trying to check if user is authorised to access the resource, for example when user requests to url api/proxy. I use before_request to call checking function @hook('before_request') def check_permission(): securityService = SecuritySer

  • python - custom contextmanager decorator for with statementDecember 6

    here's the code... There must be some errors, cause, even though the code seems to work as I want, testing it, the decorated function resulted up to 30 time slower than the original. Decorator: import wrapt @wrapt.decorator class custom_with(object):

  • Jaccard Distance calculation using pdist in scipyDecember 4

    import scipy.spatial.distance as dist Y=[[1,2,3],[2,3,4]] Q=dist.pdist(Y,'jaccard') print Q The following snippet gives jaccard distance as 1 while it should be 0.5. On the other hand if Y=[[1,2,3],[4,2,3]] i.e if ordering is changed output is 0.33.

  • Mapping topics to labels in pythonDecember 3

    I have a file of documents labeled as follows: 101 magical awards hosted two days ago 102 it was a good badminton game where each sides ended up in a tie 101 the awards were hosted by the actor who received critical acclaim for his movie 103 heavy ra

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 13 q. 0.370 s.