Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Magical math

I was reviewing linear algebra and vector math in general and I do grasp that vectors can easily be used for area or volume, and the comparison to doing it with lines is a somewhat improper comparison. In the case of vectors or matrices there are points that relate to each other in Cartesian space , whereas intersecting lines with known length must also have an angle to put the entire situation in a usable form to compute area or volume. Vectors have more information than lines of known length. It just seemed odd that two different MIT professors thought that vectors were easier than angles and lines, because one has more information than the other and it requires an additional measure to produce a vector coordinate.

The main point of this is to test my mail checker python script and so I had to devise something to complain about that at least had some vague meaning, though that has not stopped me in the past from posting utter gibberish. The core of the mail test is below and I use a dictionary and pickle to save it with the file and its associated size. When mail is received, the indicator is triggered and speaks, and stays on the screen with a specific associated image for each mail received. I just wanted a way to know when important mail arrives when I am studying and also if I am out, then I can see on the screen if something has happened while I was gone.


def checkMailSize(ipath): global rebuild name=os.listdir(ipath) for named in name: try: if notify[named] != -1: newfile=ipath+"/"+named if notify[named] == os.path.getsize(newfile): pass else: ping=named+'.png' pong='Mail from '+named+' received' p=subprocess.Popen(['/usr/bin/display', ping ]) p=subprocess.Popen(['/usr/bin/espeak', '-v', 'en+f3' ,'-p', '65', '-s', '130', '-a', '60', '-g', '6', '-k20', pong ]) print strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()) time.sleep(3) rebuild=1 except: pass

Take a swig of C with your python

From a tutorial on SWIG here, with some changes for my machine. The script is swigp.sh and needs to be chmod +x before use.

sudo apt-get install swig
locate -r "/Python\.h$"

The locate command uses option -r for regular expression and I am just a REGEX kind of guy so I used that.

#!/usr/bin/env bash
swig -python example.i
gcc -c example.c example_wrap.c   -I/usr/include/python2.6
ld -shared example.o example_wrap.o -o _example.so 
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import example
print example.fact(6)
exit()

This is a python program to further automate the process. I could add the line "python examplec.py" to my shell script.

motey@motey-desktop:~/Documents$ ./swigp.sh
motey@motey-desktop:~/Documents$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import example
>>> example.fact(5)
120
>>> exit()

This really makes it simple to add a little C code to the python. I was thinking about making a wxPython interface to my little ethernet / TCP / IP / AI spoofer and it seemed the lowest level interface would be messy in python and it just a small section anyway, so it seems reasonable to just code it in C and SWIG it. If I knew it was this easy, I would have done this long ago.

Taming pythons


motey@motey-desktop:~$ ls -l `locate matplotlib| grep pyc`

While considering matplotlib it seemed reasonable to indulge my laziness and apply my python skills. In this case I use wget to retrieve the python examples and then script them to run. The one at left is nice as it is an interactive plot and demonstrates control sliders. Sweet! The code could be cleaned up but again laziness dominates. In the process I discovered that some pyc modules should be refreshed due to some strange interactive complexity and so this shell one liner below solves that.


sudo python -c 'import pylab'
# -*- coding: utf-8 -*- funcy='python ' for child in soup.recursiveChildGenerator(): name = getattr(child, "name", None) if name is not None: if name == 'a': if '.py' in child['href']: if '#' not in child['href']: if '..' not in child['href']: z = webadd3+str(child['href']) print 'wget '+z else: z= string.replace(str(child['href']),'..',webadd2,1) print 'wget ' +z print funcy+os.path.basename(z)

It is a beautiful soup, but it tastes like python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from BeautifulSoup import BeautifulSoup
import re

doc = ['<html><head><title>Page title</title></head>',
       '<body><p id="firstpara" align="center">This is paragraph <b>one</b>.',
       '<p id="secondpara" align="blah">This is paragraph <b>two</b>.<pre>Preish</pre>',
       '</html>']
soup = BeautifulSoup(''.join(doc))

print soup.prettify()
titleTag = soup.html.pre
print titleTag
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from BeautifulSoup import BeautifulSoup
import re
if __name__ == "__main__":
 fo=open('wx.html','r').read()
 soup = BeautifulSoup(fo)
 k=1
 for cod in soup.findAll('pre','code'):
  print cod.string
  newf='zorf'+str(k)
  fp=open(newf+'.py','w')
  fp.write(cod.string)
  fp.close()
  k+=1
 exit(0)

My interest is not for scraping pages for pre formatted -code-, it is to search pages for reference to specific spectral frequencies that I associate with strange matter that does not occur naturally like graphene nanotubes, plutonium or some specific spectra combinations which I would associate with a strange matter configuration. These are just constructed tools that serve as a testable base for gathering and parsing generally.

Threading the snakes to make a universe

The point of this is to test PyCurl with an innocuous list of files. The unique addition to a PyCurl code that is a common example is the first quote. I just extracted the file name so I could name it the same on my computer. The web address is just and example that occurred to me when I was working through the GTK python stuff. The process is to write it to file with the address to get and then run the CurL code on that file with the number of concurrent threads I want to use for the bandwidth.

The ultimate goal is to automate all of the aspects of creating a 4 dimensional causal map of the universe from the data bases available. It becomes a lobe of Alice Infinity's brain. It takes an identity such as a star position, galaxy, black hole, GRB, imploding neutron star, collapsing dwarf or other object or effect and plots against the 4 dimensional map of the near universe and its intervening space. It then determines the causal relationship of the parts and further examines the relationship for anomalies. An example might be a massive sun spot which irradiates a planet or nebula and it is possible to get a spectral match for Plutonium. That would be an anomaly as it is not a naturally occurring compound in free space. I doubt that I would be that lucky ( and them that unlucky ) to see a planet with nukes that got zapped by a GRB or massive flare, but that is just one possible anomaly that serves as an example.

In addition it correlates the 4 space sequence from a hypothesized big bang to the present and maps the parametric as 1. expanding 2. static 3. decaying and so forth to identify the most likely fit for the data. This then comes out in the end as something like "Hey look at 30° up 15° right, there is %s there!" % ('Plutonium') and "The data provides 80% likely undefined Universe scale."

    bn= os.path.basename(url)
#!/usr/bin/env python # -*- coding: utf-8 -*- """Extract list of URLs in a web page""" from sgmllib import SGMLParser class URLLister(SGMLParser): def reset(self): SGMLParser.reset(self) self.urls = [] def start_a(self, attrs): href = [v for k, v in attrs if k=='href'] if href: self.urls.extend(href) if __name__ == "__main__": import urllib usock = urllib.urlopen("http://www.pygtk.org/pygtk2tutorial/examples/") parser = URLLister() parser.feed(usock.read()) parser.close() usock.close() fo=open('urls.txt','w') for url in parser.urls: if '.png' in url or '.jpg' in url or '.tif' in url or '.xpm' in url : fo.write('http://www.pygtk.org/pygtk2tutorial/examples/') print url fo.write(url) fo.write('\n') fo.close()

A python explains itself in detail

Getting smarter makes me feel stupid, but now that I know, I must be smart again, right?

I could have done all of this with a single Python built-in function. "help(os)". So now I am stupid->smarter.


# -*- coding: utf-8 -*- import os #This is used as such: # python this.py>next.py # python next.py>osfunk.txt print "import os" def ossy (): for i in dir(os): if i[1]!='_': if i[1]>'Z': t=str(i) print "print '----- %s ---'" % (t) print "print os."+i+".__doc__" print "print " ossy()

The point of the code is to create a program that creates a file. This only creates a text file, however the complete program creates an indexed HTML document that allows me to auto document the functions in a specific module of interest using HTML tags. In the second stage of this it creates a file with elements as such:

----- chdir ---
chdir(path)

Change the current working directory to the specified path.

Python is a wonderful tool to learn

The tutorials at TuxRadar are really simple to follow and it is surprising how much can be done with python + gtk + webkit in just a few minutes.



# -*- coding: utf-8 -*- #/usr/bin/python from xml.dom import minidom import urllib import gtk rss="http://www.tuxradar.com/rss" connection=urllib.urlopen(rss) feed=minidom.parse(connection) connection.close() items=feed.getElementsByTagName('item') len(items) item=items[0] print item.childNodes[0].nodeName print item.childNodes[1].nodeName print item.childNodes[2].nodeName print item.childNodes[3].nodeName print item.childNodes[1].childNodes[0].data window=gtk.Window() window.show() window.set_title("RSS FEED") vbox=gtk.VBox() window.add(vbox) textview = gtk.TextView() vbox.pack_start(textview) vbox.show_all() buffer=textview.get_buffer() vbox.remove(textview) combo=gtk.combo_box_new_text() vbox.pack_start(combo, False) for item in items: combo.append_text(item.childNodes[1].childNodes[0].data) vbox.pack_start(textview) print combo.get_active() window.show() vbox.show_all() wait=raw_input()

Keeping my brain warm by thinking

The source for arandr is python code and should be a breeze to modify. It uses gtk and looks pretty straight forward in structure. I mainly wanted to know the hot key assignments so I could play a little song ( not really a song per se , and not even audible, but a compilation of effects ) on the interface and see what it does. It is odd how much stuff was sold by Philip Kindred Dick's estate and I am betting he didn't get much use of that money when he used to be dead. Now I feel obliged to read the entire biography as it includes the fact that Ursula Le Guin was somehow related tangentially. I will let PKD craft a revue of the python code. The arandr source is obtained my usual ways by :



sudo apt-get source arandr

#!/usr/bin/env python """Run ARandR GUI""" from screenlayout.gui import main main()

The complete main arandr script is above and some look about below.

motie$ locate arandr /usr/bin/arandr motie$ ls -lA /usr/bin/arandr -rwxr-xr-x 1 root root 81 2009-12-21 13:41 /usr/bin/arandr motie$ file /usr/bin/arandr /usr/bin/arandr: python script text executable motie$ cat /usr/bin/arandr #!/usr/bin/python """Run ARandR GUI""" from screenlayout.gui import main main()

Many ways to skin a spider


As a natural progression from MD2, I looked into MD3 format and I found a windows program called MD3view done in C++. It was scary. It shows how evil C++ can be if you combine it with windows. It is like taking a mutagen and applying it to the evil beast. I looked at the source and found "DWORD" defined as a data type and when I was done washing my eyes with sulfuric acid, I decided to take a different approach. I got some python scripts for MD3 and used blender import and export. It was clean and quick and UV unwrap, texturing , and changes were a matter of minutes. So rather than redesign the world for every application. I reused all the utility of blender and the versatility of python. It is easy and mainly I just wanted to investigate the way in which it was structured and how the vertex animation was accomplished.

Zim Zim Python Python Fix Fix

I recently upgraded to Ubuntu/Kubuntu 10.04 and it comes with some changes. Zim wiki is now completely python and much faster and clearly cleaner and more attractive. Thunderbird 3 is also very nice. Upgrade went easily, but some questions were difficult, like: "The quantum entanglement of multiple simultaneous realities has caused a Gamma Ray Burst, continue, Yes or No".

It seems that the equation references in Zim are slightly different and so I devised this little tidbit to bring harmony back to the universe of Zim, Zimpy, and perhaps python itself. The point of this is to take {{./Dir/equation_xx}} and convert it to {{./equation_xx}}. I could have used grep, sed, awk or C, but python is a clean language and I think it is more understandable when viewed by others.

#!/usr/bin/python
# -*- coding: utf-8 -*-

import os.path
import sys

# If there is more than one reference on a line in the Zim it will require that the script be run once for each level. 
#I could just iterate a few times, but it is easy enough to hit up arrow in terminal and run again
#I am also limiting the location to within media just to make sure it doesn't go awry in my root directory
#This is GPL code if you have any question what that means : 
#         Return to your home planet and never visit Earth again!!
#Use at your own risk, code provided as example only
fileScan=0

def doall(aDir,anExt):
 name=os.listdir(aDir)
 allScan=0
 global fileScan
 for named in name:
  if named.find(anExt) != -1:
   (jbase,jext)= os.path.splitext(named)
   allScan=allScan+fixequations(jbase,aDir) #t or not determines if it really does something
   fileScan=fileScan+1
 return allScan
 
#Just list the files that would be changed
def fixequationst(thebase,adir):
 print "Fixing ",adir," file ",thebase+".txt"
 return 1
 
def fixequations(thebase,adir):
 allScan=0
 thename1=thebase+".txt"
 thename4=thebase+"UNIQUEOLD.txt"
 thename2=thebase+"UNIQUENEW.txt"
 handle=open(adir+"/"+thename1,"r")
 handlew=open(adir+"/"+thename2,"w")
 aline="something"
 while aline:
  aline=handle.readline()
  if aline.find("media") != -1 and aline.find("{{") != -1 and aline.find("}}") != -1 and aline.find("equation") != -1:
   token4s=aline[aline.find('{{/media')+2:aline.find('equation}}')+8]
   if token4s != -1  and  aline.find('{{/media')+2 < aline.find('equation}}')+8 : 
    (jbase,jext)= os.path.splitext(token4s)
    jext2=jext.split("?")
    newr= aline.replace(token4s,"./"+os.path.basename(jbase)+jext2[0][0:]+"?type=equation")
#    print newr,token4s,thebase,adir #This would allow progress monitoring of changes
    handlew.write(newr)
    allScan=allScan+1
   else:
    handlew.write(aline)
  else:
   handlew.write(aline)
 handle.close()
 handlew.close()
 os.rename(adir+"/"+thename1,adir+"/"+thename4)
 os.rename(adir+"/"+thename2,adir+"/"+thename1)
 os.remove(adir+"/"+thename4)
 return allScan
 
def scanDirs(ipath,theExt):
 filesChecked=0
 thisext=theExt
 thisdir=ipath
 filesChecked=filesChecked+doall(thisdir,thisext)
 return filesChecked
 
#------- This is where it does something ------
pathsScanned=0
allScan=0
filesChecked=0
if len(sys.argv) > 2:
 InputDir=sys.argv[1]
 x=os.path.exists(InputDir+"/Home"+sys.argv[2])
 y=os.path.isfile(InputDir+"/Home"+sys.argv[2])
 if x==True and y==True:
  print "Scanning"
  for root, dirs, files in os.walk(InputDir):
   for onedir in dirs:
    path = os.path.join(InputDir,root, onedir)
    filesChecked=filesChecked+scanDirs(path,sys.argv[2])
    pathsScanned=pathsScanned+1
 else:
  if x==False:
   print InputDir+" does not exist and returns "+str(x)+" when checked."
  if y==False:
   print InputDir+"/Home.txt is not a file and thus "+InputDir+" is not a Zim Wiki location. And when checked returns "+str(y)
else:
 print "Input arguments::"
 print sys.argv
 print "This requires base directory containing Home.txt and a limit on file types like: .txt"
 print "It must be invoked with python also as it requires 3 arguments."
 print "Example would be:"
 print "\"python FixZim.py /someplace .txt \""

print "Number of paths scanned is "+str(pathsScanned)+" and references changed is "+str(filesChecked)+" in "+str(fileScan)+" files."

Mixing math methods

Further refinement of the idea of transporting equations to action, surfaces and demonstrations in blender.

Blender allows python scripts to be transported with the blend file and can produce movies with sound and animation. It is the perfect vehicle for carrying function with data.

The simplest space

The file is a k3d surface file and the image is with conditional boundaries spaces and with surface normals. The file extension is k3ds. I have been working at resolving the sqrt(-1) as it is extended into all mathematics. There is a different perspective to all this that is less contradictory, and allows an easy progression to higher space, but it is like learning math from the ground up in a new way. It doesn't bother me as I switch from language to language all the time in programming and on the net. Sadly, this is the simplest common denominator that I can create and even this is not the whole picture. I have started doing Python in blender to allow things that are only available in other packages like numpy and even gimp or inkscape. The image is of some related surfaces that also have connectivity between them and so this is another dimension and this is just the relationship of three dimensions. I can select surfaces in the 3D space and use them in blender to analyze and comprehend the complex functional space of a signal, gravity, or system.


Name:motey /* Author: motey */ F():(x/y)*(x+y)+ (y/x)*(x+y)+ (x+z)*(x/z)+ (z/x)*(x+z)+ (z/y)*(z+y)+ (y/z)*(y+z)- 15*(cos(x)+ cos(y)+ cos(z)) [x]: -pi , pi [y]: -pi , pi [z]: -pi , pi Cnd: (x^2 + y^2 > 3.14) & ( x+y+z > -3.14) ;

When the matrices are included in this it becomes even more complex and this is the foundational relationship of numerical space or measured space and sets.

It is very complex and the rule sets are complex. I see no way to resolve it to anything less simple, in fact it must be 4 infinities more complex than this just to deal with common perception.

There is quite a bit of overlap in the packages, but it seems that Python is the common denominator which can integrate them all. Perl and CPAN is another, but Perl is a little trickier and somewhat obtuse. Python seems to be structured well enough to be understandable, though it lacks speed. This is where the libraries help.

I suppose I will use the blender template with python to integrate all of the math and graphics. It has 3space and time incorporated in the design and so is closer to the manipulation of S3 in S3 and T2 in T2, but that is as close as 3 infinities, but there seems no better way to deal with it or allow visualization.

G and c fall out as it is applied to charge space and so it gives a coherent expansion of the possibilities for matter from the lowest elements to the combinations of them.

An interesting correlation is the nature of information itself and that relationship to the DNA pair AT and also GC. I could say that a specific temperature that GC is boundary and AT is open and thus the combinations of ATn are the information in the same way that 0s and 1s are the foundation of binary logic.

The TED talk by Michael Shermer is very entertaining and it is an interesting equation that deals with Type 1 and Type 2 errors when Type 2 is fatal. It is worth viewing. It does get to the heart of superstition. I would add that superstition and craziness can be a survival parameter in the same way that randomness can be applied to war games to get advantage. Just because some people are illogical and insane does not mean they are absolutely destined for a Darwin award, and in fact the crazy guy and his wife who hide in a cave could be the founder of a new race if there is a global calamity that makes them selected. It seems that there is an underlying survival mechanism that is explored in the "Mote in God's Eye" and that is the "Crazy Eddie" hypothesis. And the moties is the origin of the pseudonym motey that I often use.

This bodes well

A hole in a black hole, that does happen. As I said before, if two black holes collide, at the intersect tangent is a very odd effect where the "event horizon" is dissolved. As a result the inside becomes the outside for some period of time. This is true of any externally applied distortion. In the tangent space of the event horizon is another state that would exist for some time. So I am talking about time in time and so what is (m·L2/t2)·(t=time)2? The event horizon of a black hole would hardly be static and I suppose ( possibly incorrectly ) that the events at the horizon would be mirrored in its effect and are thus measurable in x-ray, and light. It seems there should be a transform that I could apply to x-ray data from the Milky Way galaxy x-ray survey to view half of the boundary. This is why data is so important and conclusions on data are merely an obfuscation.




set terminal svg enhanced size 875 1250 fname "Times" fsize 25 set terminal postscript enhanced portrait dashed lw 1 "Helvetica" 14 set output "bode.ps" G(w,n) = 0 * w * n + 100000 # 1 / (sqrt(1 + w**(2*n))) dB(x) = 0 + x + 100000 # 20 * log10(abs(x)) P(w) = w * 0 + 200 # -atan(w)*180/pi set grid set logscale x 10 set logscale y 10 set nokey #0.1,-25 set style line 1 lt 1 lw 2 set style line 3 lt 3 lw 1 set style arrow 3 nohead ls 3 set style line 4 lt 4 lw 1 set style arrow 4 head filled size screen 0.02,15,45 ls 4 set style line 2 lt 2 lw 1 set style arrow 2 nohead ls 2 set multiplot set size 1,0.5 set origin 0,0.5 set xrange [0.001:1000] set yrange [0.001:100] #set yrange [-50:150] set xtics 10 set ytics 10 set mxtics 10 set mytics 10 set ylabel "Gain" plot dB(G(x,1)) ls 1 title "1st-order response" set size 0.967,0.45 set origin 0.033,0.05 unset logscale y set yrange [-285:105] set ytics 45 set mytics 3 set xlabel "Frequency" plot P(x) ls 1 title "Phase response" unset multiplot

It works generally, but I think I have something wrong here.[SOLVED], decided to use matplotlib, scipy, numpy, numarray with python, which is often easier to apply.

More advances on weather


cd /home/motey/bin
python webkit2png.py http://www.nws.noaa.gov/>page1.png
echo -ne "Page 1"
convert -crop 416x242+261+258 page1.png map1.png
python webkit2png.py http://www.weather.gov/sat_tab.php?image=ir>page2.png
echo -ne "Page 2"
convert -crop 517x378+140+299 page2.png map2.png
python webkit2png.py http://www.weather.gov/forecasts/graphical/sectors/>page3.png
echo -ne "Page 3"
convert -crop 517x375+147+275 page3.png map3.png
python webkit2png.py http://www.weather.gov/forecasts/wfo/supplementalpages/view_image.php?image=../images/dmx/MaxT1_dmx.png>page4.png
echo -ne "Page 4"
convert -crop 427x505+199+140 page4.png map4.png
python webkit2png.py "http://forecast.weather.gov/MapClick.php?lat=41.48389104267175&lon=-93.372802734375&site=dmx&smap=1&marine=0&unit=0&lg=en&FcstType=graphical">page5.png
echo "Page 5"
convert -crop 810x1048+70+354 page5.png map5.png
display map1.png & display map2.png & display map3.png & display map4.png & display map5.png
ps

Ultimately I will merge the data to textures and incorporate them as a room in the caves of reason. Above is the latest script and I like the graphing they do as it seems to be done with gnuplot, but since it is the gubmint it is more likely they are paying Microsoft ( with my money ) for something that is available free. Mickey Microsoft knows how to make money for nothing, that is for sure. The sad thing is that the government we own is in cahoots to help them rob the people they are "supposed" to serve.

Interfacing C and Python using SWIG

In this test I use 4 files to show how this process works.

  1. module.c
  2. swigtest.py
  3. Makefile
  4. myso.i

Makefiles need to have a TAB on the line after the colon and that is odd, but that is just the way it is. The file that does all the work is Makefile which contains this:

all: swig -python myso.i gcc -fpic -c module.c myso_wrap.c -I/usr/include/python2.6/ gcc -shared module.o myso_wrap.o -o _myso.so

The control file for SWIG is myso.i and contains this:

%module myso extern void indicate_link(const char* passedString);

The C code is in module.c and contains this:

#include <stdio.h> void indicate_link(const char* passedString) { printf("STD C interface - passed string = %s.\n", passedString); }

The python file to test this is swigtest.py and contains this:

#!/usr/bin/env python import _myso _myso.indicate_link(' Successful Swig and C and Python test')

The whole process is then done by typing make, and then ./swigtest.py

The methods of interfacing languages varies and this is just one way.

Many other things need to be known and chmod +x swigtest.py is one. Also you may have to sudo apt-get install swig.

Zimming the Wiki with Link maps

So I am doing a bad thing that could bite me later, but I wanted to get ahead of things a bit. I got the debian for the new Zim, which is Python based and so I installed that. I have looked through the code a bit. Everything seems to work the same and I have no problems with functions. The Link Map is new and that is interesting, but seems to be a WIP. Great work all in all. I can program in perl, but actually I find it clumsy and cryptic and more difficult to read, after using Python more.

Actually I don't see how it could bite me as I have been in all the modules and it is much easier to understand structure with Python than perl. It was a good choice to upgrade this. Well done. It seems a bit more polished, intuitive and smoother while still keeping the speed up. It responds much better and just seems less clunky.

This is version 0.46 and it is WAY faster after the PY code gets compiled the first time and beats the interpreted perl by a factor of 10 or more. Total win. Code looks great too and is well formatted.


The new Google search is just what I needed to pair search terms I hope, anyway it is good for links and that helps too. That search return is for aliens, so it gets a better layout sometimes than the tag cloud.

Blender object structure


verts = [] faces = [] vec=Vector(1,0,0) verts.extend([vec.x,vec.y,vec.z]) vec=Vector(1,1,0) verts.extend([vec.x,vec.y,vec.z]) vec=Vector(0,1,0) verts.extend([vec.x,vec.y,vec.z]) vec=Vector(0,0,0) verts.extend([vec.x,vec.y,vec.z]) faces.extend([0,1,2,3]) return verts, faces

This python code creates two groups which are vertices and faces. It is not elegant and not intended to be. This creates a single face using four corners and thus constitutes the simplest object that I can create to demonstrate how the interface is used to create more complex objects and models.


verts_loc, faces = add_face() mesh = bpy.data.meshes.new("FaceOfBoe") mesh.add_geometry(int(len(verts_loc) / 3), 0, int(len(faces) / 4)) mesh.verts.foreach_set("co", verts_loc) mesh.faces.foreach_set("verts_raw", faces) mesh.faces.foreach_set("smooth", [False] * len(mesh.faces)) mesh.update() ob_new = bpy.data.objects.new("FaceOfBoe", mesh) scene.objects.link(ob_new) ob_new.selected = True ob_new.location = scene.cursor_location

And an explanation of what the parts do.

verts_loc, faces = add_face() # as above procedure to create the elements mesh = bpy.data.meshes.new("FaceOfBoe") # create object to hold all the data mesh.add_geometry(int(len(verts_loc) / 3), 0, int(len(faces) / 4)) mesh.verts.foreach_set("co", verts_loc) mesh.faces.foreach_set("verts_raw", faces) mesh.faces.foreach_set("smooth", [False] * len(mesh.faces)) #add the items to that structure and set some attributes mesh.update() #bookkeeping ob_new = bpy.data.objects.new("FaceOfBoe", mesh) # create object structure to be placed in scene scene.objects.link(ob_new) #add that to the scene ob_new.selected = True #make it selected when done, optional ob_new.location = scene.cursor_location #it has to go somewhere so the cursor is a logical place Now blender has the data to display and use it.

I could just as well have meta code which interprets "Create a model that has 4 unique points at the corners of a square and add it to a scene". In this way I know what this method is doing and it abstracts the use further. All of the same things happen and it selects the points by its own code and by simply having a meta interface allows me to avoid remembering precisely what face.create.standard.sample,centered actually does. I would still have to create the code in this case, but in a more general case I can use the meta interpreter to select certain aspects which are mutable and apply those variations. I have used this method for 30 years. It was deadly slow in 1980 and is now usable. I would write code at the mock assembly level which was "Set variable owner of the data = 10". It is not ambiguous as the = sign and the first occurrence of "variable" and "set" are reserved. I could use the words "variable" and "set" in the name without conflict. The one thing that I could not do is name a variable with an = sign in it as that is the symbol which terminates name context. I intend to extend this syntax to make it completely unambiguous using unicode symbols to indicate and separate object names, actions and context. ⇒Maximum readability ⇐

By using the variable by name it allows the code to access variables in a way which is not compile time oriented and operations have nothing to do with the CPU.

One of the aspects of using blender or any other software is to get the general framework correct. At the start is a point or vertex which is a spatial position. This can be grouped with another vertex to represent an edge, and then a minimum of three connected edges makes a face. It is basic geometry of forms and space. The way in which the objects are stored accessed and manipulated is in some part determined by the software interface. By using Python, it is possible to determine what actions are available, how they are applied to the primitive elements and then create a procedure that either instantiates or modifies that object.

The dependencies are the ability to understand the geometry and topology of the forms and the ways in which they can be transformed. It also requires an understanding of the syntax and language structure to combine actions on objects so that a desired result is achieved.

There is advantage in having a solid framework to consider the matter. It is useful to see examples of how the interface is applied to achieve certain effects. However, the most important first step is to grasp the basics. When using Python there are basic data types which are common to all programming and some extensions. The primitives of the language and the primitives of the interface are the only way in which a result can be achieved.

The association of methods in programming and object structures in blender makes the entire process more clear and easier to extend. An example might be a list of vertices in a format that is x,y,z as the spatial location. A list. Python has methods that act on lists. An edge can be an association of members of a vertex list and is itself a list. The same holds true of faces. Once the objects become associated in more complex ways, it becomes necessary to understand how those objects are structured as data. Which elements or properties do they contain and what ways can they be manipulated.

It is not necessary to know the detail of how that is implemented and this is the style of object oriented programming. New members can be added to sets and it does not require a recompilation or changes to every reference. Python must handle the data types and methods in a consistent way, else it would no longer be python, but some other snake software. By dissolving the underlying structure and then reassembling it, I hope this makes the use of it simpler and more understandable to a person wanting to start generating results and needing a firm predictable place to start.

Whether you program to create product at the interface level by a series of actions or by a script, the end result is the same. By symbolically representing the underlying complexity it is possible to add another layer of abstraction which hides more of the implementation detail. By clicking add cube, a person is not required to know or care how the result is achieved. There are many levels of use and the level of interface is the most effective. The new interface exposes many more methods in a more intuitive fashion to a novice user and this is good. As a user of earlier versions it is a bump in the road.

Symmetry, names, quarks, charm and beauty

A new script from gimp and a chance to test the interaction of new elements. I have been looking at biology of embryonic development also. Something to remember if you are putting new scripts in gimp directories, they must be executable ( chmod +x ) or they will not get registered and used.

This image is a mixed symmetry and though the image hardly tells the story, each change and relationship between the symmetries and their effect on the product, told me a new thing. It is really strange because each thing seems to echo into every other understanding and whether it means anything or not, zona pellucida and corona radiata still interact in all the infinities.

An interesting thing that I stumbled across is the fact that anatomy and naming of body parts was so messed up in the 1500's that they had to almost start all over again. They must have settled on Latin, which I suppose is as good as anything, if the choice is learning twenty languages and then trying to mix them all to explain what a frog's leg looks like.

You know what they say, "If it quarks like an atomic particle, it probably was named in isolation."


It may not be understood by others yet, but there is a symmetry in the universe from the neutrino to the whole universe and reflects in the origin of life and the nature of sentience. There is a whole world below DNA in the cell that is completely undiscovered and holds some strange facts about life, its origins and the things that may exist in places unseen. There is a strange sub-universe that exists within our perception and the failure to recognize it seems absurd to me now. It is always that way. I could have been that ignorant yesterday and so I speak of myself when I wonder why it is that the things which should be obvious on inspection are categorized and cartooned to be less than they are. Each perception and new knowledge combine to create a more complete image of what the universe is all about and if I consider how I viewed the universe at 20, it almost makes be shudder. There in the dark of knowing, the Were-tortoise hides.

Just the fluff ma'am


python webkit2png.py http://www.somepage/>page.png convert -crop 416x242+261+258 page.png cropped.png

This is an example of one shell script used to get the data of interest and leave the rest. The code is created in a script in the execute path of shell and then the normal language interface translates a statement into the action in whatever language or script is required. In this case it could be "show me the US precipitation map" or "show me the US temperature map" and I have published a shell script that does this and it is actually easier to make a hash and data base, but that is a long program and should be something that any programmer can do in a matter of minutes.

I was trying out a python script called webkit2png.py and combining that with all my other programs and plasmoids and such. It is very odd, but I can change my entire view of the web by making my interface more and more intelligent all the time. I browse the web in a rather obtuse way. By using many scripts and pre processing of data, I eat all the worms and spit out the germs.

To make that more clear, spam is considered net trash and just thrown away. It could be considered a resource. A lot of effort goes into creating and shoveling spam into NULL space. If the stream can be manipulated , it becomes a tool and though that process distorts the purpose of the spam to different goals, they are offering it for free and why shouldn't I get a computational gain from their effort. It would seem that if the effectiveness of the spam was reduced they would produce more to get the same effect and I could then collect more. Any state change that has memory can be made computational. By influencing the manifold space of the envelope, I am simply programming in a new language. The spam must be cast and thus is a process and any process can be programmed from external events. A honey pot is a kind of spam trap, but they are not reprogramming the stream to their benefit. They are taking a very dull and time consuming approach. It fails to take into account the underlying process. Removing or hardening an interface does not stop criminal motive, they have an infinite play field to act upon. Locking one of an infinite set of doors to your house simply means they will enter through the next.

So let them in an easy door and run them on a treadmill trying to get back out, so they generate electricity. Will you stop trying to leave, if I let you out?

Might work, I will consider it. Infinity plus one is always fun.

Blender 2.5 Python 3.x and Make Human

This is kind of cleanup work. Blender comes with Python 3, which is different and blender 2.5⇒2.6 is different also. Make human has changed and so has make ant. It is a lot of change and so that is fun. In the process I am going back and analyzing how HOX (Homeobox) genes act to make an organism and it is somewhat like the Cube game engine. I can have a python script that generates an organism and correlate how the organism develops. I use a different approach and have volumetric muscles which are objects and the laws of physics determine how the muscles act in a circumstance. By also creating a cellularly modeled neural array that is trained, the entire process proceeds from DNA to model without any intervention, if I get the relationships correct. I am going back over this to make the entire process programmable in English.

The work involves tuning the relationship between a symbolic gene set and the product organism. I always learn some new things when I revisit the techniques and this is a great opportunity to make the process more coherent, and perhaps extensible.

The image is an example of a series of steps applied to a cube. I can do this in my program also, but the interface is designed differently and projected to be coherent with WebGL arrival.

One of the things I wanted to do, is to see if I could recurse everything and have a python script that was a tutorial in blender 2.5 and python 3.0 that would generate a video and blend file that could be played along with the video and the sound generated by a voice generator.

This way it would be easier to explain how antfarmgl and the WebGL interface works.

I may seem that I hop about subjects all the time, but my days are full and I study physics, genetics, mathematics, programming, and chemistry all at the same time and a couple posts every day is like 2 frames of a 14 hour video and they are bound to be different, unless I just sat and stared all day.

People are creating new scripts for gimp every day and blender has interface to svg. In addition I am developing new tricks and each day make the scheme scripts, interfaces, python and overall process more clear and easier to use. Sometimes I am frustrated when I have an idea of some decoration that I want to create for a post and so it isn't perfect, but each day makes it a little less frustrating.

Contributors

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen