• kw

    I will be mentoring a gifted high school student with programming experience for 3 months, and I was hoping to get some feedback here on the most straightforward way for him to complete this goal:

    • First, an iPad/GoPro camera is used to record a video/still frames of a chemical reaction that result in bubble formation. I.e. at the beginning of the video you would see a blank background, and then later in the video a population of bubbles would exist and grow in size and number.

    • Then the iPad would be used to analyze and then to plot (# of bubbles) or (total bubble area) versus time.

    (we are limiting ourselves to an iPad to test the limits of on demand mobile analytics)

    Some strategies I have considered:

    1) Use Pythonista with supported matplotlib/numpy modules to analyze images.

    Pros: He learns to use Pythonista, the best mobile IDE (he has some experience with this already, I guess his HS has students download this)!

    Cons: Without scipy, I'm not sure that the image analysis that we will run across will be entirely possible with matplotlib/numpy. I'm also not sure what limitations we will run into with the pure python modules available in Pythonista.

    2) Program this analysis using a python IDE on a PC/mac and then use kivy or some other means to try and compile the code into a stand alone iOS app.

    Pros: Access to scipy and other image analysis packages that are already finished. We don't have to reinvent the wheel on particle counting.

    Cons: I imagine it might be a nightmare trying to successfully compile from python to a stand alone app... Maybe I'm wrong here?

    3) Program the entire thing in Obj C and Swift using X Code.

    Pros: He will get experience with an actual app development environment. We might be able to leverage the OpenCV framework.

    Cons: The learning curve might be too high to complete within the time frame.

    4) Set up a server on a windows PC that uses open source image analysis (ImageJ / Fiji) and use Pythonista to upload the relevant data (image/video) and initiate the off-site analysis.

    Pros: Decouples the image processing aspect from the mobile device used.

    Cons: Not sure where to look on how to connect a non-jailbroken iPad directly to a PC with bluetooth/WiFi and send it commands to initiate an analysis on the PC and have the PC send back results. This has to be done on an intranet decoupled from a shared WiFi network. Also, having a user connect to multiple wifi nodes would be a usability hassle (having to switch between the go pro and the PC/Raspberry Pi)

    Ideally this would result in an ultraportable analysis tool for this specific application of measuring a reaction rate that would simply require the user to record the reaction and press analyze (either within an IDE on the iPad, or a standalone app).

    Thanks for any feedback!


    posted in Pythonista read more
  • kw

    Hello community!

    I'm wondering if the following is possible:

    Can python generate a text file and send it to another app? (basically initiate the 'open in' prompt, or do it automatically, and let me choose which app to open the text file in).

    For those interested in what I'm trying to do:

    1. Use 'Get Console' App to collect serial data from equipment that is then copied to iOS clipboard

    2. Use 'Pythonista' App to take this unicode string of data and format it

    3. Open formatted data in 'Data Explorer' which accepts *.txt files

    I'm trying to see if going from 2 to 3 is possible through Pythonista.

    Thanks so much for your help!

    posted in Pythonista read more
  • kw

    Fun possibility?

    matplotlib + (lightning to serial adapter) + pyserial + equipment = real time data streaming/plotting?

    This is that cable: http://redpark.com/lightning-console-cable-l2-rj45v/ , I have used it with get-console for data acquisition. Cool stuff!

    posted in Pythonista read more
  • kw

    You must program in complete silence :D :D

    posted in Pythonista read more
  • kw

    Don't answer this if you don't want to, but do you think it will be possible to interact with 3D graphics made by matplotlib?

    (maybe with scene kit? https://developer.apple.com/library/mac/documentation/3DDrawing/Conceptual/SceneKit_PG/Introduction/Introduction.html)

    posted in Pythonista read more
  • kw

    Can someone explain or point to how you can post highlighted/colored python code easily to this forum in Markdown? I tried using the < pre > and < code > tags, but it did not highlight colors. Thanks!

    posted in Pythonista read more
  • kw

    ccc is an excellent coder to have as part of the community :)

    posted in Pythonista read more
  • kw

    /me screams

    (I would make it an in app purchase so that we have ways of funding your development, the people that would use such modules can definitely support you :) )

    posted in Pythonista read more
  • kw

    Hi Community,

    In my efforts, I ran across the following problem: When I use <code>console.quicklook</code> to preview my generated csv file, the 'open in' button does not function for any apps except for the iOS mail client.

    <b>Observations:</b> All the icons appear, but when I touch them, it registers the touch and the menu goes away, but nothing happens (except for the mail client, which properly sends the generated csv as an attachment. The attachment can then be opened in the apps that were listed from safari, but this is a round about way).

    The first two lines of the CSV file it is working off of are here:


    11-23-13 06:26:18 622.80

    11-23-13 06:27:18 623.24</code>


    My code (forgive me for this, been working with python for a week :) ) is just attempting to find the time in seconds from the first event and create a new csv file that is formatted differently than the one listed above.



    csvfilename = time.strftime("%Y%m%d") + '_data.csv'

    with open(csvfilename,'rbU') as csvfile:

    reader = csv.reader(csvfile,delimiter='\t')
    new_date_list = [] 
    new_val_list = [] 
    for row in reader:
        #create new lists that will be turned into a csv later

    update_del = [] #list for timedelta objects

    for i in range(len(new_date_list)):

    date_object = datetime.datetime.strptime(new_date_list[i], '%m-%d-%y %H:%M:%S')
        #creates a timedelta object (difference between two date objects)    
    deltimeobj = date_object - 

    `` datetime.datetime.strptime(new_date_list[0], '%m-%d-%y %H:%M:%S')


    #generates a new csv file

    with open( time.strftime("%Y%m%d") + 'w'+ '_data.csv','wa') as csvfile:

    writer = csv.writer(csvfile, dialect='excel')
    for i in range(len(new_date_list)):

    out_file_name = time.strftime("%Y%m%d") + 'w' + '_data.csv'

    msg = ' Tap "send" icon at right of titlebar to "Open In" another app. '
    console.hud_alert(msg, 'success', 3)


    This code results in a csv file that can be opened only in the mail client, which I then email to myself, open in safari and then open in 'Graphical' by vernier (for example, many other apps open csv files.)

    In this example, Graphical by Vernier (and every other app that supports csv files) shows up as an 'open in' option but when touched does not register any action.

    Any thoughts would be appreciated :)

    posted in Pythonista read more
  • kw

    I don't know of an easy way, but I am new to Python ;p

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!