ScientificPython-2.9.4/0000755000076600000240000000000012270505006015415 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/bsp_virtual0000755000076600000240000003041211501734142017676 0ustar hinsenstaff00000000000000#!python # Run BSP code using threads to emulate processors # # Written by Konrad Hinsen # last revision: 2009-1-26 # import code, getopt import ihooks, imp, pdb, traceback import threading import copy, os, operator, sys, time, types from StringIO import StringIO import Scientific.BSP debug = 0 # # Forced termination exception # class ForcedTermination(Exception): pass # # The virtual parallel machine # class VirtualBSPMachine: def __init__(self, nproc, show_runtime=0): pids = range(nproc) self.nproc = nproc self.show_runtime = runtime self.current_pid = 0 self.debugger = None self.name_spaces = [{'__name__': '__main__'} for pid in pids] self.mailbox = [[] for pid in pids] self.runtime = [0. for pid in pids] self.output = [None for pid in pids] self.exception = [None for pid in pids] self.condition = threading.Condition() self.active_thread = -1 def currentPid(self): return self.current_pid def numberOfProcessors(self): return nproc def isExtendedName(self, name): return name[:2] == '_P' and name[7] == '_' def extendedName(self, name, pid = None): if pid is None: pid = self.current_pid return ("_P%05d_" % pid) + name def baseName(self, name): if self.isExtendedName(name): return name[8:] else: return name def virtualProcessor(self, pid): if debug: print "*** Starting processor", pid self.condition.acquire() while self.active_thread != pid: self.condition.wait() self.condition.release() self.exception[pid] = None if self.debugger is not None: if self.current_pid in self.debugged_pids: print "*** Debugging pid", self.current_pid self.debugger.reset() sys.settrace(self.debugger.trace_dispatch) else: print "*** Not debugging pid", self.current_pid try: exec self.code in self.name_spaces[pid] except: self.exception[pid] = sys.exc_info() self.showtraceback() if self.debugger is not None: sys.settrace(None) self.terminated[pid] = True self.condition.acquire() self.active_thread = -1 self.condition.notifyAll() self.condition.release() def run(self, code, buffered_output = 0): self.code = code pids = range(self.nproc) self.done = False self.terminated = [False for pid in pids] self.active_thread = -1 for pid in pids: if buffered_output: self.output[pid] = StringIO() thread = threading.Thread(name = 'Processor %d' % pid, target = lambda p=pid: self.virtualProcessor(p)) thread.start() super_step = 0 real_stdout = sys.stdout real_stderr = sys.stderr while 1: if debug: print "*** Superstep ", super_step for self.current_pid in pids: if debug: print "*** Running ", self.current_pid if buffered_output: sys.stdout = self.output[self.current_pid] sys.stderr = self.output[self.current_pid] self.condition.acquire() self.active_thread = self.current_pid start_time = time.time() self.condition.notifyAll() while self.active_thread != -1: self.condition.wait() self.condition.release() sys.settrace(None) self.runtime[self.current_pid] += time.time()-start_time if buffered_output: sys.stdout = real_stdout sys.stderr = real_stderr if debug: print "*** ", self.current_pid, " at barrier" if debug: print "*** End of superstep ", super_step self.messages = self.mailbox self.mailbox = [[] for pid in pids] super_step += 1 self.done = reduce(operator.or_, self.terminated) if self.done: if debug: print "*** End of execution " for pid in pids: if not self.terminated[pid]: print "*** Processor %d still running" % pid break if self.show_runtime: print "Runtimes:" for pid in range(nproc): print " Processor %d: %f s" % (pid, self.runtime[pid]) def showtraceback(self): try: type, value, tb = sys.exc_info() sys.last_type = type sys.last_value = value sys.last_traceback = tb tblist = traceback.extract_tb(tb) del tblist[:1] list = traceback.format_list(tblist) if list: list.insert(0, "Traceback (most recent call last):\n") list[len(list):] = traceback.format_exception_only(type, value) finally: tblist = tb = None map(sys.stderr.write, list) def run_debug(self, command, debugger, pids): self.debugger = debugger self.debugged_pids = pids self.run(command, 0) self.debugger = None def put(self, object, pid_list): if self.debugger: sys.settrace(None) for pid in pid_list: self.mailbox[pid].append(copy.deepcopy(object)) def send(self, messages): if self.debugger: sys.settrace(None) for pid, data in messages: self.put(data, [pid]) def sync(self): if self.debugger: sys.settrace(None) pid = self.current_pid if debug: print "--- ", pid, " at sync" self.condition.acquire() self.active_thread = -1 self.condition.notifyAll() while self.active_thread != pid: self.condition.wait() self.condition.release() if self.done: if debug: print "--- ", pid, " terminated" raise ForcedTermination if debug: print "--- ", pid, " continuing after sync" if self.debugger is not None: if self.current_pid in self.debugged_pids: print "*** Debugging pid", self.current_pid self.debugger.reset() sys.settrace(self.debugger.trace_dispatch) else: print "*** Not debugging pid", self.current_pid return self.messages[pid] # # Change module imports such that every virtual processor gets its # own copy of all modules except for builtin modules. # class Hooks(ihooks.Hooks): def is_builtin(self, name): return imp.is_builtin(machine.baseName(name)) def init_builtin(self, name): return imp.init_builtin(machine.baseName(name)) def is_frozen(self, name): return imp.is_frozen(machine.baseName(name)) def init_frozen(self, name): return imp.init_frozen(machine.baseName(name)) def get_frozen_object(self, name): return imp.get_frozen_object(machine.baseName(name)) def load_dynamic(self, name, filename, file=None): return imp.load_dynamic(machine.baseName(name), filename, file) class ModuleLoader(ihooks.ModuleLoader): def find_module_in_dir(self, name, dir, allow_packages=1): if dir is None: return self.find_builtin_module(name) name = machine.baseName(name) return ihooks.ModuleLoader.find_module_in_dir(self, name, dir, allow_packages) class ModuleImporter(ihooks.ModuleImporter): def __init__(self, loader = None): ihooks.ModuleImporter.__init__(self, loader) for name in self.modules.keys(): if not (machine.isExtendedName(name) or name == "Scientific" or name[:11] == "Scientific."): for pid in range(machine.nproc): self.modules[machine.extendedName(name, pid)] = \ self.modules[name] def import_module(self, name, globals=None, locals=None, fromlist=None): name = machine.extendedName(name) return ihooks.ModuleImporter.import_module(self, name, globals, locals, fromlist) def import_it(self, partname, fqname, parent, force_load=0): if not partname: raise ValueError("Empty module name") if not force_load: try: return self.modules[fqname] except KeyError: pass try: path = parent and parent.__path__ except AttributeError: return None stuff = self.loader.find_module(partname, path) if not stuff: return None m = self.loader.load_module(fqname, stuff) if parent: setattr(parent, machine.baseName(partname), m) return m def find_head_package(self, parent, name): if '.' in name: i = name.find('.') head = name[:i] tail = name[i+1:] else: head = name tail = "" if parent: qname = "%s.%s" % (parent.__name__, machine.baseName(head)) else: qname = head q = self.import_it(head, qname, parent) if q: return q, tail if parent: qname = head parent = None q = self.import_it(head, qname, parent) if q: return q, tail raise ImportError("No module named " + qname) # # An interactive parallel console # class VirtualConsole(code.InteractiveConsole): def __init__(self, virtual_machine): code.InteractiveConsole.__init__(self) self.virtual_machine = virtual_machine def runcode(self, compiled_code): try: self.virtual_machine.run(compiled_code, 1) self.showOutput() except SystemExit: raise except: self.showOutput() self.virtual_machine.showtraceback() else: if code.softspace(sys.stdout, 0): print def showOutput(self): for pid in range(self.virtual_machine.numberOfProcessors()): output = self.virtual_machine.output[pid].getvalue() if output: sys.stdout.write(("-- Processor %d " % pid) + 40*'-' + '\n') sys.stdout.write(output) def push(self, line): if line and line[0] == '!': command = line.strip()[1:] exec command in {'pm': self.pdb_pm, 'run': self.pdb_run} return 0 return code.InteractiveConsole.push(self, line) def pdb_pm(self, pid): pdb.post_mortem(self.virtual_machine.exception[pid][-1]) def pdb_run(self, pids, command): try: command = compile(command, '', 'exec') except SyntaxError: self.showsyntaxerror() return if type(pids) == type(0): pids = [pids] debugger = pdb.Pdb() self.virtual_machine.run_debug(command, debugger, pids) debugger.quitting = 1 sys.settrace(None) options, args = getopt.getopt(sys.argv[1:], 'in:t') interactive = False runtime = False nproc = 1 for option, value in options: if option == '-i': interactive = True if option == '-t': runtime = True if option == '-n': nproc = int(value) if len(args) < 2: interactive = True machine = VirtualBSPMachine(nproc, runtime) sys.virtual_bsp_machine = machine hooks = Hooks() loader = ModuleLoader(hooks) importer = ModuleImporter(loader) sys.setrecursionlimit((nproc+1)*1000) importer.install() cprt = 'Type "copyright", "credits" or "license" for more information.' banner = "Python %s on %s\n%s\n(Parallel console, %d processors)" % \ (sys.version, sys.platform, cprt, nproc) if len(args) > 1: script_name = args[1] script = file(script_name).read() compiled_code = compile(script, script_name, 'exec') machine.run(compiled_code) banner = '' if interactive: console = VirtualConsole(machine) console.interact(banner) ScientificPython-2.9.4/bsp_virtual_stackless0000755000076600000240000002737711501734140021770 0ustar hinsenstaff00000000000000#!python # Run BSP code in Stackless Python with one task per virtual processor # # Written by Konrad Hinsen # last revision: 2004-3-29 # import code, copy, getopt, ihooks, imp, os, pdb, sys, time, traceback, types from StringIO import StringIO import stackless import Scientific.BSP debug = 0 # # End of task exception # class TaskEnded(Exception): def __init__(self, pid): self.pid = pid # # Forced termination exception # class ForcedTermination(Exception): pass # # The virtual parallel machine # class VirtualBSPMachine: def __init__(self, nproc, show_runtime=0): pids = range(nproc) self.nproc = nproc self.show_runtime = runtime self.current_pid = 0 self.debugger = None self.to_channels = [stackless.channel() for pid in pids] self.back_channels = [stackless.channel() for pid in pids] self.name_spaces = [{'__name__': '__main__'} for pid in pids] self.mailboxes = [[] for pid in pids] self.runtime = [0. for pid in pids] self.output = [None for pid in pids] self.exception = [None for pid in pids] def currentPid(self): return self.current_pid def numberOfProcessors(self): return nproc def isExtendedName(self, name): return name[:2] == '_P' and name[7] == '_' def extendedName(self, name): return ("_P%05d_" % self.current_pid) + name def baseName(self, name): if self.isExtendedName(name): return name[8:] else: return name def virtualProcessor(self, pid): self.back_channels[pid].send(None) self.to_channels[pid].receive() self.exception[pid] = None try: exec self.code in self.name_spaces[pid] except: self.exception[pid] = sys.exc_info() self.showtraceback() if self.debugger is not None: sys.settrace(None) if self.exception[pid] is None \ or self.exception[pid][0] != ForcedTermination: self.back_channels[pid].send_exception(TaskEnded, pid) def run(self, code, buffered_output = 0): self.code = code pids = range(self.nproc) self.tasklets = [] for pid in pids: if buffered_output: self.output[pid] = StringIO() task = stackless.tasklet(self.virtualProcessor)(pid) self.tasklets.append(task) task.setatomic(1) task.run() for pid in pids: self.back_channels[pid].receive() super_step = 0 real_stdout = sys.stdout real_stderr = sys.stderr while 1: terminated = [] if debug: print "*** Superstep ", super_step for self.current_pid in pids: try: if debug: print "*** Running ", self.current_pid if buffered_output: sys.stdout = self.output[self.current_pid] sys.stderr = self.output[self.current_pid] start_time = time.time() if self.debugger is not None: if self.current_pid in self.debugged_pids: print "*** Debugging pid", self.current_pid self.debugger.reset() sys.settrace(self.debugger.trace_dispatch) else: print "*** Not debugging pid", self.current_pid self.to_channels[self.current_pid].send(None) self.back_channels[self.current_pid].receive() sys.settrace(None) self.runtime[self.current_pid] += time.time()-start_time if buffered_output: sys.stdout = real_stdout sys.stderr = real_stderr if debug: print "*** ", self.current_pid, " at barrier" except TaskEnded, exception: if buffered_output: sys.stdout = real_stdout sys.stderr = real_stderr if debug: print "*** Received exception", exception.pid terminated.append(exception.pid) self.messages = self.mailboxes self.mailboxes = [[] for pid in pids] if debug: print "*** End of superstep ", super_step super_step += 1 if terminated: for pid in pids: if pid not in terminated: self.to_channels[pid].send_exception(ForcedTermination) break if self.show_runtime: print "Runtimes:" for pid in range(nproc): print " Processor %d: %f s" % (pid, self.runtime[pid]) def showtraceback(self): try: type, value, tb = sys.exc_info() sys.last_type = type sys.last_value = value sys.last_traceback = tb tblist = traceback.extract_tb(tb) del tblist[:1] list = traceback.format_list(tblist) if list: list.insert(0, "Traceback (most recent call last):\n") list[len(list):] = traceback.format_exception_only(type, value) finally: tblist = tb = None map(sys.stderr.write, list) def run_debug(self, command, debugger, pids): self.debugger = debugger self.debugged_pids = pids self.run(command, 0) self.debugger = None def put(self, object, pid_list): if self.debugger: sys.settrace(None) for pid in pid_list: self.mailboxes[pid].append(copy.deepcopy(object)) def send(self, messages): if self.debugger: sys.settrace(None) for pid, data in messages: self.put(data, [pid]) def sync(self): if self.debugger: sys.settrace(None) pid = self.current_pid if debug: print "--- ", pid, " at barrier" self.back_channels[pid].send(None) if debug: print "--- ", pid, " waiting" self.to_channels[pid].receive() if debug: print "--- ", pid, " released" messages = self.messages[pid] self.messages[pid] = None return messages # # Change module imports such that every virtual processor gets its # own copy of all modules except for builtin modules. # class Hooks(ihooks.Hooks): def is_builtin(self, name): return imp.is_builtin(machine.baseName(name)) def init_builtin(self, name): return imp.init_builtin(machine.baseName(name)) def is_frozen(self, name): return imp.is_frozen(machine.baseName(name)) def init_frozen(self, name): return imp.init_frozen(machine.baseName(name)) def get_frozen_object(self, name): return imp.get_frozen_object(machine.baseName(name)) class ModuleLoader(ihooks.ModuleLoader): def find_module_in_dir(self, name, dir, allow_packages=1): if dir is None: return self.find_builtin_module(name) name = machine.baseName(name) return ihooks.ModuleLoader.find_module_in_dir(self, name, dir, allow_packages) class ModuleImporter(ihooks.ModuleImporter): def __init__(self, loader = None): ihooks.ModuleImporter.__init__(self, loader) for name in self.modules.keys(): if not (machine.isExtendedName(name) or name == "Scientific" or name[:11] == "Scientific."): for pid in range(machine.nproc): self.modules[machine.extendedName(name, pid)] = \ self.modules[name] def import_module(self, name, globals=None, locals=None, fromlist=None): name = machine.extendedName(name) return ihooks.ModuleImporter.import_module(self, name, globals, locals, fromlist) def import_it(self, partname, fqname, parent, force_load=0): if not partname: raise ValueError("Empty module name") if not force_load: try: return self.modules[fqname] except KeyError: pass try: path = parent and parent.__path__ except AttributeError: return None stuff = self.loader.find_module(partname, path) if not stuff: return None m = self.loader.load_module(fqname, stuff) if parent: setattr(parent, machine.baseName(partname), m) return m def find_head_package(self, parent, name): if '.' in name: i = name.find('.') head = name[:i] tail = name[i+1:] else: head = name tail = "" if parent: qname = "%s.%s" % (parent.__name__, machine.baseName(head)) else: qname = head q = self.import_it(head, qname, parent) if q: return q, tail if parent: qname = head parent = None q = self.import_it(head, qname, parent) if q: return q, tail raise ImportError("No module named " + qname) # # An interactive parallel console # class VirtualConsole(code.InteractiveConsole): def __init__(self, virtual_machine): code.InteractiveConsole.__init__(self) self.virtual_machine = virtual_machine def runcode(self, compiled_code): try: self.virtual_machine.run(compiled_code, 1) self.showOutput() except SystemExit: raise except: self.showOutput() self.virtual_machine.showtraceback() else: if code.softspace(sys.stdout, 0): print def showOutput(self): for pid in range(self.virtual_machine.numberOfProcessors()): output = self.virtual_machine.output[pid].getvalue() if output: sys.stdout.write(("-- Processor %d " % pid) + 40*'-' + '\n') sys.stdout.write(output) def push(self, line): if line and line[0] == '!': command = line.strip()[1:] exec command in {'pm': self.pdb_pm, 'run': self.pdb_run} return 0 return code.InteractiveConsole.push(self, line) def pdb_pm(self, pid): pdb.post_mortem(self.virtual_machine.exception[pid][-1]) def pdb_run(self, pids, command): try: command = compile(command, '', 'exec') except SyntaxError: self.showsyntaxerror() return if type(pids) == type(0): pids = [pids] debugger = pdb.Pdb() self.virtual_machine.run_debug(command, debugger, pids) debugger.quitting = 1 sys.settrace(None) options, args = getopt.getopt(sys.argv[1:], 'it') interactive = 0 runtime = 0 for option, value in options: if option == '-i': interactive = 1 if option == '-t': runtime = 1 if len(args) < 2: interactive = 1 nproc = int(args[0]) machine = VirtualBSPMachine(nproc, runtime) sys.virtual_bsp_machine = machine hooks = Hooks() loader = ModuleLoader(hooks) importer = ModuleImporter(loader) sys.setrecursionlimit((nproc+1)*1000) importer.install() cprt = 'Type "copyright", "credits" or "license" for more information.' banner = "Python %s on %s\n%s\n(Parallel console, %d processors)" % \ (sys.version, sys.platform, cprt, nproc) if len(args) > 1: script_name = args[1] script = file(script_name).read() compiled_code = compile(script, script_name, 'exec') machine.run(compiled_code) banner = '' if interactive: console = VirtualConsole(machine) console.interact(banner) ScientificPython-2.9.4/Doc/0000755000076600000240000000000012270505002016116 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Doc/BSP_Tutorial.pdf0000644000076600000240000032432011501734163021134 0ustar hinsenstaff00000000000000%PDF-1.2 6 0 obj << /S /GoTo /D (section.1) >> endobj 8 0 obj (Introduction) endobj 10 0 obj << /S /GoTo /D (section.2) >> endobj 12 0 obj (Usage) endobj 14 0 obj << /S /GoTo /D (section.3) >> endobj 16 0 obj (Concepts) endobj 18 0 obj << /S /GoTo /D (subsection.3.1) >> endobj 20 0 obj (Processors) endobj 22 0 obj << /S /GoTo /D (subsection.3.2) >> endobj 24 0 obj (Local and global objects) endobj 26 0 obj << /S /GoTo /D (subsection.3.3) >> endobj 28 0 obj (Local and global functions) endobj 30 0 obj << /S /GoTo /D (subsection.3.4) >> endobj 32 0 obj (Local and global classes) endobj 34 0 obj << /S /GoTo /D (subsection.3.5) >> endobj 36 0 obj (Communication) endobj 38 0 obj << /S /GoTo /D (subsection.3.6) >> endobj 40 0 obj (Input and output) endobj 42 0 obj << /S /GoTo /D (section.4) >> endobj 44 0 obj (Standard global classes) endobj 46 0 obj << /S /GoTo /D (section.5) >> endobj 48 0 obj (A first example) endobj 50 0 obj << /S /GoTo /D (section.6) >> endobj 52 0 obj (Systolic algorithms) endobj 54 0 obj << /S /GoTo /D (section.7) >> endobj 56 0 obj (Back to trivial parallelism) endobj 58 0 obj << /S /GoTo /D (section.8) >> endobj 60 0 obj (Distributed data classes) endobj 62 0 obj << /S /GoTo /D (section.9) >> endobj 64 0 obj (Distributed file access) endobj 66 0 obj << /S /GoTo /D [65 0 R /Fit ] >> endobj 70 0 obj << /Length 71 0 R /Filter /FlateDecode >> stream xڅɒ>WTŐ %7O'8S3SDKHzxR]޾A&t*bS(j>>~ӏiQI\>>mU`v]ѧH77'\dt?&,/|86Ly!ÿatoKUתEYFgh Ϸ-yfAw[UEmBE;{&:קϼAb\_iRU/^h?Lț/ ^βJ.)$yKXd!`[5Q3m`ƲU*h]&1ȹu ~ytENq5{zXU9{p*':??31`Ǒw#'D_7w: DfĺՏZ, acD80/|xuɄ" y2h V)*L jĢaB?u:t_r=)5"Sg~D _ I`@r+~,#Ӳ:$V@Q\{ Q8pœF[6)9G%?52Rh[80Z(eT (mpK-uIA#e㥔㖕=TIiC0^i5fө A F^zFɕÙRjEr _| -Ay 2zaA(.{0]ljs `hq<_ f  B`ܘ 1p5 i:! Cb.ZkR2#Dac{OIeg ʻ]DΡPk fcc Vp[wb(pAGܟJN)?l?29Xʽ„5K,WxQ [0fc^J0ѻypy#|P̢#> endobj 1 0 obj << /Type /Encoding /Differences [ 24 /breve /caron /circumflex /dotaccent /hungarumlaut /ogonek /ring /tilde 39 /quotesingle 96 /grave 128 /bullet /dagger /daggerdbl /ellipsis /emdash /endash /florin /fraction /guilsinglleft /guilsinglright /minus /perthousand /quotedblbase /quotedblleft /quotedblright /quoteleft /quoteright /quotesinglbase /trademark /fi /fl /Lslash /OE /Scaron /Ydieresis /Zcaron /dotlessi /lslash /oe /scaron /zcaron 164 /currency 166 /brokenbar 168 /dieresis /copyright /ordfeminine 172 /logicalnot /.notdef /registered /macron /degree /plusminus /twosuperior /threesuperior /acute /mu 183 /periodcentered /cedilla /onesuperior /ordmasculine 188 /onequarter /onehalf /threequarters 192 /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis ] >> endobj 2 0 obj << /Type /Font /Subtype /Type1 /Name /ZaDb /BaseFont /ZapfDingbats >> endobj 3 0 obj << /Type /Font /Subtype /Type1 /Name /Helv /BaseFont /Helvetica /Encoding 1 0 R >> endobj 4 0 obj << /Fields [] /DR << /Font << /ZaDb 2 0 R /Helv 3 0 R >> >> /DA (/Helv 10 Tf 0 g ) /NeedAppearances true >> endobj 75 0 obj << /Type /Annot /Border [0 0 1] /H /I /C [0 1 1] /Rect [212.375 354.545 249.929 365.171] /Subtype /Link /A << /Type /Action /S /URI /URI (http://www.python.org/) >> >> endobj 76 0 obj << /Type /Annot /Border [0 0 1] /H /I /C [0 1 1] /Rect [129.131 181.195 187.791 191.822] /Subtype /Link /A << /Type /Action /S /URI /URI (http://oldwww.comlab.ox.ac.uk/oucl/oxpara/bsp/bspmodel.htm) >> >> endobj 68 0 obj << /D [65 0 R /XYZ 86.399 708.042 null] >> endobj 67 0 obj << /D [65 0 R /XYZ 86.399 683.136 null] >> endobj 5 0 obj << /D [65 0 R /XYZ 86.399 497.226 null] >> endobj 69 0 obj << /Font << /F18 72 0 R /F19 73 0 R /F23 74 0 R /F15 73 0 R >> /ProcSet [ /PDF /Text ] >> endobj 82 0 obj << /Length 83 0 R /Filter /FlateDecode >> stream x}XKo6ap+'$;29jD8^,bWU"y3/}OpȄ/P^U}fH"akk_l58=֬Ƶ9 tx 9}Hrkh$ t'v4[DqЃ΋ZNw!J*kX;;& ڍ=ď#>߷A>^ V 6eQ0Z@`CP>k+ CdB7*+(Zp9^M@id׿E;Ac&7un1q5=4'Zd;A3utӦE{hT;b0WsC $Uv?5$RҐ|wCOmH(vIqXj gּ2 Y!k eu͗Wb(]rk֤-y/^LTiaTFNǓE܊((ta%aR@EţJDXㇿuendstream endobj 83 0 obj 2398 endobj 81 0 obj << /Type /Page /Contents 82 0 R /Resources 80 0 R /MediaBox [0 0 611.998 791.997] /Parent 77 0 R /Annots [ 84 0 R 85 0 R ] >> endobj 84 0 obj << /Type /Annot /Border [0 0 1] /H /I /C [0 1 0] /Rect [410.596 555.614 416.449 563.319] /Subtype /Link /A << /S /GoTo /D (cite.BSML) >> >> endobj 85 0 obj << /Type /Annot /Border [0 0 1] /H /I /C [0 1 1] /Rect [245.53 400.397 328.933 411.024] /Subtype /Link /A << /Type /Action /S /URI /URI (http://dirac.cnrs-orleans.fr/programs/scientific.html) >> >> endobj 79 0 obj << /D [81 0 R /XYZ 86.399 708.042 null] >> endobj 9 0 obj << /D [81 0 R /XYZ 86.399 448.599 null] >> endobj 13 0 obj << /D [81 0 R /XYZ 86.399 136.803 null] >> endobj 80 0 obj << /Font << /F15 73 0 R /F23 74 0 R /F24 86 0 R >> /ProcSet [ /PDF /Text ] >> endobj 90 0 obj << /Length 91 0 R /Filter /FlateDecode >> stream xڕX_oK,$"(REq@ޥjVRZ3Ù v]UwUn>bTZ8Jr=Ltn}HiQԻeRcJb~<ɩ#9a`~]wW}ǞELm:t?:کDŽϯX?fy_wbF؊J?lh2*bs?`Ztk[cӡU .gf>6rjש q?cvP+0F份OhiYj:j%,oL>&K.NTDRb܇ZO'tͥkn_UTYtb2*K pFcwŚRƞ4_IC+s;N`{gBӽ 3B<$yCRy*3H P+/89hE ײ_"b&pk^/mbtk ʼn:Wٳ,u$jU=:wcsMnZOҋ3YDcWE'o~ɔ6rSPKEJG2F4oX}ˉib+&r/P@AczQ͛oU 'woh B5 BLk$X[h"fߜ!SIfQ,),S)RpaQ$6ag\U8`gUb ԗmѻm>`c8nxRox0 g1Q=EF̦ժ4ܤKF&r`FSɏ;?xB=!B`QZyJ$c4-ܵ Mשo|rFy0 HX/0 S skII>A A9%4TtVILyL\,4/% ѱ_o3d"`\RqVf3q&SL_'"3@ $#iW?"mDJ`1O.L-dآY^lpһpoKSjt5 V2 ~͟e@0 ý 2O`zw<~P[z 1n.hWe ደT. SHAXDuO"Hp\FSQ;6a%4E7Gã48XLgE8fVean> endobj 87 0 obj << /D [89 0 R /XYZ 86.399 708.042 null] >> endobj 17 0 obj << /D [89 0 R /XYZ 86.399 536.561 null] >> endobj 21 0 obj << /D [89 0 R /XYZ 86.399 407.504 null] >> endobj 25 0 obj << /D [89 0 R /XYZ 86.399 179.651 null] >> endobj 88 0 obj << /Font << /F15 73 0 R /F27 92 0 R /F33 93 0 R /F30 94 0 R /F34 74 0 R >> /ProcSet [ /PDF /Text ] >> endobj 98 0 obj << /Length 99 0 R /Filter /FlateDecode >> stream xڍXrߠ#bs_|81­bA*X\jHV5_ H:\^WEeyUݾ*L8ɮx^'ׇ0^]5Sxl{F^Thaz~E~ӄ@ܻ}N}Gbրҫ#G.uCt2vۍP]k >?SOxC,,u'^k`&9zOאoKKWOFw1yG L:U3;6ثe2V{ѵ_Bhm 3!,b;Q67yȦSE&G) Q᱿0N:쵆369UNWY~?BTsmĻtLhŖҟ.3 $ 5)X{-kFwq$np@4>t2ܶ9hCXc~ "$:з[CLU3UiZn ,VC3#H灳2CVNs¦^!')j@f$p*tҋWR񥓄~էwwrZLQh.**w'6*.N 'q=L'ݕ ~ჩjr4%sn԰fx46 Q3]}אJH%*0AebqRjGʼn]择/)bv)-Q R4 a}xE x C7j,7I&yo7Rim*yԓQڌchg@^F4si2U޽xpuJAMXU7>8mmnt|~!ܱx4ձܠ=X</MEEc0 [ZiBy2uhG rrb0)})@ G)=i@ݷv O$k(yULzaDEbxJ`f>S) 6‹IjF1JV V>JA$4aA`3|8 j:@puNҺ'NIXiim)h+!5o'ߋm*rrR$苮tluy@\+wBGF.ihdjx Tbq>XB6_/R[y9\ֶ"f(lҮog%H3p&rriy!&xѮAstU-'^Dq5@eN@nc'%dZj8^d3΀4 R'`HWp/d$o?:8zE(A?A'23fitx&ʨt{ܱ!RN)*{Pt瘔x&`xSg.4^h>vgT,vߺ||+V- STv?;+Q*°^&n]Îl!"⦑/aɜ3GF ~#1PW2m{4b~xfx#-ʼnqK:b]eO%B&,> endobj 95 0 obj << /D [97 0 R /XYZ 86.399 708.042 null] >> endobj 29 0 obj << /D [97 0 R /XYZ 86.399 683.136 null] >> endobj 33 0 obj << /D [97 0 R /XYZ 86.399 586.623 null] >> endobj 37 0 obj << /D [97 0 R /XYZ 86.399 269.771 null] >> endobj 41 0 obj << /D [97 0 R /XYZ 86.399 139.427 null] >> endobj 96 0 obj << /Font << /F34 74 0 R /F15 73 0 R /F33 93 0 R /F24 86 0 R /F23 74 0 R >> /ProcSet [ /PDF /Text ] >> endobj 103 0 obj << /Length 104 0 R /Filter /FlateDecode >> stream xڍWKo6b^_zprW\P=6z8N~}g8,9rX`5$yq#4a26ጧ|/\z9˴Mq4PM϶h;eT4;}iP؎ȲVװϖWv'L+w6[DT\Q盿AWLiןv/?\ق!ϛ+fpô> yț6,Lx 4MqgOѦdb9xqd37K?cS%*g.M6šSϱ}v%%u1O}q_s5ΧX17-s0BBrmR=zLNsg>+Zj%:_˸|h24<>,f0RgМ9GQt)o rv UA`&"ITU^vI| @+I=K"%ޓ9IN?(έ8Mb4_FZ,!~ʻqp5Rr*JBER)%ܣ6Gbrg '߆#ҽ)|b&M];\A~N2y+4|giOS}69ھ/*{~ qg9vdIͽ#HgU|( tL 1K/ǣn{"'kJ[G/ZZ?0n(+{[]uhN0>/y$i(|J_k3DWUpf(FkŴW,ĕF2oW2lMY1/C!\|]`{LW26#^u`q*:~K-Y Pn~_QQ *%kѐ*vbjA@)QSje2Χ;O3ŗ %ܕ-Og+pҧfڞ%Ty&@HJ%\%85{MUEOVb<:LJ'@owѢ;,e5p^t[i7 %W4"0ڕUXEho`hWt#!K v鼇nS0⟽G3((Oݑ:; A߂icB_6il@4->l:ZW.U@$!v+Nibi7EP (: N2~4AIOr0R((ylq ԺY3)jJ`e/9HXQ(e<91; WZ$)g6͐+afZF6VA] Y=ط޶Ym8'<{:GNMsfqV/qh% wd-ܽ SIEk <xT[WwҤ_Q4</#9gx^o̸J_K ܳIvfga柶슮s o64W`N!Q2ᮅgPtc+@98ڌx!ö @%Ʈn{$E$ 㖍.Ͼyq?j3Y`H ow3ȗendstream endobj 104 0 obj 1597 endobj 102 0 obj << /Type /Page /Contents 103 0 R /Resources 101 0 R /MediaBox [0 0 611.998 791.997] /Parent 77 0 R >> endobj 100 0 obj << /D [102 0 R /XYZ 86.399 708.042 null] >> endobj 45 0 obj << /D [102 0 R /XYZ 86.399 331.041 null] >> endobj 101 0 obj << /Font << /F15 73 0 R /F24 86 0 R /F23 74 0 R >> /ProcSet [ /PDF /Text ] >> endobj 108 0 obj << /Length 109 0 R /Filter /FlateDecode >> stream xڍXKo6@h">$Rrhm/ Z W\ G!5oF+v f]fD,/Wo^z'DDnosu,:?IECѽPIPb8}6[~#gDIp7L}c3t'Q^ع~qթj>$xԐ~FExс غw^ύ=o;Lxmx$|[uyq8 sNh\W mA(W2U[j0*LyN&NT1n2DTR8 7̢4]|Gȳ=Nm +a8sl ŗ=,.ñ?$)NLt! !)Ys5=?|!3)'5 -{uJHGnnD8U^JaLu]IiB~%2 vn{*ܹ; ^SDႪ߰FZ@Tx}cxj<^*@~Br,Z!A0p|i滽\ŠDJۅ  F}]Y=!QV? R &+Z*Tz1,圍W 3daB* 8tfB~,z:4l=۱@> endobj 105 0 obj << /D [107 0 R /XYZ 86.399 708.042 null] >> endobj 106 0 obj << /Font << /F24 86 0 R /F15 73 0 R >> /ProcSet [ /PDF /Text ] >> endobj 113 0 obj << /Length 114 0 R /Filter /FlateDecode >> stream xڝWێ6~*"uЇiEt-Sk"R6 啽nbjf9s;UĪ*⴮WE)bQU_\=#qMKݻ pIeԨpGiE u,5і4Nc8<AnjFcxaJq׫YVk"sM^SQ=ؖ.Ω?Dd(wƏlAk/Ա5iqs"VB-nĖ\3"\O㨝@!*O< )P! vbY&QO,lEHyAys:#+b@sGyh]Ϙ5B,'e l& e?\H! l L#=fBAlyzmD#Tܬ9 k=/ZU_ႂMKụḭ7a#l.;=@tt<Цؠ[^ۈ/F+.;JxE6FiM} ?XxЀ^Fo{ K-]N&Iݟ'U^WQ"'Î7 gm!o}l`0\"l**jAf?Ea# rnY(O5d>P͝n^}DȀ>IP4@ #Hi0w.lqo8:$[^-˧cq= &D-P .7XVCky0y~.cr9Bv8vt2u㷋 b?| |92z0%L*sSSOɛ䭂cbYt็^_Nphc3m ϾfvȬ؞ou^<;PƸx=>Nx0 kSO۝b-]_whif~b݇9{T&2%\|JkRկaDZendstream endobj 114 0 obj 1525 endobj 112 0 obj << /Type /Page /Contents 113 0 R /Resources 111 0 R /MediaBox [0 0 611.998 791.997] /Parent 115 0 R >> endobj 110 0 obj << /D [112 0 R /XYZ 86.399 708.042 null] >> endobj 49 0 obj << /D [112 0 R /XYZ 86.399 607.503 null] >> endobj 111 0 obj << /Font << /F15 73 0 R /F23 74 0 R /F27 92 0 R /F30 94 0 R /F24 86 0 R >> /ProcSet [ /PDF /Text ] >> endobj 119 0 obj << /Length 120 0 R /Filter /FlateDecode >> stream xڭXK6rӊ(Q-i/8ԋjGv@bX.0)!Sծln~uwJEy_ ݧJtGI0vL)vqS׼~6 {C${rjڌ][F8UQcwaQ}I&2ԓE u`AO<pm偟/Ɠ ~Ɩ#hN ;kyڛk]i=o"5" zxFo顛Pj*.zOnqz{zy/Ǯ-{JvqI':{7Ekb;}Hy+=JSFMZ/_FN#lCc5G%6#ixꬣ?*]4-@ B0#'{O,l{ љIAԺҌi0{AZ: #]SixлyqmyX ^-Q:,p$wh9$Oa֬NƵS@c]a92 _N. 7 EW0. lG ݧv-RVA Z Pg8y yvH{҇4"s%n |beڛ/ ׈NNv:ka=x}i@IiyR97f`tMo Z:6W,1:%/Ŕ1E L!Y$#bISσr#ڃscF(dž?Wez d?;zHiKMFR zر8WcXSþA~b:#B %h. 6̘H/Vis/a=a$8IvP. EP7J:D00Fya?Itu!N{ BjWr4"fTZ'M_NT8G` &)9'kZ<"3Oı=wfkl"@K$TW!5 9~{5T5dEhs08s_eoEeNv8ֳkXGUS)~u â-~0r0P2V28evLa zu1ǝ1^G{|OBp=ܓJ 8I^N높M{FjDazY_M8ղjȉ)c9#i,eZ"ޡc\⤥BgF%}.⮥?8c-0[a{.ЀDe|T4TY@ ,z?8gf p*MҚb\;_XbW.213& E:)e֟(endstream endobj 120 0 obj 2107 endobj 118 0 obj << /Type /Page /Contents 119 0 R /Resources 117 0 R /MediaBox [0 0 611.998 791.997] /Parent 115 0 R >> endobj 116 0 obj << /D [118 0 R /XYZ 86.399 708.042 null] >> endobj 117 0 obj << /Font << /F24 86 0 R /F15 73 0 R /F27 92 0 R /F30 94 0 R >> /ProcSet [ /PDF /Text ] >> endobj 124 0 obj << /Length 125 0 R /Filter /FlateDecode >> stream xڭXK6o=DNZ3@MRH,CDH>;J "g3o> ~&}nwdūk+pss$˛ow/B̶{|qt5N'©e#B-o~O說u+MpdQ:" 3 ߓUeMVĎlydrjMD=Ȳ..S ?NW;nDw*WFO" LY_Pr-KOUhJw!N88' d曶ՇŠ(* A),)l`hWUdG-\ g% S<0Xw{2ﭒV씪4#+7 D>Kh>Z'5B%bܷ#uUl;5Kx\Ȱ,U~E/9<03UK<N]fլWo.pU#FJ\iBWO@ojz<e j]hRWٳ^x=L--PXXLB>N_ 09Z 0={g/S6vў,8\k0xZĀ Cen0J9w(tOtef*"a!H0pRAzn\v.y4ka`J=D0IJE?wWxNeƞz?i"E`+NVk*ia&N~˃j6fxq X>ݠ}8uI_$n'pP:vJ`gPP-N>NS,EF^27%y@zpͰ7m+}.> endobj 121 0 obj << /D [123 0 R /XYZ 86.399 708.042 null] >> endobj 53 0 obj << /D [123 0 R /XYZ 86.399 683.136 null] >> endobj 122 0 obj << /Font << /F23 74 0 R /F15 73 0 R /F24 86 0 R >> /ProcSet [ /PDF /Text ] >> endobj 129 0 obj << /Length 130 0 R /Filter /FlateDecode >> stream xڍXKoO9XFl( d&@`bnUK"ɯOby0"Y/V}Ul>?^)fYUpyw| XJ۲|tOT:E2^)+Yܙ;  GUE,Ɖ9jY ӱHٞE?P`9}RnrGO\ԏϦqul3}7<kmvޤMowtff &q7uF]Yv>Lyeu)<{`߬d=Jă(5gsd8-n>aM : YbNb(z~-jPmЀL'TL@mv$^e,oXl&!G W&rbZ*};>/p2~&M7T:͊_._T13ԣ5a,S1M` PEM!H_M[mv歒s:Y$uF&4_p7I7 d^S'F'48\X7xGZex~V6nw]'a1N^D ?+2\V/),,r7 \6jx̋gCh:{33I i #X99mxُ3Mc;m2 @5YHg 5OC(pxdʎq/$A.x&• .,r({]X׌Ly]%,T$:]*bÙmJzBWK}*4B Wq40^yxh"fk9DsdD^. x NnX ?.1Qh &Ouv|M3crA#hZ#aٻS  =];rUAߒ >vw.\p[ {ufiիE*_Zi[DU-=T䶹VZPszmҟ,U#26dpI>T_P-}<\t/HUK+Ugڋ{>GI UgsSdP`MZAZsXn{yL%w:]xʢ9[x,xHDjo|Nv])ǔ-ht2 Ϳ87C9X=UE9ͦ<|)<Wz+[x'"a*[ᷦ[y,4]FAew~$-Si3)"g;霈)*8w+Q_Xnw)3=Wza;d$>vP7ƧL<.535l#Y`~%r\ɀ/i1>OR/*åwyz endstream endobj 130 0 obj 2114 endobj 128 0 obj << /Type /Page /Contents 129 0 R /Resources 127 0 R /MediaBox [0 0 611.998 791.997] /Parent 115 0 R >> endobj 126 0 obj << /D [128 0 R /XYZ 86.399 708.042 null] >> endobj 127 0 obj << /Font << /F24 86 0 R /F15 73 0 R /F33 93 0 R >> /ProcSet [ /PDF /Text ] >> endobj 134 0 obj << /Length 135 0 R /Filter /FlateDecode >> stream x}Ɏ6>XEd&7CK6fׯl /$6*qWT>}͏*(;@tZF#;X/8ͣ4=Tex,O}N-#׽n }?f Bw,Β~.W;گa, ph3IѶj.";` :X?5#bI0SMc21}k_)KUN}h2R*`2h:" !~@t Q4 mxXn 83 fqu^5Ut1J^ʳ7`"њQFD*ydhƶbsHQ  Jx˴><jjhȻdz8 /)K Xп-vc4Z?n?VCZix&܈gqHoZ1]hq[}KX2.~5Gǟ+B f˿I4':: (cKQF4I p) D2>n*0 3#؃$F0 C[l7_HGVB+lbMAE0/#gN#1ckXWS%~]ZmwJ?tHf2~ųUZĠxB]3 cӸNki&0b8)Y NǁXz"p$̻Ro<9Q@Ka']?⤂* b -ٍHMTj;ma!2-% E^N9jx"Ɍ<ϝ {=^u)m{}t/\Ȥd$)=[.miw^6j0@!4@3(4%:wV{u}x@0TeZ-ޚA~pi#*% $DƯN`u..Hxps<6k 8G VBrskAd8H3K#R`Y;>UlX8L8d&)U5&T'fwF+Gl8B]A{p.xLP@ SFir/$a Z-T4E< kxjL[Ns0PU(K\6.!dx/eRZ| @YDG8hYQI\յ$:PHp\QsΘy`D'JuҝsWjIELũLoLwbkjC`ϰJlô8}pѭW5RDwI\jX| TD5A_nIXur-8ᑯ;{El`6xd㈠:/4WX *54'c&TWK b(!)%VB"E%YRQ|:P ݵC(A s2yvu*n 1D>A"tLT5ӢyKuwĔF{C.L*1`(IN8qGC~[a@eE\ 5ԛ?SLF[`F#nhDJ<\ym΃ju:YR C`DS^KAY*d q% .Y1\"Jw$(`QO4'OyƯ\BQEBEl8deÀJy 5Z+L`Sk?e dfD+ռm ,NMg1n+n|T >> endobj 131 0 obj << /D [133 0 R /XYZ 86.399 708.042 null] >> endobj 57 0 obj << /D [133 0 R /XYZ 86.399 486.457 null] >> endobj 132 0 obj << /Font << /F15 73 0 R /F24 86 0 R /F23 74 0 R /F33 93 0 R >> /ProcSet [ /PDF /Text ] >> endobj 139 0 obj << /Length 140 0 R /Filter /FlateDecode >> stream xڵV]o0}ϯR4#H}>LV^*"`VkmگkB@S^s|'⇧ پ?]1j;YXct/Έ9K.1 ݭxgMsKynEq!| *=5,$Exq$0ARX޾T)4,'<(,yB ?ҢP$MT<αiD8hK$dazFN &=খ*,49PSX:Gq$1 \JOvXT2r}+ƥvuϳkǾRS;a!8Ke (b Pxv" l$\\:9ԡ<\K # ՙ+%Ui+M5u]}u1M 2(hA@oARkW12Q4#<b3`;# C})F@o-Η5W~;xCao休jϠdf3C%]ՎMTHE퐉XQNuR <9 j?Qwj9I qvcFkt=nk9tM,̓9Ȋ3)?ʴJ.¸{7M1 w}ߞطvdž 6I( pύ[d#%$Yu(Bi|YoLc{S-i-oM9IBPY(uxdMISsny#2ٯk"lc> endobj 136 0 obj << /D [138 0 R /XYZ 86.399 708.042 null] >> endobj 137 0 obj << /Font << /F24 86 0 R /F15 73 0 R >> /ProcSet [ /PDF /Text ] >> endobj 144 0 obj << /Length 145 0 R /Filter /FlateDecode >> stream xڍXYo6~OiiE)qqd ,noYwWoߘ6<]JG~W|2Mڶ1 ds?}ALg!YU76JS/Jq7D]-z{:oʾOȻQyGy7Y\Ϥϝ={v`b+@bފeB-fyMlPT8=c5,2m ,<Qpz0JbXI-K,9&jJߠBUr=|2ivA''z|4e],I?rQ&>Dv YJj׊~<Ӗr$9ת O6?dQ:99JE FDc*6!)G .k,{SP XWxe2W $ =YVM; geZa6#`APح$@&EO ?.%F <1ۃ˒ht ޡ-궼' EGj#pVcE3FYydkD쮌ȅ)<˰xZ]R'!ҭAY]:(vkq!Bzuc }dT̋Á:Pq^n d]p(lف%,JfClh;=f]/niu[,zڂ6zLzƸ|lʉ,i]ӎ ~J!vo6Q蜷O ?4%;,'r˾mhn{iDNHuwG[=g"/gǻX6`z׷G/0Yl-: -5|Aw_ `#Fϗ05˘]`ӳ d|n_ !endstream endobj 145 0 obj 1761 endobj 143 0 obj << /Type /Page /Contents 144 0 R /Resources 142 0 R /MediaBox [0 0 611.998 791.997] /Parent 146 0 R >> endobj 141 0 obj << /D [143 0 R /XYZ 86.399 708.042 null] >> endobj 61 0 obj << /D [143 0 R /XYZ 86.399 462.713 null] >> endobj 142 0 obj << /Font << /F24 86 0 R /F23 74 0 R /F15 73 0 R /F27 92 0 R >> /ProcSet [ /PDF /Text ] >> endobj 151 0 obj << /Length 152 0 R /Filter /FlateDecode >> stream xڝUQs8~ϯ`܉UXL&tez}LGhbdԿ~+ɸ8GN"v]Az^A!$!l{v9?{5 !87_Yy@+ϧ$Bݿ^[+xߎKo9~$ m`;zA^+pε53~}RVI5z˕NyՆ8̍A,xJg_-(?0럛[cbqz=~sFWdVAQQ2mlAira}Zoϔt:V+sg u{hڜGi3 YXvMKQ-3 9e&$L1MxHj 1ҜBzn߸]pZ٭m5^X0qtV\J:a1J0EȼހPĊ݆z(eruTYqS?-T{WrSOH 72h.?9W t(rU%qԜˊe{G8$+R"2s2 @91/GIA1!+sL;?)낫u͡!KB tYt(3/*eY73c( nhʵb[j@a+U{I!D)_@yJl 01&54YCp(})waIT T0AM)כh Q^`;e%j-!d*Rt̸Tә8_c"t8P&kO8[f,hB׬SB v_p=bj~G 諌-FSnA{Aswq#),v@nUs>g4rja(fDv̟V #E6qvZNObS6Dz~cendstream endobj 152 0 obj 923 endobj 150 0 obj << /Type /Page /Contents 151 0 R /Resources 149 0 R /MediaBox [0 0 611.998 791.997] /Parent 146 0 R >> endobj 148 0 obj << /D [150 0 R /XYZ 86.399 708.042 null] >> endobj 147 0 obj << /D [150 0 R /XYZ 86.399 272.71 null] >> endobj 78 0 obj << /D [150 0 R /XYZ 86.399 277.691 null] >> endobj 149 0 obj << /Font << /F24 86 0 R /F23 74 0 R /F15 73 0 R >> /ProcSet [ /PDF /Text ] >> endobj 94 0 obj << /Type /Font /Subtype /Type1 /FirstChar 0 /LastChar 127 /Widths 153 0 R /BaseFont 159 0 R /FontDescriptor 160 0 R >> endobj 153 0 obj [ 778 278 778 500 778 500 778 778 778 778 778 778 778 1000 500 500 778 778 778 778 778 778 778 778 778 778 778 778 1000 1000 778 778 1000 1000 500 500 1000 1000 1000 778 1000 1000 611 611 1000 1000 1000 778 275 1000 667 667 889 889 0 0 556 556 667 500 722 722 778 778 611 798 657 527 771 528 719 595 845 545 678 762 690 1201 820 796 696 817 848 606 545 626 613 988 713 668 725 667 667 667 667 667 611 611 444 444 444 444 500 500 389 389 278 500 500 611 500 278 833 750 833 417 667 667 778 778 444 444 444 611 778 778 778 778 ] endobj 154 0 obj << /Length 155 0 R /Length1 156 0 R /Length2 157 0 R /Length3 158 0 R >> stream %!PS-AdobeFont-1.1: CMSY10 1.0 %%CreationDate: 1991 Aug 15 07:20:57 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMSY10) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle -14.035 def /isFixedPitch false def end readonly def /FontName /AAAAAA+CMSY10 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 0 /minus put readonly def /FontBBox{-29 -960 1116 775}readonly def /UniqueID 5000820 def currentdict end currentfile eexec oc;j~EЪ/ ȭX~id}S5Q!gtⵎkJc;rN^X5.Sy +'IqV:r㚉#,# dBZ *R*"7٨y=cLIPsF'f> ba ]fv+QAwdO[x"%Sx~{p҈덡|O BÄ/GL3h+Ng03jU1~akDzq=U}.KY碌 ֻ1?C N2Muh/4Gm&v.d)%\о .u 39:8*v ur{:i!O`Jʍ0F~Uc=6o]|IjFU9QkFψ-p;ja/Oz8tM-H =Q4beGHv /o9SK)B5:G||.͔'+;B)Dd!;(y[hb0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark endstream endobj 155 0 obj 1899 endobj 156 0 obj 770 endobj 157 0 obj 597 endobj 158 0 obj 532 endobj 159 0 obj /AAAAAA+CMSY10 endobj 160 0 obj << /Ascent 750 /CapHeight 683 /Descent 0 /FontName 159 0 R /ItalicAngle -14 /StemV 85 /XHeight 431 /FontBBox [ -29 -960 1116 775 ] /Flags 4 /CharSet (/minus) /FontFile 154 0 R >> endobj 93 0 obj << /Type /Font /Subtype /Type1 /FirstChar 0 /LastChar 127 /Widths 161 0 R /BaseFont 167 0 R /FontDescriptor 168 0 R >> endobj 161 0 obj [ 613 800 750 677 650 727 700 750 700 750 700 600 550 575 863 875 300 325 500 500 500 500 500 815 450 525 700 700 500 863 963 750 250 300 500 800 755 800 750 300 400 400 500 750 300 350 300 500 500 500 500 500 500 500 500 500 500 500 300 300 300 750 500 500 750 727 688 700 738 663 638 757 727 377 513 752 613 877 727 750 663 750 713 550 700 727 727 977 727 727 600 300 500 300 500 300 300 500 450 450 500 450 300 450 500 300 300 450 250 800 550 500 500 450 413 400 325 525 450 650 450 475 400 500 1000 500 500 500 ] endobj 162 0 obj << /Length 163 0 R /Length1 164 0 R /Length2 165 0 R /Length3 166 0 R >> stream %!PS-AdobeFont-1.1: CMTI12 1.0 %%CreationDate: 1991 Aug 18 21:06:53 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMTI12) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle -14.04 def /isFixedPitch false def end readonly def /FontName /YGWSKE+CMTI12 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 11 /ff put dup 45 /hyphen put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 103 /g put dup 104 /h put dup 105 /i put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 114 /r put dup 115 /s put dup 116 /t put dup 121 /y put dup 122 /z put readonly def /FontBBox{-36 -251 1103 750}readonly def /UniqueID 5000829 def currentdict end currentfile eexec oc;j~EЪ)s̾;.;rTejiK/df5A|{S/ )Sc\^ȟmp+#vL17~k d# ]LeVߐGoo٥\k 9M֨[G(aܘ|RP>f}|Zx'5+jۊz3p3`/gtJ8)&ho%̸{sCVah~I"Y0'Ӷg; 怦#Ӝոgl;O6jyg H@n΅ l2qŽwޗMe]}Aq}_oyѣg+JIua;5m˺ڳŞppX!cs|:J#]Ts*?~XH VH ‡9E ;ۉ?jK&\$x!/_lPK1Mgl"oË 9ёIهnXBf9)/Pj0RToTX0Pv쓴|0)O!Voҟ=gǿRsv { ۟%\]司ؤp5wlAfr8\"ڻb\i5K@>CkYa\vs!Q"H*!,h< 0,{ ˟KZ!JlFvtDl*lC0X0^UXr7H֩JkfG6/Ԑ{ڱԐ'T.#[tR0S7ڭS-L1{ob))'V?h~:7s9p%?k0>>)/hsXNIN`DtMrל%12kyYc`G 3rOOʞvzßV'4K "Ƿç5wG{g~ìs\_ղ!K,Z!_YKB$0PPulZkZB=0AYwAcA2#uY m:#즙@|V\Ɋ0s`{x|%ɰةL1z8'~9pl94BgZsҭ&MVRƳ?'7>V\ZY#MK*Nf,23!8vf- Wͤ-twƇz۩HʆL hzK6Z }D beqev]  TսhsQKQ"fEMĺ߇.bU/H>$D.w Or|qȓ7AY|ewlBy^, 3Su[*lg(TEȲHuxmWȽVj^}>߆[x Ej̞_֛ԶS'E "LÎd"ߧkԱ1fP&voymw$7?N030oWWZ-J- y@ n(`EVgՙC3YR rʪ.9H2&vC&W[4rK Zfdلo0 Wߒ5R+\U.9u̮_ w ,ȩУRdq{҇.鉄zRܬzpC(ꈔé /Yu3ٵ{:GKJ_Sޥ^1SXN= MdB1IbayUfn:\uͧҩ&1U/X0FNKQx9D\B/l0wjHіi)ͶDLD{)0Ҷbͼh" wHzOZGL^{AbvvG!PR)"76KPp} 'g~ h7*A\/#X!KK*L*׺;}OQiQV\K cpX#I (3* +-t__Ojt^hz(h](CqstqԱޗqlG+"nkabyΧ &-b=g/6R7poy3Eu;b 93bR#nЦ̈wI VvOoy3ThHPW4ˇyu5śLx )EJ.$ J)EuŒu0= L/zS"i=ft4d7H2̉jJ}fFd;(-}C!F^AM/Xc! Ǻ+r2vz5z:Ю?B\g0 s$ h'QKUKrPcMJޏ':XQ&N҅5]yZ-I6)Ma1bnѧCYGAxY*)aښ  OWȘCXFrik`wwGYV8:2]]G-E"GX~"DUތi9]c|{;̘aIKEQrLƖO^Ap ݏcر+8yan½t9 Y{V7 f,a%uhA`ijҿCN ta""0k}yٲ?_;PZh *Fw=5L)FCٗG)bgN /E2L2{+`'M=iMXDp5ژr83߬b;X1_eQo{_gecnd*7tr(F h\*}'v/^Qv$ӭ`L^#w(no7Md3s$6p!P75p)aL߯Yڣ39  **veK)hl[Y,uc.v0`n4È" ~ GVcjrj9(釹ld.hM @7kxX~mk6)ME_C/ڤRmhJت;8 F)WE{)BgW\NFׇeɨ"BCA Fi[9bM#0fc~iBX1 Ža.<$,Gbr9Tz~Meނb{ITo46=ZdYμ*b*G^Df-qf\M$v!k )E!W[XW|"Q`\!Щ-B78;ad mM.H3XuO'{&DQ֠} #TCwH7w,O&+yh|uOA7A3Z0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark endstream endobj 163 0 obj 6252 endobj 164 0 obj 1053 endobj 165 0 obj 4667 endobj 166 0 obj 532 endobj 167 0 obj /YGWSKE+CMTI12 endobj 168 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 /FontName 167 0 R /ItalicAngle -14 /StemV 63 /XHeight 431 /FontBBox [ -36 -251 1103 750 ] /Flags 4 /CharSet (/ff/hyphen/a/b/c/d/e/g/h/i/l/m/n/o/p/r/s/t/y/z) /FontFile 162 0 R >> endobj 92 0 obj << /Type /Font /Subtype /Type1 /FirstChar 0 /LastChar 127 /Widths 169 0 R /BaseFont 175 0 R /FontDescriptor 176 0 R >> endobj 169 0 obj [ 607 816 748 680 729 811 766 571 653 598 758 623 553 508 434 395 428 483 456 346 564 571 589 484 428 555 505 557 425 528 580 613 637 610 458 577 809 505 354 641 979 979 979 979 272 272 490 490 490 490 490 490 490 490 490 490 490 490 272 272 762 490 762 490 517 734 744 701 813 725 634 772 811 432 541 833 666 947 784 748 631 776 745 602 574 665 571 924 813 568 670 381 381 381 979 979 411 514 416 421 509 454 483 469 564 334 405 509 292 856 584 471 491 434 441 461 354 557 473 700 556 477 455 312 378 623 490 272 ] endobj 170 0 obj << /Length 171 0 R /Length1 172 0 R /Length2 173 0 R /Length3 174 0 R >> stream %!PS-AdobeFont-1.1: CMMI12 1.100 %%CreationDate: 1996 Jul 27 08:57:55 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.100) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMMI12) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle -14.04 def /isFixedPitch false def end readonly def /FontName /SGKAAA+CMMI12 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 33 /omega put dup 59 /comma put dup 70 /F put dup 78 /N put dup 83 /S put dup 113 /q put dup 116 /t put readonly def /FontBBox{-30 -250 1026 750}readonly def /UniqueID 5087386 def currentdict end currentfile eexec oc;j~EЪ)s̾;.;rTejiK/df5A|{S/ )Sc\^ȟmp+#vL17~k d# ]LeVߐGoo٥\k 9M֨[G(aܘ|RP6n=: b9s2m4{~CD%xyDOg<<Alw| Uv̬i@o *|'iSq?s"{}3w*`,\Ź g=X|Y20V O T{̀]mDU:Ms/V-|UҔ4Beg}%1%V7E]|o?41 ZYmm  w* IGK2Yd0=bsS;e`hz9h˴ %^{x 'i{]& 9c< U6cޏ(>O1sb>HAҞ#A͇i;yZYIG 2og#!\SR8?STGA' ;%a %98ٮ( 5E= W"2b'+}»*?)bUE5Jh E.ͥq XZUgT^.и`}o>,e,yh[g 2Zzn[or_!](l︟ŭ=}:8@|\mlʛo<ϒM fY~CN YZtHvMLi,9!<Ȋ. :PaUHQ*xa@=Qwh\}\^ nϛ$Eij\i4 #UdupdqoTi而Mne2.^P-VvI¬h)&܀X-OiUpm&cBK?BmCW'N̪ '`7 aCs 1OV!83!R|1cenժɾ:yE[tB5MxwBYR]*[~q el5.#?*>3nQ1Ie9 } |}_fŮ!θNljl:kA ahG'ˋGѺhGȭ!~ >ux$-|Uuțm`ۖn>,-t'ڮS&63؜,/tp9&*QJ,+,Wig *_Pٕ 5SW M?qj7Bs9xA#WurL"_B)&s6/w5+Cתo%G20^=|QVosWO05wq\.1#peHeWO${s iRBW g\ŢT5MghhڈKφ_qH YXhZSRɓeqy x%ݡ^_[h*ߦ{.b]H봈THAHcgU4"-\1Ⱥr5"f4]U$-0e4kV=*AsTpUi^q5?cI)@k$̗r,Q1 /2}iKi %)]> 0⥢ v[@ r榷1&"Ɔc(wyQ4'mfΞ{Yh _ʺ՜*'˂%=sI䕤qr 9Cn o L3]B$},j6͹5w`4l ЍE}{)FC(wȦ f>ގK rrti^ ]rεdK +0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark endstream endobj 171 0 obj 4812 endobj 172 0 obj 864 endobj 173 0 obj 3416 endobj 174 0 obj 532 endobj 175 0 obj /SGKAAA+CMMI12 endobj 176 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 /FontName 175 0 R /ItalicAngle -14 /StemV 65 /XHeight 431 /FontBBox [ -30 -250 1026 750 ] /Flags 4 /CharSet (/omega/comma/F/N/S/q/t) /FontFile 170 0 R >> endobj 86 0 obj << /Type /Font /Subtype /Type1 /FirstChar 0 /LastChar 127 /Widths 177 0 R /BaseFont 183 0 R /FontDescriptor 184 0 R >> endobj 177 0 obj [ 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 515 ] endobj 178 0 obj << /Length 179 0 R /Length1 180 0 R /Length2 181 0 R /Length3 182 0 R >> stream %!PS-AdobeFont-1.1: CMTT12 1.0 %%CreationDate: 1991 Aug 20 16:45:46 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMTT12) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch true def end readonly def /FontName /IWIAFV+CMTT12 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 33 /exclam put dup 34 /quotedbl put dup 35 /numbersign put dup 37 /percent put dup 39 /quoteright put dup 40 /parenleft put dup 41 /parenright put dup 42 /asterisk put dup 43 /plus put dup 44 /comma put dup 45 /hyphen put dup 46 /period put dup 47 /slash put dup 48 /zero put dup 49 /one put dup 50 /two put dup 51 /three put dup 52 /four put dup 53 /five put dup 54 /six put dup 55 /seven put dup 56 /eight put dup 57 /nine put dup 58 /colon put dup 61 /equal put dup 65 /A put dup 66 /B put dup 67 /C put dup 68 /D put dup 69 /E put dup 70 /F put dup 71 /G put dup 72 /H put dup 73 /I put dup 76 /L put dup 77 /M put dup 78 /N put dup 79 /O put dup 80 /P put dup 82 /R put dup 83 /S put dup 84 /T put dup 86 /V put dup 87 /W put dup 91 /bracketleft put dup 92 /backslash put dup 93 /bracketright put dup 95 /underscore put dup 96 /quoteleft put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 104 /h put dup 105 /i put dup 107 /k put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 113 /q put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 118 /v put dup 119 /w put dup 120 /x put dup 121 /y put dup 122 /z put readonly def /FontBBox{-1 -234 524 695}readonly def /UniqueID 5000833 def currentdict end currentfile eexec oc;j~EЪ*BgNӽ ؑlKq*޲Xws|QFqv`zXMyp"5O˩YŝP(DT![v67XFlU&3!Rq4wσ~j+ou_dV` H [fIs ?Sy_aOg+k%;Y`AXGSp֓Y%&n@C[KBcCE(7@$2`5ձSX/ z)ύ թFrsWa-3"ay}]*z]¶2k,2ƲXg׳1V71y \š)~V+h7|v1j>3~ /%'5 {kz M˿G%+g@|x̅/ER~AX^o*ӳF7/q \X<~Zֿ]ŋ *8)E_oG aUXGv:.~2ڜlT3eU&:0V{]GhsH޹o?SV=9͒SaM8 pHs,omΠK>CРk%th1eh@D/!0eΨ4t`] P(hk4>r\>+rY]Q:N"F5HFx&پub9Tc_RHb Rˬ z4&)oHf ]CcuF,P=p9Qgt }$$D0C̕>mt(Zr :gY'Jk:BjUc@&=)Jxn4Zuh"҂ن{Ow .e <]aS8 ^M("ԗmߖD  l/J8 :h|S_b]F7Bw YrtuH=ŽUøp6;%u4m 32ũ"!{@#ѳ|)g$뵎~xN$Ҕ!_9DMAt=? x'tDfU_?H{: ހ)è. n sc| &k td P X wTp_NۣYtce9c ;6nޭL@Ζݻ8ƵZ]aH$-x|qHv;ߚV 7WAҾ>ㅏf%8+%ϕ:|,BmkxA\"d[O_e9;sG,Ep5ǎ&H~hjT'#cVs[r BDg8q#kș(XqF<AhMp]{kвQ+zMO fD Ldg$bXnTæ t0''Oϊl23@Q ‡=!^4ܷd~vۼ"8#oorDllZ"~I+QwӞTcO>ALSMH%ҲG12PKuxdmXu93 m}:'1ÂDkml k ]\~冖pVokZ2't@d=/XO9Z^wgQ-4:)|wK&gAy=5z b2xwx:@}8éTwpň2X2v>`J+^\0 MEQ&gLfQ''f4;ǐ"\GW$`>:؇\qfq`5e#BCJ yAn<)>u1ڦԔPd-KEU.c۠O 4MGi{EwKu;Fe ڳFŒт6j1{b#*1s!!\8'!ֹ{,cm ҆]T$ہ 8+:Ӧy;̗w&…v)+C/zխ %l"G3R'ϭ%&odRSK&+Hk5#fivGg8)Ѷ5ȵwߢ/ڕYQ%kۨpk%\ ]E-PCWOxH@ b`RGk&EKQ6XV=X?eh>H-_Aŷm͏FJˇO78>*沓t!w>ISeYSJF% )\%;7A&q<$hpW|Q>g@J +m L]"(Nfs-< ߑn*㣚2nոZOJCy^]1m/wW0.']P-p7]Mt&X(5XA~I{DV4g!? SŘw&"F9koK鿑ZG,C-H_i)(Kp WLhrG[0k75.Om/nmxjK_XFz8.NDlEe7lp}Μ##X; `FK,!VD޻迃4@kd+[CC'^Qs5 ~/Arx9S[3*,# Fڐw8FzP. L5̑KI45>,*T<׼>Zعj;~u,~_ 7c| \6EH0:;i]*4%5&[8XhUPmiLIj8K؉8yU&AqFop@XY^ 5lK ʧ:@"_ln:gjm?ΐnΓ$A!t4Y_ꠥZd!|B#=#fu:>PI08X Z{ڭŅNpz WU3c"tVU;vkqT{Hf-tz Ej޺eD(aU!Dc͑RX$Rl'#:B0-Hat#}u\|oe:`#zSL:^gu0vsrWD[rdw䄤 ! x c^#YZο`55M7{ZON&n=53"Ev@KrA[߽:pS<2(\+퀅? KJ::"\G^I<'va;Uy hjϮqYKDgcI˜E!QrsJù͙ p"q şYƇi9H=",ݰD׻u0,C7L_@`B f..JS'ڙ͘* ȫ`좜^*LK=',8اD͋EjC31_ruٲ$ 'o02zSFҊ7y 6nݙWq" !sґXVܨf2VY(7}ߘD˸nۺQ?,mXBxBxkEi i=p%BC_2s;=F=68{i/FSj8X{X4eŅSSPzR>]bHe2pY:䬏H/0<~2 Z?ʨa#6s@. F?]x +0(/ v;zǨ>wʆeDQd-j8BǏ&Mh rz\ c~5_DeH!OGr3T(o*\ZV w6?}rB->Z P$,ixZ˃X.v$gA{DVHDμyY?TP6n5M&PypSQ+"cz*4~b X|L'>vKLk|q{k.YW:лt ɚLw '. z< wG~LkHOɯN+03qJzaz$B;ua~0~?bʛF ԡfxB ?H558"cUhz!q6μEoes>HqHTHn5sW.lvTp$AC&T x:./T^etdи?SpFoAw;Eۆ:E jq=uY04/%WF3Ӿl#'/(w.tjwɎDu0Y y¬{-_6>A郳{zPb-Ke;J{7DqG$S7ņnÅ峰m% R%1kI*'gЄ]Mߢ(qț/IfhLOfLJOfXI_b sjscwH)6O';7:'\S~Fcztx+ozѰ)<;D]sJΕ<ȳakTx0OjIPWxzHp(XWI4ӚaA: a~PkjF;td2ϔn,! o#.l Q}%[&~@tM&kGPO(SᒱDZ`+CI~$ߣ3o)(9oI\ 1tf*h.7MxUl7~ fE:؟yIV@] _%r+7VhY B<Q tv-NgnGۂV_5Ѐ(Yř魹ΣGiZsi> 7 mu+$T' MP<ƭDAV'idwREOߊxsڿpil 3؝;̓y#_2c*wϦй,JKqop U猶DpMD 9{(c$FȖF'BSb6{PPňw'0sCR[s]];=$=]2?{d L`R˸L4˱Rmc?t]&ݲu-5P 6.hqڅv[QV!xkD@nFX.*M{$M$YuUcyӤdf4óq\ߤ [YLzrXK~}h#R6KyL^c@C:-`H#Cgi)`MNYA4clAB_u1<#9ujڎd|Ճ=tۂ ځxyk55r[7d҆;z.DI]ZʄVFL]a"SWw&1g4t}ۓ#ݬyHG?bFH+Lemyѯ-?ܜcjP %=*&ؿ!VC5\IV4tN*ܲ~ͭ+xε}, O_~X1 ǀH@lNq/gR8˕h6 cnϸ4,2(}NwȔOr,披͸rSr·-1̯9`ݧHJQxMT] @,R>yw*k+gL sw~21XaG%GgkD&OF2y٫D A8USϤGܮX G^jJ[gYR\PgHXp'ǕjB라>p]49LV!~nV(BYFZ&\ud#mnslB$lƎwMG.9{PNj>q[v$vBF3-vM~pu+!r\ lNx➇dlauLJVUnEU+*Pi:: Egz}BqZ^q9o"CV3ƨȗcSvnhjgVpc"J$3!v%KdU Bl|mtNzH w*' xw4PM}*_ GiwA_qnupKE+Mu kpf v{PMX"wf)#w)վ-1PՇDb ϴ; |CxԚ*9Ї p)_@)ޜZr! NYX(_yVzcc50z'U>H;IP}v϶@>ax#d6 ;s 5]xy( y5[+R ]dt+Ù}v>Bԃ&~i4' cgi7H|-O{esRH6t{_@mb0`Vfȹ8t޶@Gvn,*Qݙ:rt5Vi) Tm=vJ72FML%tQyYQ䊰5"g_]b Eɭ r (9ep}-¦>IInI>;!~$Gt: ⓼g(W=ټ]ZBy9ϩ2;淮c6w߯l/d輼Q4xk{_aɓʿr eC=*#)2K!h~pY _Pp /!"g!h{Х'$ Y+5cK˥7_([El9I@s9fot6q@{.0vPMʳ!90f >*3 d1;b-tFzkus? c!ݥ0Z@g; ~j?R΅굺U[H`/ Vr#1Z$ђ/[fbU(C;=;Y7,.dY E%$s!UAfejwx >϶ L޽sGU HvJMy3\dKnN; =t.q10(GGeasu%dg1lq<{C[YMܙ"O0cJ7 $T8;'y:vaƍ5"ySpQu=< E4J~iA+j(evMLO1D`4!d{HK@AJktg< 'WJsS^6z}i̤lVR- DTUhV•~]"sPa-<Aʊ&F`3B5|0"}|LOeH("=hyPi`&^8PWlף]9/$~vDR99z"Cn0:!uh#lq4S籉mQ8uLCyqzȭG+.?Gbv XaǵD6eO(4F¡_MFYWyoۅgڝ\rlƓ y.uWl~t>k'vD 5}jw(I[wUA\ O-yi/A `4,5xc5W č&; %$GW3>s%ٚ$HmuCJ9{G-'n2wla *FGAҥ}j D~tGCRE"zx(,:+aYqbeeMEL6~BK"x 2BD)ѷ:>\t'qTR c>̰UE~,a@YpE?Vk>S t%T"B+Ґ* 𰴶YPc4?0%.Hӹ+ѭ7 ]YjkE(B2hu/PTxn Pq9 ގ{)ǫY1cg!۝?_Ux5j%}*v(ɗb]Lh#Ƥɾ͵x-ʪOԀlȔeD݌~/%n땸ZSDwTĴ4c d Ə!i9Jyc͖ 3MBcu^' 8m $tE?|)5 l:@G/A{4c`w]gL(&: f#Lk%2Ai>'fs~?Z"0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark endstream endobj 179 0 obj 14178 endobj 180 0 obj 1967 endobj 181 0 obj 11679 endobj 182 0 obj 532 endobj 183 0 obj /IWIAFV+CMTT12 endobj 184 0 obj << /Ascent 611 /CapHeight 611 /Descent -222 /FontName 183 0 R /ItalicAngle 0 /StemV 65 /XHeight 431 /FontBBox [ -1 -234 524 695 ] /Flags 4 /CharSet (/exclam/quotedbl/numbersign/percent/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/equal/A/B/C/D/E/F/G/H/I/L/M/N/O/P/R/S/T/V/W/bracketleft/backslash/bracketright/underscore/quoteleft/a/b/c/d/e/f/g/h/i/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z) /FontFile 178 0 R >> endobj 74 0 obj << /Type /Font /Subtype /Type1 /FirstChar 0 /LastChar 127 /Widths 185 0 R /BaseFont 191 0 R /FontDescriptor 192 0 R >> endobj 185 0 obj [ 676 938 875 787 750 880 813 875 813 875 813 656 625 625 938 938 313 344 563 563 563 563 563 850 500 574 813 875 563 1019 1144 875 313 343 581 938 563 938 875 313 438 438 563 875 313 375 313 563 563 563 563 563 563 563 563 563 563 563 313 313 343 875 531 531 875 850 800 813 862 738 707 884 880 419 581 881 676 1067 880 845 769 845 839 625 782 865 850 1162 850 850 688 313 581 313 563 313 313 547 625 500 625 513 344 563 625 313 344 594 313 938 625 563 625 594 460 444 438 625 594 813 594 594 500 563 1125 563 563 563 ] endobj 186 0 obj << /Length 187 0 R /Length1 188 0 R /Length2 189 0 R /Length3 190 0 R >> stream %!PS-AdobeFont-1.1: CMBX12 1.0 %%CreationDate: 1991 Aug 20 16:34:54 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMBX12) readonly def /FamilyName (Computer Modern) readonly def /Weight (Bold) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /YADKQF+CMBX12 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 12 /fi put dup 46 /period put dup 49 /one put dup 50 /two put dup 51 /three put dup 52 /four put dup 53 /five put dup 54 /six put dup 55 /seven put dup 56 /eight put dup 57 /nine put dup 65 /A put dup 66 /B put dup 67 /C put dup 68 /D put dup 73 /I put dup 76 /L put dup 80 /P put dup 82 /R put dup 83 /S put dup 85 /U put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 104 /h put dup 105 /i put dup 106 /j put dup 107 /k put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 118 /v put dup 120 /x put dup 121 /y put readonly def /FontBBox{-53 -251 1139 750}readonly def /UniqueID 5000769 def currentdict end currentfile eexec oc;j~EЪ*BgNӽ ؑlKq*޲Xws|QFqv`zXMyp"5O˩YŝP(DT![v67XFlU&3!Rq4wσ~j+ou_dV`Ky Z]uMYb[1[l',t\pڮԞZO4GJ7 i!U&Ϸݢh`ZṆhKGz; #1&()$J3KُօEsjFf"P$-I޵˕B 6=hqDV<` EkENrraƌJG ~L{6IE6U'y 0gK>&)o>2\U]$XW-1f@'B 1mW=L%5t.O-]N CT4>&wvNXŅCf עr1fׁVCȖ~q0 Xf^^$ӷ%G7dȱ\lFc0]g<銷_&W{>}N|ӷ 054H4ܞlG>T_cќ6Y1 nUr-u$yfOσ4nAyغINz+:΃΃Џ}=|z`v+D{.;FWLEc6o, e&ۺH%&e+ o='a9ܮ;-sg}l3K?SEhAr;}5٠땷7_KߔZn+ Kw$ZdvԬ|d-!{FIqsR .ik]q?J +L.ʗk9Z2鵺B&9X/֧Jbsk7};Sa5p1 $'*nci-:~wD:TNiuޖ{CoGR#os6깿z-vUnxC-Ѱ{ h`YZSPU}3 /XI~WbɅ%0`T)|ge79!#tj^V+D<(wD ʔr8ʺE,E-*I-&E$gZI]{xԎ\W sR6̜KYX6Xir?̘sܧ^PrFx3yD` fEt`" ];ʉP^ 4,&N`ʗ" ޒW ){8|lbLb|ъ.xC53ںAag@@[!1׶ ?E'Y.":.KvQ#NtZ{kiԍ_pKbeg|S~Xct]†t8LЅ0.]RMOi*k0;?Ϻhq1mo\A!wڞyEm N KI3W1aZbPОYك:jǻ2$rzLgF۞wg7/M#g3(p)&ְ3Z螺 2APZ߾uӺ[s1`1s<+5;TxVͤf1jIT_6^)ެ޷ P2Bʆ{qb^/񴕴Җ@pG1BH9Ae$r2kOV,)/QWZF] a(}]9+,|l|33k xFwdL8>>|<@42r{t)#r~;Isi-)0xX`<'8$cT̵04aN5'?ˢ ̋2a/3^P)weƘ]?߂!oSF`j,8q۸&Bow?u\WnHr/msXxg+';gVP@qVQy\S=O8|[?f/gz0_)Ns?ZA{xzZ8y:oAOM1#5Jilsi^Cry4̦MGT~ 6yfCs@;ՓϘBω PiVoz Js6> Kl4-Z$AqmvlH%6!(h!xS(maw7=2BT9j{v{bDzll l>;Iݨ=i f]F <_`Mv&a9 {j]|P(f)fvz/^H;=KY~=$Qv[sB~;aia+7 _e>Vx)2MgK=h'V5z{R>H%٫y i@Z|C$}\?\H"Ӎc0П31dL22ȜT~JO%XnݗT{]ҵTOGv~4=z@I~P/u׀|HMdN V򴙸V.+ʔ4QJxrx^(+|cBWx9^iD;s) ÑN_O @s e|&K)JܽhfͮZAGzk#iZi*.uT r]r?,۝ktX[iT SۗhIX28_BWɳ6 QKGB EyO?ZUKS-@ci^^+렖ʒ xceU-V;[$z&l/TR,׈_3:?O b%7p&x GWWZlwh7h40ͥ])Jo]bv⯙l(ڦGVzH1`$n[ Z.MK`EIV&>TOkJM.W,"o6S6if R:X-GjfZ >R:!yfsxq*jM@qDzu;^AZEy t3gw=@SƧG?_㵈i2yy`;%iQ_/?+P|g1*ՠˎz54t_=Z9J؋S:'M9vG/Gdd]n%G4"#֑(r܀G<^@;y,KoÞ1(:5Q̱L]Kx@C#cvre@wݏCoHhdj;lsbr6,ɼ8C`㰡G Q>pTRs@8^RHahY?< o˙Zu>(MPg8IX%=Z㒹?]\Lwdn%6? I!%W%&XA3Cz՞^/7VY0Ȣ1罹az/Ȩ~!^in~\Jme/3ZNYg3 $WDcl~* KdxWʨlBE٣VmP&wQt߱!Dֿ҃gZSFȿ(ivIERpXP%FH 3NN2 #,΄}6)m˚3`}#D;f] b!>P_DjgcGTppe?CsU p eTd%ǯڣpA`$ v[V&3nF4feJ&PC!AXyIWr_bCyU1^W{ZڜX-Y#%Rl ;*=C? qۭb8NlD^bLMed0 QHELzut*zo=@\.b&Ld4=cS1nx= 0ֺ;B&G%L c Wɠ=FDPUvK8n2S?C[&Š'4iy/=_I(QJ- !FE4ĕr[bUJ^vQ𭭜M~Le$?DΡ)w(G==Le 1REiw)H&SpS{EO] M[ הC è|\YxGcfg篺;ݤ5;`=y?<[^}J-GMSNߩ2/9 =>? Y%ߏ7lc \!zsnR;N'[?ћ`SeǶ+P(`N.4IA{ wEkd:B4*-6Es8xY)[ժ-9{7Og R L$3lPj YDH#ӻiga]k‡U^Kz|Tz#9f:6h3V$;N۪wCȫrA;MԾy7%:fOdOhZBz^黭pcnr[9Q̡w#/Њ8L9F΋s- >]\#a?\Q>w""> endobj 73 0 obj << /Type /Font /Subtype /Type1 /FirstChar 0 /LastChar 127 /Widths 193 0 R /BaseFont 199 0 R /FontDescriptor 200 0 R >> endobj 193 0 obj [ 612 816 762 680 653 734 707 762 707 762 707 571 544 544 816 816 272 299 490 490 490 490 490 734 435 490 707 762 490 884 993 762 272 272 490 816 490 816 762 272 381 381 490 762 272 326 272 490 490 490 490 490 490 490 490 490 490 490 272 272 272 762 462 462 762 734 693 707 748 666 639 768 734 353 503 761 612 897 734 762 666 762 721 544 707 734 734 1006 734 734 598 272 490 272 490 272 272 490 544 435 544 435 299 490 544 272 299 517 272 816 544 490 544 517 381 386 381 544 517 707 517 517 435 490 979 490 490 490 ] endobj 194 0 obj << /Length 195 0 R /Length1 196 0 R /Length2 197 0 R /Length3 198 0 R >> stream %!PS-AdobeFont-1.1: CMR12 1.0 %%CreationDate: 1991 Aug 20 16:38:05 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMR12) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /MUGOEB+CMR12 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 11 /ff put dup 12 /fi put dup 13 /fl put dup 14 /ffi put dup 19 /acute put dup 34 /quotedblright put dup 39 /quoteright put dup 40 /parenleft put dup 41 /parenright put dup 44 /comma put dup 45 /hyphen put dup 46 /period put dup 47 /slash put dup 48 /zero put dup 49 /one put dup 50 /two put dup 51 /three put dup 52 /four put dup 53 /five put dup 54 /six put dup 55 /seven put dup 56 /eight put dup 57 /nine put dup 58 /colon put dup 59 /semicolon put dup 65 /A put dup 66 /B put dup 67 /C put dup 68 /D put dup 69 /E put dup 70 /F put dup 71 /G put dup 72 /H put dup 73 /I put dup 74 /J put dup 75 /K put dup 76 /L put dup 77 /M put dup 78 /N put dup 79 /O put dup 80 /P put dup 82 /R put dup 83 /S put dup 84 /T put dup 85 /U put dup 87 /W put dup 91 /bracketleft put dup 92 /quotedblleft put dup 93 /bracketright put dup 97 /a put dup 98 /b put dup 99 /c put dup 100 /d put dup 101 /e put dup 102 /f put dup 103 /g put dup 104 /h put dup 105 /i put dup 106 /j put dup 107 /k put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 112 /p put dup 113 /q put dup 114 /r put dup 115 /s put dup 116 /t put dup 117 /u put dup 118 /v put dup 119 /w put dup 120 /x put dup 121 /y put dup 122 /z put dup 127 /dieresis put readonly def /FontBBox{-34 -251 988 750}readonly def /UniqueID 5000794 def currentdict end currentfile eexec oc;j~EЪ*BgNӽ ؑlKq*޲Xws|QFqv`zXMyp"5O˩YŝP(DT![v67XFlU&3!Rq4wσ~j+ou\@[6]nhmlhaH+4/?3&n=a6E#|~.ԅˠLw2.槝sNY ڻ.,VnNX3|裠k(QIOs m;fߖC1}_a Io#0wݙ\P,f *bG3Z2کP8L3r[vnc_Eh~g9|M) }YaѕH|1m![AzXpPNCU7Uֲ7ΖTgx_hyW^]W}s_Zfs@dYr ȟsy&vJx)ݱ~Kq 45hL#q:4pP?g |GJSn^i26M Ęz0. v31껰xCj 7}0a `~iEfÎB wS:;9l[ vqo (>DlqY?kڑo^8KLG7qZC`D A ƾ ERtHȺ$, Dr[:|ͫߟ@hqs|:2f7Z5|+EM*{g4_<:xig0NA2ϩ6k'18>22$[9Y&;3!CmM&R(漟k{92j1*a ]ot W]ϭjY>5?1& '8*MS ~غ ]Y!s-Մ+Z9G>~4TQڋ,> JagWwSLr˕#aD6IT (}5}s @Y{mHś$lP{t'kpz}ziI]n][=ZÙ:#(@56U5"5$>؛ )QTxܗKIqeTzGxž N dĄ:et_x?UYߺNCtV @fs=P`xbTZJBɷe8 _Aju` 9G8U> ioUqׇLSk罆 !<8NRB0MS-ڡvGXDXD-%!!Gv}2GۀFe݌[l^9 4"s檠gŚpOsD{6LX/uVYLy@_t$G/5}!q]S x0`{HsJdGI.q޵@G!T)4w k5C"@Tld$@b?4 Q)Ky pdlMOX!f~@܌uʍ=lKB KsVHSU HLݦոw0КdD^mJn+a ؟G{X]7֌pKCeq7.S&D ,nPەqZw;+>?oDzj'+GaB_g;R_1(LKr%ZzH ɦ` ^ c݄d"Y1PA)2ȝ08{Ŗ"䡰 qzH RDm$M! %*nqoc|VoT',2O=($M:P?1΢1١/"a/ZtU9u 1I= qlWjgEP=~hc؏vτsjI,)CT t^͑ZJ)2,Ǔy{y:<1PjњyQP&UX8U5M:N}e1vo(Qq\>=4̲+)U.ZSlgad|QwVj'NGᴵHs;J @Da+Zd>X+s@|(S:$dyN|s|Ma7&!rލ?\9V*1v& HQ%$4HcG a*`B5N s8Dt  GzՇ!%d"%%1b%)ZZєD'؏Kͤ(\p3ժ4$*-z]6Uٔ AT~ /#³ Ԉ)*i J0.|G g ُ!Ԉj}XVYHh{B=9K܁a in~'NIe:gתIoeWB|w?Wg^bpT.0F]u|zWS Y`҄ZSy1Ax'ɦGVO5. ȶ°%yXmLW.ՏxG~96]CSHE}lrNektW%XS.1 Ir0=#j#<^|Aon ]ɓc7AR+H(BxzoZ}zfת%3t1  2lك4Yԉ>\1Ӥ&1E- ͑38~!\V{uu>N/#2)W/-'eԝA2O(}Qy NJE:P2 9\"̚7chM`P|m%,1FݖVi>񎭍y ԁI;FT#a{\T΍ˣ =#²5VϞ J͵ 9? %B{t][$>ph>EG#1)t|#r_,٥u"W"D`g>P%Id6}I=>w.:?zzJ jbm3eOF4<z" C|%@=gSjf UCJDՄzf!C$*EZz]Hm`ǠBYa8 nMC(~3[އLGҬЙ8>0N8~w3 AyTk͍[,Id_Po'XKO4~Hȯ41 ʊMPw8NU%T@?bчUuE:1nQ;c쩮,%g%?gf{-Yr0:{/?trER,DA܋Kޅ8(icEhS>Ϡ*#VEUX,(25L oOdY൫lJvP+N Uu+mHN?8 a\):[> 瞞.:w>rGyE+UpzĘX#vs,1h(uf} xRu)q9ĤşM(ZvuZ4Q[+6jOz[N9Zc/~tg'?1j#ڃsw$H,pMeUr֌s]p.9W6R fLoOV f})ECωb#\E|e@6\+[;v Sl"ߎW/arnGOY/rsL.cO˃EGzc"1>j~^-xPmLo/ɨw=&fheCH)exHޡbfq(`r/hDz:-9B።g_ jA!J,G6l1m ,c`z˹%+n[8cNjQxX;g+{C@82omqK;!jFU|oK̒Pp%mq:j oUqf]cNL;$\a}5dA!. 0HzipFj?-Ώo^CheWUۣlp.6r :$IAСy-ޛxW"?!{^L"NVEs8ŠznTG}z)E.f-vf)q8)[E}wdWSYiBC(sQ+oGSt/]Χ0{(C򥜾F%#P.1Y2 U Sl7| )/NŒ~9>2;hZAJkڦ((ۂ) `Zuw_te=XA7"!wUD&y8NhIWjU*wsVфΔ.8"Hi"5*IOwB3ajM\%40yaÆ,PIEӄ1Pg8.yߺ}(ij<}K{y` Q-+h]qPn2>J>3-s*}δsl:FAwr8K7f~8Xڼ^yŇ=Fkf|q3 ([0:][!Bj%p&[ 1H2t:)xce+͝F{m ׀=Zlc4'^lIzHn [Ʉ ys4 .TО?.Aa=UdLx`\BS)TkMɀ(ݠMœzA~;lq˒B X'jKaZ}?Oe$-mJbf濕5ȕYI1]hԫfLG' "BTeOa6y#uհ"uXi !p?A/^&ƙ r^FܔmMtQ]}rD$N4{ Qr0f0]g5kַεjlpgԹFZxWork=K$2P^-GqɷZi6@b:^4;!k8A#b8fާ"{EB8yni. 33J: Q#h".x$.lKW jڔ]3[Im1?E5m%B|0C=eԘ]ͷ?*+.Kf$=z?C]_z^xM9j)kb$JWux]W[ϚPJs#_¡C߬UwAk[|8l%v6gh]txSnAc`ZžsKiZ.+Q5f~fSԦrF3AgTxn3YHC1a,[ng3c^ͥtUn#cy{^Jθ l5|".(x%Ɩn&d`kLvmktH=^Lё wo!=(;]%Qr{{vn(: fYO~Ig'׫ɥ 9fjy<$*;*5r:.4 B8j[O4*=t`]zCm5Lg |rwԎ:vlqYԕ3;+OtJaŞaH܍8|-T1d>+gQpzrF#qɯB VB2ҩF&|0ay<4Û1Ŗ]gGUt)2HZ00l8,v9t7 /cnA;)S|iSP,=Ӹ,9}. ?`->a()lK Wݵ0+=Ѿh:).NI{. U>r@( ؘp$f9er0ygѧqiGFXz^չ8:]}[~a!_l>rX_ll{IYxov!cDQ5v l}q/e#y_rfݦqU_Ua;t ;&ME <}238}sk~l\e4w1kIvاqk+7a5QCsU6if]XtQ 9u52em 2QӅ!ӒW`*^٨,j&nkX+` QY@a%ҋWub=tXf$tA[钚l̀9Gh@_$S${EFcL9f% 668gmFy e`z+>R>_>=r;  Zn^|^ > n rlqK^2RB`Nrw /.FRlOCALi{y/B:V҂=|d,oxy =FoЪ, 9;»qp|Zyal=||:j-$xYvWe(QFwZؠU٦PK 2R,詚q-[Wz&a+_})w[Aە]ם! _^]֋ǮM.sK.*=U+/ӿ>&S,>8D=@@-"CP"d mɿVk Tltg^5h~NO W H39rQ,! o!"b|Occ(jپaR|/0eHS]{W_IJ5PՉC08v~x^'LPMnVχY9̹b5v,]joiثl1Aj%~ mb:Z_߽ӫX$ں{NaICܝMUg~^3Og(%F^?P7-|jilu[tV[rYs!c+mo ;0Ɵ}oLJ*u;!MGǚZt_ڼ—=HK9C]MVFc3IWGs=UYHGOwM0럫"XN @|< ٰ>sVkiX[ Mci'v@'؏k|%T{slA3 X9 UQp>FƆw~\/~ݸt ۋ'/^a;S ~!sYIX&8)^B`NY!{Ho[lDj+7Pjk0dV*<٨.kN)B-8_ ٦i]47G-K^X`#{n4F= П?6XfgN2 z66be֝2 ɐ7_nTI>\N,p~ b15X!Xmճ;~2&_PV"]:Gn%6#^^lȧ3a{+~!a&zyTky3Ekl<_Ff!~+̟^5O@¶~#.v)GI.)pۮރv4'#)E#p żZ96ao7 jl-zӨћ6]'I Jl/>6|)-! ݶ8 I~#(tEYr-hDd:Z #XsC|me|`xO~%^&{Fv:69;ʗŠKg8ð]@f e_cu,z4a07y M=jy(hÞ# .xL~ylPX` ~:;/Lj0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark endstream endobj 195 0 obj 15395 endobj 196 0 obj 1977 endobj 197 0 obj 12886 endobj 198 0 obj 532 endobj 199 0 obj /MUGOEB+CMR12 endobj 200 0 obj << /Ascent 694 /CapHeight 683 /Descent -194 /FontName 199 0 R /ItalicAngle 0 /StemV 65 /XHeight 431 /FontBBox [ -34 -251 988 750 ] /Flags 4 /CharSet (/ff/fi/fl/ffi/acute/quotedblright/quoteright/parenleft/parenright/comma/hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/R/S/T/U/W/bracketleft/quotedblleft/bracketright/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/dieresis) /FontFile 194 0 R >> endobj 72 0 obj << /Type /Font /Subtype /Type1 /FirstChar 0 /LastChar 127 /Widths 201 0 R /BaseFont 207 0 R /FontDescriptor 208 0 R >> endobj 201 0 obj [ 576 772 720 641 615 693 668 720 668 720 668 525 499 499 749 749 250 276 459 459 459 459 459 693 406 459 668 720 459 837 942 720 250 250 459 772 459 772 720 250 354 354 459 720 250 302 250 459 459 459 459 459 459 459 459 459 459 459 250 250 250 720 433 433 720 693 654 668 707 628 602 726 693 328 471 719 576 850 693 720 628 720 680 511 668 693 693 955 693 693 563 250 459 250 459 250 250 459 511 406 511 406 276 459 511 250 276 485 250 772 511 459 511 485 354 359 354 511 485 668 485 485 406 459 917 459 459 459 ] endobj 202 0 obj << /Length 203 0 R /Length1 204 0 R /Length2 205 0 R /Length3 206 0 R >> stream %!PS-AdobeFont-1.1: CMR17 1.0 %%CreationDate: 1991 Aug 20 16:38:24 % Copyright (C) 1997 American Mathematical Society. All Rights Reserved. 11 dict begin /FontInfo 7 dict dup begin /version (1.0) readonly def /Notice (Copyright (C) 1997 American Mathematical Society. All Rights Reserved) readonly def /FullName (CMR17) readonly def /FamilyName (Computer Modern) readonly def /Weight (Medium) readonly def /ItalicAngle 0 def /isFixedPitch false def end readonly def /FontName /KMDSMA+CMR17 def /PaintType 0 def /FontType 1 def /FontMatrix [0.001 0 0 0.001 0 0] readonly def /Encoding 256 array 0 1 255 {1 index exch /.notdef put} for dup 66 /B put dup 80 /P put dup 83 /S put dup 97 /a put dup 101 /e put dup 103 /g put dup 104 /h put dup 105 /i put dup 108 /l put dup 109 /m put dup 110 /n put dup 111 /o put dup 114 /r put dup 116 /t put dup 119 /w put dup 121 /y put readonly def /FontBBox{-33 -250 945 749}readonly def /UniqueID 5000795 def currentdict end currentfile eexec oc;j~EЪ*BgNӽ ؑlKq*޲Xws|QFqv`zXMyp"5O˩YŝP(DT![v67XFlU&3!Rq4wσ~j+ou_^ 2nΗ%)[yi2:(o Gu^~kτ>(O/߄ۤXNߵ(ӸaXœIli-i{.%Õ` vEa!n]8rCzi.;a.|&Lу׊@a, |/"UZ%F 7?@^7>at%Tcq{K9a%-dSKKV$m3+8&t}2oM# *w6`*s:82hbwC$o&I$}&3Ͻ3i b3? K{\7j}8fnd Zt4~d. (w;ZdLBarεR['`a_Btl27[rLPYm 力HI~xܧsbV2mͽ1hŚ5araxә0?3c1'㵩KGVA'{ı= _B }ۏݖZ?13ooMEɹe0 R"W|f in`LƔ4ׁMFm5L~,fWZ 2q05HQd 8\u lޫ#\E\Q {5T1Gh4N^8r`ڑA+1 HJ9)Ԍ5FzlVJcǢD{L<^W1+bѧ0|*1bLM O=fwn©&9mGc .bGi6q) 'ݻ;ݟK8a-QEʃ3MXt\Pr!}'B"Xly[ Np{0t aKD@#]TRZdfT"~el$$-ߡ z, &@ѽ]KiBSߌtl}W݉` FR< (\NGvo=‹NSudVY`L_t= \w' c[stz԰s'$լC/ f"_ehpٌ /&||{8ؤO~L9 ީtyhlm7I'p(jmc ]sQg7f R: ;gYonD#BqQ= 0)rz9*+RWoDjDKh̛2>Pb,xC E#(2cw/Qg;ֈjיNioppuA#F>c?u=ۄ8?T>ojfq9R;#8{pF$/=kOJ2|ޚ^| [0,KdYxc {y;j A/W皦⳽|贱]a|9=pCKyM$NJlܔBYۚ SsEw27`ꌘedm /%I w"_vq,c`h}?4@ҧN>l Ъ7] @1]˫F}/_M;H~VJkX.9E|zEL8L^P~]ܳ,(R+E=J}Jp-%F?N!b>F;iFԝY͞/'Ρh[Z ,C:_ AWS@'&R~Nahl#VWOr4[P!3Ћ$B!: p^Y׼3֔' ֏X 0>+t'TBuklIRBWW"Ϛ5Zѡ @U:UV&/vGVqXtMAݼ >@ɻ'so,zeܜ=|efk`RL9$̨j>9=zIg7FW ,=8t G6vO]a\JR<&:GμV%/>+r?`IwEP\X`e-ZlϨj> endobj 77 0 obj << /Type /Pages /Count 6 /Parent 209 0 R /Kids [65 0 R 81 0 R 89 0 R 97 0 R 102 0 R 107 0 R] >> endobj 115 0 obj << /Type /Pages /Count 6 /Parent 209 0 R /Kids [112 0 R 118 0 R 123 0 R 128 0 R 133 0 R 138 0 R] >> endobj 146 0 obj << /Type /Pages /Count 2 /Parent 209 0 R /Kids [143 0 R 150 0 R] >> endobj 209 0 obj << /Type /Pages /Count 14 /Kids [77 0 R 115 0 R 146 0 R] >> endobj 210 0 obj << /Type /Outlines /First 7 0 R /Last 63 0 R /Count 9 >> endobj 63 0 obj << /Title 64 0 R /A 62 0 R /Parent 210 0 R /Prev 59 0 R >> endobj 59 0 obj << /Title 60 0 R /A 58 0 R /Parent 210 0 R /Prev 55 0 R /Next 63 0 R >> endobj 55 0 obj << /Title 56 0 R /A 54 0 R /Parent 210 0 R /Prev 51 0 R /Next 59 0 R >> endobj 51 0 obj << /Title 52 0 R /A 50 0 R /Parent 210 0 R /Prev 47 0 R /Next 55 0 R >> endobj 47 0 obj << /Title 48 0 R /A 46 0 R /Parent 210 0 R /Prev 43 0 R /Next 51 0 R >> endobj 43 0 obj << /Title 44 0 R /A 42 0 R /Parent 210 0 R /Prev 15 0 R /Next 47 0 R >> endobj 39 0 obj << /Title 40 0 R /A 38 0 R /Parent 15 0 R /Prev 35 0 R >> endobj 35 0 obj << /Title 36 0 R /A 34 0 R /Parent 15 0 R /Prev 31 0 R /Next 39 0 R >> endobj 31 0 obj << /Title 32 0 R /A 30 0 R /Parent 15 0 R /Prev 27 0 R /Next 35 0 R >> endobj 27 0 obj << /Title 28 0 R /A 26 0 R /Parent 15 0 R /Prev 23 0 R /Next 31 0 R >> endobj 23 0 obj << /Title 24 0 R /A 22 0 R /Parent 15 0 R /Prev 19 0 R /Next 27 0 R >> endobj 19 0 obj << /Title 20 0 R /A 18 0 R /Parent 15 0 R /Next 23 0 R >> endobj 15 0 obj << /Title 16 0 R /A 14 0 R /Parent 210 0 R /Prev 11 0 R /Next 43 0 R /First 19 0 R /Last 39 0 R /Count -6 >> endobj 11 0 obj << /Title 12 0 R /A 10 0 R /Parent 210 0 R /Prev 7 0 R /Next 15 0 R >> endobj 7 0 obj << /Title 8 0 R /A 6 0 R /Parent 210 0 R /Next 11 0 R >> endobj 211 0 obj << /Names [(Doc-Start) 67 0 R (cite.BSML) 78 0 R (page.1) 68 0 R (page.10) 126 0 R (page.11) 131 0 R (page.12) 136 0 R (page.13) 141 0 R (page.14) 148 0 R (page.2) 79 0 R (page.3) 87 0 R (page.4) 95 0 R (page.5) 100 0 R (page.6) 105 0 R (page.7) 110 0 R (page.8) 116 0 R (page.9) 121 0 R (section*.1) 147 0 R (section.1) 5 0 R (section.2) 9 0 R (section.3) 13 0 R (section.4) 41 0 R (section.5) 45 0 R (section.6) 49 0 R (section.7) 53 0 R (section.8) 57 0 R (section.9) 61 0 R (subsection.3.1) 17 0 R (subsection.3.2) 21 0 R (subsection.3.3) 25 0 R (subsection.3.4) 29 0 R (subsection.3.5) 33 0 R (subsection.3.6) 37 0 R] /Limits [(Doc-Start) (subsection.3.6)] >> endobj 212 0 obj << /Kids [211 0 R] >> endobj 213 0 obj << /Dests 212 0 R >> endobj 214 0 obj << /Type /Catalog /Pages 209 0 R /Outlines 210 0 R /Names 213 0 R /PageMode /UseOutlines /URI << /Base () >> /ViewerPreferences << >> /OpenAction 66 0 R >> endobj 215 0 obj << /Author () /Title () /Subject () /Creator (LaTeX with hyperref package) /Producer (pdfTeX13.d) /Keywords () /Creator (TeX) /Producer (pdfTeX-0.13d) /CreationDate (D:20020117185000) >> endobj xref 0 216 0000000000 65535 f 0000003529 00000 n 0000004847 00000 n 0000004934 00000 n 0000005034 00000 n 0000005681 00000 n 0000000009 00000 n 0000103133 00000 n 0000000054 00000 n 0000008910 00000 n 0000000084 00000 n 0000103046 00000 n 0000000130 00000 n 0000008968 00000 n 0000000154 00000 n 0000102921 00000 n 0000000200 00000 n 0000011565 00000 n 0000000227 00000 n 0000102847 00000 n 0000000278 00000 n 0000011624 00000 n 0000000307 00000 n 0000102760 00000 n 0000000358 00000 n 0000011683 00000 n 0000000401 00000 n 0000102673 00000 n 0000000452 00000 n 0000014365 00000 n 0000000497 00000 n 0000102586 00000 n 0000000548 00000 n 0000014424 00000 n 0000000591 00000 n 0000102499 00000 n 0000000642 00000 n 0000014483 00000 n 0000000674 00000 n 0000102425 00000 n 0000000725 00000 n 0000014542 00000 n 0000000760 00000 n 0000102337 00000 n 0000000806 00000 n 0000016595 00000 n 0000000848 00000 n 0000102249 00000 n 0000000894 00000 n 0000020854 00000 n 0000000928 00000 n 0000102161 00000 n 0000000974 00000 n 0000025407 00000 n 0000001012 00000 n 0000102073 00000 n 0000001058 00000 n 0000030739 00000 n 0000001104 00000 n 0000101985 00000 n 0000001150 00000 n 0000034155 00000 n 0000001193 00000 n 0000101910 00000 n 0000001239 00000 n 0000003387 00000 n 0000001281 00000 n 0000005622 00000 n 0000005563 00000 n 0000005739 00000 n 0000001331 00000 n 0000003366 00000 n 0000095175 00000 n 0000078396 00000 n 0000067619 00000 n 0000005159 00000 n 0000005343 00000 n 0000101445 00000 n 0000035584 00000 n 0000008851 00000 n 0000009027 00000 n 0000008339 00000 n 0000005845 00000 n 0000008318 00000 n 0000008481 00000 n 0000008637 00000 n 0000052043 00000 n 0000011506 00000 n 0000011742 00000 n 0000011390 00000 n 0000009121 00000 n 0000011369 00000 n 0000046123 00000 n 0000038737 00000 n 0000035739 00000 n 0000014306 00000 n 0000014601 00000 n 0000014190 00000 n 0000011860 00000 n 0000014169 00000 n 0000016534 00000 n 0000016655 00000 n 0000016415 00000 n 0000014719 00000 n 0000016393 00000 n 0000018905 00000 n 0000018966 00000 n 0000018786 00000 n 0000016750 00000 n 0000018764 00000 n 0000020793 00000 n 0000020914 00000 n 0000020673 00000 n 0000019049 00000 n 0000020651 00000 n 0000101557 00000 n 0000023359 00000 n 0000023420 00000 n 0000023239 00000 n 0000021033 00000 n 0000023217 00000 n 0000025346 00000 n 0000025467 00000 n 0000025226 00000 n 0000023527 00000 n 0000025204 00000 n 0000027895 00000 n 0000027956 00000 n 0000027775 00000 n 0000025562 00000 n 0000027753 00000 n 0000030678 00000 n 0000030799 00000 n 0000030558 00000 n 0000028051 00000 n 0000030536 00000 n 0000031970 00000 n 0000032031 00000 n 0000031850 00000 n 0000030906 00000 n 0000031829 00000 n 0000034094 00000 n 0000034215 00000 n 0000033974 00000 n 0000032114 00000 n 0000033952 00000 n 0000101674 00000 n 0000035524 00000 n 0000035463 00000 n 0000035644 00000 n 0000035343 00000 n 0000034322 00000 n 0000035322 00000 n 0000035874 00000 n 0000036418 00000 n 0000038424 00000 n 0000038446 00000 n 0000038467 00000 n 0000038488 00000 n 0000038509 00000 n 0000038541 00000 n 0000038872 00000 n 0000039406 00000 n 0000045765 00000 n 0000045787 00000 n 0000045809 00000 n 0000045831 00000 n 0000045852 00000 n 0000045884 00000 n 0000046258 00000 n 0000046791 00000 n 0000051710 00000 n 0000051732 00000 n 0000051753 00000 n 0000051775 00000 n 0000051796 00000 n 0000051828 00000 n 0000052178 00000 n 0000052711 00000 n 0000066996 00000 n 0000067019 00000 n 0000067041 00000 n 0000067064 00000 n 0000067085 00000 n 0000067117 00000 n 0000067754 00000 n 0000068292 00000 n 0000077964 00000 n 0000077986 00000 n 0000078008 00000 n 0000078030 00000 n 0000078051 00000 n 0000078083 00000 n 0000078531 00000 n 0000079065 00000 n 0000094567 00000 n 0000094590 00000 n 0000094612 00000 n 0000094635 00000 n 0000094656 00000 n 0000094687 00000 n 0000095310 00000 n 0000095843 00000 n 0000101106 00000 n 0000101128 00000 n 0000101149 00000 n 0000101171 00000 n 0000101192 00000 n 0000101223 00000 n 0000101759 00000 n 0000101836 00000 n 0000103205 00000 n 0000103887 00000 n 0000103926 00000 n 0000103964 00000 n 0000104140 00000 n trailer << /Size 216 /Root 214 0 R /Info 215 0 R >> startxref 104346 %%EOF ScientificPython-2.9.4/Doc/CHANGELOG0000644000076600000240000003450612270504464017353 0ustar hinsenstaff000000000000002.9.3 --> 2.9.4 ---------------- Cleanup: - The module Scientific.BSP.RemoteObjects was removed. It was experimental and never fully functional. - Tabs were replaced by spaces in two files. Bug fixes: - Typos 2.9.2 --> 2.9.3 ---------------- Cleanup: - Support for Numeric and numarray was removed, because it becomes difficult to test. The only supported array package is NumPy. - The Cython modules were updated following recent evolutions in Cython. In particular, Cython's numpy.pxd is used for accessing NumPy arrays. - Functions from the standard library module "string" were replaced by string methods as far as possible. Improvements: - No more platform-specific subpackages for the extension modules. They are placed at the same level as the Python modules. Bug fixes: - Scientific.BSP: Some operations created nested ParValue objects. (Thanks to Kelson Zawack!) 2.9.1 --> 2.9.2 ---------------- Improvements: - Allow unicode strings where reasonable, in particular for filenames. - Include C versions of Cython modules in the distribution, removing the build dependence on Cython. - New submodule of Visualization for the molecular viewer Chimera. Bug fixes: - NumPy compatibility fixes. - IO.TextFile: make sure that __del__ closes a file only if it was opened successfully - Geometry.Transformation: ensure that screwMotion returns a positive distance. - Physics.PhysicalQuantities: fix definition of barn. - IO.NetCDF: replace unsigned long by size_t in C interface to netCDF. - Functions.Interpolation: more checks on axis arrays. - DistributedComputing: fixed deadlock in task manager. 2.9.0 --> 2.9.1 ---------------- Improvements: - The task_manager script accepts an optional argument -w/--wait that makes it wait for the named task to start. - New classes DerivFn and NumDerivFn in Functions.FirstDerivatives. - New optional validator in Functions.LeastSquares. - PDB output can handle alternate location fields. - The NumPy header location is obtained from NumPy during installation. Bug fixes: - Better error handling in netCDF array write operations. - DistributedComputing: improved Windows compatibility 2.7.10 --> 2.9.0 ----------------- Improvements: - Scientific.IO.NetCDF.NetCDFFile accepts optional flags for the 64-bit file format (from netCDF 3.6) and the HDF5 file format (from netCDF 4). Bug fixes: - Methods derivative() and integral() crashed because index_expression was deleted at the end of the module. 2.7.9 --> 2.7.10 ---------------- Bug fixes: - Removed all occurrences of "as" as a variable name for compatibility with Python 2.6. - Installation without the netCDF module did not work. Improvements: - Vector.dyadicProduct() was replaced by a more efficient implementation. - Scientific.IO.PDB: Atom objects now have a parent attribute whose value is the containing group. 2.7.8 --> 2.7.9 --------------- License change: ScientificPython is now distributed under the CeCILL-C license, which is an adaptation of the LGPL to French law. The previously used CeCILL license, similar to the GPL, was considered too restrictive. Bug fixes: - MPI interfaces did not work correctly with NumPy and/or Python 2.5. Improvements: - Compilation script for mpipython works around a Python configuration bug under MacOS X. - Docstrings have been cleaned up. 2.7.7 --> 2.7.8 --------------- Bug fixes: - Due to a typo in Scientific.IO.PDBSpaceGroups, some space group names were not found in the space group table. Improvements: - Vector objects can now be multiplied with NumPy scalar objects (which is what you get when extracting numbers from NumPy arrays). Due to the way NumPy scalars handle multiplication, the result used to be an array rather than a Vector, which caused various applications to crash. - The build procedure under Windows has been improved. It can generate a binary installer that includes the netCDF DLL, making ScientificPython independent of a netCDF installation. 2.7.6 --> 2.7.7 --------------- Bug fixes: - Installation on Windows didn't work because the Unix maths libraries don't exist there. Improvements: - InterpolatingFunction and TensorField objects can represent periodic functions/fields. - DistributedComputing: the watchdog period of slave processes is now a user-definable parameter. - PDBSpaceGroups was simplified, making it shorter and faster to load. - Scientific.N contains the array type object in the variable array_type. This makes it possible to write Pyrex modules using arrays in such a way that they always use the numeric module for which ScientificPython was compiled. 2.7.5 --> 2.7.6 --------------- Bug fixes: - NumPy compatibility fixes. - Pyro 3.6 compatibility fix in DistributedComputing.MasterSlave 2.7.4 --> 2.7.5 --------------- New features: - Scaling, inversion, and shear transformations added to Geometry.Transformations Improvements: - PDB parser handles CRYST1, SCALEn and MTRIXn records - Better identification of the Numerics package that is being used Bug fixes: - Scientific_affinitypropagation.c compiles with NumPy 2.7.3 --> 2.7.4 --------------- New features: - New module Clustering.AffinityPropagation. - New class BSP.ParRootSequence. Bug fixes: - Replaced float equality test in Functions.InterpolatingFunction - Removed exception for order > 1 in Derivatives.DerivVar.__init__ - Fixed reading of non-string attributes from netCDF files. Improvements: - New methods getBinIndices and getBinCount in Statistics.Histogram.Histogram - Physics.PhysicalQuantities: unit definitions added to doc string 2.7.2 --> 2.7.3 --------------- Improvements: - Added multi-module setup for master-slave computations. - More information available through task_manager. - task_manager can start slave processes. 2.7.1 --> 2.7.2 --------------- Bug fixes: - Scientific_netcdf would not compile with NumPy under Python 2.4 because NumPy also defined Py_ssize_t. 2.7 --> 2.7.1 ------------- Improvements: - NumPy compatibility. Scientific_netcdf was revised by hand. The Python code was run through numpy.oldnumeric.alter_code1 to identify the critical sections, which were then all handled in some way. It is possible that there are still incompatibilities of the kind that numpy.oldnumeric.alter_code1 cannot detect 2.5.12hg --> 2.7 ---------------- New features: - Subpackage Scientific.DistributedComputing for easy parallelization of independent tasks. 2.5.11 --> 2.5.12hg ------------------- Bug fixes: - VRML2 output would crash for scenes containing Line objects - Pyrex implmentation of vector objects could crash instead of raising an exception in divide operations. - Pyrex implmentation of vector objects would raise exceptions incorrectly under Python 2.5 Improvements: - builds Macintosh packages with documentation and examples 2.5.10 --> 2.5.11 ----------------- Bug fixes: - Pyrex implementation of vector objects raised exceptions in comparisons - Pyrex implementation of vector objects did not accept negative indices - Some object deletions during conversion to epydoc had to be reversed Improvements: - Two test suites 2.5.9 --> 2.5.10 ---------------- Bug fixes: - Fixed netCDF error handling Improvements: - Support for NumPy (not very well tested yet) - Scientific.NumberDict more efficient 2.5.8 --> 2.5.9 --------------- Improvements: - Scientifc.IO.NetCDF supports the new 64-bit data structures in Python 2.5 (not yet tested on a 64-bit machine) - Docstrings modified for use with Epydoc. 2.5.7 --> 2.5.8 --------------- Bug fixes: - Syntax error in Scientific.IO.PDB - Attribute deletion in netCDF file and variable objects caused a crash. 2.5.6 --> 2.5.7 ---------------- Bug fixes: - Tensor-vector multiplication was incorrect with the Pyrex implementation of vector objects. 2.5.5 --> 2.5.6 ---------------- Bug fixes: - Scientific.BSP.ParClass did not pass on __call__ and __getitem__ to local class - Scientific.BSP.ParClass: Class wrappers did not always return the right global object. 2.5.4 --> 2.5.5 ---------------- Bug fixes: - Scientific.IO.NetCDF.NetCDFVariable.assignValue() had incomplete error reporting. Some errors would not raise exceptions as required. 2.5.3 --> 2.5.4 ---------------- Improvements: - A "test" method on MPI request objects permits to check if data is available (thanks to Jakob Schiotz for this addition). Bug fixes: - The new Pyrex vector objects could not be pickled. 2.5.1 --> 2.5.3 ---------------- Improvements: - The class Scientific.Geometry.Vector has been reimplemented in Pyrex, yielding much faster vector operations. There is, however, the restriction that the vector elements must be of type "float". For the rare applications where this condition is not fulfilled (such as Scientific.Functions.Derivatives.DerivVector), the Python implementation remains accessible as Scientific.Geometry.VectorModule.Vector. 2.4.9 --> 2.5.1 ---------------- Improvements: - Vector and Tensor objects permit comparison with other types of objects (which always return False) - Numarray can be used instead of Numeric as far as possible (see README for details) 2.4.7 --> 2.4.9: ---------------- Bug fixes: - Integer array attributes caused a TypeError with recent versions of Numeric (that don't do silent casts from Long to Int any more). Additions: - Method "threeAngles" in Geometry.Transformation.Rotation. 2.4.6 --> 2.4.7: ---------------- Bug fixes: - Scientific.BSP: alltrue() and anytrue() sometimes returned wrong results. Additions: - Scientific.Visualization.VMD can now correctly launch VMD under Windows 2.4.3 --> 2.4.4: ---------------- Bug fixes: NetCDF error messages should now be correct. No more "unknown errors"! 2.4 --> 2.4.1: -------------- Bug fixes: - Scientific.MPI did not contain the _C_API object needed by C extension modules that call MPI. - The arguments to the receiveString method are now optional, as documented. 2.3.3 --> 2.4: -------------- Bug fixes: - Memory function calculation in Scientific.Signals.Models returned a wrong value for the first point. - Some indexing problems in Scientific.IO.NetCDF were fixed; none of them caused wrong results, just unjustified exceptions. 2.3.2 --> 2.3.3: ---------------- Bug fixes: - The method divide() assumed the wrong coefficient order. New features: - Module Scientific.Signals.Models - Class Scientific.Statistics.Histogram.WeightedHistogram 2.3.1 --> 2.3.2: ---------------- Incompatible changes: - Specification of routines in Scientific.BSP changed. 2.2 --> 2.3.1 ------------- New features: - New modules Scientific.BSP and Scientific.BSP.IO 2.1.5 --> 2.2 ------------- Bug fixes: - The sign convention for rotation angles was not correctly applied in Scientific.Geometry.Transformation and Scientific.Geometry.Quaternions. Everything was consistent, but with the wrong sign. Improvements: - Scientific.IO.PDB can handle a larger range of variant formats for DNA New features: - New module Scientific.Visualization.VPython. - Scientific.IO.TextFile also handles bzip2 compressed files (extension .bz2). This only works if bzip2 is installed. 2.1.4 --> 2.1.5 --------------- New features: - Scientific.TkWidgets.TkPlotCanvas: - Popup menu on right button - Value display on middle button - HorizontalLine, VerticalLine objects Modifications: - MPI interface no longer assumes that MPI_Op and MPI_Datatype are integers (they aren't in LAM, for example). 2.1.3 --> 2.1.4 --------------- New features: - New MPI functions implemented by Jakob Schiotz: - nonblocking send and receive - abort - reduce and allreduce Modifications: - The Python interpreter lock is released during calls to the netCDF library, permitting other threads to continue during I/O operations. An internal lock has been added to prevent reentrant calls to the netCDF library, which is not thread safe. (If you don't understand any of this, you shouldn't care, it has no consequences unless you use threads.) - Methods receive and receiveString on MPI communicator objects can be called without source and tag arguments (defaults to None). Bug fixes: - The compilation script did not work correctly for MPI support 2.1.2 --> 2.1.3 --------------- New features: - Some small utility widgets have been added to Scientific.TkWidgets. They are not particularly "scientific", but not worth the effort of a separate distribution. Bug fixes: - The abs() function didn't work on DerivVar objects (modules Scientific.Functions.Derivatives and Scientific.Functions.FirstDerivatives) with negative values. - The method projectionOf in Scientific.Geometry.Objects3D.Plane was wrong. 2.1.1 --> 2.1.2 --------------- Installation: - The mpipython executable is compiled using 'mpicc', which should simplify installation significantly because all library specifications are automatically taken into account. In other words, MPI support should work on all platforms without any modifications to the Setup file. (Thanks to Jakob Schiotz for this suggestion!) - Some 'extern' declarations were changed to 'staticforward' to please some compilers. Documentation: - the documentation for the methods receive and receiveString were wrong. 2.1.0 --> 2.1.1 --------------- Bug fixes: - The upper bound for MPI message tags was not treated correctly, leading to a bound of zero on some platforms. Modifications: - The methods sendArray and sendString were combined into a single method send. - broadcastArray was renamed to broadcast, shareArray was renamed to share, receiveArray was renamed to receive. The only function that retains a data type indication is receiveString. 2.0.1 --> 2.1.0 --------------- Additions: - MPI interface in Scientific.MPI 2.0 --> 2.0.1 ------------- Bug fixes: - The method integral() in class Scientific.Functions.Interpolation.InterpolatingFunction didn't work. - Integer attributes were handled incorrectly on machines with 64 bit long types (DEC Alpha, 64-bit SGI machines) - Syntax errors in Scientific.Visualization.VRML2 fixed. - Memory leaks fixed. Additions: - Scientific.Functions.Interpolation.InterpolatingFunction instances support most array indexing operations (all except NewAxis, which makes no sense) - New class Scientific.Functions.Interpolation.NetCDFInterpolatingFunction represents a function defined by a variable stored in a netCDF file. - Append mode in Scientific.IO.TextFile.TextFile ScientificPython-2.9.4/Doc/Reference/0000755000076600000240000000000012270505005020017 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Doc/Reference/api-objects.txt0000644000076600000240000120277711501734224023003 0ustar hinsenstaff00000000000000Scientific Scientific-module.html Scientific.BSP Scientific.BSP-module.html Scientific.BSP.ParInvalid Scientific.BSP-module.html#ParInvalid Scientific.BSP.processorID Scientific.BSP-module.html#processorID Scientific.BSP.numberOfProcessors Scientific.BSP-module.html#numberOfProcessors Scientific.BSP.name Scientific.BSP-module.html#name Scientific.BSP.Console Scientific.BSP.Console-module.html Scientific.BSP.Console._pid_banner Scientific.BSP.Console-module.html#_pid_banner Scientific.BSP.Console.isOK Scientific.BSP.Console-module.html#isOK Scientific.BSP.Console.interpreter Scientific.BSP.Console-module.html#interpreter Scientific.BSP.Console.numberOfProcessors Scientific.BSP.Console-module.html#numberOfProcessors Scientific.BSP.Console.console Scientific.BSP.Console-module.html#console Scientific.BSP.Console.synchronize Scientific.BSP.Console-module.html#synchronize Scientific.BSP.Console.typePar Scientific.BSP.Console-module.html#typePar Scientific.BSP.Console.processorID Scientific.BSP.Console-module.html#processorID Scientific.BSP.Console.ok Scientific.BSP.Console-module.html#ok Scientific.BSP.Console.syncCheck Scientific.BSP.Console-module.html#syncCheck Scientific.BSP.IO Scientific.BSP.IO-module.html Scientific.BSP.IO.ParInvalid Scientific.BSP.IO-module.html#ParInvalid Scientific.BSP.IO.ParNetCDFFile Scientific.BSP.IO-module.html#ParNetCDFFile Scientific.BSP.IO.ParNetCDFVariable Scientific.BSP.IO-module.html#ParNetCDFVariable Scientific.Clustering Scientific.Clustering-module.html Scientific.Clustering.AffinityPropagation Scientific.Clustering.AffinityPropagation-module.html Scientific.DictWithDefault Scientific.DictWithDefault-module.html Scientific.DistributedComputing Scientific.DistributedComputing-module.html Scientific.DistributedComputing.MasterSlave Scientific.DistributedComputing.MasterSlave-module.html Scientific.DistributedComputing.MasterSlave.initializeMasterProcess Scientific.DistributedComputing.MasterSlave-module.html#initializeMasterProcess Scientific.DistributedComputing.MasterSlave.getMachineInfo Scientific.DistributedComputing.MasterSlave-module.html#getMachineInfo Scientific.DistributedComputing.MasterSlave.runJob Scientific.DistributedComputing.MasterSlave-module.html#runJob Scientific.DistributedComputing.MasterSlave.startSlaveProcess Scientific.DistributedComputing.MasterSlave-module.html#startSlaveProcess Scientific.DistributedComputing.MasterSlave.debug Scientific.DistributedComputing.MasterSlave-module.html#debug Scientific.DistributedComputing.TaskManager Scientific.DistributedComputing.TaskManager-module.html Scientific.DistributedComputing.TaskManager.debug Scientific.DistributedComputing.TaskManager-module.html#debug Scientific.FFT Scientific.FFT-module.html Scientific.FFT.package Scientific.FFT-module.html#package Scientific.Functions Scientific.Functions-module.html Scientific.Functions.Derivatives Scientific.Functions.Derivatives-module.html Scientific.Functions.Derivatives._mapderiv Scientific.Functions.Derivatives-module.html#_mapderiv Scientific.Functions.Derivatives._indexDeriv Scientific.Functions.Derivatives-module.html#_indexDeriv Scientific.Functions.Derivatives._toFloat Scientific.Functions.Derivatives-module.html#_toFloat Scientific.Functions.Derivatives.isDerivVar Scientific.Functions.Derivatives-module.html#isDerivVar Scientific.Functions.Derivatives.DerivVector Scientific.Functions.Derivatives-module.html#DerivVector Scientific.Functions.FindRoot Scientific.Functions.FindRoot-module.html Scientific.Functions.FindRoot.newtonRaphson Scientific.Functions.FindRoot-module.html#newtonRaphson Scientific.Functions.FirstDerivatives Scientific.Functions.FirstDerivatives-module.html Scientific.Functions.FirstDerivatives._mapderiv Scientific.Functions.FirstDerivatives-module.html#_mapderiv Scientific.Functions.FirstDerivatives.isDerivVar Scientific.Functions.FirstDerivatives-module.html#isDerivVar Scientific.Functions.FirstDerivatives.DerivVector Scientific.Functions.FirstDerivatives-module.html#DerivVector Scientific.Functions.Interpolation Scientific.Functions.Interpolation-module.html Scientific.Functions.Interpolation._lookup Scientific.Functions.Interpolation-module.html#_lookup Scientific.Functions.Interpolation._combinations Scientific.Functions.Interpolation-module.html#_combinations Scientific.Functions.Interpolation.index_expression Scientific.Functions.Interpolation-module.html#index_expression Scientific.Functions.LeastSquares Scientific.Functions.LeastSquares-module.html Scientific.Functions.LeastSquares._chiSquare Scientific.Functions.LeastSquares-module.html#_chiSquare Scientific.Functions.LeastSquares.polynomialLeastSquaresFit Scientific.Functions.LeastSquares-module.html#polynomialLeastSquaresFit Scientific.Functions.LeastSquares._polynomialModel Scientific.Functions.LeastSquares-module.html#_polynomialModel Scientific.Functions.LeastSquares.leastSquaresFit Scientific.Functions.LeastSquares-module.html#leastSquaresFit Scientific.Functions.Polynomial Scientific.Functions.Polynomial-module.html Scientific.Functions.Polynomial._powers Scientific.Functions.Polynomial-module.html#_powers Scientific.Functions.Polynomial._fitPolynomial Scientific.Functions.Polynomial-module.html#_fitPolynomial Scientific.Functions.Polynomial._isSequence Scientific.Functions.Polynomial-module.html#_isSequence Scientific.Functions.Rational Scientific.Functions.Rational-module.html Scientific.Functions.Romberg Scientific.Functions.Romberg-module.html Scientific.Functions.Romberg._romberg_diff Scientific.Functions.Romberg-module.html#_romberg_diff Scientific.Functions.Romberg.trapezoid Scientific.Functions.Romberg-module.html#trapezoid Scientific.Functions.Romberg._difftrap Scientific.Functions.Romberg-module.html#_difftrap Scientific.Functions.Romberg.romberg Scientific.Functions.Romberg-module.html#romberg Scientific.Geometry Scientific.Geometry-module.html Scientific.Geometry.epsilon Scientific.Geometry-module.html#epsilon Scientific.Geometry.ez Scientific.Geometry-module.html#ez Scientific.Geometry.ey Scientific.Geometry-module.html#ey Scientific.Geometry.ex Scientific.Geometry-module.html#ex Scientific.Geometry.delta Scientific.Geometry-module.html#delta Scientific.Geometry.nullVector Scientific.Geometry-module.html#nullVector Scientific.Geometry.Objects3D Scientific.Geometry.Objects3D-module.html Scientific.Geometry.Objects3D._intersectTable Scientific.Geometry.Objects3D-module.html#_intersectTable Scientific.Geometry.Objects3D._intersectSphereSphere Scientific.Geometry.Objects3D-module.html#_intersectSphereSphere Scientific.Geometry.Objects3D._addIntersectFunction Scientific.Geometry.Objects3D-module.html#_addIntersectFunction Scientific.Geometry.Objects3D.rotatePoint Scientific.Geometry.Objects3D-module.html#rotatePoint Scientific.Geometry.Objects3D._intersectCirclePlane Scientific.Geometry.Objects3D-module.html#_intersectCirclePlane Scientific.Geometry.Objects3D._intersectSphereCone Scientific.Geometry.Objects3D-module.html#_intersectSphereCone Scientific.Geometry.Objects3D._intersectPlanePlane Scientific.Geometry.Objects3D-module.html#_intersectPlanePlane Scientific.Geometry.Objects3D.rotateDirection Scientific.Geometry.Objects3D-module.html#rotateDirection Scientific.Geometry.Objects3D._eps Scientific.Geometry.Objects3D-module.html#_eps Scientific.Geometry.Quaternion Scientific.Geometry.Quaternion-module.html Scientific.Geometry.Quaternion.isQuaternion Scientific.Geometry.Quaternion-module.html#isQuaternion Scientific.Geometry.TensorAnalysis Scientific.Geometry.TensorAnalysis-module.html Scientific.Geometry.TensorAnalysis.index_expression Scientific.Geometry.TensorAnalysis-module.html#index_expression Scientific.Geometry.Transformation Scientific.Geometry.Transformation-module.html Scientific.Geometry.Transformation.mod_angle Scientific.Geometry.Transformation-module.html#mod_angle Scientific.Geometry.Transformation.angleFromSineAndCosine Scientific.Geometry.Transformation-module.html#angleFromSineAndCosine Scientific.IO Scientific.IO-module.html Scientific.IO.ArrayIO Scientific.IO.ArrayIO-module.html Scientific.IO.ArrayIO.writeDataSets Scientific.IO.ArrayIO-module.html#writeDataSets Scientific.IO.ArrayIO.readFloatArray Scientific.IO.ArrayIO-module.html#readFloatArray Scientific.IO.ArrayIO.readIntegerArray Scientific.IO.ArrayIO-module.html#readIntegerArray Scientific.IO.ArrayIO.writeArray Scientific.IO.ArrayIO-module.html#writeArray Scientific.IO.ArrayIO.readArray Scientific.IO.ArrayIO-module.html#readArray Scientific.IO.FortranFormat Scientific.IO.FortranFormat-module.html Scientific.IO.NetCDF Scientific.IO.NetCDF-module.html Scientific.IO.NetCDF._C_API Scientific.IO.NetCDF-module.html#_C_API Scientific.IO.PDB Scientific.IO.PDB-module.html Scientific.IO.PDB.defineAminoAcidResidue Scientific.IO.PDB-module.html#defineAminoAcidResidue Scientific.IO.PDB.defineNucleicAcidResidue Scientific.IO.PDB-module.html#defineNucleicAcidResidue Scientific.IO.PDB.amino_acids Scientific.IO.PDB-module.html#amino_acids Scientific.IO.PDB.nucleic_acids Scientific.IO.PDB-module.html#nucleic_acids Scientific.IO.PDBSpaceGroups Scientific.IO.PDBSpaceGroups-module.html Scientific.IO.PDBSpaceGroups._space_group_table Scientific.IO.PDBSpaceGroups-module.html#_space_group_table Scientific.IO.PDBSpaceGroups.getSpaceGroupTransformations Scientific.IO.PDBSpaceGroups-module.html#getSpaceGroupTransformations Scientific.IO.PDBSpaceGroups.sg Scientific.IO.PDBSpaceGroups-module.html#sg Scientific.IO.TextFile Scientific.IO.TextFile-module.html Scientific.IO.TextFile._version Scientific.IO.TextFile-module.html#_version Scientific.MPI Scientific.MPI-module.html Scientific.MPI._C_API Scientific.MPI-module.html#_C_API Scientific.MPI.world Scientific.MPI-module.html#world Scientific.MPI.IO Scientific.MPI.IO-module.html Scientific.NRNG Scientific.NRNG-module.html Scientific.NRNG.default_distribution Scientific.NRNG-module.html#default_distribution Scientific.NRNG.package Scientific.NRNG-module.html#package Scientific.NRNG.standard_generator Scientific.NRNG-module.html#standard_generator Scientific.NumberDict Scientific.NumberDict-module.html Scientific.Physics Scientific.Physics-module.html Scientific.Physics.PhysicalQuantities Scientific.Physics.PhysicalQuantities-module.html Scientific.Physics.PhysicalQuantities.prefix Scientific.Physics.PhysicalQuantities-module.html#prefix Scientific.Physics.PhysicalQuantities._prefixes Scientific.Physics.PhysicalQuantities-module.html#_prefixes Scientific.Physics.PhysicalQuantities._unit_table Scientific.Physics.PhysicalQuantities-module.html#_unit_table Scientific.Physics.PhysicalQuantities._findUnit Scientific.Physics.PhysicalQuantities-module.html#_findUnit Scientific.Physics.PhysicalQuantities.description Scientific.Physics.PhysicalQuantities-module.html#description Scientific.Physics.PhysicalQuantities._help Scientific.Physics.PhysicalQuantities-module.html#_help Scientific.Physics.PhysicalQuantities.unit Scientific.Physics.PhysicalQuantities-module.html#unit Scientific.Physics.PhysicalQuantities._convertValue Scientific.Physics.PhysicalQuantities-module.html#_convertValue Scientific.Physics.PhysicalQuantities._base_units Scientific.Physics.PhysicalQuantities-module.html#_base_units Scientific.Physics.PhysicalQuantities.isPhysicalUnit Scientific.Physics.PhysicalQuantities-module.html#isPhysicalUnit Scientific.Physics.PhysicalQuantities._addUnit Scientific.Physics.PhysicalQuantities-module.html#_addUnit Scientific.Physics.PhysicalQuantities._base_names Scientific.Physics.PhysicalQuantities-module.html#_base_names Scientific.Physics.PhysicalQuantities.isPhysicalQuantity Scientific.Physics.PhysicalQuantities-module.html#isPhysicalQuantity Scientific.Physics.PhysicalQuantities._round Scientific.Physics.PhysicalQuantities-module.html#_round Scientific.Physics.PhysicalQuantities.value Scientific.Physics.PhysicalQuantities-module.html#value Scientific.Physics.PhysicalQuantities._addPrefixed Scientific.Physics.PhysicalQuantities-module.html#_addPrefixed Scientific.Physics.Potential Scientific.Physics.Potential-module.html Scientific.Physics.Potential.DerivVectors Scientific.Physics.Potential-module.html#DerivVectors Scientific.Physics.Potential.EnergyGradients Scientific.Physics.Potential-module.html#EnergyGradients Scientific.Physics.Potential.EnergyGradientsForceConstants Scientific.Physics.Potential-module.html#EnergyGradientsForceConstants Scientific.QtWidgets Scientific.QtWidgets-module.html Scientific.QtWidgets.QtPlotCanvas Scientific.QtWidgets.QtPlotCanvas-module.html Scientific.QtWidgets.QtPlotCanvas.IO_Combined Scientific.QtWidgets.QtPlotCanvas-module.html#IO_Combined Scientific.QtWidgets.QtPlotCanvas.IO_TypeMask Scientific.QtWidgets.QtPlotCanvas-module.html#IO_TypeMask Scientific.QtWidgets.QtPlotCanvas.IO_OpenError Scientific.QtWidgets.QtPlotCanvas-module.html#IO_OpenError Scientific.QtWidgets.QtPlotCanvas.IO_UnspecifiedError Scientific.QtWidgets.QtPlotCanvas-module.html#IO_UnspecifiedError Scientific.QtWidgets.QtPlotCanvas.IO_ResourceError Scientific.QtWidgets.QtPlotCanvas-module.html#IO_ResourceError Scientific.QtWidgets.QtPlotCanvas.QCOORD_MIN Scientific.QtWidgets.QtPlotCanvas-module.html#QCOORD_MIN Scientific.QtWidgets.QtPlotCanvas.QCOORD_MAX Scientific.QtWidgets.QtPlotCanvas-module.html#QCOORD_MAX Scientific.QtWidgets.QtPlotCanvas.IO_Truncate Scientific.QtWidgets.QtPlotCanvas-module.html#IO_Truncate Scientific.QtWidgets.QtPlotCanvas.PYQT_VERSION_STR Scientific.QtWidgets.QtPlotCanvas-module.html#PYQT_VERSION_STR Scientific.QtWidgets.QtPlotCanvas.PYQT_VERSION Scientific.QtWidgets.QtPlotCanvas-module.html#PYQT_VERSION Scientific.QtWidgets.QtPlotCanvas.IO_AbortError Scientific.QtWidgets.QtPlotCanvas-module.html#IO_AbortError Scientific.QtWidgets.QtPlotCanvas.QT_VERSION Scientific.QtWidgets.QtPlotCanvas-module.html#QT_VERSION Scientific.QtWidgets.QtPlotCanvas.IO_ModeMask Scientific.QtWidgets.QtPlotCanvas-module.html#IO_ModeMask Scientific.QtWidgets.QtPlotCanvas.IO_TimeOutError Scientific.QtWidgets.QtPlotCanvas-module.html#IO_TimeOutError Scientific.QtWidgets.QtPlotCanvas.IO_ReadWrite Scientific.QtWidgets.QtPlotCanvas-module.html#IO_ReadWrite Scientific.QtWidgets.QtPlotCanvas.IO_WriteError Scientific.QtWidgets.QtPlotCanvas-module.html#IO_WriteError Scientific.QtWidgets.QtPlotCanvas.IO_Direct Scientific.QtWidgets.QtPlotCanvas-module.html#IO_Direct Scientific.QtWidgets.QtPlotCanvas.IO_ReadError Scientific.QtWidgets.QtPlotCanvas-module.html#IO_ReadError Scientific.QtWidgets.QtPlotCanvas.QtFatalMsg Scientific.QtWidgets.QtPlotCanvas-module.html#QtFatalMsg Scientific.QtWidgets.QtPlotCanvas.QtWarningMsg Scientific.QtWidgets.QtPlotCanvas-module.html#QtWarningMsg Scientific.QtWidgets.QtPlotCanvas.IO_WriteOnly Scientific.QtWidgets.QtPlotCanvas-module.html#IO_WriteOnly Scientific.QtWidgets.QtPlotCanvas.colors_by_name Scientific.QtWidgets.QtPlotCanvas-module.html#colors_by_name Scientific.QtWidgets.QtPlotCanvas.IO_Async Scientific.QtWidgets.QtPlotCanvas-module.html#IO_Async Scientific.QtWidgets.QtPlotCanvas.IO_ConnectError Scientific.QtWidgets.QtPlotCanvas-module.html#IO_ConnectError Scientific.QtWidgets.QtPlotCanvas.qApp Scientific.QtWidgets.QtPlotCanvas-module.html#qApp Scientific.QtWidgets.QtPlotCanvas.IO_Raw Scientific.QtWidgets.QtPlotCanvas-module.html#IO_Raw Scientific.QtWidgets.QtPlotCanvas.IO_ReadOnly Scientific.QtWidgets.QtPlotCanvas-module.html#IO_ReadOnly Scientific.QtWidgets.QtPlotCanvas.IO_Translate Scientific.QtWidgets.QtPlotCanvas-module.html#IO_Translate Scientific.QtWidgets.QtPlotCanvas.QtDebugMsg Scientific.QtWidgets.QtPlotCanvas-module.html#QtDebugMsg Scientific.QtWidgets.QtPlotCanvas.IO_FatalError Scientific.QtWidgets.QtPlotCanvas-module.html#IO_FatalError Scientific.QtWidgets.QtPlotCanvas.IO_StateMask Scientific.QtWidgets.QtPlotCanvas-module.html#IO_StateMask Scientific.QtWidgets.QtPlotCanvas.IO_Open Scientific.QtWidgets.QtPlotCanvas-module.html#IO_Open Scientific.QtWidgets.QtPlotCanvas.IO_Append Scientific.QtWidgets.QtPlotCanvas-module.html#IO_Append Scientific.QtWidgets.QtPlotCanvas.QT_VERSION_STR Scientific.QtWidgets.QtPlotCanvas-module.html#QT_VERSION_STR Scientific.QtWidgets.QtPlotCanvas.IO_Sequential Scientific.QtWidgets.QtPlotCanvas-module.html#IO_Sequential Scientific.QtWidgets.QtPlotCanvas.IO_Ok Scientific.QtWidgets.QtPlotCanvas-module.html#IO_Ok Scientific.QtWidgets.QtVisualizationCanvas Scientific.QtWidgets.QtVisualizationCanvas-module.html Scientific.QtWidgets.QtVisualizationCanvas.IO_Combined Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_Combined Scientific.QtWidgets.QtVisualizationCanvas.IO_TypeMask Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_TypeMask Scientific.QtWidgets.QtVisualizationCanvas.IO_OpenError Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_OpenError Scientific.QtWidgets.QtVisualizationCanvas.IO_UnspecifiedError Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_UnspecifiedError Scientific.QtWidgets.QtVisualizationCanvas.IO_ResourceError Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_ResourceError Scientific.QtWidgets.QtVisualizationCanvas.QCOORD_MIN Scientific.QtWidgets.QtVisualizationCanvas-module.html#QCOORD_MIN Scientific.QtWidgets.QtVisualizationCanvas.QCOORD_MAX Scientific.QtWidgets.QtVisualizationCanvas-module.html#QCOORD_MAX Scientific.QtWidgets.QtVisualizationCanvas.IO_Truncate Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_Truncate Scientific.QtWidgets.QtVisualizationCanvas.PYQT_VERSION_STR Scientific.QtWidgets.QtVisualizationCanvas-module.html#PYQT_VERSION_STR Scientific.QtWidgets.QtVisualizationCanvas.PYQT_VERSION Scientific.QtWidgets.QtVisualizationCanvas-module.html#PYQT_VERSION Scientific.QtWidgets.QtVisualizationCanvas.IO_AbortError Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_AbortError Scientific.QtWidgets.QtVisualizationCanvas.QT_VERSION Scientific.QtWidgets.QtVisualizationCanvas-module.html#QT_VERSION Scientific.QtWidgets.QtVisualizationCanvas.IO_ModeMask Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_ModeMask Scientific.QtWidgets.QtVisualizationCanvas.IO_TimeOutError Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_TimeOutError Scientific.QtWidgets.QtVisualizationCanvas.IO_ReadWrite Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_ReadWrite Scientific.QtWidgets.QtVisualizationCanvas.IO_Direct Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_Direct Scientific.QtWidgets.QtVisualizationCanvas.IO_ReadError Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_ReadError Scientific.QtWidgets.QtVisualizationCanvas.QtFatalMsg Scientific.QtWidgets.QtVisualizationCanvas-module.html#QtFatalMsg Scientific.QtWidgets.QtVisualizationCanvas.QtWarningMsg Scientific.QtWidgets.QtVisualizationCanvas-module.html#QtWarningMsg Scientific.QtWidgets.QtVisualizationCanvas.IO_WriteOnly Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_WriteOnly Scientific.QtWidgets.QtVisualizationCanvas.colors_by_name Scientific.QtWidgets.QtVisualizationCanvas-module.html#colors_by_name Scientific.QtWidgets.QtVisualizationCanvas.IO_Async Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_Async Scientific.QtWidgets.QtVisualizationCanvas.IO_ConnectError Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_ConnectError Scientific.QtWidgets.QtVisualizationCanvas.qApp Scientific.QtWidgets.QtVisualizationCanvas-module.html#qApp Scientific.QtWidgets.QtVisualizationCanvas.IO_Raw Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_Raw Scientific.QtWidgets.QtVisualizationCanvas.IO_WriteError Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_WriteError Scientific.QtWidgets.QtVisualizationCanvas.IO_ReadOnly Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_ReadOnly Scientific.QtWidgets.QtVisualizationCanvas.IO_Translate Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_Translate Scientific.QtWidgets.QtVisualizationCanvas.QtDebugMsg Scientific.QtWidgets.QtVisualizationCanvas-module.html#QtDebugMsg Scientific.QtWidgets.QtVisualizationCanvas.IO_FatalError Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_FatalError Scientific.QtWidgets.QtVisualizationCanvas.IO_StateMask Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_StateMask Scientific.QtWidgets.QtVisualizationCanvas.IO_Open Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_Open Scientific.QtWidgets.QtVisualizationCanvas.IO_Append Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_Append Scientific.QtWidgets.QtVisualizationCanvas.QT_VERSION_STR Scientific.QtWidgets.QtVisualizationCanvas-module.html#QT_VERSION_STR Scientific.QtWidgets.QtVisualizationCanvas.IO_Sequential Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_Sequential Scientific.QtWidgets.QtVisualizationCanvas.IO_Ok Scientific.QtWidgets.QtVisualizationCanvas-module.html#IO_Ok Scientific.Signals Scientific.Signals-module.html Scientific.Signals.Models Scientific.Signals.Models-module.html Scientific.Signals.Models._realPart Scientific.Signals.Models-module.html#_realPart Scientific.Signals.Models._isComplex Scientific.Signals.Models-module.html#_isComplex Scientific.Statistics Scientific.Statistics-module.html Scientific.Statistics.skewness Scientific.Statistics-module.html#skewness Scientific.Statistics.weightedMean Scientific.Statistics-module.html#weightedMean Scientific.Statistics.average Scientific.Statistics-module.html#average Scientific.Statistics.normalizedMoment Scientific.Statistics-module.html#normalizedMoment Scientific.Statistics.median Scientific.Statistics-module.html#median Scientific.Statistics.standardDeviation Scientific.Statistics-module.html#standardDeviation Scientific.Statistics.moment Scientific.Statistics-module.html#moment Scientific.Statistics.mode Scientific.Statistics-module.html#mode Scientific.Statistics.correlation Scientific.Statistics-module.html#correlation Scientific.Statistics.variance Scientific.Statistics-module.html#variance Scientific.Statistics.kurtosis Scientific.Statistics-module.html#kurtosis Scientific.Statistics.mean Scientific.Statistics-module.html#mean Scientific.Statistics.Histogram Scientific.Statistics.Histogram-module.html Scientific.Threading Scientific.Threading-module.html Scientific.Threading.TaskManager Scientific.Threading.TaskManager-module.html Scientific.TkWidgets Scientific.TkWidgets-module.html Scientific.TkWidgets.TkPlotCanvas Scientific.TkWidgets.TkPlotCanvas-module.html Scientific.TkWidgets.TkVisualizationCanvas Scientific.TkWidgets.TkVisualizationCanvas-module.html Scientific.Visualization Scientific.Visualization-module.html Scientific.Visualization.Color Scientific.Visualization.Color-module.html Scientific.Visualization.Color._light_colors Scientific.Visualization.Color-module.html#_light_colors Scientific.Visualization.Color._full_colors Scientific.Visualization.Color-module.html#_full_colors Scientific.Visualization.Color.ColorByName Scientific.Visualization.Color-module.html#ColorByName Scientific.Visualization.Color._dark_colors Scientific.Visualization.Color-module.html#_dark_colors Scientific.Visualization.PyMOL Scientific.Visualization.PyMOL-module.html Scientific.Visualization.PyMOL.isGroup Scientific.Visualization.PyMOL-module.html#isGroup Scientific.Visualization.PyMOL.EmissiveMaterial Scientific.Visualization.PyMOL-module.html#EmissiveMaterial Scientific.Visualization.PyMOL.DiffuseMaterial Scientific.Visualization.PyMOL-module.html#DiffuseMaterial Scientific.Visualization.PyMOL._diffuse_material_dict Scientific.Visualization.PyMOL-module.html#_diffuse_material_dict Scientific.Visualization.VMD Scientific.Visualization.VMD-module.html Scientific.Visualization.VMD.isGroup Scientific.Visualization.VMD-module.html#isGroup Scientific.Visualization.VMD.EmissiveMaterial Scientific.Visualization.VMD-module.html#EmissiveMaterial Scientific.Visualization.VMD.ey Scientific.Visualization.VMD-module.html#ey Scientific.Visualization.VMD.ex Scientific.Visualization.VMD-module.html#ex Scientific.Visualization.VMD.ez Scientific.Visualization.VMD-module.html#ez Scientific.Visualization.VMD.DiffuseMaterial Scientific.Visualization.VMD-module.html#DiffuseMaterial Scientific.Visualization.VMD._diffuse_material_dict Scientific.Visualization.VMD-module.html#_diffuse_material_dict Scientific.Visualization.VPython Scientific.Visualization.VPython-module.html Scientific.Visualization.VPython.isGroup Scientific.Visualization.VPython-module.html#isGroup Scientific.Visualization.VPython.EmissiveMaterial Scientific.Visualization.VPython-module.html#EmissiveMaterial Scientific.Visualization.VPython._emissive_material_dict Scientific.Visualization.VPython-module.html#_emissive_material_dict Scientific.Visualization.VPython.DiffuseMaterial Scientific.Visualization.VPython-module.html#DiffuseMaterial Scientific.Visualization.VPython._diffuse_material_dict Scientific.Visualization.VPython-module.html#_diffuse_material_dict Scientific.Visualization.VRML Scientific.Visualization.VRML-module.html Scientific.Visualization.VRML.isGroup Scientific.Visualization.VRML-module.html#isGroup Scientific.Visualization.VRML.EmissiveMaterial Scientific.Visualization.VRML-module.html#EmissiveMaterial Scientific.Visualization.VRML.ey Scientific.Visualization.VRML-module.html#ey Scientific.Visualization.VRML.ex Scientific.Visualization.VRML-module.html#ex Scientific.Visualization.VRML.ez Scientific.Visualization.VRML-module.html#ez Scientific.Visualization.VRML._emissive_material_dict Scientific.Visualization.VRML-module.html#_emissive_material_dict Scientific.Visualization.VRML.DiffuseMaterial Scientific.Visualization.VRML-module.html#DiffuseMaterial Scientific.Visualization.VRML._diffuse_material_dict Scientific.Visualization.VRML-module.html#_diffuse_material_dict Scientific.Visualization.VRML2 Scientific.Visualization.VRML2-module.html Scientific.Visualization.VRML2.isGroup Scientific.Visualization.VRML2-module.html#isGroup Scientific.Visualization.VRML2.EmissiveMaterial Scientific.Visualization.VRML2-module.html#EmissiveMaterial Scientific.Visualization.VRML2.ey Scientific.Visualization.VRML2-module.html#ey Scientific.Visualization.VRML2.ex Scientific.Visualization.VRML2-module.html#ex Scientific.Visualization.VRML2.ez Scientific.Visualization.VRML2-module.html#ez Scientific.Visualization.VRML2._emissive_material_dict Scientific.Visualization.VRML2-module.html#_emissive_material_dict Scientific.Visualization.VRML2.DiffuseMaterial Scientific.Visualization.VRML2-module.html#DiffuseMaterial Scientific.Visualization.VRML2._diffuse_material_dict Scientific.Visualization.VRML2-module.html#_diffuse_material_dict Scientific.indexing Scientific.indexing-module.html Scientific.indexing.index_expression Scientific.indexing-module.html#index_expression Scientific.BSP.Console.BSPSyncError Scientific.BSP.Console.BSPSyncError-class.html Scientific.BSP.Console.OKToken Scientific.BSP.Console.OKToken-class.html Scientific.BSP.Console.OKToken.__init__ Scientific.BSP.Console.OKToken-class.html#__init__ Scientific.BSP.Console.OutputStream Scientific.BSP.Console.OutputStream-class.html Scientific.BSP.Console.OutputStream.write Scientific.BSP.Console.OutputStream-class.html#write Scientific.BSP.Console.OutputStream.__init__ Scientific.BSP.Console.OutputStream-class.html#__init__ Scientific.BSP.Console.OutputStream.__getattr__ Scientific.BSP.Console.OutputStream-class.html#__getattr__ Scientific.BSP.Console.ParallelConsole Scientific.BSP.Console.ParallelConsole-class.html Scientific.BSP.Console.ParallelConsole.mainloop Scientific.BSP.Console.ParallelConsole-class.html#mainloop Scientific.BSP.Console.ParallelConsole.push Scientific.BSP.Console.ParallelConsole-class.html#push Scientific.BSP.Console.ParallelConsole.__init__ Scientific.BSP.Console.ParallelConsole-class.html#__init__ Scientific.BSP.Console.ParallelInterpreter Scientific.BSP.Console.ParallelInterpreter-class.html Scientific.BSP.Console.ParallelInterpreter.mainloop Scientific.BSP.Console.ParallelInterpreter-class.html#mainloop Scientific.BSP.Console.ParallelInterpreter.__init__ Scientific.BSP.Console.ParallelInterpreter-class.html#__init__ Scientific.BSP.ParAccumulator Scientific.BSP.ParAccumulator-class.html Scientific.BSP.ParValue.anytrue Scientific.BSP.ParValue-class.html#anytrue Scientific.BSP.ParValue.__ne__ Scientific.BSP.ParValue-class.html#__ne__ Scientific.BSP.ParValue.fullExchange Scientific.BSP.ParValue-class.html#fullExchange Scientific.BSP.ParValue.__str__ Scientific.BSP.ParValue-class.html#__str__ Scientific.BSP.ParValue.reduce Scientific.BSP.ParValue-class.html#reduce Scientific.BSP.ParValue.accumulate Scientific.BSP.ParValue-class.html#accumulate Scientific.BSP.ParValue.__lt__ Scientific.BSP.ParValue-class.html#__lt__ Scientific.BSP.ParAccumulator.__init__ Scientific.BSP.ParAccumulator-class.html#__init__ Scientific.BSP.ParValue.is_parvalue Scientific.BSP.ParValue-class.html#is_parvalue Scientific.BSP.ParAccumulator.calculateTotal Scientific.BSP.ParAccumulator-class.html#calculateTotal Scientific.BSP.ParValue.alltrue Scientific.BSP.ParValue-class.html#alltrue Scientific.BSP.ParValue.__getattr__ Scientific.BSP.ParValue-class.html#__getattr__ Scientific.BSP.ParValue.getattr Scientific.BSP.ParValue-class.html#getattr Scientific.BSP.ParValue.__call__ Scientific.BSP.ParValue-class.html#__call__ Scientific.BSP.ParValue.__len__ Scientific.BSP.ParValue-class.html#__len__ Scientific.BSP.ParValue.__repr__ Scientific.BSP.ParValue-class.html#__repr__ Scientific.BSP.ParValue.map Scientific.BSP.ParValue-class.html#map Scientific.BSP.ParValue.__getitem__ Scientific.BSP.ParValue-class.html#__getitem__ Scientific.BSP.ParValue.get Scientific.BSP.ParValue-class.html#get Scientific.BSP.ParValue.broadcast Scientific.BSP.ParValue-class.html#broadcast Scientific.BSP.ParValue.__divmod__ Scientific.BSP.ParValue-class.html#__divmod__ Scientific.BSP.ParValue.__add__ Scientific.BSP.ParValue-class.html#__add__ Scientific.BSP.ParValue.__gt__ Scientific.BSP.ParValue-class.html#__gt__ Scientific.BSP.ParValue.put Scientific.BSP.ParValue-class.html#put Scientific.BSP.ParValue.__eq__ Scientific.BSP.ParValue-class.html#__eq__ Scientific.BSP.ParValue.__nonzero__ Scientific.BSP.ParValue-class.html#__nonzero__ Scientific.BSP.ParValue.__mod__ Scientific.BSP.ParValue-class.html#__mod__ Scientific.BSP.ParValue.__neg__ Scientific.BSP.ParValue-class.html#__neg__ Scientific.BSP.ParValue.__div__ Scientific.BSP.ParValue-class.html#__div__ Scientific.BSP.ParValue.__le__ Scientific.BSP.ParValue-class.html#__le__ Scientific.BSP.ParValue.__mul__ Scientific.BSP.ParValue-class.html#__mul__ Scientific.BSP.ParAccumulator.addValue Scientific.BSP.ParAccumulator-class.html#addValue Scientific.BSP.ParValue.__sub__ Scientific.BSP.ParValue-class.html#__sub__ Scientific.BSP.ParValue.__ge__ Scientific.BSP.ParValue-class.html#__ge__ Scientific.BSP.ParValue.__pow__ Scientific.BSP.ParValue-class.html#__pow__ Scientific.BSP.ParBase Scientific.BSP.ParBase-class.html Scientific.BSP.ParBase.get Scientific.BSP.ParBase-class.html#get Scientific.BSP.ParBase.broadcast Scientific.BSP.ParBase-class.html#broadcast Scientific.BSP.ParBase.put Scientific.BSP.ParBase-class.html#put Scientific.BSP.ParBase.is_parclass Scientific.BSP.ParBase-class.html#is_parclass Scientific.BSP.ParBase.exchangeMessages Scientific.BSP.ParBase-class.html#exchangeMessages Scientific.BSP.ParClass Scientific.BSP.ParClass-class.html Scientific.BSP.ParClass._collectAttributes Scientific.BSP.ParClass-class.html#_collectAttributes Scientific.BSP.ParClass._collectAttributes1 Scientific.BSP.ParClass-class.html#_collectAttributes1 Scientific.BSP.ParClass.__call__ Scientific.BSP.ParClass-class.html#__call__ Scientific.BSP.ParClass.__init__ Scientific.BSP.ParClass-class.html#__init__ Scientific.BSP.ParConstant Scientific.BSP.ParConstant-class.html Scientific.BSP.ParValue.anytrue Scientific.BSP.ParValue-class.html#anytrue Scientific.BSP.ParValue.__ne__ Scientific.BSP.ParValue-class.html#__ne__ Scientific.BSP.ParValue.__str__ Scientific.BSP.ParValue-class.html#__str__ Scientific.BSP.ParValue.reduce Scientific.BSP.ParValue-class.html#reduce Scientific.BSP.ParValue.accumulate Scientific.BSP.ParValue-class.html#accumulate Scientific.BSP.ParValue.__lt__ Scientific.BSP.ParValue-class.html#__lt__ Scientific.BSP.ParConstant.__init__ Scientific.BSP.ParConstant-class.html#__init__ Scientific.BSP.ParValue.is_parvalue Scientific.BSP.ParValue-class.html#is_parvalue Scientific.BSP.ParValue.fullExchange Scientific.BSP.ParValue-class.html#fullExchange Scientific.BSP.ParValue.alltrue Scientific.BSP.ParValue-class.html#alltrue Scientific.BSP.ParValue.__getattr__ Scientific.BSP.ParValue-class.html#__getattr__ Scientific.BSP.ParValue.getattr Scientific.BSP.ParValue-class.html#getattr Scientific.BSP.ParValue.__call__ Scientific.BSP.ParValue-class.html#__call__ Scientific.BSP.ParValue.__len__ Scientific.BSP.ParValue-class.html#__len__ Scientific.BSP.ParValue.__repr__ Scientific.BSP.ParValue-class.html#__repr__ Scientific.BSP.ParValue.map Scientific.BSP.ParValue-class.html#map Scientific.BSP.ParValue.__getitem__ Scientific.BSP.ParValue-class.html#__getitem__ Scientific.BSP.ParValue.get Scientific.BSP.ParValue-class.html#get Scientific.BSP.ParValue.broadcast Scientific.BSP.ParValue-class.html#broadcast Scientific.BSP.ParValue.__divmod__ Scientific.BSP.ParValue-class.html#__divmod__ Scientific.BSP.ParValue.__add__ Scientific.BSP.ParValue-class.html#__add__ Scientific.BSP.ParValue.__gt__ Scientific.BSP.ParValue-class.html#__gt__ Scientific.BSP.ParValue.put Scientific.BSP.ParValue-class.html#put Scientific.BSP.ParValue.__eq__ Scientific.BSP.ParValue-class.html#__eq__ Scientific.BSP.ParValue.__nonzero__ Scientific.BSP.ParValue-class.html#__nonzero__ Scientific.BSP.ParValue.__mod__ Scientific.BSP.ParValue-class.html#__mod__ Scientific.BSP.ParValue.__neg__ Scientific.BSP.ParValue-class.html#__neg__ Scientific.BSP.ParValue.__div__ Scientific.BSP.ParValue-class.html#__div__ Scientific.BSP.ParValue.__le__ Scientific.BSP.ParValue-class.html#__le__ Scientific.BSP.ParValue.__mul__ Scientific.BSP.ParValue-class.html#__mul__ Scientific.BSP.ParValue.__sub__ Scientific.BSP.ParValue-class.html#__sub__ Scientific.BSP.ParValue.__ge__ Scientific.BSP.ParValue-class.html#__ge__ Scientific.BSP.ParValue.__pow__ Scientific.BSP.ParValue-class.html#__pow__ Scientific.BSP.ParData Scientific.BSP.ParData-class.html Scientific.BSP.ParValue.anytrue Scientific.BSP.ParValue-class.html#anytrue Scientific.BSP.ParValue.__ne__ Scientific.BSP.ParValue-class.html#__ne__ Scientific.BSP.ParValue.__str__ Scientific.BSP.ParValue-class.html#__str__ Scientific.BSP.ParValue.reduce Scientific.BSP.ParValue-class.html#reduce Scientific.BSP.ParValue.accumulate Scientific.BSP.ParValue-class.html#accumulate Scientific.BSP.ParValue.__lt__ Scientific.BSP.ParValue-class.html#__lt__ Scientific.BSP.ParData.__init__ Scientific.BSP.ParData-class.html#__init__ Scientific.BSP.ParValue.is_parvalue Scientific.BSP.ParValue-class.html#is_parvalue Scientific.BSP.ParValue.fullExchange Scientific.BSP.ParValue-class.html#fullExchange Scientific.BSP.ParValue.alltrue Scientific.BSP.ParValue-class.html#alltrue Scientific.BSP.ParValue.__getattr__ Scientific.BSP.ParValue-class.html#__getattr__ Scientific.BSP.ParValue.getattr Scientific.BSP.ParValue-class.html#getattr Scientific.BSP.ParValue.__call__ Scientific.BSP.ParValue-class.html#__call__ Scientific.BSP.ParValue.__len__ Scientific.BSP.ParValue-class.html#__len__ Scientific.BSP.ParValue.__repr__ Scientific.BSP.ParValue-class.html#__repr__ Scientific.BSP.ParValue.map Scientific.BSP.ParValue-class.html#map Scientific.BSP.ParValue.__getitem__ Scientific.BSP.ParValue-class.html#__getitem__ Scientific.BSP.ParValue.get Scientific.BSP.ParValue-class.html#get Scientific.BSP.ParValue.broadcast Scientific.BSP.ParValue-class.html#broadcast Scientific.BSP.ParValue.__divmod__ Scientific.BSP.ParValue-class.html#__divmod__ Scientific.BSP.ParValue.__add__ Scientific.BSP.ParValue-class.html#__add__ Scientific.BSP.ParValue.__gt__ Scientific.BSP.ParValue-class.html#__gt__ Scientific.BSP.ParValue.put Scientific.BSP.ParValue-class.html#put Scientific.BSP.ParValue.__eq__ Scientific.BSP.ParValue-class.html#__eq__ Scientific.BSP.ParValue.__nonzero__ Scientific.BSP.ParValue-class.html#__nonzero__ Scientific.BSP.ParValue.__mod__ Scientific.BSP.ParValue-class.html#__mod__ Scientific.BSP.ParValue.__neg__ Scientific.BSP.ParValue-class.html#__neg__ Scientific.BSP.ParValue.__div__ Scientific.BSP.ParValue-class.html#__div__ Scientific.BSP.ParValue.__le__ Scientific.BSP.ParValue-class.html#__le__ Scientific.BSP.ParValue.__mul__ Scientific.BSP.ParValue-class.html#__mul__ Scientific.BSP.ParValue.__sub__ Scientific.BSP.ParValue-class.html#__sub__ Scientific.BSP.ParValue.__ge__ Scientific.BSP.ParValue-class.html#__ge__ Scientific.BSP.ParValue.__pow__ Scientific.BSP.ParValue-class.html#__pow__ Scientific.BSP.ParFunction Scientific.BSP.ParFunction-class.html Scientific.BSP.ParValue.anytrue Scientific.BSP.ParValue-class.html#anytrue Scientific.BSP.ParValue.__ne__ Scientific.BSP.ParValue-class.html#__ne__ Scientific.BSP.ParValue.__str__ Scientific.BSP.ParValue-class.html#__str__ Scientific.BSP.ParValue.reduce Scientific.BSP.ParValue-class.html#reduce Scientific.BSP.ParValue.accumulate Scientific.BSP.ParValue-class.html#accumulate Scientific.BSP.ParValue.__lt__ Scientific.BSP.ParValue-class.html#__lt__ Scientific.BSP.ParFunction.__init__ Scientific.BSP.ParFunction-class.html#__init__ Scientific.BSP.ParValue.is_parvalue Scientific.BSP.ParValue-class.html#is_parvalue Scientific.BSP.ParValue.fullExchange Scientific.BSP.ParValue-class.html#fullExchange Scientific.BSP.ParValue.alltrue Scientific.BSP.ParValue-class.html#alltrue Scientific.BSP.ParValue.__getattr__ Scientific.BSP.ParValue-class.html#__getattr__ Scientific.BSP.ParValue.getattr Scientific.BSP.ParValue-class.html#getattr Scientific.BSP.ParValue.__call__ Scientific.BSP.ParValue-class.html#__call__ Scientific.BSP.ParValue.__len__ Scientific.BSP.ParValue-class.html#__len__ Scientific.BSP.ParValue.__mul__ Scientific.BSP.ParValue-class.html#__mul__ Scientific.BSP.ParValue.map Scientific.BSP.ParValue-class.html#map Scientific.BSP.ParValue.__getitem__ Scientific.BSP.ParValue-class.html#__getitem__ Scientific.BSP.ParValue.get Scientific.BSP.ParValue-class.html#get Scientific.BSP.ParValue.broadcast Scientific.BSP.ParValue-class.html#broadcast Scientific.BSP.ParValue.__divmod__ Scientific.BSP.ParValue-class.html#__divmod__ Scientific.BSP.ParValue.__add__ Scientific.BSP.ParValue-class.html#__add__ Scientific.BSP.ParValue.__gt__ Scientific.BSP.ParValue-class.html#__gt__ Scientific.BSP.ParValue.put Scientific.BSP.ParValue-class.html#put Scientific.BSP.ParValue.__eq__ Scientific.BSP.ParValue-class.html#__eq__ Scientific.BSP.ParValue.__nonzero__ Scientific.BSP.ParValue-class.html#__nonzero__ Scientific.BSP.ParValue.__mod__ Scientific.BSP.ParValue-class.html#__mod__ Scientific.BSP.ParValue.__neg__ Scientific.BSP.ParValue-class.html#__neg__ Scientific.BSP.ParValue.__div__ Scientific.BSP.ParValue-class.html#__div__ Scientific.BSP.ParValue.__le__ Scientific.BSP.ParValue-class.html#__le__ Scientific.BSP.ParFunction.__repr__ Scientific.BSP.ParFunction-class.html#__repr__ Scientific.BSP.ParValue.__sub__ Scientific.BSP.ParValue-class.html#__sub__ Scientific.BSP.ParValue.__ge__ Scientific.BSP.ParValue-class.html#__ge__ Scientific.BSP.ParValue.__pow__ Scientific.BSP.ParValue-class.html#__pow__ Scientific.BSP.ParIndex Scientific.BSP.ParIndex-class.html Scientific.BSP.ParIndex.__repr__ Scientific.BSP.ParIndex-class.html#__repr__ Scientific.BSP.ParIndex.is_parindex Scientific.BSP.ParIndex-class.html#is_parindex Scientific.BSP.ParIndex.__init__ Scientific.BSP.ParIndex-class.html#__init__ Scientific.BSP.ParIndexIterator Scientific.BSP.ParIndexIterator-class.html Scientific.BSP.ParIndexIterator.__getitem__ Scientific.BSP.ParIndexIterator-class.html#__getitem__ Scientific.BSP.ParIndexIterator.__init__ Scientific.BSP.ParIndexIterator-class.html#__init__ Scientific.BSP.ParIterator Scientific.BSP.ParIterator-class.html Scientific.BSP.ParIterator.__getitem__ Scientific.BSP.ParIterator-class.html#__getitem__ Scientific.BSP.ParIterator.__init__ Scientific.BSP.ParIterator-class.html#__init__ Scientific.BSP.ParMessages Scientific.BSP.ParMessages-class.html Scientific.BSP.ParValue.anytrue Scientific.BSP.ParValue-class.html#anytrue Scientific.BSP.ParValue.__ne__ Scientific.BSP.ParValue-class.html#__ne__ Scientific.BSP.ParValue.__str__ Scientific.BSP.ParValue-class.html#__str__ Scientific.BSP.ParValue.reduce Scientific.BSP.ParValue-class.html#reduce Scientific.BSP.ParValue.accumulate Scientific.BSP.ParValue-class.html#accumulate Scientific.BSP.ParValue.__lt__ Scientific.BSP.ParValue-class.html#__lt__ Scientific.BSP.ParMessages.__init__ Scientific.BSP.ParMessages-class.html#__init__ Scientific.BSP.ParValue.is_parvalue Scientific.BSP.ParValue-class.html#is_parvalue Scientific.BSP.ParValue.__eq__ Scientific.BSP.ParValue-class.html#__eq__ Scientific.BSP.ParValue.get Scientific.BSP.ParValue-class.html#get Scientific.BSP.ParValue.fullExchange Scientific.BSP.ParValue-class.html#fullExchange Scientific.BSP.ParValue.alltrue Scientific.BSP.ParValue-class.html#alltrue Scientific.BSP.ParValue.__getattr__ Scientific.BSP.ParValue-class.html#__getattr__ Scientific.BSP.ParValue.getattr Scientific.BSP.ParValue-class.html#getattr Scientific.BSP.ParValue.__call__ Scientific.BSP.ParValue-class.html#__call__ Scientific.BSP.ParValue.__len__ Scientific.BSP.ParValue-class.html#__len__ Scientific.BSP.ParValue.__mul__ Scientific.BSP.ParValue-class.html#__mul__ Scientific.BSP.ParValue.map Scientific.BSP.ParValue-class.html#map Scientific.BSP.ParValue.__getitem__ Scientific.BSP.ParValue-class.html#__getitem__ Scientific.BSP.ParMessages.exchange Scientific.BSP.ParMessages-class.html#exchange Scientific.BSP.ParValue.broadcast Scientific.BSP.ParValue-class.html#broadcast Scientific.BSP.ParValue.__divmod__ Scientific.BSP.ParValue-class.html#__divmod__ Scientific.BSP.ParValue.__add__ Scientific.BSP.ParValue-class.html#__add__ Scientific.BSP.ParValue.__gt__ Scientific.BSP.ParValue-class.html#__gt__ Scientific.BSP.ParValue.put Scientific.BSP.ParValue-class.html#put Scientific.BSP.ParMessages.data Scientific.BSP.ParMessages-class.html#data Scientific.BSP.ParValue.__nonzero__ Scientific.BSP.ParValue-class.html#__nonzero__ Scientific.BSP.ParValue.__mod__ Scientific.BSP.ParValue-class.html#__mod__ Scientific.BSP.ParValue.__neg__ Scientific.BSP.ParValue-class.html#__neg__ Scientific.BSP.ParMessages.processorIds Scientific.BSP.ParMessages-class.html#processorIds Scientific.BSP.ParValue.__div__ Scientific.BSP.ParValue-class.html#__div__ Scientific.BSP.ParValue.__le__ Scientific.BSP.ParValue-class.html#__le__ Scientific.BSP.ParValue.__repr__ Scientific.BSP.ParValue-class.html#__repr__ Scientific.BSP.ParValue.__sub__ Scientific.BSP.ParValue-class.html#__sub__ Scientific.BSP.ParValue.__ge__ Scientific.BSP.ParValue-class.html#__ge__ Scientific.BSP.ParValue.__pow__ Scientific.BSP.ParValue-class.html#__pow__ Scientific.BSP.ParRootFunction Scientific.BSP.ParRootFunction-class.html Scientific.BSP.ParValue.anytrue Scientific.BSP.ParValue-class.html#anytrue Scientific.BSP.ParValue.__ne__ Scientific.BSP.ParValue-class.html#__ne__ Scientific.BSP.ParValue.__str__ Scientific.BSP.ParValue-class.html#__str__ Scientific.BSP.ParValue.reduce Scientific.BSP.ParValue-class.html#reduce Scientific.BSP.ParValue.accumulate Scientific.BSP.ParValue-class.html#accumulate Scientific.BSP.ParValue.__lt__ Scientific.BSP.ParValue-class.html#__lt__ Scientific.BSP.ParRootFunction.__init__ Scientific.BSP.ParRootFunction-class.html#__init__ Scientific.BSP.ParValue.is_parvalue Scientific.BSP.ParValue-class.html#is_parvalue Scientific.BSP.ParValue.fullExchange Scientific.BSP.ParValue-class.html#fullExchange Scientific.BSP.ParValue.alltrue Scientific.BSP.ParValue-class.html#alltrue Scientific.BSP.ParValue.__getattr__ Scientific.BSP.ParValue-class.html#__getattr__ Scientific.BSP.ParValue.getattr Scientific.BSP.ParValue-class.html#getattr Scientific.BSP.ParValue.__call__ Scientific.BSP.ParValue-class.html#__call__ Scientific.BSP.ParValue.__len__ Scientific.BSP.ParValue-class.html#__len__ Scientific.BSP.ParValue.__mul__ Scientific.BSP.ParValue-class.html#__mul__ Scientific.BSP.ParValue.map Scientific.BSP.ParValue-class.html#map Scientific.BSP.ParValue.__getitem__ Scientific.BSP.ParValue-class.html#__getitem__ Scientific.BSP.ParValue.get Scientific.BSP.ParValue-class.html#get Scientific.BSP.ParValue.broadcast Scientific.BSP.ParValue-class.html#broadcast Scientific.BSP.ParValue.__divmod__ Scientific.BSP.ParValue-class.html#__divmod__ Scientific.BSP.ParValue.__add__ Scientific.BSP.ParValue-class.html#__add__ Scientific.BSP.ParValue.__gt__ Scientific.BSP.ParValue-class.html#__gt__ Scientific.BSP.ParValue.put Scientific.BSP.ParValue-class.html#put Scientific.BSP.ParValue.__eq__ Scientific.BSP.ParValue-class.html#__eq__ Scientific.BSP.ParValue.__nonzero__ Scientific.BSP.ParValue-class.html#__nonzero__ Scientific.BSP.ParValue.__mod__ Scientific.BSP.ParValue-class.html#__mod__ Scientific.BSP.ParValue.__neg__ Scientific.BSP.ParValue-class.html#__neg__ Scientific.BSP.ParValue.__div__ Scientific.BSP.ParValue-class.html#__div__ Scientific.BSP.ParValue.__le__ Scientific.BSP.ParValue-class.html#__le__ Scientific.BSP.ParFunction.__repr__ Scientific.BSP.ParFunction-class.html#__repr__ Scientific.BSP.ParValue.__sub__ Scientific.BSP.ParValue-class.html#__sub__ Scientific.BSP.ParValue.__ge__ Scientific.BSP.ParValue-class.html#__ge__ Scientific.BSP.ParValue.__pow__ Scientific.BSP.ParValue-class.html#__pow__ Scientific.BSP.ParRootSequence Scientific.BSP.ParRootSequence-class.html Scientific.BSP.ParValue.anytrue Scientific.BSP.ParValue-class.html#anytrue Scientific.BSP.ParValue.map Scientific.BSP.ParValue-class.html#map Scientific.BSP.ParValue.__str__ Scientific.BSP.ParValue-class.html#__str__ Scientific.BSP.ParValue.reduce Scientific.BSP.ParValue-class.html#reduce Scientific.BSP.ParValue.accumulate Scientific.BSP.ParValue-class.html#accumulate Scientific.BSP.ParValue.__lt__ Scientific.BSP.ParValue-class.html#__lt__ Scientific.BSP.ParRootSequence.__init__ Scientific.BSP.ParRootSequence-class.html#__init__ Scientific.BSP.ParValue.is_parvalue Scientific.BSP.ParValue-class.html#is_parvalue Scientific.BSP.ParValue.fullExchange Scientific.BSP.ParValue-class.html#fullExchange Scientific.BSP.ParValue.alltrue Scientific.BSP.ParValue-class.html#alltrue Scientific.BSP.ParValue.__getattr__ Scientific.BSP.ParValue-class.html#__getattr__ Scientific.BSP.ParValue.getattr Scientific.BSP.ParValue-class.html#getattr Scientific.BSP.ParValue.__call__ Scientific.BSP.ParValue-class.html#__call__ Scientific.BSP.ParValue.__len__ Scientific.BSP.ParValue-class.html#__len__ Scientific.BSP.ParValue.__repr__ Scientific.BSP.ParValue-class.html#__repr__ Scientific.BSP.ParValue.__ne__ Scientific.BSP.ParValue-class.html#__ne__ Scientific.BSP.ParSequence.__getitem__ Scientific.BSP.ParSequence-class.html#__getitem__ Scientific.BSP.ParValue.get Scientific.BSP.ParValue-class.html#get Scientific.BSP.ParValue.broadcast Scientific.BSP.ParValue-class.html#broadcast Scientific.BSP.ParValue.__divmod__ Scientific.BSP.ParValue-class.html#__divmod__ Scientific.BSP.ParValue.__add__ Scientific.BSP.ParValue-class.html#__add__ Scientific.BSP.ParValue.__gt__ Scientific.BSP.ParValue-class.html#__gt__ Scientific.BSP.ParValue.put Scientific.BSP.ParValue-class.html#put Scientific.BSP.ParValue.__eq__ Scientific.BSP.ParValue-class.html#__eq__ Scientific.BSP.ParSequence.totalLength Scientific.BSP.ParSequence-class.html#totalLength Scientific.BSP.ParValue.__nonzero__ Scientific.BSP.ParValue-class.html#__nonzero__ Scientific.BSP.ParValue.__mod__ Scientific.BSP.ParValue-class.html#__mod__ Scientific.BSP.ParValue.__neg__ Scientific.BSP.ParValue-class.html#__neg__ Scientific.BSP.ParValue.__div__ Scientific.BSP.ParValue-class.html#__div__ Scientific.BSP.ParValue.__le__ Scientific.BSP.ParValue-class.html#__le__ Scientific.BSP.ParValue.__mul__ Scientific.BSP.ParValue-class.html#__mul__ Scientific.BSP.ParValue.__sub__ Scientific.BSP.ParValue-class.html#__sub__ Scientific.BSP.ParValue.__ge__ Scientific.BSP.ParValue-class.html#__ge__ Scientific.BSP.ParValue.__pow__ Scientific.BSP.ParValue-class.html#__pow__ Scientific.BSP.ParSequence Scientific.BSP.ParSequence-class.html Scientific.BSP.ParValue.anytrue Scientific.BSP.ParValue-class.html#anytrue Scientific.BSP.ParValue.map Scientific.BSP.ParValue-class.html#map Scientific.BSP.ParValue.__str__ Scientific.BSP.ParValue-class.html#__str__ Scientific.BSP.ParValue.reduce Scientific.BSP.ParValue-class.html#reduce Scientific.BSP.ParValue.accumulate Scientific.BSP.ParValue-class.html#accumulate Scientific.BSP.ParValue.__lt__ Scientific.BSP.ParValue-class.html#__lt__ Scientific.BSP.ParSequence.__init__ Scientific.BSP.ParSequence-class.html#__init__ Scientific.BSP.ParValue.is_parvalue Scientific.BSP.ParValue-class.html#is_parvalue Scientific.BSP.ParValue.fullExchange Scientific.BSP.ParValue-class.html#fullExchange Scientific.BSP.ParValue.alltrue Scientific.BSP.ParValue-class.html#alltrue Scientific.BSP.ParValue.__getattr__ Scientific.BSP.ParValue-class.html#__getattr__ Scientific.BSP.ParValue.getattr Scientific.BSP.ParValue-class.html#getattr Scientific.BSP.ParValue.__call__ Scientific.BSP.ParValue-class.html#__call__ Scientific.BSP.ParValue.__len__ Scientific.BSP.ParValue-class.html#__len__ Scientific.BSP.ParValue.__repr__ Scientific.BSP.ParValue-class.html#__repr__ Scientific.BSP.ParValue.__ne__ Scientific.BSP.ParValue-class.html#__ne__ Scientific.BSP.ParSequence.__getitem__ Scientific.BSP.ParSequence-class.html#__getitem__ Scientific.BSP.ParValue.get Scientific.BSP.ParValue-class.html#get Scientific.BSP.ParValue.broadcast Scientific.BSP.ParValue-class.html#broadcast Scientific.BSP.ParValue.__divmod__ Scientific.BSP.ParValue-class.html#__divmod__ Scientific.BSP.ParValue.__add__ Scientific.BSP.ParValue-class.html#__add__ Scientific.BSP.ParValue.__gt__ Scientific.BSP.ParValue-class.html#__gt__ Scientific.BSP.ParValue.put Scientific.BSP.ParValue-class.html#put Scientific.BSP.ParValue.__eq__ Scientific.BSP.ParValue-class.html#__eq__ Scientific.BSP.ParSequence.totalLength Scientific.BSP.ParSequence-class.html#totalLength Scientific.BSP.ParValue.__nonzero__ Scientific.BSP.ParValue-class.html#__nonzero__ Scientific.BSP.ParValue.__mod__ Scientific.BSP.ParValue-class.html#__mod__ Scientific.BSP.ParValue.__neg__ Scientific.BSP.ParValue-class.html#__neg__ Scientific.BSP.ParValue.__div__ Scientific.BSP.ParValue-class.html#__div__ Scientific.BSP.ParValue.__le__ Scientific.BSP.ParValue-class.html#__le__ Scientific.BSP.ParValue.__mul__ Scientific.BSP.ParValue-class.html#__mul__ Scientific.BSP.ParValue.__sub__ Scientific.BSP.ParValue-class.html#__sub__ Scientific.BSP.ParValue.__ge__ Scientific.BSP.ParValue-class.html#__ge__ Scientific.BSP.ParValue.__pow__ Scientific.BSP.ParValue-class.html#__pow__ Scientific.BSP.ParTuple Scientific.BSP.ParTuple-class.html Scientific.BSP.ParValue.anytrue Scientific.BSP.ParValue-class.html#anytrue Scientific.BSP.ParValue.__ne__ Scientific.BSP.ParValue-class.html#__ne__ Scientific.BSP.ParValue.__str__ Scientific.BSP.ParValue-class.html#__str__ Scientific.BSP.ParValue.reduce Scientific.BSP.ParValue-class.html#reduce Scientific.BSP.ParValue.accumulate Scientific.BSP.ParValue-class.html#accumulate Scientific.BSP.ParValue.__lt__ Scientific.BSP.ParValue-class.html#__lt__ Scientific.BSP.ParTuple.__init__ Scientific.BSP.ParTuple-class.html#__init__ Scientific.BSP.ParValue.is_parvalue Scientific.BSP.ParValue-class.html#is_parvalue Scientific.BSP.ParValue.fullExchange Scientific.BSP.ParValue-class.html#fullExchange Scientific.BSP.ParValue.alltrue Scientific.BSP.ParValue-class.html#alltrue Scientific.BSP.ParValue.__getattr__ Scientific.BSP.ParValue-class.html#__getattr__ Scientific.BSP.ParValue.getattr Scientific.BSP.ParValue-class.html#getattr Scientific.BSP.ParValue.__call__ Scientific.BSP.ParValue-class.html#__call__ Scientific.BSP.ParTuple.__len__ Scientific.BSP.ParTuple-class.html#__len__ Scientific.BSP.ParValue.__mul__ Scientific.BSP.ParValue-class.html#__mul__ Scientific.BSP.ParValue.map Scientific.BSP.ParValue-class.html#map Scientific.BSP.ParTuple.__getitem__ Scientific.BSP.ParTuple-class.html#__getitem__ Scientific.BSP.ParValue.get Scientific.BSP.ParValue-class.html#get Scientific.BSP.ParValue.broadcast Scientific.BSP.ParValue-class.html#broadcast Scientific.BSP.ParValue.__divmod__ Scientific.BSP.ParValue-class.html#__divmod__ Scientific.BSP.ParValue.__add__ Scientific.BSP.ParValue-class.html#__add__ Scientific.BSP.ParValue.__gt__ Scientific.BSP.ParValue-class.html#__gt__ Scientific.BSP.ParValue.put Scientific.BSP.ParValue-class.html#put Scientific.BSP.ParValue.__eq__ Scientific.BSP.ParValue-class.html#__eq__ Scientific.BSP.ParValue.__nonzero__ Scientific.BSP.ParValue-class.html#__nonzero__ Scientific.BSP.ParValue.__mod__ Scientific.BSP.ParValue-class.html#__mod__ Scientific.BSP.ParValue.__neg__ Scientific.BSP.ParValue-class.html#__neg__ Scientific.BSP.ParValue.__div__ Scientific.BSP.ParValue-class.html#__div__ Scientific.BSP.ParValue.__le__ Scientific.BSP.ParValue-class.html#__le__ Scientific.BSP.ParValue.__repr__ Scientific.BSP.ParValue-class.html#__repr__ Scientific.BSP.ParValue.__sub__ Scientific.BSP.ParValue-class.html#__sub__ Scientific.BSP.ParValue.__ge__ Scientific.BSP.ParValue-class.html#__ge__ Scientific.BSP.ParValue.__pow__ Scientific.BSP.ParValue-class.html#__pow__ Scientific.BSP.ParValue Scientific.BSP.ParValue-class.html Scientific.BSP.ParValue.map Scientific.BSP.ParValue-class.html#map Scientific.BSP.ParValue.__str__ Scientific.BSP.ParValue-class.html#__str__ Scientific.BSP.ParValue.reduce Scientific.BSP.ParValue-class.html#reduce Scientific.BSP.ParValue.put Scientific.BSP.ParValue-class.html#put Scientific.BSP.ParValue.__lt__ Scientific.BSP.ParValue-class.html#__lt__ Scientific.BSP.ParValue.__init__ Scientific.BSP.ParValue-class.html#__init__ Scientific.BSP.ParValue.is_parvalue Scientific.BSP.ParValue-class.html#is_parvalue Scientific.BSP.ParValue.__mul__ Scientific.BSP.ParValue-class.html#__mul__ Scientific.BSP.ParValue.fullExchange Scientific.BSP.ParValue-class.html#fullExchange Scientific.BSP.ParValue.alltrue Scientific.BSP.ParValue-class.html#alltrue Scientific.BSP.ParValue.__getattr__ Scientific.BSP.ParValue-class.html#__getattr__ Scientific.BSP.ParValue.getattr Scientific.BSP.ParValue-class.html#getattr Scientific.BSP.ParValue.__call__ Scientific.BSP.ParValue-class.html#__call__ Scientific.BSP.ParValue.__len__ Scientific.BSP.ParValue-class.html#__len__ Scientific.BSP.ParValue.__repr__ Scientific.BSP.ParValue-class.html#__repr__ Scientific.BSP.ParValue.__ne__ Scientific.BSP.ParValue-class.html#__ne__ Scientific.BSP.ParValue.__getitem__ Scientific.BSP.ParValue-class.html#__getitem__ Scientific.BSP.ParValue.get Scientific.BSP.ParValue-class.html#get Scientific.BSP.ParValue.broadcast Scientific.BSP.ParValue-class.html#broadcast Scientific.BSP.ParValue.__divmod__ Scientific.BSP.ParValue-class.html#__divmod__ Scientific.BSP.ParValue.__add__ Scientific.BSP.ParValue-class.html#__add__ Scientific.BSP.ParValue.__gt__ Scientific.BSP.ParValue-class.html#__gt__ Scientific.BSP.ParValue.accumulate Scientific.BSP.ParValue-class.html#accumulate Scientific.BSP.ParValue.__eq__ Scientific.BSP.ParValue-class.html#__eq__ Scientific.BSP.ParValue.__nonzero__ Scientific.BSP.ParValue-class.html#__nonzero__ Scientific.BSP.ParValue.__mod__ Scientific.BSP.ParValue-class.html#__mod__ Scientific.BSP.ParValue.__neg__ Scientific.BSP.ParValue-class.html#__neg__ Scientific.BSP.ParValue.__div__ Scientific.BSP.ParValue-class.html#__div__ Scientific.BSP.ParValue.__le__ Scientific.BSP.ParValue-class.html#__le__ Scientific.BSP.ParValue.anytrue Scientific.BSP.ParValue-class.html#anytrue Scientific.BSP.ParValue.__sub__ Scientific.BSP.ParValue-class.html#__sub__ Scientific.BSP.ParValue.__ge__ Scientific.BSP.ParValue-class.html#__ge__ Scientific.BSP.ParValue.__pow__ Scientific.BSP.ParValue-class.html#__pow__ Scientific.Clustering.AffinityPropagation.DataSet Scientific.Clustering.AffinityPropagation.DataSet-class.html Scientific.Clustering.AffinityPropagation.DataSet._storeSimilarity Scientific.Clustering.AffinityPropagation.DataSet-class.html#_storeSimilarity Scientific.Clustering.AffinityPropagation.DataSet.findClusters Scientific.Clustering.AffinityPropagation.DataSet-class.html#findClusters Scientific.Clustering.AffinityPropagation.DataSet._setupEIndices Scientific.Clustering.AffinityPropagation.DataSet-class.html#_setupEIndices Scientific.Clustering.AffinityPropagation.DataSet._setupRIndices Scientific.Clustering.AffinityPropagation.DataSet-class.html#_setupRIndices Scientific.Clustering.AffinityPropagation.DataSet.__init__ Scientific.Clustering.AffinityPropagation.DataSet-class.html#__init__ Scientific.Clustering.AffinityPropagation.DataSet._setupAIndices2 Scientific.Clustering.AffinityPropagation.DataSet-class.html#_setupAIndices2 Scientific.Clustering.AffinityPropagation.DataSet._setupSimilarities Scientific.Clustering.AffinityPropagation.DataSet-class.html#_setupSimilarities Scientific.Clustering.AffinityPropagation.DataSet._setupIndices Scientific.Clustering.AffinityPropagation.DataSet-class.html#_setupIndices Scientific.Clustering.AffinityPropagation.DataSet._setupAIndices1 Scientific.Clustering.AffinityPropagation.DataSet-class.html#_setupAIndices1 Scientific.DictWithDefault.DictWithDefault Scientific.DictWithDefault.DictWithDefault-class.html Scientific.DictWithDefault.DictWithDefault.__init__ Scientific.DictWithDefault.DictWithDefault-class.html#__init__ Scientific.DictWithDefault.DictWithDefault.__getitem__ Scientific.DictWithDefault.DictWithDefault-class.html#__getitem__ Scientific.DictWithDefault.DictWithDefault.__delitem__ Scientific.DictWithDefault.DictWithDefault-class.html#__delitem__ Scientific.DistributedComputing.MasterSlave.GlobalStateValue Scientific.DistributedComputing.MasterSlave.GlobalStateValue-class.html Scientific.DistributedComputing.MasterSlave.GlobalStateValue.__init__ Scientific.DistributedComputing.MasterSlave.GlobalStateValue-class.html#__init__ Scientific.DistributedComputing.MasterSlave.MasterProcess Scientific.DistributedComputing.MasterSlave.MasterProcess-class.html Scientific.DistributedComputing.MasterSlave.MasterProcess.launchSlaveJobs Scientific.DistributedComputing.MasterSlave.MasterProcess-class.html#launchSlaveJobs Scientific.DistributedComputing.MasterSlave.MasterProcess.shutdown Scientific.DistributedComputing.MasterSlave.MasterProcess-class.html#shutdown Scientific.DistributedComputing.MasterSlave.MasterProcess.run Scientific.DistributedComputing.MasterSlave.MasterProcess-class.html#run Scientific.DistributedComputing.MasterSlave.MasterProcess.deleteGlobalState Scientific.DistributedComputing.MasterSlave.MasterProcess-class.html#deleteGlobalState Scientific.DistributedComputing.MasterSlave.MasterProcess.retrieveResult Scientific.DistributedComputing.MasterSlave.MasterProcess-class.html#retrieveResult Scientific.DistributedComputing.MasterSlave.MasterProcess.start Scientific.DistributedComputing.MasterSlave.MasterProcess-class.html#start Scientific.DistributedComputing.MasterSlave.MasterProcess.setGlobalState Scientific.DistributedComputing.MasterSlave.MasterProcess-class.html#setGlobalState Scientific.DistributedComputing.MasterSlave.MasterProcess.requestTask Scientific.DistributedComputing.MasterSlave.MasterProcess-class.html#requestTask Scientific.DistributedComputing.MasterSlave.MasterProcess.taskManagerThread Scientific.DistributedComputing.MasterSlave.MasterProcess-class.html#taskManagerThread Scientific.DistributedComputing.MasterSlave.MasterProcess.__init__ Scientific.DistributedComputing.MasterSlave.MasterProcess-class.html#__init__ Scientific.DistributedComputing.MasterSlave.SlaveProcess Scientific.DistributedComputing.MasterSlave.SlaveProcess-class.html Scientific.DistributedComputing.MasterSlave.SlaveProcess.start Scientific.DistributedComputing.MasterSlave.SlaveProcess-class.html#start Scientific.DistributedComputing.MasterSlave.SlaveProcess.terminationTest Scientific.DistributedComputing.MasterSlave.SlaveProcess-class.html#terminationTest Scientific.DistributedComputing.MasterSlave.SlaveProcess.watchdogThread Scientific.DistributedComputing.MasterSlave.SlaveProcess-class.html#watchdogThread Scientific.DistributedComputing.MasterSlave.SlaveProcess.processParameter Scientific.DistributedComputing.MasterSlave.SlaveProcess-class.html#processParameter Scientific.DistributedComputing.MasterSlave.SlaveProcess.__init__ Scientific.DistributedComputing.MasterSlave.SlaveProcess-class.html#__init__ Scientific.DistributedComputing.TaskManager.Task Scientific.DistributedComputing.TaskManager.Task-class.html Scientific.DistributedComputing.TaskManager.Task.__init__ Scientific.DistributedComputing.TaskManager.Task-class.html#__init__ Scientific.DistributedComputing.TaskManager.TaskManager Scientific.DistributedComputing.TaskManager.TaskManager-class.html Scientific.DistributedComputing.TaskManager.TaskManager.storeData Scientific.DistributedComputing.TaskManager.TaskManager-class.html#storeData Scientific.DistributedComputing.TaskManager.TaskManager.terminate Scientific.DistributedComputing.TaskManager.TaskManager-class.html#terminate Scientific.DistributedComputing.TaskManager.TaskManager._removeTask Scientific.DistributedComputing.TaskManager.TaskManager-class.html#_removeTask Scientific.DistributedComputing.TaskManager.TaskManager.__init__ Scientific.DistributedComputing.TaskManager.TaskManager-class.html#__init__ Scientific.DistributedComputing.TaskManager.TaskManager.getAnyResult Scientific.DistributedComputing.TaskManager.TaskManager-class.html#getAnyResult Scientific.DistributedComputing.TaskManager.TaskManager.ping Scientific.DistributedComputing.TaskManager.TaskManager-class.html#ping Scientific.DistributedComputing.TaskManager.TaskManager.storeException Scientific.DistributedComputing.TaskManager.TaskManager-class.html#storeException Scientific.DistributedComputing.TaskManager.TaskManager.registerProcess Scientific.DistributedComputing.TaskManager.TaskManager-class.html#registerProcess Scientific.DistributedComputing.TaskManager.TaskManager.numberOfTasks Scientific.DistributedComputing.TaskManager.TaskManager-class.html#numberOfTasks Scientific.DistributedComputing.TaskManager.TaskManager.returnTask Scientific.DistributedComputing.TaskManager.TaskManager-class.html#returnTask Scientific.DistributedComputing.TaskManager.TaskManager.getTaskWithTag Scientific.DistributedComputing.TaskManager.TaskManager-class.html#getTaskWithTag Scientific.DistributedComputing.TaskManager.TaskManager.retrieveData Scientific.DistributedComputing.TaskManager.TaskManager-class.html#retrieveData Scientific.DistributedComputing.TaskManager.TaskManager.storeResult Scientific.DistributedComputing.TaskManager.TaskManager-class.html#storeResult Scientific.DistributedComputing.TaskManager.TaskManager.activeProcessInfo Scientific.DistributedComputing.TaskManager.TaskManager-class.html#activeProcessInfo Scientific.DistributedComputing.TaskManager.TaskManager.addTaskRequest Scientific.DistributedComputing.TaskManager.TaskManager-class.html#addTaskRequest Scientific.DistributedComputing.TaskManager.TaskManager._checkoutTask Scientific.DistributedComputing.TaskManager.TaskManager-class.html#_checkoutTask Scientific.DistributedComputing.TaskManager.TaskManager.getAnyTask Scientific.DistributedComputing.TaskManager.TaskManager-class.html#getAnyTask Scientific.DistributedComputing.TaskManager.TaskManager.unregisterProcess Scientific.DistributedComputing.TaskManager.TaskManager-class.html#unregisterProcess Scientific.DistributedComputing.TaskManager.TaskManager.getResultWithTag Scientific.DistributedComputing.TaskManager.TaskManager-class.html#getResultWithTag Scientific.DistributedComputing.TaskManager.TaskManager.deleteData Scientific.DistributedComputing.TaskManager.TaskManager-class.html#deleteData Scientific.DistributedComputing.TaskManager.TaskManager.numberOfActiveProcesses Scientific.DistributedComputing.TaskManager.TaskManager-class.html#numberOfActiveProcesses Scientific.DistributedComputing.TaskManager.TaskManagerTermination Scientific.DistributedComputing.TaskManager.TaskManagerTermination-class.html Scientific.DistributedComputing.TaskManager.TaskQueue Scientific.DistributedComputing.TaskManager.TaskQueue-class.html Scientific.DistributedComputing.TaskManager.TaskQueue.addTask Scientific.DistributedComputing.TaskManager.TaskQueue-class.html#addTask Scientific.DistributedComputing.TaskManager.TaskQueue.firstTaskWithTag Scientific.DistributedComputing.TaskManager.TaskQueue-class.html#firstTaskWithTag Scientific.DistributedComputing.TaskManager.TaskQueue._checkForTermination Scientific.DistributedComputing.TaskManager.TaskQueue-class.html#_checkForTermination Scientific.DistributedComputing.TaskManager.TaskQueue.taskWithId Scientific.DistributedComputing.TaskManager.TaskQueue-class.html#taskWithId Scientific.DistributedComputing.TaskManager.TaskQueue._removeTask Scientific.DistributedComputing.TaskManager.TaskQueue-class.html#_removeTask Scientific.DistributedComputing.TaskManager.TaskQueue.__init__ Scientific.DistributedComputing.TaskManager.TaskQueue-class.html#__init__ Scientific.DistributedComputing.TaskManager.TaskQueue.firstTask Scientific.DistributedComputing.TaskManager.TaskQueue-class.html#firstTask Scientific.DistributedComputing.TaskManager.TaskQueue.terminateWaitingThreads Scientific.DistributedComputing.TaskManager.TaskQueue-class.html#terminateWaitingThreads Scientific.DistributedComputing.TaskManager.TaskQueue.__len__ Scientific.DistributedComputing.TaskManager.TaskQueue-class.html#__len__ Scientific.DistributedComputing.TaskManager.TaskQueue.taskCount Scientific.DistributedComputing.TaskManager.TaskQueue-class.html#taskCount Scientific.DistributedComputing.TaskManager.TaskRaisedException Scientific.DistributedComputing.TaskManager.TaskRaisedException-class.html Scientific.DistributedComputing.TaskManager.TaskRaisedException.__init__ Scientific.DistributedComputing.TaskManager.TaskRaisedException-class.html#__init__ Scientific.DistributedComputing.TaskManager.Watchdog Scientific.DistributedComputing.TaskManager.Watchdog-class.html Scientific.DistributedComputing.TaskManager.Watchdog.unregisterProcess Scientific.DistributedComputing.TaskManager.Watchdog-class.html#unregisterProcess Scientific.DistributedComputing.TaskManager.Watchdog.ping Scientific.DistributedComputing.TaskManager.Watchdog-class.html#ping Scientific.DistributedComputing.TaskManager.Watchdog.terminate Scientific.DistributedComputing.TaskManager.Watchdog-class.html#terminate Scientific.DistributedComputing.TaskManager.Watchdog.watchdogThread Scientific.DistributedComputing.TaskManager.Watchdog-class.html#watchdogThread Scientific.DistributedComputing.TaskManager.Watchdog.registerProcess Scientific.DistributedComputing.TaskManager.Watchdog-class.html#registerProcess Scientific.DistributedComputing.TaskManager.Watchdog.__init__ Scientific.DistributedComputing.TaskManager.Watchdog-class.html#__init__ Scientific.Functions.Derivatives.DerivVar Scientific.Functions.Derivatives.DerivVar-class.html Scientific.Functions.Derivatives.DerivVar.__add__ Scientific.Functions.Derivatives.DerivVar-class.html#__add__ Scientific.Functions.Derivatives.DerivVar.__cmp__ Scientific.Functions.Derivatives.DerivVar-class.html#__cmp__ Scientific.Functions.Derivatives.DerivVar.__str__ Scientific.Functions.Derivatives.DerivVar-class.html#__str__ Scientific.Functions.Derivatives.DerivVar.sign Scientific.Functions.Derivatives.DerivVar-class.html#sign Scientific.Functions.Derivatives.DerivVar.arctan2 Scientific.Functions.Derivatives.DerivVar-class.html#arctan2 Scientific.Functions.Derivatives.DerivVar.__radd__ Scientific.Functions.Derivatives.DerivVar-class.html#__radd__ Scientific.Functions.Derivatives.DerivVar.__rsub__ Scientific.Functions.Derivatives.DerivVar-class.html#__rsub__ Scientific.Functions.Derivatives.DerivVar.__rdiv__ Scientific.Functions.Derivatives.DerivVar-class.html#__rdiv__ Scientific.Functions.Derivatives.DerivVar.__rmul__ Scientific.Functions.Derivatives.DerivVar-class.html#__rmul__ Scientific.Functions.Derivatives.DerivVar.tan Scientific.Functions.Derivatives.DerivVar-class.html#tan Scientific.Functions.Derivatives.DerivVar.__abs__ Scientific.Functions.Derivatives.DerivVar-class.html#__abs__ Scientific.Functions.Derivatives.DerivVar.toOrder Scientific.Functions.Derivatives.DerivVar-class.html#toOrder Scientific.Functions.Derivatives.DerivVar.__rpow__ Scientific.Functions.Derivatives.DerivVar-class.html#__rpow__ Scientific.Functions.Derivatives.DerivVar.log Scientific.Functions.Derivatives.DerivVar-class.html#log Scientific.Functions.Derivatives.DerivVar.sqrt Scientific.Functions.Derivatives.DerivVar-class.html#sqrt Scientific.Functions.Derivatives.DerivVar.arctan Scientific.Functions.Derivatives.DerivVar-class.html#arctan Scientific.Functions.Derivatives.DerivVar.__pos__ Scientific.Functions.Derivatives.DerivVar-class.html#__pos__ Scientific.Functions.Derivatives.DerivVar.__init__ Scientific.Functions.Derivatives.DerivVar-class.html#__init__ Scientific.Functions.Derivatives.DerivVar.log10 Scientific.Functions.Derivatives.DerivVar-class.html#log10 Scientific.Functions.Derivatives.DerivVar.sin Scientific.Functions.Derivatives.DerivVar-class.html#sin Scientific.Functions.Derivatives.DerivVar.__mul__ Scientific.Functions.Derivatives.DerivVar-class.html#__mul__ Scientific.Functions.Derivatives.DerivVar.__getitem__ Scientific.Functions.Derivatives.DerivVar-class.html#__getitem__ Scientific.Functions.Derivatives.DerivVar.arcsin Scientific.Functions.Derivatives.DerivVar-class.html#arcsin Scientific.Functions.Derivatives.DerivVar.__coerce__ Scientific.Functions.Derivatives.DerivVar-class.html#__coerce__ Scientific.Functions.Derivatives.DerivVar.__pow__ Scientific.Functions.Derivatives.DerivVar-class.html#__pow__ Scientific.Functions.Derivatives.DerivVar.sinh Scientific.Functions.Derivatives.DerivVar-class.html#sinh Scientific.Functions.Derivatives.DerivVar.cosh Scientific.Functions.Derivatives.DerivVar-class.html#cosh Scientific.Functions.Derivatives.DerivVar.cos Scientific.Functions.Derivatives.DerivVar-class.html#cos Scientific.Functions.Derivatives.DerivVar.__nonzero__ Scientific.Functions.Derivatives.DerivVar-class.html#__nonzero__ Scientific.Functions.Derivatives.DerivVar.tanh Scientific.Functions.Derivatives.DerivVar-class.html#tanh Scientific.Functions.Derivatives.DerivVar.__neg__ Scientific.Functions.Derivatives.DerivVar-class.html#__neg__ Scientific.Functions.Derivatives.DerivVar.__div__ Scientific.Functions.Derivatives.DerivVar-class.html#__div__ Scientific.Functions.Derivatives.DerivVar.__repr__ Scientific.Functions.Derivatives.DerivVar-class.html#__repr__ Scientific.Functions.Derivatives.DerivVar.exp Scientific.Functions.Derivatives.DerivVar-class.html#exp Scientific.Functions.Derivatives.DerivVar.arccos Scientific.Functions.Derivatives.DerivVar-class.html#arccos Scientific.Functions.Derivatives.DerivVar.__sub__ Scientific.Functions.Derivatives.DerivVar-class.html#__sub__ Scientific.Functions.Derivatives.DerivVar._mathfunc Scientific.Functions.Derivatives.DerivVar-class.html#_mathfunc Scientific.Functions.FirstDerivatives.DerivVar Scientific.Functions.FirstDerivatives.DerivVar-class.html Scientific.Functions.FirstDerivatives.DerivVar.__add__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__add__ Scientific.Functions.FirstDerivatives.DerivVar.__cmp__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__cmp__ Scientific.Functions.FirstDerivatives.DerivVar.__str__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__str__ Scientific.Functions.FirstDerivatives.DerivVar.sign Scientific.Functions.FirstDerivatives.DerivVar-class.html#sign Scientific.Functions.FirstDerivatives.DerivVar.arctan2 Scientific.Functions.FirstDerivatives.DerivVar-class.html#arctan2 Scientific.Functions.FirstDerivatives.DerivVar.__radd__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__radd__ Scientific.Functions.FirstDerivatives.DerivVar.__rsub__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__rsub__ Scientific.Functions.FirstDerivatives.DerivVar.__rdiv__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__rdiv__ Scientific.Functions.FirstDerivatives.DerivVar.__rmul__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__rmul__ Scientific.Functions.FirstDerivatives.DerivVar.tan Scientific.Functions.FirstDerivatives.DerivVar-class.html#tan Scientific.Functions.FirstDerivatives.DerivVar.__abs__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__abs__ Scientific.Functions.FirstDerivatives.DerivVar.__init__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__init__ Scientific.Functions.FirstDerivatives.DerivVar.__rpow__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__rpow__ Scientific.Functions.FirstDerivatives.DerivVar.log Scientific.Functions.FirstDerivatives.DerivVar-class.html#log Scientific.Functions.FirstDerivatives.DerivVar.sqrt Scientific.Functions.FirstDerivatives.DerivVar-class.html#sqrt Scientific.Functions.FirstDerivatives.DerivVar.arctan Scientific.Functions.FirstDerivatives.DerivVar-class.html#arctan Scientific.Functions.FirstDerivatives.DerivVar.__pos__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__pos__ Scientific.Functions.FirstDerivatives.DerivVar.log10 Scientific.Functions.FirstDerivatives.DerivVar-class.html#log10 Scientific.Functions.FirstDerivatives.DerivVar.sin Scientific.Functions.FirstDerivatives.DerivVar-class.html#sin Scientific.Functions.FirstDerivatives.DerivVar.__neg__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__neg__ Scientific.Functions.FirstDerivatives.DerivVar.__getitem__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__getitem__ Scientific.Functions.FirstDerivatives.DerivVar.arcsin Scientific.Functions.FirstDerivatives.DerivVar-class.html#arcsin Scientific.Functions.FirstDerivatives.DerivVar.__coerce__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__coerce__ Scientific.Functions.FirstDerivatives.DerivVar.__pow__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__pow__ Scientific.Functions.FirstDerivatives.DerivVar.sinh Scientific.Functions.FirstDerivatives.DerivVar-class.html#sinh Scientific.Functions.FirstDerivatives.DerivVar.cosh Scientific.Functions.FirstDerivatives.DerivVar-class.html#cosh Scientific.Functions.FirstDerivatives.DerivVar.cos Scientific.Functions.FirstDerivatives.DerivVar-class.html#cos Scientific.Functions.FirstDerivatives.DerivVar.__nonzero__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__nonzero__ Scientific.Functions.FirstDerivatives.DerivVar.tanh Scientific.Functions.FirstDerivatives.DerivVar-class.html#tanh Scientific.Functions.FirstDerivatives.DerivVar.__div__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__div__ Scientific.Functions.FirstDerivatives.DerivVar.__mul__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__mul__ Scientific.Functions.FirstDerivatives.DerivVar.__repr__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__repr__ Scientific.Functions.FirstDerivatives.DerivVar.exp Scientific.Functions.FirstDerivatives.DerivVar-class.html#exp Scientific.Functions.FirstDerivatives.DerivVar.arccos Scientific.Functions.FirstDerivatives.DerivVar-class.html#arccos Scientific.Functions.FirstDerivatives.DerivVar.__sub__ Scientific.Functions.FirstDerivatives.DerivVar-class.html#__sub__ Scientific.Functions.FirstDerivatives.DerivVar.gamma Scientific.Functions.FirstDerivatives.DerivVar-class.html#gamma Scientific.Functions.Interpolation.InterpolatingFunction Scientific.Functions.Interpolation.InterpolatingFunction-class.html Scientific.Functions.Interpolation.InterpolatingFunction.selectInterval Scientific.Functions.Interpolation.InterpolatingFunction-class.html#selectInterval Scientific.Functions.Interpolation.InterpolatingFunction.__getslice__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getslice__ Scientific.Functions.Interpolation.InterpolatingFunction.integral Scientific.Functions.Interpolation.InterpolatingFunction-class.html#integral Scientific.Functions.Interpolation.InterpolatingFunction.cosh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#cosh Scientific.Functions.Interpolation.InterpolatingFunction._constructor Scientific.Functions.Interpolation.InterpolatingFunction-class.html Scientific.Functions.Interpolation.InterpolatingFunction.__getattr__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getattr__ Scientific.Functions.Interpolation.InterpolatingFunction.tan Scientific.Functions.Interpolation.InterpolatingFunction-class.html#tan Scientific.Functions.Interpolation.InterpolatingFunction.arctan Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arctan Scientific.Functions.Interpolation.InterpolatingFunction.__init__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__init__ Scientific.Functions.Interpolation.InterpolatingFunction.definiteIntegral Scientific.Functions.Interpolation.InterpolatingFunction-class.html#definiteIntegral Scientific.Functions.Interpolation.InterpolatingFunction.log Scientific.Functions.Interpolation.InterpolatingFunction-class.html#log Scientific.Functions.Interpolation.InterpolatingFunction.sqrt Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sqrt Scientific.Functions.Interpolation.InterpolatingFunction.__abs__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__abs__ Scientific.Functions.Interpolation.InterpolatingFunction.fitPolynomial Scientific.Functions.Interpolation.InterpolatingFunction-class.html#fitPolynomial Scientific.Functions.Interpolation.InterpolatingFunction.__call__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__call__ Scientific.Functions.Interpolation.InterpolatingFunction.derivative Scientific.Functions.Interpolation.InterpolatingFunction-class.html#derivative Scientific.Functions.Interpolation.InterpolatingFunction.sin Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sin Scientific.Functions.Interpolation.InterpolatingFunction.__len__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__len__ Scientific.Functions.Interpolation.InterpolatingFunction.__getitem__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getitem__ Scientific.Functions.Interpolation.InterpolatingFunction.arcsin Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arcsin Scientific.Functions.Interpolation.InterpolatingFunction.sinh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sinh Scientific.Functions.Interpolation.InterpolatingFunction.cos Scientific.Functions.Interpolation.InterpolatingFunction-class.html#cos Scientific.Functions.Interpolation.InterpolatingFunction.tanh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#tanh Scientific.Functions.Interpolation.InterpolatingFunction.exp Scientific.Functions.Interpolation.InterpolatingFunction-class.html#exp Scientific.Functions.Interpolation.InterpolatingFunction.arccos Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arccos Scientific.Functions.Interpolation.InterpolatingFunction._mathfunc Scientific.Functions.Interpolation.InterpolatingFunction-class.html#_mathfunc Scientific.Functions.Interpolation.NetCDFInterpolatingFunction Scientific.Functions.Interpolation.NetCDFInterpolatingFunction-class.html Scientific.Functions.Interpolation.InterpolatingFunction.selectInterval Scientific.Functions.Interpolation.InterpolatingFunction-class.html#selectInterval Scientific.Functions.Interpolation.InterpolatingFunction.__getslice__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getslice__ Scientific.Functions.Interpolation.InterpolatingFunction.integral Scientific.Functions.Interpolation.InterpolatingFunction-class.html#integral Scientific.Functions.Interpolation.InterpolatingFunction.cosh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#cosh Scientific.Functions.Interpolation.InterpolatingFunction._constructor Scientific.Functions.Interpolation.InterpolatingFunction-class.html Scientific.Functions.Interpolation.InterpolatingFunction.sqrt Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sqrt Scientific.Functions.Interpolation.InterpolatingFunction.tan Scientific.Functions.Interpolation.InterpolatingFunction-class.html#tan Scientific.Functions.Interpolation.InterpolatingFunction.arctan Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arctan Scientific.Functions.Interpolation.InterpolatingFunction.fitPolynomial Scientific.Functions.Interpolation.InterpolatingFunction-class.html#fitPolynomial Scientific.Functions.Interpolation.InterpolatingFunction.definiteIntegral Scientific.Functions.Interpolation.InterpolatingFunction-class.html#definiteIntegral Scientific.Functions.Interpolation.InterpolatingFunction.log Scientific.Functions.Interpolation.InterpolatingFunction-class.html#log Scientific.Functions.Interpolation.InterpolatingFunction.__getattr__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getattr__ Scientific.Functions.Interpolation.InterpolatingFunction.__abs__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__abs__ Scientific.Functions.Interpolation.NetCDFInterpolatingFunction.__init__ Scientific.Functions.Interpolation.NetCDFInterpolatingFunction-class.html#__init__ Scientific.Functions.Interpolation.InterpolatingFunction.__call__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__call__ Scientific.Functions.Interpolation.InterpolatingFunction.derivative Scientific.Functions.Interpolation.InterpolatingFunction-class.html#derivative Scientific.Functions.Interpolation.InterpolatingFunction.sin Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sin Scientific.Functions.Interpolation.InterpolatingFunction.__len__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__len__ Scientific.Functions.Interpolation.InterpolatingFunction.__getitem__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getitem__ Scientific.Functions.Interpolation.InterpolatingFunction.arcsin Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arcsin Scientific.Functions.Interpolation.InterpolatingFunction.sinh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sinh Scientific.Functions.Interpolation.InterpolatingFunction.cos Scientific.Functions.Interpolation.InterpolatingFunction-class.html#cos Scientific.Functions.Interpolation.InterpolatingFunction.tanh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#tanh Scientific.Functions.Interpolation.InterpolatingFunction.exp Scientific.Functions.Interpolation.InterpolatingFunction-class.html#exp Scientific.Functions.Interpolation.InterpolatingFunction.arccos Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arccos Scientific.Functions.Interpolation.InterpolatingFunction._mathfunc Scientific.Functions.Interpolation.InterpolatingFunction-class.html#_mathfunc Scientific.Functions.Polynomial.Polynomial Scientific.Functions.Polynomial.Polynomial-class.html Scientific.Functions.Polynomial.Polynomial.__coerce__ Scientific.Functions.Polynomial.Polynomial-class.html#__coerce__ Scientific.Functions.Polynomial.Polynomial.integral Scientific.Functions.Polynomial.Polynomial-class.html#integral Scientific.Functions.Polynomial.Polynomial.__div__ Scientific.Functions.Polynomial.Polynomial-class.html#__div__ Scientific.Functions.Polynomial.Polynomial.zeros Scientific.Functions.Polynomial.Polynomial-class.html#zeros Scientific.Functions.Polynomial.Polynomial.__repr__ Scientific.Functions.Polynomial.Polynomial-class.html#__repr__ Scientific.Functions.Polynomial.Polynomial.__add__ Scientific.Functions.Polynomial.Polynomial-class.html#__add__ Scientific.Functions.Polynomial.Polynomial.__rdiv__ Scientific.Functions.Polynomial.Polynomial-class.html#__rdiv__ Scientific.Functions.Polynomial.Polynomial.__call__ Scientific.Functions.Polynomial.Polynomial-class.html#__call__ Scientific.Functions.Polynomial.Polynomial.derivative Scientific.Functions.Polynomial.Polynomial-class.html#derivative Scientific.Functions.Polynomial.Polynomial.is_polynomial Scientific.Functions.Polynomial.Polynomial-class.html#is_polynomial Scientific.Functions.Polynomial.Polynomial.__init__ Scientific.Functions.Polynomial.Polynomial-class.html#__init__ Scientific.Functions.Polynomial.Polynomial.__mul__ Scientific.Functions.Polynomial.Polynomial-class.html#__mul__ Scientific.Functions.Rational.RationalFunction Scientific.Functions.Rational.RationalFunction-class.html Scientific.Functions.Rational.RationalFunction.divide Scientific.Functions.Rational.RationalFunction-class.html#divide Scientific.Functions.Rational.RationalFunction.__rsub__ Scientific.Functions.Rational.RationalFunction-class.html#__rsub__ Scientific.Functions.Rational.RationalFunction.__coerce__ Scientific.Functions.Rational.RationalFunction-class.html#__coerce__ Scientific.Functions.Rational.RationalFunction.__radd__ Scientific.Functions.Rational.RationalFunction-class.html#__radd__ Scientific.Functions.Rational.RationalFunction.is_rational_function Scientific.Functions.Rational.RationalFunction-class.html#is_rational_function Scientific.Functions.Rational.RationalFunction._normalize Scientific.Functions.Rational.RationalFunction-class.html#_normalize Scientific.Functions.Rational.RationalFunction.__div__ Scientific.Functions.Rational.RationalFunction-class.html#__div__ Scientific.Functions.Rational.RationalFunction.__mul__ Scientific.Functions.Rational.RationalFunction-class.html#__mul__ Scientific.Functions.Rational.RationalFunction.zeros Scientific.Functions.Rational.RationalFunction-class.html#zeros Scientific.Functions.Rational.RationalFunction.__repr__ Scientific.Functions.Rational.RationalFunction-class.html#__repr__ Scientific.Functions.Rational.RationalFunction.__add__ Scientific.Functions.Rational.RationalFunction-class.html#__add__ Scientific.Functions.Rational.RationalFunction.__rdiv__ Scientific.Functions.Rational.RationalFunction-class.html#__rdiv__ Scientific.Functions.Rational.RationalFunction.__rmul__ Scientific.Functions.Rational.RationalFunction-class.html#__rmul__ Scientific.Functions.Rational.RationalFunction.poles Scientific.Functions.Rational.RationalFunction-class.html#poles Scientific.Functions.Rational.RationalFunction._truncate Scientific.Functions.Rational.RationalFunction-class.html#_truncate Scientific.Functions.Rational.RationalFunction.__call__ Scientific.Functions.Rational.RationalFunction-class.html#__call__ Scientific.Functions.Rational.RationalFunction.__init__ Scientific.Functions.Rational.RationalFunction-class.html#__init__ Scientific.Functions.Rational.RationalFunction.__sub__ Scientific.Functions.Rational.RationalFunction-class.html#__sub__ Scientific.Geometry.Objects3D.BravaisLattice Scientific.Geometry.Objects3D.BravaisLattice-class.html Scientific.Geometry.Objects3D.Lattice.__setitem__ Scientific.Geometry.Objects3D.Lattice-class.html#__setitem__ Scientific.Geometry.Objects3D.Lattice.__getitem__ Scientific.Geometry.Objects3D.Lattice-class.html#__getitem__ Scientific.Geometry.Objects3D.Lattice.__len__ Scientific.Geometry.Objects3D.Lattice-class.html#__len__ Scientific.Geometry.Objects3D.BravaisLattice.__init__ Scientific.Geometry.Objects3D.BravaisLattice-class.html#__init__ Scientific.Geometry.Objects3D.RhombicLattice.makeLattice Scientific.Geometry.Objects3D.RhombicLattice-class.html#makeLattice Scientific.Geometry.Objects3D.Circle Scientific.Geometry.Objects3D.Circle-class.html Scientific.Geometry.Objects3D.Circle.volume Scientific.Geometry.Objects3D.Circle-class.html#volume Scientific.Geometry.Objects3D.GeometricalObject3D.distanceFrom Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#distanceFrom Scientific.Geometry.Objects3D.GeometricalObject3D.hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D.intersectWith Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#intersectWith Scientific.Geometry.Objects3D.Circle.__init__ Scientific.Geometry.Objects3D.Circle-class.html#__init__ Scientific.Geometry.Objects3D.Cone Scientific.Geometry.Objects3D.Cone-class.html Scientific.Geometry.Objects3D.Cone.volume Scientific.Geometry.Objects3D.Cone-class.html#volume Scientific.Geometry.Objects3D.GeometricalObject3D.distanceFrom Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#distanceFrom Scientific.Geometry.Objects3D.GeometricalObject3D.hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D.intersectWith Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#intersectWith Scientific.Geometry.Objects3D.Cone.__init__ Scientific.Geometry.Objects3D.Cone-class.html#__init__ Scientific.Geometry.Objects3D.GeometricalObject3D Scientific.Geometry.Objects3D.GeometricalObject3D-class.html Scientific.Geometry.Objects3D.GeometricalObject3D.volume Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#volume Scientific.Geometry.Objects3D.GeometricalObject3D.distanceFrom Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#distanceFrom Scientific.Geometry.Objects3D.GeometricalObject3D.hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D.intersectWith Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#intersectWith Scientific.Geometry.Objects3D.Lattice Scientific.Geometry.Objects3D.Lattice-class.html Scientific.Geometry.Objects3D.Lattice.__setitem__ Scientific.Geometry.Objects3D.Lattice-class.html#__setitem__ Scientific.Geometry.Objects3D.Lattice.__len__ Scientific.Geometry.Objects3D.Lattice-class.html#__len__ Scientific.Geometry.Objects3D.Lattice.__init__ Scientific.Geometry.Objects3D.Lattice-class.html#__init__ Scientific.Geometry.Objects3D.Lattice.__getitem__ Scientific.Geometry.Objects3D.Lattice-class.html#__getitem__ Scientific.Geometry.Objects3D.Line Scientific.Geometry.Objects3D.Line-class.html Scientific.Geometry.Objects3D.Line.distanceFrom Scientific.Geometry.Objects3D.Line-class.html#distanceFrom Scientific.Geometry.Objects3D.Line.projectionOf Scientific.Geometry.Objects3D.Line-class.html#projectionOf Scientific.Geometry.Objects3D.Line.volume Scientific.Geometry.Objects3D.Line-class.html#volume Scientific.Geometry.Objects3D.GeometricalObject3D.hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D.intersectWith Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#intersectWith Scientific.Geometry.Objects3D.Line.__init__ Scientific.Geometry.Objects3D.Line-class.html#__init__ Scientific.Geometry.Objects3D.Plane Scientific.Geometry.Objects3D.Plane-class.html Scientific.Geometry.Objects3D.Plane.distanceFrom Scientific.Geometry.Objects3D.Plane-class.html#distanceFrom Scientific.Geometry.Objects3D.Plane.rotate Scientific.Geometry.Objects3D.Plane-class.html#rotate Scientific.Geometry.Objects3D.Plane.projectionOf Scientific.Geometry.Objects3D.Plane-class.html#projectionOf Scientific.Geometry.Objects3D.Plane.volume Scientific.Geometry.Objects3D.Plane-class.html#volume Scientific.Geometry.Objects3D.GeometricalObject3D.hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D.intersectWith Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#intersectWith Scientific.Geometry.Objects3D.Plane.__init__ Scientific.Geometry.Objects3D.Plane-class.html#__init__ Scientific.Geometry.Objects3D.RhombicLattice Scientific.Geometry.Objects3D.RhombicLattice-class.html Scientific.Geometry.Objects3D.Lattice.__setitem__ Scientific.Geometry.Objects3D.Lattice-class.html#__setitem__ Scientific.Geometry.Objects3D.Lattice.__getitem__ Scientific.Geometry.Objects3D.Lattice-class.html#__getitem__ Scientific.Geometry.Objects3D.Lattice.__len__ Scientific.Geometry.Objects3D.Lattice-class.html#__len__ Scientific.Geometry.Objects3D.RhombicLattice.__init__ Scientific.Geometry.Objects3D.RhombicLattice-class.html#__init__ Scientific.Geometry.Objects3D.RhombicLattice.makeLattice Scientific.Geometry.Objects3D.RhombicLattice-class.html#makeLattice Scientific.Geometry.Objects3D.SCLattice Scientific.Geometry.Objects3D.SCLattice-class.html Scientific.Geometry.Objects3D.Lattice.__setitem__ Scientific.Geometry.Objects3D.Lattice-class.html#__setitem__ Scientific.Geometry.Objects3D.Lattice.__getitem__ Scientific.Geometry.Objects3D.Lattice-class.html#__getitem__ Scientific.Geometry.Objects3D.Lattice.__len__ Scientific.Geometry.Objects3D.Lattice-class.html#__len__ Scientific.Geometry.Objects3D.SCLattice.__init__ Scientific.Geometry.Objects3D.SCLattice-class.html#__init__ Scientific.Geometry.Objects3D.RhombicLattice.makeLattice Scientific.Geometry.Objects3D.RhombicLattice-class.html#makeLattice Scientific.Geometry.Objects3D.Sphere Scientific.Geometry.Objects3D.Sphere-class.html Scientific.Geometry.Objects3D.Sphere.volume Scientific.Geometry.Objects3D.Sphere-class.html#volume Scientific.Geometry.Objects3D.Sphere.distanceFrom Scientific.Geometry.Objects3D.Sphere-class.html#distanceFrom Scientific.Geometry.Objects3D.GeometricalObject3D.hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#hasPoint Scientific.Geometry.Objects3D.GeometricalObject3D.intersectWith Scientific.Geometry.Objects3D.GeometricalObject3D-class.html#intersectWith Scientific.Geometry.Objects3D.Sphere.__init__ Scientific.Geometry.Objects3D.Sphere-class.html#__init__ Scientific.Geometry.Quaternion.Quaternion Scientific.Geometry.Quaternion.Quaternion-class.html Scientific.Geometry.Quaternion.Quaternion.__repr__ Scientific.Geometry.Quaternion.Quaternion-class.html#__repr__ Scientific.Geometry.Quaternion.Quaternion.inverse Scientific.Geometry.Quaternion.Quaternion-class.html#inverse Scientific.Geometry.Quaternion.Quaternion.__add__ Scientific.Geometry.Quaternion.Quaternion-class.html#__add__ Scientific.Geometry.Quaternion.Quaternion.__getitem__ Scientific.Geometry.Quaternion.Quaternion-class.html#__getitem__ Scientific.Geometry.Quaternion.Quaternion.asRotation Scientific.Geometry.Quaternion.Quaternion-class.html#asRotation Scientific.Geometry.Quaternion.Quaternion._matrix Scientific.Geometry.Quaternion.Quaternion-class.html#_matrix Scientific.Geometry.Quaternion.Quaternion.is_quaternion Scientific.Geometry.Quaternion.Quaternion-class.html#is_quaternion Scientific.Geometry.Quaternion.Quaternion.__init__ Scientific.Geometry.Quaternion.Quaternion-class.html#__init__ Scientific.Geometry.Quaternion.Quaternion.__div__ Scientific.Geometry.Quaternion.Quaternion-class.html#__div__ Scientific.Geometry.Quaternion.Quaternion.__mul__ Scientific.Geometry.Quaternion.Quaternion-class.html#__mul__ Scientific.Geometry.Quaternion.Quaternion.norm Scientific.Geometry.Quaternion.Quaternion-class.html#norm Scientific.Geometry.Quaternion.Quaternion._rot Scientific.Geometry.Quaternion.Quaternion-class.html#_rot Scientific.Geometry.Quaternion.Quaternion.__rdiv__ Scientific.Geometry.Quaternion.Quaternion-class.html#__rdiv__ Scientific.Geometry.Quaternion.Quaternion.__rmul__ Scientific.Geometry.Quaternion.Quaternion-class.html#__rmul__ Scientific.Geometry.Quaternion.Quaternion.__sub__ Scientific.Geometry.Quaternion.Quaternion-class.html#__sub__ Scientific.Geometry.Quaternion.Quaternion.asMatrix Scientific.Geometry.Quaternion.Quaternion-class.html#asMatrix Scientific.Geometry.Quaternion.Quaternion.dot Scientific.Geometry.Quaternion.Quaternion-class.html#dot Scientific.Geometry.Quaternion.Quaternion.normalized Scientific.Geometry.Quaternion.Quaternion-class.html#normalized Scientific.Geometry.Tensor Scientific.Geometry.Tensor-class.html Scientific.Geometry.Tensor.asymmetricalPart Scientific.Geometry.Tensor-class.html#asymmetricalPart Scientific.Geometry.Tensor.__str__ Scientific.Geometry.Tensor-class.html#__str__ Scientific.Geometry.Tensor.__radd__ Scientific.Geometry.Tensor-class.html#__radd__ Scientific.Geometry.Tensor.__rsub__ Scientific.Geometry.Tensor-class.html#__rsub__ Scientific.Geometry.Tensor.__rdiv__ Scientific.Geometry.Tensor-class.html#__rdiv__ Scientific.Geometry.Tensor.__rmul__ Scientific.Geometry.Tensor-class.html#__rmul__ Scientific.Geometry.Tensor.__init__ Scientific.Geometry.Tensor-class.html#__init__ Scientific.Geometry.Tensor.inverse Scientific.Geometry.Tensor-class.html#inverse Scientific.Geometry.Tensor.trace Scientific.Geometry.Tensor-class.html#trace Scientific.Geometry.Tensor.__cmp__ Scientific.Geometry.Tensor-class.html#__cmp__ Scientific.Geometry.Tensor.diagonalization Scientific.Geometry.Tensor-class.html#diagonalization Scientific.Geometry.Tensor.__len__ Scientific.Geometry.Tensor-class.html#__len__ Scientific.Geometry.Tensor.__mul__ Scientific.Geometry.Tensor-class.html#__mul__ Scientific.Geometry.Tensor.__getitem__ Scientific.Geometry.Tensor-class.html#__getitem__ Scientific.Geometry.Tensor.transpose Scientific.Geometry.Tensor-class.html#transpose Scientific.Geometry.Tensor.asVector Scientific.Geometry.Tensor-class.html#asVector Scientific.Geometry.Tensor.diagonal Scientific.Geometry.Tensor-class.html#diagonal Scientific.Geometry.Tensor.is_tensor Scientific.Geometry.Tensor-class.html#is_tensor Scientific.Geometry.Tensor.__add__ Scientific.Geometry.Tensor-class.html#__add__ Scientific.Geometry.Tensor.__sub__ Scientific.Geometry.Tensor-class.html#__sub__ Scientific.Geometry.Tensor.__neg__ Scientific.Geometry.Tensor-class.html#__neg__ Scientific.Geometry.Tensor.__div__ Scientific.Geometry.Tensor-class.html#__div__ Scientific.Geometry.Tensor.__repr__ Scientific.Geometry.Tensor-class.html#__repr__ Scientific.Geometry.Tensor.eigenvalues Scientific.Geometry.Tensor-class.html#eigenvalues Scientific.Geometry.Tensor.symmetricalPart Scientific.Geometry.Tensor-class.html#symmetricalPart Scientific.Geometry.Tensor.dot Scientific.Geometry.Tensor-class.html#dot Scientific.Geometry.TensorAnalysis.ScalarField Scientific.Geometry.TensorAnalysis.ScalarField-class.html Scientific.Functions.Interpolation.InterpolatingFunction.selectInterval Scientific.Functions.Interpolation.InterpolatingFunction-class.html#selectInterval Scientific.Functions.Interpolation.InterpolatingFunction.__getslice__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getslice__ Scientific.Functions.Interpolation.InterpolatingFunction.integral Scientific.Functions.Interpolation.InterpolatingFunction-class.html#integral Scientific.Functions.Interpolation.InterpolatingFunction.cosh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#cosh Scientific.Geometry.TensorAnalysis.ScalarField._constructor Scientific.Geometry.TensorAnalysis.ScalarField-class.html Scientific.Geometry.TensorAnalysis.TensorField.zero Scientific.Geometry.TensorAnalysis.TensorField-class.html#zero Scientific.Functions.Interpolation.InterpolatingFunction.__getattr__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getattr__ Scientific.Geometry.TensorAnalysis.TensorField.allDerivatives Scientific.Geometry.TensorAnalysis.TensorField-class.html#allDerivatives Scientific.Functions.Interpolation.InterpolatingFunction.tan Scientific.Functions.Interpolation.InterpolatingFunction-class.html#tan Scientific.Functions.Interpolation.InterpolatingFunction.__abs__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__abs__ Scientific.Geometry.TensorAnalysis.ScalarField.__init__ Scientific.Geometry.TensorAnalysis.ScalarField-class.html#__init__ Scientific.Functions.Interpolation.InterpolatingFunction.definiteIntegral Scientific.Functions.Interpolation.InterpolatingFunction-class.html#definiteIntegral Scientific.Functions.Interpolation.InterpolatingFunction.log Scientific.Functions.Interpolation.InterpolatingFunction-class.html#log Scientific.Geometry.TensorAnalysis.ScalarField.gradient Scientific.Geometry.TensorAnalysis.ScalarField-class.html#gradient Scientific.Geometry.TensorAnalysis.ScalarField.laplacian Scientific.Geometry.TensorAnalysis.ScalarField-class.html#laplacian Scientific.Functions.Interpolation.InterpolatingFunction.arctan Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arctan Scientific.Functions.Interpolation.InterpolatingFunction.fitPolynomial Scientific.Functions.Interpolation.InterpolatingFunction-class.html#fitPolynomial Scientific.Geometry.TensorAnalysis.TensorField.__call__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__call__ Scientific.Geometry.TensorAnalysis.TensorField.derivative Scientific.Geometry.TensorAnalysis.TensorField-class.html#derivative Scientific.Functions.Interpolation.InterpolatingFunction.sin Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sin Scientific.Functions.Interpolation.InterpolatingFunction.__len__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__len__ Scientific.Geometry.TensorAnalysis.TensorField._reduceAxis Scientific.Geometry.TensorAnalysis.TensorField-class.html#_reduceAxis Scientific.Geometry.TensorAnalysis.TensorField.__getitem__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__getitem__ Scientific.Functions.Interpolation.InterpolatingFunction.arcsin Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arcsin Scientific.Geometry.TensorAnalysis.TensorField._checkCompatibility Scientific.Geometry.TensorAnalysis.TensorField-class.html#_checkCompatibility Scientific.Geometry.TensorAnalysis.TensorField.__add__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__add__ Scientific.Functions.Interpolation.InterpolatingFunction.sqrt Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sqrt Scientific.Functions.Interpolation.InterpolatingFunction.sinh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sinh Scientific.Functions.Interpolation.InterpolatingFunction.cos Scientific.Functions.Interpolation.InterpolatingFunction-class.html#cos Scientific.Functions.Interpolation.InterpolatingFunction.tanh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#tanh Scientific.Functions.Interpolation.InterpolatingFunction.exp Scientific.Functions.Interpolation.InterpolatingFunction-class.html#exp Scientific.Functions.Interpolation.InterpolatingFunction.arccos Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arccos Scientific.Geometry.TensorAnalysis.TensorField.__sub__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__sub__ Scientific.Functions.Interpolation.InterpolatingFunction._mathfunc Scientific.Functions.Interpolation.InterpolatingFunction-class.html#_mathfunc Scientific.Geometry.TensorAnalysis.TensorField Scientific.Geometry.TensorAnalysis.TensorField-class.html Scientific.Functions.Interpolation.InterpolatingFunction.selectInterval Scientific.Functions.Interpolation.InterpolatingFunction-class.html#selectInterval Scientific.Functions.Interpolation.InterpolatingFunction.__getslice__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getslice__ Scientific.Functions.Interpolation.InterpolatingFunction.integral Scientific.Functions.Interpolation.InterpolatingFunction-class.html#integral Scientific.Functions.Interpolation.InterpolatingFunction.cosh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#cosh Scientific.Functions.Interpolation.InterpolatingFunction._constructor Scientific.Functions.Interpolation.InterpolatingFunction-class.html Scientific.Geometry.TensorAnalysis.TensorField.zero Scientific.Geometry.TensorAnalysis.TensorField-class.html#zero Scientific.Functions.Interpolation.InterpolatingFunction.__getattr__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getattr__ Scientific.Geometry.TensorAnalysis.TensorField.allDerivatives Scientific.Geometry.TensorAnalysis.TensorField-class.html#allDerivatives Scientific.Functions.Interpolation.InterpolatingFunction.tan Scientific.Functions.Interpolation.InterpolatingFunction-class.html#tan Scientific.Functions.Interpolation.InterpolatingFunction.arctan Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arctan Scientific.Geometry.TensorAnalysis.TensorField.__init__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__init__ Scientific.Functions.Interpolation.InterpolatingFunction.definiteIntegral Scientific.Functions.Interpolation.InterpolatingFunction-class.html#definiteIntegral Scientific.Functions.Interpolation.InterpolatingFunction.log Scientific.Functions.Interpolation.InterpolatingFunction-class.html#log Scientific.Functions.Interpolation.InterpolatingFunction.sqrt Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sqrt Scientific.Functions.Interpolation.InterpolatingFunction.__abs__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__abs__ Scientific.Functions.Interpolation.InterpolatingFunction.fitPolynomial Scientific.Functions.Interpolation.InterpolatingFunction-class.html#fitPolynomial Scientific.Geometry.TensorAnalysis.TensorField.__call__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__call__ Scientific.Geometry.TensorAnalysis.TensorField.derivative Scientific.Geometry.TensorAnalysis.TensorField-class.html#derivative Scientific.Functions.Interpolation.InterpolatingFunction.sin Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sin Scientific.Functions.Interpolation.InterpolatingFunction.__len__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__len__ Scientific.Geometry.TensorAnalysis.TensorField._reduceAxis Scientific.Geometry.TensorAnalysis.TensorField-class.html#_reduceAxis Scientific.Geometry.TensorAnalysis.TensorField.__getitem__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__getitem__ Scientific.Functions.Interpolation.InterpolatingFunction.arcsin Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arcsin Scientific.Geometry.TensorAnalysis.TensorField._checkCompatibility Scientific.Geometry.TensorAnalysis.TensorField-class.html#_checkCompatibility Scientific.Geometry.TensorAnalysis.TensorField.__add__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__add__ Scientific.Functions.Interpolation.InterpolatingFunction.sinh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sinh Scientific.Functions.Interpolation.InterpolatingFunction.cos Scientific.Functions.Interpolation.InterpolatingFunction-class.html#cos Scientific.Functions.Interpolation.InterpolatingFunction.tanh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#tanh Scientific.Functions.Interpolation.InterpolatingFunction.exp Scientific.Functions.Interpolation.InterpolatingFunction-class.html#exp Scientific.Functions.Interpolation.InterpolatingFunction.arccos Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arccos Scientific.Geometry.TensorAnalysis.TensorField.__sub__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__sub__ Scientific.Functions.Interpolation.InterpolatingFunction._mathfunc Scientific.Functions.Interpolation.InterpolatingFunction-class.html#_mathfunc Scientific.Geometry.TensorAnalysis.VectorField Scientific.Geometry.TensorAnalysis.VectorField-class.html Scientific.Functions.Interpolation.InterpolatingFunction.selectInterval Scientific.Functions.Interpolation.InterpolatingFunction-class.html#selectInterval Scientific.Functions.Interpolation.InterpolatingFunction.__getslice__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getslice__ Scientific.Functions.Interpolation.InterpolatingFunction.integral Scientific.Functions.Interpolation.InterpolatingFunction-class.html#integral Scientific.Functions.Interpolation.InterpolatingFunction.cosh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#cosh Scientific.Geometry.TensorAnalysis.VectorField.strain Scientific.Geometry.TensorAnalysis.VectorField-class.html#strain Scientific.Geometry.TensorAnalysis.VectorField.zero Scientific.Geometry.TensorAnalysis.VectorField-class.html#zero Scientific.Geometry.TensorAnalysis.VectorField.laplacian Scientific.Geometry.TensorAnalysis.VectorField-class.html#laplacian Scientific.Geometry.TensorAnalysis.TensorField.allDerivatives Scientific.Geometry.TensorAnalysis.TensorField-class.html#allDerivatives Scientific.Geometry.TensorAnalysis.VectorField.curl Scientific.Geometry.TensorAnalysis.VectorField-class.html#curl Scientific.Functions.Interpolation.InterpolatingFunction.arctan Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arctan Scientific.Functions.Interpolation.InterpolatingFunction.tan Scientific.Functions.Interpolation.InterpolatingFunction-class.html#tan Scientific.Geometry.TensorAnalysis.VectorField.__init__ Scientific.Geometry.TensorAnalysis.VectorField-class.html#__init__ Scientific.Functions.Interpolation.InterpolatingFunction.definiteIntegral Scientific.Functions.Interpolation.InterpolatingFunction-class.html#definiteIntegral Scientific.Functions.Interpolation.InterpolatingFunction.log Scientific.Functions.Interpolation.InterpolatingFunction-class.html#log Scientific.Geometry.TensorAnalysis.VectorField._divergence Scientific.Geometry.TensorAnalysis.VectorField-class.html#_divergence Scientific.Geometry.TensorAnalysis.VectorField._strain Scientific.Geometry.TensorAnalysis.VectorField-class.html#_strain Scientific.Functions.Interpolation.InterpolatingFunction.__abs__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__abs__ Scientific.Geometry.TensorAnalysis.VectorField._curl Scientific.Geometry.TensorAnalysis.VectorField-class.html#_curl Scientific.Functions.Interpolation.InterpolatingFunction.fitPolynomial Scientific.Functions.Interpolation.InterpolatingFunction-class.html#fitPolynomial Scientific.Geometry.TensorAnalysis.TensorField.__call__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__call__ Scientific.Geometry.TensorAnalysis.TensorField.derivative Scientific.Geometry.TensorAnalysis.TensorField-class.html#derivative Scientific.Functions.Interpolation.InterpolatingFunction.sin Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sin Scientific.Functions.Interpolation.InterpolatingFunction.__len__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__len__ Scientific.Geometry.TensorAnalysis.TensorField._reduceAxis Scientific.Geometry.TensorAnalysis.TensorField-class.html#_reduceAxis Scientific.Geometry.TensorAnalysis.TensorField.__getitem__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__getitem__ Scientific.Geometry.TensorAnalysis.VectorField.divergenceCurlAndStrain Scientific.Geometry.TensorAnalysis.VectorField-class.html#divergenceCurlAndStrain Scientific.Functions.Interpolation.InterpolatingFunction.arcsin Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arcsin Scientific.Geometry.TensorAnalysis.VectorField.divergence Scientific.Geometry.TensorAnalysis.VectorField-class.html#divergence Scientific.Geometry.TensorAnalysis.TensorField._checkCompatibility Scientific.Geometry.TensorAnalysis.TensorField-class.html#_checkCompatibility Scientific.Geometry.TensorAnalysis.TensorField.__add__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__add__ Scientific.Functions.Interpolation.InterpolatingFunction.sqrt Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sqrt Scientific.Functions.Interpolation.InterpolatingFunction.__getattr__ Scientific.Functions.Interpolation.InterpolatingFunction-class.html#__getattr__ Scientific.Functions.Interpolation.InterpolatingFunction.sinh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#sinh Scientific.Functions.Interpolation.InterpolatingFunction.cos Scientific.Functions.Interpolation.InterpolatingFunction-class.html#cos Scientific.Geometry.TensorAnalysis.VectorField._constructor Scientific.Geometry.TensorAnalysis.VectorField-class.html Scientific.Functions.Interpolation.InterpolatingFunction.tanh Scientific.Functions.Interpolation.InterpolatingFunction-class.html#tanh Scientific.Geometry.TensorAnalysis.VectorField.length Scientific.Geometry.TensorAnalysis.VectorField-class.html#length Scientific.Functions.Interpolation.InterpolatingFunction.exp Scientific.Functions.Interpolation.InterpolatingFunction-class.html#exp Scientific.Functions.Interpolation.InterpolatingFunction.arccos Scientific.Functions.Interpolation.InterpolatingFunction-class.html#arccos Scientific.Geometry.TensorAnalysis.TensorField.__sub__ Scientific.Geometry.TensorAnalysis.TensorField-class.html#__sub__ Scientific.Functions.Interpolation.InterpolatingFunction._mathfunc Scientific.Functions.Interpolation.InterpolatingFunction-class.html#_mathfunc Scientific.Geometry.Transformation.Inversion Scientific.Geometry.Transformation.Inversion-class.html Scientific.Geometry.Transformation.Scaling.inverse Scientific.Geometry.Transformation.Scaling-class.html#inverse Scientific.Geometry.Transformation.Scaling.__mul__ Scientific.Geometry.Transformation.Scaling-class.html#__mul__ Scientific.Geometry.Transformation.Scaling.__call__ Scientific.Geometry.Transformation.Scaling-class.html#__call__ Scientific.Geometry.Transformation.Scaling.asLinearTransformation Scientific.Geometry.Transformation.Scaling-class.html#asLinearTransformation Scientific.Geometry.Transformation.Scaling.is_scaling Scientific.Geometry.Transformation.Scaling-class.html#is_scaling Scientific.Geometry.Transformation.Inversion.__init__ Scientific.Geometry.Transformation.Inversion-class.html#__init__ Scientific.Geometry.Transformation.LinearTransformation Scientific.Geometry.Transformation.LinearTransformation-class.html Scientific.Geometry.Transformation.LinearTransformation.__call__ Scientific.Geometry.Transformation.LinearTransformation-class.html#__call__ Scientific.Geometry.Transformation.LinearTransformation.asLinearTransformation Scientific.Geometry.Transformation.LinearTransformation-class.html#asLinearTransformation Scientific.Geometry.Transformation.LinearTransformation.inverse Scientific.Geometry.Transformation.LinearTransformation-class.html#inverse Scientific.Geometry.Transformation.LinearTransformation.__mul__ Scientific.Geometry.Transformation.LinearTransformation-class.html#__mul__ Scientific.Geometry.Transformation.LinearTransformation.__init__ Scientific.Geometry.Transformation.LinearTransformation-class.html#__init__ Scientific.Geometry.Transformation.RigidBodyTransformation Scientific.Geometry.Transformation.RigidBodyTransformation-class.html Scientific.Geometry.Transformation.Transformation.__call__ Scientific.Geometry.Transformation.Transformation-class.html#__call__ Scientific.Geometry.Transformation.RigidBodyTransformation.screwMotion Scientific.Geometry.Transformation.RigidBodyTransformation-class.html#screwMotion Scientific.Geometry.Transformation.RigidBodyTransformation.translation Scientific.Geometry.Transformation.RigidBodyTransformation-class.html#translation Scientific.Geometry.Transformation.Transformation.inverse Scientific.Geometry.Transformation.Transformation-class.html#inverse Scientific.Geometry.Transformation.RigidBodyTransformation.rotation Scientific.Geometry.Transformation.RigidBodyTransformation-class.html#rotation Scientific.Geometry.Transformation.Rotation Scientific.Geometry.Transformation.Rotation-class.html Scientific.Geometry.Transformation.Rotation.inverse Scientific.Geometry.Transformation.Rotation-class.html#inverse Scientific.Geometry.Transformation.Rotation.asQuaternion Scientific.Geometry.Transformation.Rotation-class.html#asQuaternion Scientific.Geometry.Transformation.Rotation.screwMotion Scientific.Geometry.Transformation.Rotation-class.html#screwMotion Scientific.Geometry.Transformation.Rotation.axisAndAngle Scientific.Geometry.Transformation.Rotation-class.html#axisAndAngle Scientific.Geometry.Transformation.Rotation.threeAngles Scientific.Geometry.Transformation.Rotation-class.html#threeAngles Scientific.Geometry.Transformation.Rotation.is_rotation Scientific.Geometry.Transformation.Rotation-class.html#is_rotation Scientific.Geometry.Transformation.Rotation.__call__ Scientific.Geometry.Transformation.Rotation-class.html#__call__ Scientific.Geometry.Transformation.Rotation.translation Scientific.Geometry.Transformation.Rotation-class.html#translation Scientific.Geometry.Transformation.Rotation.rotation Scientific.Geometry.Transformation.Rotation-class.html#rotation Scientific.Geometry.Transformation.Rotation.asLinearTransformation Scientific.Geometry.Transformation.Rotation-class.html#asLinearTransformation Scientific.Geometry.Transformation.Rotation.__init__ Scientific.Geometry.Transformation.Rotation-class.html#__init__ Scientific.Geometry.Transformation.Rotation.__mul__ Scientific.Geometry.Transformation.Rotation-class.html#__mul__ Scientific.Geometry.Transformation.RotationTranslation Scientific.Geometry.Transformation.RotationTranslation-class.html Scientific.Geometry.Transformation.RotationTranslation.inverse Scientific.Geometry.Transformation.RotationTranslation-class.html#inverse Scientific.Geometry.Transformation.RotationTranslation.is_rotation_translation Scientific.Geometry.Transformation.RotationTranslation-class.html#is_rotation_translation Scientific.Geometry.Transformation.RotationTranslation.screwMotion Scientific.Geometry.Transformation.RotationTranslation-class.html#screwMotion Scientific.Geometry.Transformation.RotationTranslation.asLinearTransformation Scientific.Geometry.Transformation.RotationTranslation-class.html#asLinearTransformation Scientific.Geometry.Transformation.RotationTranslation.__mul__ Scientific.Geometry.Transformation.RotationTranslation-class.html#__mul__ Scientific.Geometry.Transformation.RotationTranslation.__call__ Scientific.Geometry.Transformation.RotationTranslation-class.html#__call__ Scientific.Geometry.Transformation.RotationTranslation.rotation Scientific.Geometry.Transformation.RotationTranslation-class.html#rotation Scientific.Geometry.Transformation.RotationTranslation.translation Scientific.Geometry.Transformation.RotationTranslation-class.html#translation Scientific.Geometry.Transformation.RotationTranslation.__init__ Scientific.Geometry.Transformation.RotationTranslation-class.html#__init__ Scientific.Geometry.Transformation.Scaling Scientific.Geometry.Transformation.Scaling-class.html Scientific.Geometry.Transformation.Scaling.inverse Scientific.Geometry.Transformation.Scaling-class.html#inverse Scientific.Geometry.Transformation.Scaling.__mul__ Scientific.Geometry.Transformation.Scaling-class.html#__mul__ Scientific.Geometry.Transformation.Scaling.__call__ Scientific.Geometry.Transformation.Scaling-class.html#__call__ Scientific.Geometry.Transformation.Scaling.asLinearTransformation Scientific.Geometry.Transformation.Scaling-class.html#asLinearTransformation Scientific.Geometry.Transformation.Scaling.is_scaling Scientific.Geometry.Transformation.Scaling-class.html#is_scaling Scientific.Geometry.Transformation.Scaling.__init__ Scientific.Geometry.Transformation.Scaling-class.html#__init__ Scientific.Geometry.Transformation.Shear Scientific.Geometry.Transformation.Shear-class.html Scientific.Geometry.Transformation.Shear.__call__ Scientific.Geometry.Transformation.Shear-class.html#__call__ Scientific.Geometry.Transformation.Shear.asLinearTransformation Scientific.Geometry.Transformation.Shear-class.html#asLinearTransformation Scientific.Geometry.Transformation.Shear.inverse Scientific.Geometry.Transformation.Shear-class.html#inverse Scientific.Geometry.Transformation.Shear.__mul__ Scientific.Geometry.Transformation.Shear-class.html#__mul__ Scientific.Geometry.Transformation.Shear.__init__ Scientific.Geometry.Transformation.Shear-class.html#__init__ Scientific.Geometry.Transformation.Transformation Scientific.Geometry.Transformation.Transformation-class.html Scientific.Geometry.Transformation.Transformation.__call__ Scientific.Geometry.Transformation.Transformation-class.html#__call__ Scientific.Geometry.Transformation.Transformation.inverse Scientific.Geometry.Transformation.Transformation-class.html#inverse Scientific.Geometry.Transformation.Translation Scientific.Geometry.Transformation.Translation-class.html Scientific.Geometry.Transformation.Translation.inverse Scientific.Geometry.Transformation.Translation-class.html#inverse Scientific.Geometry.Transformation.Translation.asLinearTransformation Scientific.Geometry.Transformation.Translation-class.html#asLinearTransformation Scientific.Geometry.Transformation.Translation.screwMotion Scientific.Geometry.Transformation.Translation-class.html#screwMotion Scientific.Geometry.Transformation.Translation.is_translation Scientific.Geometry.Transformation.Translation-class.html#is_translation Scientific.Geometry.Transformation.Translation.displacement Scientific.Geometry.Transformation.Translation-class.html#displacement Scientific.Geometry.Transformation.Translation.__mul__ Scientific.Geometry.Transformation.Translation-class.html#__mul__ Scientific.Geometry.Transformation.Translation.__call__ Scientific.Geometry.Transformation.Translation-class.html#__call__ Scientific.Geometry.Transformation.Translation.rotation Scientific.Geometry.Transformation.Translation-class.html#rotation Scientific.Geometry.Transformation.Translation.translation Scientific.Geometry.Transformation.Translation-class.html#translation Scientific.Geometry.Transformation.Translation.__init__ Scientific.Geometry.Transformation.Translation-class.html#__init__ Scientific.Geometry.Vector Scientific.Geometry.Vector-class.html Scientific.Geometry.Vector.__str__ Scientific.Geometry.Vector-class.html#__str__ Scientific.Geometry.Vector.__radd__ Scientific.Geometry.Vector-class.html#__radd__ Scientific.Geometry.Vector.__rsub__ Scientific.Geometry.Vector-class.html#__rsub__ Scientific.Geometry.Vector.__rdiv__ Scientific.Geometry.Vector-class.html#__rdiv__ Scientific.Geometry.Vector.__rmul__ Scientific.Geometry.Vector-class.html#__rmul__ Scientific.Geometry.Vector.__init__ Scientific.Geometry.Vector-class.html#__init__ Scientific.Geometry.Vector.angle Scientific.Geometry.Vector-class.html#angle Scientific.Geometry.Vector.__setstate__ Scientific.Geometry.Vector-class.html#__setstate__ Scientific.Geometry.Vector.cross Scientific.Geometry.Vector-class.html#cross Scientific.Geometry.Vector.__cmp__ Scientific.Geometry.Vector-class.html#__cmp__ Scientific.Geometry.Vector.__copy__ Scientific.Geometry.Vector-class.html#__copy__ Scientific.Geometry.Vector.__getstate__ Scientific.Geometry.Vector-class.html#__getstate__ Scientific.Geometry.Vector.__len__ Scientific.Geometry.Vector-class.html#__len__ Scientific.Geometry.Vector.__mul__ Scientific.Geometry.Vector-class.html#__mul__ Scientific.Geometry.Vector.__getitem__ Scientific.Geometry.Vector-class.html#__getitem__ Scientific.Geometry.Vector.normal Scientific.Geometry.Vector-class.html#normal Scientific.Geometry.Vector.__deepcopy__ Scientific.Geometry.Vector-class.html#__deepcopy__ Scientific.Geometry.Vector.__div__ Scientific.Geometry.Vector-class.html#__div__ Scientific.Geometry.Vector.__add__ Scientific.Geometry.Vector-class.html#__add__ Scientific.Geometry.Vector.__sub__ Scientific.Geometry.Vector-class.html#__sub__ Scientific.Geometry.Vector.dyadicProduct Scientific.Geometry.Vector-class.html#dyadicProduct Scientific.Geometry.Vector.is_vector Scientific.Geometry.Vector-class.html#is_vector Scientific.Geometry.Vector.asTensor Scientific.Geometry.Vector-class.html#asTensor Scientific.Geometry.Vector.__neg__ Scientific.Geometry.Vector-class.html#__neg__ Scientific.Geometry.Vector.length Scientific.Geometry.Vector-class.html#length Scientific.Geometry.Vector.__repr__ Scientific.Geometry.Vector-class.html#__repr__ Scientific.Geometry.Vector.y Scientific.Geometry.Vector-class.html#y Scientific.Geometry.Vector.x Scientific.Geometry.Vector-class.html#x Scientific.Geometry.Vector.z Scientific.Geometry.Vector-class.html#z Scientific.IO.FortranFormat.FortranFormat Scientific.IO.FortranFormat.FortranFormat-class.html Scientific.IO.FortranFormat.FortranFormat.__init__ Scientific.IO.FortranFormat.FortranFormat-class.html#__init__ Scientific.IO.FortranFormat.FortranFormat.__getitem__ Scientific.IO.FortranFormat.FortranFormat-class.html#__getitem__ Scientific.IO.FortranFormat.FortranFormat.__len__ Scientific.IO.FortranFormat.FortranFormat-class.html#__len__ Scientific.IO.FortranFormat.FortranLine Scientific.IO.FortranFormat.FortranLine-class.html Scientific.IO.FortranFormat.FortranLine.__getitem__ Scientific.IO.FortranFormat.FortranLine-class.html#__getitem__ Scientific.IO.FortranFormat.FortranLine.__getslice__ Scientific.IO.FortranFormat.FortranLine-class.html#__getslice__ Scientific.IO.FortranFormat.FortranLine._input Scientific.IO.FortranFormat.FortranLine-class.html#_input Scientific.IO.FortranFormat.FortranLine.__str__ Scientific.IO.FortranFormat.FortranLine-class.html#__str__ Scientific.IO.FortranFormat.FortranLine._output Scientific.IO.FortranFormat.FortranLine-class.html#_output Scientific.IO.FortranFormat.FortranLine.__len__ Scientific.IO.FortranFormat.FortranLine-class.html#__len__ Scientific.IO.FortranFormat.FortranLine.isBlank Scientific.IO.FortranFormat.FortranLine-class.html#isBlank Scientific.IO.FortranFormat.FortranLine.__init__ Scientific.IO.FortranFormat.FortranLine-class.html#__init__ Scientific.IO.NetCDF.NetCDFFile Scientific.IO.NetCDF.NetCDFFile-class.html Scientific.IO.NetCDF.NetCDFFile.createDimension Scientific.IO.NetCDF.NetCDFFile-class.html#createDimension Scientific.IO.NetCDF.NetCDFFile.createVariable Scientific.IO.NetCDF.NetCDFFile-class.html#createVariable Scientific.IO.NetCDF.NetCDFFile.sync Scientific.IO.NetCDF.NetCDFFile-class.html#sync Scientific.IO.NetCDF.NetCDFFile.flush Scientific.IO.NetCDF.NetCDFFile-class.html#flush Scientific.IO.NetCDF.NetCDFFile.close Scientific.IO.NetCDF.NetCDFFile-class.html#close Scientific.IO.NetCDF.NetCDFFile.__init__ Scientific.IO.NetCDF.NetCDFFile-class.html#__init__ Scientific.IO.NetCDF.NetCDFVariable Scientific.IO.NetCDF.NetCDFVariable-class.html Scientific.IO.NetCDF.NetCDFVariable.assignValue Scientific.IO.NetCDF.NetCDFVariable-class.html#assignValue Scientific.IO.NetCDF.NetCDFVariable.getValue Scientific.IO.NetCDF.NetCDFVariable-class.html#getValue Scientific.IO.NetCDF.NetCDFVariable.__init__ Scientific.IO.NetCDF.NetCDFVariable-class.html#__init__ Scientific.IO.NetCDF.NetCDFVariable.typecode Scientific.IO.NetCDF.NetCDFVariable-class.html#typecode Scientific.IO.PDB.AminoAcidResidue Scientific.IO.PDB.AminoAcidResidue-class.html Scientific.IO.PDB.Group.__getitem__ Scientific.IO.PDB.Group-class.html#__getitem__ Scientific.IO.PDB.Group.__str__ Scientific.IO.PDB.Group-class.html#__str__ Scientific.IO.PDB.AminoAcidResidue.isNTerminus Scientific.IO.PDB.AminoAcidResidue-class.html#isNTerminus Scientific.IO.PDB.AminoAcidResidue.writeToFile Scientific.IO.PDB.AminoAcidResidue-class.html#writeToFile Scientific.IO.PDB.AminoAcidResidue.addAtom Scientific.IO.PDB.AminoAcidResidue-class.html#addAtom Scientific.IO.PDB.Group.changeName Scientific.IO.PDB.Group-class.html#changeName Scientific.IO.PDB.Group.deleteAtom Scientific.IO.PDB.Group-class.html#deleteAtom Scientific.IO.PDB.Group.isCompatible Scientific.IO.PDB.Group-class.html#isCompatible Scientific.IO.PDB.Group.__init__ Scientific.IO.PDB.Group-class.html#__init__ Scientific.IO.PDB.Group.deleteHydrogens Scientific.IO.PDB.Group-class.html#deleteHydrogens Scientific.IO.PDB.AminoAcidResidue.is_amino_acid Scientific.IO.PDB.AminoAcidResidue-class.html#is_amino_acid Scientific.IO.PDB.AminoAcidResidue.isCTerminus Scientific.IO.PDB.AminoAcidResidue-class.html#isCTerminus Scientific.IO.PDB.Group.__len__ Scientific.IO.PDB.Group-class.html#__len__ Scientific.IO.PDB.Group.__repr__ Scientific.IO.PDB.Group-class.html#__repr__ Scientific.IO.PDB.Atom Scientific.IO.PDB.Atom-class.html Scientific.IO.PDB.Atom.__getitem__ Scientific.IO.PDB.Atom-class.html#__getitem__ Scientific.IO.PDB.Atom.__str__ Scientific.IO.PDB.Atom-class.html#__str__ Scientific.IO.PDB.Atom.writeToFile Scientific.IO.PDB.Atom-class.html#writeToFile Scientific.IO.PDB.Atom.__setitem__ Scientific.IO.PDB.Atom-class.html#__setitem__ Scientific.IO.PDB.Atom.__repr__ Scientific.IO.PDB.Atom-class.html#__repr__ Scientific.IO.PDB.Atom.type Scientific.IO.PDB.Atom-class.html#type Scientific.IO.PDB.Atom.__init__ Scientific.IO.PDB.Atom-class.html#__init__ Scientific.IO.PDB.Chain Scientific.IO.PDB.Chain-class.html Scientific.IO.PDB.Chain.__getslice__ Scientific.IO.PDB.Chain-class.html#__getslice__ Scientific.IO.PDB.Chain.__getitem__ Scientific.IO.PDB.Chain-class.html#__getitem__ Scientific.IO.PDB.Chain.sequence Scientific.IO.PDB.Chain-class.html#sequence Scientific.IO.PDB.Chain.writeToFile Scientific.IO.PDB.Chain-class.html#writeToFile Scientific.IO.PDB.Chain.removeResidues Scientific.IO.PDB.Chain-class.html#removeResidues Scientific.IO.PDB.Chain.__len__ Scientific.IO.PDB.Chain-class.html#__len__ Scientific.IO.PDB.Chain.__init__ Scientific.IO.PDB.Chain-class.html#__init__ Scientific.IO.PDB.Chain.deleteHydrogens Scientific.IO.PDB.Chain-class.html#deleteHydrogens Scientific.IO.PDB.Chain.addResidue Scientific.IO.PDB.Chain-class.html#addResidue Scientific.IO.PDB.Group Scientific.IO.PDB.Group-class.html Scientific.IO.PDB.Group.__getitem__ Scientific.IO.PDB.Group-class.html#__getitem__ Scientific.IO.PDB.Group.__str__ Scientific.IO.PDB.Group-class.html#__str__ Scientific.IO.PDB.Group.isCompatible Scientific.IO.PDB.Group-class.html#isCompatible Scientific.IO.PDB.Group.writeToFile Scientific.IO.PDB.Group-class.html#writeToFile Scientific.IO.PDB.Group.addAtom Scientific.IO.PDB.Group-class.html#addAtom Scientific.IO.PDB.Group.changeName Scientific.IO.PDB.Group-class.html#changeName Scientific.IO.PDB.Group.deleteAtom Scientific.IO.PDB.Group-class.html#deleteAtom Scientific.IO.PDB.Group.__len__ Scientific.IO.PDB.Group-class.html#__len__ Scientific.IO.PDB.Group.deleteHydrogens Scientific.IO.PDB.Group-class.html#deleteHydrogens Scientific.IO.PDB.Group.__init__ Scientific.IO.PDB.Group-class.html#__init__ Scientific.IO.PDB.Group.__repr__ Scientific.IO.PDB.Group-class.html#__repr__ Scientific.IO.PDB.HetAtom Scientific.IO.PDB.HetAtom-class.html Scientific.IO.PDB.Atom.__getitem__ Scientific.IO.PDB.Atom-class.html#__getitem__ Scientific.IO.PDB.Atom.__str__ Scientific.IO.PDB.Atom-class.html#__str__ Scientific.IO.PDB.Atom.writeToFile Scientific.IO.PDB.Atom-class.html#writeToFile Scientific.IO.PDB.Atom.__setitem__ Scientific.IO.PDB.Atom-class.html#__setitem__ Scientific.IO.PDB.Atom.__repr__ Scientific.IO.PDB.Atom-class.html#__repr__ Scientific.IO.PDB.HetAtom.type Scientific.IO.PDB.HetAtom-class.html#type Scientific.IO.PDB.Atom.__init__ Scientific.IO.PDB.Atom-class.html#__init__ Scientific.IO.PDB.Molecule Scientific.IO.PDB.Molecule-class.html Scientific.IO.PDB.Group.__getitem__ Scientific.IO.PDB.Group-class.html#__getitem__ Scientific.IO.PDB.Group.__str__ Scientific.IO.PDB.Group-class.html#__str__ Scientific.IO.PDB.Group.isCompatible Scientific.IO.PDB.Group-class.html#isCompatible Scientific.IO.PDB.Group.writeToFile Scientific.IO.PDB.Group-class.html#writeToFile Scientific.IO.PDB.Group.addAtom Scientific.IO.PDB.Group-class.html#addAtom Scientific.IO.PDB.Group.changeName Scientific.IO.PDB.Group-class.html#changeName Scientific.IO.PDB.Group.deleteAtom Scientific.IO.PDB.Group-class.html#deleteAtom Scientific.IO.PDB.Group.__init__ Scientific.IO.PDB.Group-class.html#__init__ Scientific.IO.PDB.Group.deleteHydrogens Scientific.IO.PDB.Group-class.html#deleteHydrogens Scientific.IO.PDB.Group.__len__ Scientific.IO.PDB.Group-class.html#__len__ Scientific.IO.PDB.Group.__repr__ Scientific.IO.PDB.Group-class.html#__repr__ Scientific.IO.PDB.NucleotideChain Scientific.IO.PDB.NucleotideChain-class.html Scientific.IO.PDB.Chain.__getslice__ Scientific.IO.PDB.Chain-class.html#__getslice__ Scientific.IO.PDB.Chain.__getitem__ Scientific.IO.PDB.Chain-class.html#__getitem__ Scientific.IO.PDB.Chain.sequence Scientific.IO.PDB.Chain-class.html#sequence Scientific.IO.PDB.NucleotideChain.isCompatible Scientific.IO.PDB.NucleotideChain-class.html#isCompatible Scientific.IO.PDB.Chain.writeToFile Scientific.IO.PDB.Chain-class.html#writeToFile Scientific.IO.PDB.Chain.removeResidues Scientific.IO.PDB.Chain-class.html#removeResidues Scientific.IO.PDB.Chain.addResidue Scientific.IO.PDB.Chain-class.html#addResidue Scientific.IO.PDB.Chain.__init__ Scientific.IO.PDB.Chain-class.html#__init__ Scientific.IO.PDB.Chain.deleteHydrogens Scientific.IO.PDB.Chain-class.html#deleteHydrogens Scientific.IO.PDB.NucleotideChain.isTerminated Scientific.IO.PDB.NucleotideChain-class.html#isTerminated Scientific.IO.PDB.Chain.__len__ Scientific.IO.PDB.Chain-class.html#__len__ Scientific.IO.PDB.NucleotideResidue Scientific.IO.PDB.NucleotideResidue-class.html Scientific.IO.PDB.NucleotideResidue.is_nucleotide Scientific.IO.PDB.NucleotideResidue-class.html#is_nucleotide Scientific.IO.PDB.Group.__getitem__ Scientific.IO.PDB.Group-class.html#__getitem__ Scientific.IO.PDB.NucleotideResidue.hasDesoxyribose Scientific.IO.PDB.NucleotideResidue-class.html#hasDesoxyribose Scientific.IO.PDB.Group.__len__ Scientific.IO.PDB.Group-class.html#__len__ Scientific.IO.PDB.Group.__str__ Scientific.IO.PDB.Group-class.html#__str__ Scientific.IO.PDB.NucleotideResidue.hasRibose Scientific.IO.PDB.NucleotideResidue-class.html#hasRibose Scientific.IO.PDB.NucleotideResidue.isCompatible Scientific.IO.PDB.NucleotideResidue-class.html#isCompatible Scientific.IO.PDB.NucleotideResidue.writeToFile Scientific.IO.PDB.NucleotideResidue-class.html#writeToFile Scientific.IO.PDB.NucleotideResidue.addAtom Scientific.IO.PDB.NucleotideResidue-class.html#addAtom Scientific.IO.PDB.Group.changeName Scientific.IO.PDB.Group-class.html#changeName Scientific.IO.PDB.NucleotideResidue.hasTerminalH Scientific.IO.PDB.NucleotideResidue-class.html#hasTerminalH Scientific.IO.PDB.NucleotideResidue.__init__ Scientific.IO.PDB.NucleotideResidue-class.html#__init__ Scientific.IO.PDB.Group.deleteHydrogens Scientific.IO.PDB.Group-class.html#deleteHydrogens Scientific.IO.PDB.Group.deleteAtom Scientific.IO.PDB.Group-class.html#deleteAtom Scientific.IO.PDB.NucleotideResidue.hasPhosphate Scientific.IO.PDB.NucleotideResidue-class.html#hasPhosphate Scientific.IO.PDB.Group.__repr__ Scientific.IO.PDB.Group-class.html#__repr__ Scientific.IO.PDB.PDBFile Scientific.IO.PDB.PDBFile-class.html Scientific.IO.PDB.PDBFile.nextResidue Scientific.IO.PDB.PDBFile-class.html#nextResidue Scientific.IO.PDB.PDBFile.__del__ Scientific.IO.PDB.PDBFile-class.html#__del__ Scientific.IO.PDB.PDBFile.writeAtom Scientific.IO.PDB.PDBFile-class.html#writeAtom Scientific.IO.PDB.PDBFile.terminateChain Scientific.IO.PDB.PDBFile-class.html#terminateChain Scientific.IO.PDB.PDBFile.writeComment Scientific.IO.PDB.PDBFile-class.html#writeComment Scientific.IO.PDB.PDBFile.writeLine Scientific.IO.PDB.PDBFile-class.html#writeLine Scientific.IO.PDB.PDBFile._chain_ids Scientific.IO.PDB.PDBFile-class.html#_chain_ids Scientific.IO.PDB.PDBFile.close Scientific.IO.PDB.PDBFile-class.html#close Scientific.IO.PDB.PDBFile.readLine Scientific.IO.PDB.PDBFile-class.html#readLine Scientific.IO.PDB.PDBFile.__init__ Scientific.IO.PDB.PDBFile-class.html#__init__ Scientific.IO.PDB.PDBFile.nextChain Scientific.IO.PDB.PDBFile-class.html#nextChain Scientific.IO.PDB.PeptideChain Scientific.IO.PDB.PeptideChain-class.html Scientific.IO.PDB.Chain.__getslice__ Scientific.IO.PDB.Chain-class.html#__getslice__ Scientific.IO.PDB.Chain.__getitem__ Scientific.IO.PDB.Chain-class.html#__getitem__ Scientific.IO.PDB.Chain.sequence Scientific.IO.PDB.Chain-class.html#sequence Scientific.IO.PDB.PeptideChain.isCompatible Scientific.IO.PDB.PeptideChain-class.html#isCompatible Scientific.IO.PDB.Chain.writeToFile Scientific.IO.PDB.Chain-class.html#writeToFile Scientific.IO.PDB.Chain.removeResidues Scientific.IO.PDB.Chain-class.html#removeResidues Scientific.IO.PDB.Chain.addResidue Scientific.IO.PDB.Chain-class.html#addResidue Scientific.IO.PDB.Chain.__init__ Scientific.IO.PDB.Chain-class.html#__init__ Scientific.IO.PDB.Chain.deleteHydrogens Scientific.IO.PDB.Chain-class.html#deleteHydrogens Scientific.IO.PDB.PeptideChain.isTerminated Scientific.IO.PDB.PeptideChain-class.html#isTerminated Scientific.IO.PDB.Chain.__len__ Scientific.IO.PDB.Chain-class.html#__len__ Scientific.IO.PDB.Residue Scientific.IO.PDB.Residue-class.html Scientific.IO.PDB.Group.__getitem__ Scientific.IO.PDB.Group-class.html#__getitem__ Scientific.IO.PDB.Group.__str__ Scientific.IO.PDB.Group-class.html#__str__ Scientific.IO.PDB.Group.isCompatible Scientific.IO.PDB.Group-class.html#isCompatible Scientific.IO.PDB.Group.writeToFile Scientific.IO.PDB.Group-class.html#writeToFile Scientific.IO.PDB.Group.addAtom Scientific.IO.PDB.Group-class.html#addAtom Scientific.IO.PDB.Group.changeName Scientific.IO.PDB.Group-class.html#changeName Scientific.IO.PDB.Group.deleteAtom Scientific.IO.PDB.Group-class.html#deleteAtom Scientific.IO.PDB.Group.__init__ Scientific.IO.PDB.Group-class.html#__init__ Scientific.IO.PDB.Group.deleteHydrogens Scientific.IO.PDB.Group-class.html#deleteHydrogens Scientific.IO.PDB.Group.__len__ Scientific.IO.PDB.Group-class.html#__len__ Scientific.IO.PDB.Group.__repr__ Scientific.IO.PDB.Group-class.html#__repr__ Scientific.IO.PDB.ResidueNumber Scientific.IO.PDB.ResidueNumber-class.html Scientific.IO.PDB.ResidueNumber.__str__ Scientific.IO.PDB.ResidueNumber-class.html#__str__ Scientific.IO.PDB.ResidueNumber.__repr__ Scientific.IO.PDB.ResidueNumber-class.html#__repr__ Scientific.IO.PDB.ResidueNumber.__init__ Scientific.IO.PDB.ResidueNumber-class.html#__init__ Scientific.IO.PDB.ResidueNumber.__cmp__ Scientific.IO.PDB.ResidueNumber-class.html#__cmp__ Scientific.IO.PDB.Structure Scientific.IO.PDB.Structure-class.html Scientific.IO.PDB.Structure.renumberAtoms Scientific.IO.PDB.Structure-class.html#renumberAtoms Scientific.IO.PDB.Structure.peptide_chain_constructor Scientific.IO.PDB.PeptideChain-class.html Scientific.IO.PDB.Structure.joinPeptideChains Scientific.IO.PDB.Structure-class.html#joinPeptideChains Scientific.IO.PDB.Structure.deleteHydrogens Scientific.IO.PDB.Structure-class.html#deleteHydrogens Scientific.IO.PDB.Structure.addMolecule Scientific.IO.PDB.Structure-class.html#addMolecule Scientific.IO.PDB.Structure.splitPeptideChain Scientific.IO.PDB.Structure-class.html#splitPeptideChain Scientific.IO.PDB.Structure._joinChains Scientific.IO.PDB.Structure-class.html#_joinChains Scientific.IO.PDB.Structure.__init__ Scientific.IO.PDB.Structure-class.html#__init__ Scientific.IO.PDB.Structure.extractData Scientific.IO.PDB.Structure-class.html#extractData Scientific.IO.PDB.Structure.newChain Scientific.IO.PDB.Structure-class.html#newChain Scientific.IO.PDB.Structure.splitNucleotideChain Scientific.IO.PDB.Structure-class.html#splitNucleotideChain Scientific.IO.PDB.Structure._splitChain Scientific.IO.PDB.Structure-class.html#_splitChain Scientific.IO.PDB.Structure.writeToFile Scientific.IO.PDB.Structure-class.html#writeToFile Scientific.IO.PDB.Structure.deleteResidue Scientific.IO.PDB.Structure-class.html#deleteResidue Scientific.IO.PDB.Structure.__len__ Scientific.IO.PDB.Structure-class.html#__len__ Scientific.IO.PDB.Structure.__repr__ Scientific.IO.PDB.Structure-class.html#__repr__ Scientific.IO.PDB.Structure.__getitem__ Scientific.IO.PDB.Structure-class.html#__getitem__ Scientific.IO.PDB.Structure.molecule_constructor Scientific.IO.PDB.Molecule-class.html Scientific.IO.PDB.Structure.parseFile Scientific.IO.PDB.Structure-class.html#parseFile Scientific.IO.PDB.Structure.newResidue Scientific.IO.PDB.Structure-class.html#newResidue Scientific.IO.PDB.Structure.findSpaceGroupTransformations Scientific.IO.PDB.Structure-class.html#findSpaceGroupTransformations Scientific.IO.PDB.Structure.nucleotide_chain_constructor Scientific.IO.PDB.NucleotideChain-class.html Scientific.IO.PDB.Structure.joinNucleotideChains Scientific.IO.PDB.Structure-class.html#joinNucleotideChains Scientific.IO.PDBSpaceGroups.SpaceGroup Scientific.IO.PDBSpaceGroups.SpaceGroup-class.html Scientific.IO.PDBSpaceGroups.SpaceGroup.__init__ Scientific.IO.PDBSpaceGroups.SpaceGroup-class.html#__init__ Scientific.IO.TextFile.TextFile Scientific.IO.TextFile.TextFile-class.html Scientific.IO.TextFile.TextFile.writelines Scientific.IO.TextFile.TextFile-class.html#writelines Scientific.IO.TextFile.TextFile.__getitem__ Scientific.IO.TextFile.TextFile-class.html#__getitem__ Scientific.IO.TextFile.TextFile.__del__ Scientific.IO.TextFile.TextFile-class.html#__del__ Scientific.IO.TextFile.TextFile.readlines Scientific.IO.TextFile.TextFile-class.html#readlines Scientific.IO.TextFile.TextFile.write Scientific.IO.TextFile.TextFile-class.html#write Scientific.IO.TextFile.TextFile.read Scientific.IO.TextFile.TextFile-class.html#read Scientific.IO.TextFile.TextFile.flush Scientific.IO.TextFile.TextFile-class.html#flush Scientific.IO.TextFile.TextFile.close Scientific.IO.TextFile.TextFile-class.html#close Scientific.IO.TextFile.TextFile.readline Scientific.IO.TextFile.TextFile-class.html#readline Scientific.IO.TextFile.TextFile.__init__ Scientific.IO.TextFile.TextFile-class.html#__init__ Scientific.IterationCountExceededError Scientific.IterationCountExceededError-class.html Scientific.MPI.IO.LogFile Scientific.MPI.IO.LogFile-class.html Scientific.MPI.IO.LogFile.write Scientific.MPI.IO.LogFile-class.html#write Scientific.MPI.IO.LogFile.close Scientific.MPI.IO.LogFile-class.html#close Scientific.MPI.IO.LogFile.__init__ Scientific.MPI.IO.LogFile-class.html#__init__ Scientific.MPI.IO.LogFile.flush Scientific.MPI.IO.LogFile-class.html#flush Scientific.MPI.MPICommunicator Scientific.MPI.MPICommunicator-class.html Scientific.MPI.MPICommunicator.subset Scientific.MPI.MPICommunicator-class.html#subset Scientific.MPI.MPICommunicator.reduce Scientific.MPI.MPICommunicator-class.html#reduce Scientific.MPI.MPICommunicator.barrier Scientific.MPI.MPICommunicator-class.html#barrier Scientific.MPI.MPICommunicator.receive Scientific.MPI.MPICommunicator-class.html#receive Scientific.MPI.MPICommunicator.nonblockingReceive Scientific.MPI.MPICommunicator-class.html#nonblockingReceive Scientific.MPI.MPICommunicator.nonblockingProbe Scientific.MPI.MPICommunicator-class.html#nonblockingProbe Scientific.MPI.MPICommunicator.share Scientific.MPI.MPICommunicator-class.html#share Scientific.MPI.MPICommunicator.receiveString Scientific.MPI.MPICommunicator-class.html#receiveString Scientific.MPI.MPICommunicator.send Scientific.MPI.MPICommunicator-class.html#send Scientific.MPI.MPICommunicator.broadcast Scientific.MPI.MPICommunicator-class.html#broadcast Scientific.MPI.MPICommunicator.duplicate Scientific.MPI.MPICommunicator-class.html#duplicate Scientific.MPI.MPICommunicator.abort Scientific.MPI.MPICommunicator-class.html#abort Scientific.MPI.MPICommunicator.allreduce Scientific.MPI.MPICommunicator-class.html#allreduce Scientific.MPI.MPICommunicator.nonblockingSend Scientific.MPI.MPICommunicator-class.html#nonblockingSend Scientific.MPI.MPIOperationObject Scientific.MPI.MPIOperationObject-class.html Scientific.MPI.MPIRequest Scientific.MPI.MPIRequest-class.html Scientific.MPI.MPIRequest.test Scientific.MPI.MPIRequest-class.html#test Scientific.MPI.MPIRequest.wait Scientific.MPI.MPIRequest-class.html#wait Scientific.MPI.band Scientific.MPI.band-class.html Scientific.MPI.bor Scientific.MPI.bor-class.html Scientific.MPI.bxor Scientific.MPI.bxor-class.html Scientific.MPI.land Scientific.MPI.land-class.html Scientific.MPI.lor Scientific.MPI.lor-class.html Scientific.MPI.lxor Scientific.MPI.lxor-class.html Scientific.MPI.max Scientific.MPI.max-class.html Scientific.MPI.maxloc Scientific.MPI.maxloc-class.html Scientific.MPI.min Scientific.MPI.min-class.html Scientific.MPI.minloc Scientific.MPI.minloc-class.html Scientific.MPI.prod Scientific.MPI.prod-class.html Scientific.MPI.replace Scientific.MPI.replace-class.html Scientific.MPI.sum Scientific.MPI.sum-class.html Scientific.NumberDict.NumberDict Scientific.NumberDict.NumberDict-class.html Scientific.NumberDict.NumberDict.__rmul__ Scientific.NumberDict.NumberDict-class.html#__rmul__ Scientific.NumberDict.NumberDict.__getitem__ Scientific.NumberDict.NumberDict-class.html#__getitem__ Scientific.NumberDict.NumberDict.__coerce__ Scientific.NumberDict.NumberDict-class.html#__coerce__ Scientific.NumberDict.NumberDict.__add__ Scientific.NumberDict.NumberDict-class.html#__add__ Scientific.NumberDict.NumberDict.__div__ Scientific.NumberDict.NumberDict-class.html#__div__ Scientific.NumberDict.NumberDict.__mul__ Scientific.NumberDict.NumberDict-class.html#__mul__ Scientific.NumberDict.NumberDict.__sub__ Scientific.NumberDict.NumberDict-class.html#__sub__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html Scientific.Physics.PhysicalQuantities.PhysicalQuantity.inUnitsOf Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#inUnitsOf Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__str__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__str__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__radd__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__radd__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__rsub__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__rsub__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.sqrt Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#sqrt Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__rdiv__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__rdiv__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__rmul__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__rmul__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.convertToUnit Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#convertToUnit Scientific.Physics.PhysicalQuantities.PhysicalQuantity.tan Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#tan Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__cmp__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__cmp__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__init__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__init__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__rpow__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__rpow__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.isCompatible Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#isCompatible Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__abs__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__abs__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__pos__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__pos__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.sin Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#sin Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__mul__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__mul__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity._sum Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#_sum Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__pow__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__pow__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__add__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__add__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.getUnitName Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#getUnitName Scientific.Physics.PhysicalQuantities.PhysicalQuantity.cos Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#cos Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__nonzero__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__nonzero__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__neg__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__neg__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.getValue Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#getValue Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__div__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__div__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__repr__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__repr__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity.__sub__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#__sub__ Scientific.Physics.PhysicalQuantities.PhysicalQuantity._number Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#_number Scientific.Physics.PhysicalQuantities.PhysicalQuantity.inBaseUnits Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.html#inBaseUnits Scientific.Physics.PhysicalQuantities.PhysicalUnit Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html Scientific.Physics.PhysicalQuantities.PhysicalUnit.conversionTupleTo Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#conversionTupleTo Scientific.Physics.PhysicalQuantities.PhysicalUnit.conversionFactorTo Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#conversionFactorTo Scientific.Physics.PhysicalQuantities.PhysicalUnit.name Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#name Scientific.Physics.PhysicalQuantities.PhysicalUnit.setName Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#setName Scientific.Physics.PhysicalQuantities.PhysicalUnit.__str__ Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#__str__ Scientific.Physics.PhysicalQuantities.PhysicalUnit.isCompatible Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#isCompatible Scientific.Physics.PhysicalQuantities.PhysicalUnit.__cmp__ Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#__cmp__ Scientific.Physics.PhysicalQuantities.PhysicalUnit.isDimensionless Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#isDimensionless Scientific.Physics.PhysicalQuantities.PhysicalUnit.__div__ Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#__div__ Scientific.Physics.PhysicalQuantities.PhysicalUnit.__mul__ Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#__mul__ Scientific.Physics.PhysicalQuantities.PhysicalUnit.__pow__ Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#__pow__ Scientific.Physics.PhysicalQuantities.PhysicalUnit.__init__ Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#__init__ Scientific.Physics.PhysicalQuantities.PhysicalUnit.__rdiv__ Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#__rdiv__ Scientific.Physics.PhysicalQuantities.PhysicalUnit.__rmul__ Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#__rmul__ Scientific.Physics.PhysicalQuantities.PhysicalUnit.isAngle Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#isAngle Scientific.Physics.PhysicalQuantities.PhysicalUnit.__repr__ Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html#__repr__ Scientific.Physics.Potential.PotentialWithGradients Scientific.Physics.Potential.PotentialWithGradients-class.html Scientific.Physics.Potential.PotentialWithGradients.__call__ Scientific.Physics.Potential.PotentialWithGradients-class.html#__call__ Scientific.Physics.Potential.PotentialWithGradients.__init__ Scientific.Physics.Potential.PotentialWithGradients-class.html#__init__ Scientific.Physics.Potential.PotentialWithGradientsAndForceConstants Scientific.Physics.Potential.PotentialWithGradientsAndForceConstants-class.html Scientific.Physics.Potential.PotentialWithGradientsAndForceConstants.__call__ Scientific.Physics.Potential.PotentialWithGradientsAndForceConstants-class.html#__call__ Scientific.Physics.Potential.PotentialWithGradientsAndForceConstants.__init__ Scientific.Physics.Potential.PotentialWithGradientsAndForceConstants-class.html#__init__ Scientific.QtWidgets.QtPlotCanvas.HorizontalLine Scientific.QtWidgets.QtPlotCanvas.HorizontalLine-class.html Scientific.QtWidgets.QtPlotCanvas.HorizontalLine.draw Scientific.QtWidgets.QtPlotCanvas.HorizontalLine-class.html#draw Scientific.QtWidgets.QtPlotCanvas.PolyLine._attributes Scientific.QtWidgets.QtPlotCanvas.PolyLine-class.html#_attributes Scientific.QtWidgets.QtPlotCanvas.PolyPoints.scaleAndShift Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#scaleAndShift Scientific.QtWidgets.QtPlotCanvas.PolyPoints.boundingBox Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#boundingBox Scientific.QtWidgets.QtPlotCanvas.HorizontalLine.writeToFile Scientific.QtWidgets.QtPlotCanvas.HorizontalLine-class.html#writeToFile Scientific.QtWidgets.QtPlotCanvas.HorizontalLine.__init__ Scientific.QtWidgets.QtPlotCanvas.HorizontalLine-class.html#__init__ Scientific.QtWidgets.QtPlotCanvas.PlotCanvas Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas._textBoundingBox Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#_textBoundingBox qt.Qt.UIEffect qt.Qt.UIEffect-class.html qt.QWidget.FocusPolicy qt.QWidget.FocusPolicy-class.html qt.Qt.SequenceMatch qt.Qt.SequenceMatch-class.html qt.Qt.TextFormat qt.Qt.TextFormat-class.html qt.Qt.TextFlags qt.Qt.TextFlags-class.html qt.Qt.AlignmentFlags qt.Qt.AlignmentFlags-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas.select Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#select Scientific.QtWidgets.QtPlotCanvas.PlotCanvas._drawAxes Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#_drawAxes qt.Qt.GUIStyle qt.Qt.GUIStyle-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas.mousePressEvent Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#mousePressEvent qt.Qt.WindowState qt.Qt.WindowState-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas._axisInterval Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#_axisInterval qt.Qt.PenCapStyle qt.Qt.PenCapStyle-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas._showValue Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#_showValue Scientific.QtWidgets.QtPlotCanvas.PlotCanvas.redraw Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#redraw qt.Qt.Key qt.Qt.Key-class.html qt.Qt.Orientation qt.Qt.Orientation-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas._multiples Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#_multiples qt.Qt.Corner qt.Qt.Corner-class.html qt.Qt.StringComparisonMode qt.Qt.StringComparisonMode-class.html qt.Qt.PenJoinStyle qt.Qt.PenJoinStyle-class.html qt.Qt.WidgetState qt.Qt.WidgetState-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas._autoScale Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#_autoScale Scientific.QtWidgets.QtPlotCanvas.PlotCanvas.clear Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#clear qt.Qt.PenStyle qt.Qt.PenStyle-class.html qt.Qt.BrushStyle qt.Qt.BrushStyle-class.html qt.Qt.DateFormat qt.Qt.DateFormat-class.html qt.Qt.TimeSpec qt.Qt.TimeSpec-class.html qt.Qt.ArrowType qt.Qt.ArrowType-class.html qt.Qt.SortOrder qt.Qt.SortOrder-class.html qt.Qt.MacintoshVersion qt.Qt.MacintoshVersion-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas._hideValue Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#_hideValue qt.Qt.AnchorAttribute qt.Qt.AnchorAttribute-class.html qt.QWidget.BackgroundOrigin qt.QWidget.BackgroundOrigin-class.html qt.Qt.WidgetFlags qt.Qt.WidgetFlags-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas._popupMenu Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#_popupMenu Scientific.QtWidgets.QtPlotCanvas.PlotCanvas.__init__ Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#__init__ qt.Qt.WindowsVersion qt.Qt.WindowsVersion-class.html qt.Qt.BGMode qt.Qt.BGMode-class.html qt.QPaintDevice.PDevCmd qt.QPaintDevice.PDevCmd-class.html qt.Qt.Dock qt.Qt.Dock-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas._setsize Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#_setsize qt.Qt.BackgroundMode qt.Qt.BackgroundMode-class.html qt.Qt.RasterOp qt.Qt.RasterOp-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas.mouseReleaseEvent Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#mouseReleaseEvent qt.Qt.ButtonState qt.Qt.ButtonState-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas.resizeEvent Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#resizeEvent Scientific.QtWidgets.QtPlotCanvas.PlotCanvas._ticks Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#_ticks Scientific.QtWidgets.QtPlotCanvas.PlotCanvas.mouseMoveEvent Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#mouseMoveEvent qt.Qt.Modifier qt.Qt.Modifier-class.html qt.Qt.ImageConversionFlags qt.Qt.ImageConversionFlags-class.html qt.Qt.CursorShape qt.Qt.CursorShape-class.html Scientific.QtWidgets.QtPlotCanvas.PlotCanvas._xmgr Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#_xmgr Scientific.QtWidgets.QtPlotCanvas.PlotCanvas.draw Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#draw Scientific.QtWidgets.QtPlotCanvas.PlotCanvas.paintEvent Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html#paintEvent Scientific.QtWidgets.QtPlotCanvas.PlotGraphics Scientific.QtWidgets.QtPlotCanvas.PlotGraphics-class.html Scientific.QtWidgets.QtPlotCanvas.PlotGraphics.__getitem__ Scientific.QtWidgets.QtPlotCanvas.PlotGraphics-class.html#__getitem__ Scientific.QtWidgets.QtPlotCanvas.PlotGraphics.__init__ Scientific.QtWidgets.QtPlotCanvas.PlotGraphics-class.html#__init__ Scientific.QtWidgets.QtPlotCanvas.PlotGraphics.__len__ Scientific.QtWidgets.QtPlotCanvas.PlotGraphics-class.html#__len__ Scientific.QtWidgets.QtPlotCanvas.PolyLine Scientific.QtWidgets.QtPlotCanvas.PolyLine-class.html Scientific.QtWidgets.QtPlotCanvas.PolyPoints.writeToFile Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#writeToFile Scientific.QtWidgets.QtPlotCanvas.PolyPoints.scaleAndShift Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#scaleAndShift Scientific.QtWidgets.QtPlotCanvas.PolyPoints.boundingBox Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#boundingBox Scientific.QtWidgets.QtPlotCanvas.PolyLine._attributes Scientific.QtWidgets.QtPlotCanvas.PolyLine-class.html#_attributes Scientific.QtWidgets.QtPlotCanvas.PolyLine.__init__ Scientific.QtWidgets.QtPlotCanvas.PolyLine-class.html#__init__ Scientific.QtWidgets.QtPlotCanvas.PolyMarker Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html Scientific.QtWidgets.QtPlotCanvas.PolyMarker.draw Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html#draw Scientific.QtWidgets.QtPlotCanvas.PolyMarker._triangle_down Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html#_triangle_down Scientific.QtWidgets.QtPlotCanvas.PolyPoints.scaleAndShift Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#scaleAndShift Scientific.QtWidgets.QtPlotCanvas.PolyMarker._circle Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html#_circle Scientific.QtWidgets.QtPlotCanvas.PolyMarker._plus Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html#_plus Scientific.QtWidgets.QtPlotCanvas.PolyMarker._attributes Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html#_attributes Scientific.QtWidgets.QtPlotCanvas.PolyMarker._triangle Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html#_triangle Scientific.QtWidgets.QtPlotCanvas.PolyMarker._cross Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html#_cross Scientific.QtWidgets.QtPlotCanvas.PolyPoints.boundingBox Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#boundingBox Scientific.QtWidgets.QtPlotCanvas.PolyPoints.writeToFile Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#writeToFile Scientific.QtWidgets.QtPlotCanvas.PolyMarker._dot Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html#_dot Scientific.QtWidgets.QtPlotCanvas.PolyMarker._square Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html#_square Scientific.QtWidgets.QtPlotCanvas.PolyMarker.__init__ Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html#__init__ Scientific.QtWidgets.QtPlotCanvas.PolyPoints Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html Scientific.QtWidgets.QtPlotCanvas.PolyPoints.boundingBox Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#boundingBox Scientific.QtWidgets.QtPlotCanvas.PolyPoints.__init__ Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#__init__ Scientific.QtWidgets.QtPlotCanvas.PolyPoints.scaleAndShift Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#scaleAndShift Scientific.QtWidgets.QtPlotCanvas.PolyPoints.writeToFile Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#writeToFile Scientific.QtWidgets.QtPlotCanvas.VerticalLine Scientific.QtWidgets.QtPlotCanvas.VerticalLine-class.html Scientific.QtWidgets.QtPlotCanvas.VerticalLine.draw Scientific.QtWidgets.QtPlotCanvas.VerticalLine-class.html#draw Scientific.QtWidgets.QtPlotCanvas.PolyLine._attributes Scientific.QtWidgets.QtPlotCanvas.PolyLine-class.html#_attributes Scientific.QtWidgets.QtPlotCanvas.PolyPoints.scaleAndShift Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#scaleAndShift Scientific.QtWidgets.QtPlotCanvas.PolyPoints.boundingBox Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html#boundingBox Scientific.QtWidgets.QtPlotCanvas.VerticalLine.writeToFile Scientific.QtWidgets.QtPlotCanvas.VerticalLine-class.html#writeToFile Scientific.QtWidgets.QtPlotCanvas.VerticalLine.__init__ Scientific.QtWidgets.QtPlotCanvas.VerticalLine-class.html#__init__ Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D-class.html Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D.lines Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D-class.html#lines Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D._attributes Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D-class.html#_attributes Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D.__init__ Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D-class.html#__init__ Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html qt.Qt.UIEffect qt.Qt.UIEffect-class.html qt.QWidget.FocusPolicy qt.QWidget.FocusPolicy-class.html qt.Qt.SequenceMatch qt.Qt.SequenceMatch-class.html qt.Qt.TextFormat qt.Qt.TextFormat-class.html qt.Qt.TextFlags qt.Qt.TextFlags-class.html qt.Qt.AlignmentFlags qt.Qt.AlignmentFlags-class.html qt.Qt.SortOrder qt.Qt.SortOrder-class.html qt.Qt.GUIStyle qt.Qt.GUIStyle-class.html Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas.mousePressEvent Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html#mousePressEvent qt.Qt.WindowState qt.Qt.WindowState-class.html qt.Qt.PenCapStyle qt.Qt.PenCapStyle-class.html Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas.redraw Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html#redraw qt.Qt.Key qt.Qt.Key-class.html qt.Qt.Orientation qt.Qt.Orientation-class.html qt.Qt.Corner qt.Qt.Corner-class.html qt.Qt.StringComparisonMode qt.Qt.StringComparisonMode-class.html qt.Qt.PenJoinStyle qt.Qt.PenJoinStyle-class.html qt.Qt.WidgetState qt.Qt.WidgetState-class.html Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas.clear Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html#clear qt.Qt.PenStyle qt.Qt.PenStyle-class.html qt.Qt.BrushStyle qt.Qt.BrushStyle-class.html qt.Qt.DateFormat qt.Qt.DateFormat-class.html qt.Qt.TimeSpec qt.Qt.TimeSpec-class.html Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas.copyViewpointFrom Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html#copyViewpointFrom Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas.setViewpoint Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html#setViewpoint qt.Qt.ArrowType qt.Qt.ArrowType-class.html qt.Qt.MacintoshVersion qt.Qt.MacintoshVersion-class.html qt.Qt.AnchorAttribute qt.Qt.AnchorAttribute-class.html qt.QWidget.BackgroundOrigin qt.QWidget.BackgroundOrigin-class.html qt.Qt.WidgetFlags qt.Qt.WidgetFlags-class.html Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas.__init__ Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html#__init__ qt.Qt.WindowsVersion qt.Qt.WindowsVersion-class.html qt.Qt.BGMode qt.Qt.BGMode-class.html qt.QPaintDevice.PDevCmd qt.QPaintDevice.PDevCmd-class.html qt.Qt.Dock qt.Qt.Dock-class.html Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas._setsize Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html#_setsize qt.Qt.BackgroundMode qt.Qt.BackgroundMode-class.html qt.Qt.RasterOp qt.Qt.RasterOp-class.html Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas.mouseReleaseEvent Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html#mouseReleaseEvent qt.Qt.ButtonState qt.Qt.ButtonState-class.html Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas.resizeEvent Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html#resizeEvent qt.Qt.Modifier qt.Qt.Modifier-class.html qt.Qt.ImageConversionFlags qt.Qt.ImageConversionFlags-class.html qt.Qt.CursorShape qt.Qt.CursorShape-class.html Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas.draw Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html#draw Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas.paintEvent Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.html#paintEvent Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphics Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphics-class.html Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphics.__getitem__ Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphics-class.html#__getitem__ Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphics.__init__ Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphics-class.html#__init__ Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphics.__len__ Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphics-class.html#__len__ Scientific.Signals.Models.AutoRegressiveModel Scientific.Signals.Models.AutoRegressiveModel-class.html Scientific.Signals.Models.AutoRegressiveModel.predictStep Scientific.Signals.Models.AutoRegressiveModel-class.html#predictStep Scientific.Signals.Models.AutoRegressiveModel.frictionConstant Scientific.Signals.Models.AutoRegressiveModel-class.html#frictionConstant Scientific.Signals.Models.AutoRegressiveModel.spectrum Scientific.Signals.Models.AutoRegressiveModel-class.html#spectrum Scientific.Signals.Models.AutoRegressiveModel._findCoefficients Scientific.Signals.Models.AutoRegressiveModel-class.html#_findCoefficients Scientific.Signals.Models.AutoRegressiveModel._setTrajectory Scientific.Signals.Models.AutoRegressiveModel-class.html#_setTrajectory Scientific.Signals.Models.AutoRegressiveModel.poles Scientific.Signals.Models.AutoRegressiveModel-class.html#poles Scientific.Signals.Models.AutoRegressiveModel.memoryFunctionZ Scientific.Signals.Models.AutoRegressiveModel-class.html#memoryFunctionZ Scientific.Signals.Models.AutoRegressiveModel.correlation Scientific.Signals.Models.AutoRegressiveModel-class.html#correlation Scientific.Signals.Models.AutoRegressiveModel.memoryFunction Scientific.Signals.Models.AutoRegressiveModel-class.html#memoryFunction Scientific.Signals.Models.AutoRegressiveModel.memoryFunctionZapprox Scientific.Signals.Models.AutoRegressiveModel-class.html#memoryFunctionZapprox Scientific.Signals.Models.AutoRegressiveModel.__init__ Scientific.Signals.Models.AutoRegressiveModel-class.html#__init__ Scientific.Signals.Models.AveragedAutoRegressiveModel Scientific.Signals.Models.AveragedAutoRegressiveModel-class.html Scientific.Signals.Models.AutoRegressiveModel.memoryFunctionZ Scientific.Signals.Models.AutoRegressiveModel-class.html#memoryFunctionZ Scientific.Signals.Models.AutoRegressiveModel.frictionConstant Scientific.Signals.Models.AutoRegressiveModel-class.html#frictionConstant Scientific.Signals.Models.AutoRegressiveModel._findCoefficients Scientific.Signals.Models.AutoRegressiveModel-class.html#_findCoefficients Scientific.Signals.Models.AutoRegressiveModel.spectrum Scientific.Signals.Models.AutoRegressiveModel-class.html#spectrum Scientific.Signals.Models.AutoRegressiveModel._setTrajectory Scientific.Signals.Models.AutoRegressiveModel-class.html#_setTrajectory Scientific.Signals.Models.AveragedAutoRegressiveModel.add Scientific.Signals.Models.AveragedAutoRegressiveModel-class.html#add Scientific.Signals.Models.AutoRegressiveModel.poles Scientific.Signals.Models.AutoRegressiveModel-class.html#poles Scientific.Signals.Models.AutoRegressiveModel.predictStep Scientific.Signals.Models.AutoRegressiveModel-class.html#predictStep Scientific.Signals.Models.AutoRegressiveModel.correlation Scientific.Signals.Models.AutoRegressiveModel-class.html#correlation Scientific.Signals.Models.AutoRegressiveModel.memoryFunction Scientific.Signals.Models.AutoRegressiveModel-class.html#memoryFunction Scientific.Signals.Models.AutoRegressiveModel.memoryFunctionZapprox Scientific.Signals.Models.AutoRegressiveModel-class.html#memoryFunctionZapprox Scientific.Signals.Models.AveragedAutoRegressiveModel.__init__ Scientific.Signals.Models.AveragedAutoRegressiveModel-class.html#__init__ Scientific.Statistics.Histogram.Histogram Scientific.Statistics.Histogram.Histogram-class.html Scientific.Statistics.Histogram.Histogram.normalize Scientific.Statistics.Histogram.Histogram-class.html#normalize Scientific.Statistics.Histogram.Histogram._addData Scientific.Statistics.Histogram.Histogram-class.html#_addData Scientific.Statistics.Histogram.Histogram.__getslice__ Scientific.Statistics.Histogram.Histogram-class.html#__getslice__ Scientific.Statistics.Histogram.Histogram.__getitem__ Scientific.Statistics.Histogram.Histogram-class.html#__getitem__ Scientific.Statistics.Histogram.Histogram.getBinCounts Scientific.Statistics.Histogram.Histogram-class.html#getBinCounts Scientific.Statistics.Histogram.Histogram._setup Scientific.Statistics.Histogram.Histogram-class.html#_setup Scientific.Statistics.Histogram.Histogram.addData Scientific.Statistics.Histogram.Histogram-class.html#addData Scientific.Statistics.Histogram.Histogram.__len__ Scientific.Statistics.Histogram.Histogram-class.html#__len__ Scientific.Statistics.Histogram.Histogram.getBinIndices Scientific.Statistics.Histogram.Histogram-class.html#getBinIndices Scientific.Statistics.Histogram.Histogram.__init__ Scientific.Statistics.Histogram.Histogram-class.html#__init__ Scientific.Statistics.Histogram.Histogram.normalizeArea Scientific.Statistics.Histogram.Histogram-class.html#normalizeArea Scientific.Statistics.Histogram.WeightedHistogram Scientific.Statistics.Histogram.WeightedHistogram-class.html Scientific.Statistics.Histogram.Histogram.normalize Scientific.Statistics.Histogram.Histogram-class.html#normalize Scientific.Statistics.Histogram.WeightedHistogram._addData Scientific.Statistics.Histogram.WeightedHistogram-class.html#_addData Scientific.Statistics.Histogram.Histogram.__getitem__ Scientific.Statistics.Histogram.Histogram-class.html#__getitem__ Scientific.Statistics.Histogram.Histogram.__getslice__ Scientific.Statistics.Histogram.Histogram-class.html#__getslice__ Scientific.Statistics.Histogram.Histogram.getBinCounts Scientific.Statistics.Histogram.Histogram-class.html#getBinCounts Scientific.Statistics.Histogram.Histogram._setup Scientific.Statistics.Histogram.Histogram-class.html#_setup Scientific.Statistics.Histogram.WeightedHistogram.addData Scientific.Statistics.Histogram.WeightedHistogram-class.html#addData Scientific.Statistics.Histogram.Histogram.__len__ Scientific.Statistics.Histogram.Histogram-class.html#__len__ Scientific.Statistics.Histogram.Histogram.getBinIndices Scientific.Statistics.Histogram.Histogram-class.html#getBinIndices Scientific.Statistics.Histogram.WeightedHistogram.__init__ Scientific.Statistics.Histogram.WeightedHistogram-class.html#__init__ Scientific.Statistics.Histogram.Histogram.normalizeArea Scientific.Statistics.Histogram.Histogram-class.html#normalizeArea Scientific.Threading.TaskManager.TaskManager Scientific.Threading.TaskManager.TaskManager-class.html Scientific.Threading.TaskManager.TaskManager._scheduler Scientific.Threading.TaskManager.TaskManager-class.html#_scheduler Scientific.Threading.TaskManager.TaskManager.runTask Scientific.Threading.TaskManager.TaskManager-class.html#runTask Scientific.Threading.TaskManager.TaskManager.terminate Scientific.Threading.TaskManager.TaskManager-class.html#terminate Scientific.Threading.TaskManager.TaskManager.__init__ Scientific.Threading.TaskManager.TaskManager-class.html#__init__ Scientific.Threading.TaskManager.TaskManager._removeTask Scientific.Threading.TaskManager.TaskManager-class.html#_removeTask Scientific.TkWidgets.ButtonBar Scientific.TkWidgets.ButtonBar-class.html Tkinter.Misc.getdouble float-class.html Tkinter.Misc.getint int-class.html Scientific.TkWidgets.ButtonBar.__init__ Scientific.TkWidgets.ButtonBar-class.html#__init__ Scientific.TkWidgets.FilenameEntry Scientific.TkWidgets.FilenameEntry-class.html Tkinter.Misc.getdouble float-class.html Scientific.TkWidgets.FilenameEntry.get Scientific.TkWidgets.FilenameEntry-class.html#get Tkinter.Misc.getint int-class.html Scientific.TkWidgets.FilenameEntry.browse Scientific.TkWidgets.FilenameEntry-class.html#browse Scientific.TkWidgets.FilenameEntry.__init__ Scientific.TkWidgets.FilenameEntry-class.html#__init__ Scientific.TkWidgets.FloatEntry Scientific.TkWidgets.FloatEntry-class.html Tkinter.Misc.getdouble float-class.html Scientific.TkWidgets.FloatEntry.get Scientific.TkWidgets.FloatEntry-class.html#get Scientific.TkWidgets.FloatEntry.set Scientific.TkWidgets.FloatEntry-class.html#set Tkinter.Misc.getint int-class.html Scientific.TkWidgets.FloatEntry.__init__ Scientific.TkWidgets.FloatEntry-class.html#__init__ Scientific.TkWidgets.FloatEntry.bind Scientific.TkWidgets.FloatEntry-class.html#bind Scientific.TkWidgets.IntEntry Scientific.TkWidgets.IntEntry-class.html Tkinter.Misc.getdouble float-class.html Scientific.TkWidgets.IntEntry.get Scientific.TkWidgets.IntEntry-class.html#get Scientific.TkWidgets.FloatEntry.set Scientific.TkWidgets.FloatEntry-class.html#set Tkinter.Misc.getint int-class.html Scientific.TkWidgets.FloatEntry.__init__ Scientific.TkWidgets.FloatEntry-class.html#__init__ Scientific.TkWidgets.FloatEntry.bind Scientific.TkWidgets.FloatEntry-class.html#bind Scientific.TkWidgets.ModalDialog Scientific.TkWidgets.ModalDialog-class.html Tkinter.Misc.getdouble float-class.html Scientific.TkWidgets.ModalDialog.buttonbox Scientific.TkWidgets.ModalDialog-class.html#buttonbox Tkinter.Misc.getint int-class.html Scientific.TkWidgets.ModalDialog.body Scientific.TkWidgets.ModalDialog-class.html#body Scientific.TkWidgets.ModalDialog.ok Scientific.TkWidgets.ModalDialog-class.html#ok Scientific.TkWidgets.ModalDialog.cancel Scientific.TkWidgets.ModalDialog-class.html#cancel Scientific.TkWidgets.ModalDialog.apply Scientific.TkWidgets.ModalDialog-class.html#apply Scientific.TkWidgets.ModalDialog.__init__ Scientific.TkWidgets.ModalDialog-class.html#__init__ Scientific.TkWidgets.ModalDialog.validate Scientific.TkWidgets.ModalDialog-class.html#validate Scientific.TkWidgets.StatusBar Scientific.TkWidgets.StatusBar-class.html Tkinter.Misc.getdouble float-class.html Scientific.TkWidgets.StatusBar.set Scientific.TkWidgets.StatusBar-class.html#set Tkinter.Misc.getint int-class.html Scientific.TkWidgets.StatusBar.__init__ Scientific.TkWidgets.StatusBar-class.html#__init__ Scientific.TkWidgets.StatusBar.clear Scientific.TkWidgets.StatusBar-class.html#clear Scientific.TkWidgets.TkPlotCanvas.HorizontalLine Scientific.TkWidgets.TkPlotCanvas.HorizontalLine-class.html Scientific.TkWidgets.TkPlotCanvas.HorizontalLine.draw Scientific.TkWidgets.TkPlotCanvas.HorizontalLine-class.html#draw Scientific.TkWidgets.TkPlotCanvas.PolyLine._attributes Scientific.TkWidgets.TkPlotCanvas.PolyLine-class.html#_attributes Scientific.TkWidgets.TkPlotCanvas.PolyPoints.scaleAndShift Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#scaleAndShift Scientific.TkWidgets.TkPlotCanvas.PolyPoints.boundingBox Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#boundingBox Scientific.TkWidgets.TkPlotCanvas.HorizontalLine.writeToFile Scientific.TkWidgets.TkPlotCanvas.HorizontalLine-class.html#writeToFile Scientific.TkWidgets.TkPlotCanvas.HorizontalLine.__init__ Scientific.TkWidgets.TkPlotCanvas.HorizontalLine-class.html#__init__ Scientific.TkWidgets.TkPlotCanvas.PlotCanvas Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html Tkinter.Misc.getdouble float-class.html Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._showValue Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_showValue Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._mouseRelease Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_mouseRelease Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._setsize Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_setsize Scientific.TkWidgets.TkPlotCanvas.PlotCanvas.redraw Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#redraw Tkinter.Misc.getint int-class.html Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._ticks Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_ticks Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._multiples Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_multiples Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._mousePressed Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_mousePressed Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._testFont Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_testFont Scientific.TkWidgets.TkPlotCanvas.PlotCanvas.reconfigure Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#reconfigure Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._hideValue Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_hideValue Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._mouseMotion Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_mouseMotion Scientific.TkWidgets.TkPlotCanvas.PlotCanvas.select Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#select Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._drawAxes Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_drawAxes Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._xmgr Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_xmgr Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._autoScale Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_autoScale Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._popupMenu Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_popupMenu Scientific.TkWidgets.TkPlotCanvas.PlotCanvas.__init__ Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#__init__ Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._textBoundingBox Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_textBoundingBox Scientific.TkWidgets.TkPlotCanvas.PlotCanvas.draw Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#draw Scientific.TkWidgets.TkPlotCanvas.PlotCanvas.bind Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#bind Scientific.TkWidgets.TkPlotCanvas.PlotCanvas.clear Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#clear Scientific.TkWidgets.TkPlotCanvas.PlotCanvas._axisInterval Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html#_axisInterval Scientific.TkWidgets.TkPlotCanvas.PlotGraphics Scientific.TkWidgets.TkPlotCanvas.PlotGraphics-class.html Scientific.TkWidgets.TkPlotCanvas.PlotGraphics.__getitem__ Scientific.TkWidgets.TkPlotCanvas.PlotGraphics-class.html#__getitem__ Scientific.TkWidgets.TkPlotCanvas.PlotGraphics.__init__ Scientific.TkWidgets.TkPlotCanvas.PlotGraphics-class.html#__init__ Scientific.TkWidgets.TkPlotCanvas.PlotGraphics.__len__ Scientific.TkWidgets.TkPlotCanvas.PlotGraphics-class.html#__len__ Scientific.TkWidgets.TkPlotCanvas.PolyLine Scientific.TkWidgets.TkPlotCanvas.PolyLine-class.html Scientific.TkWidgets.TkPlotCanvas.PolyPoints.writeToFile Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#writeToFile Scientific.TkWidgets.TkPlotCanvas.PolyPoints.scaleAndShift Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#scaleAndShift Scientific.TkWidgets.TkPlotCanvas.PolyPoints.boundingBox Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#boundingBox Scientific.TkWidgets.TkPlotCanvas.PolyLine._attributes Scientific.TkWidgets.TkPlotCanvas.PolyLine-class.html#_attributes Scientific.TkWidgets.TkPlotCanvas.PolyLine.__init__ Scientific.TkWidgets.TkPlotCanvas.PolyLine-class.html#__init__ Scientific.TkWidgets.TkPlotCanvas.PolyMarker Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html Scientific.TkWidgets.TkPlotCanvas.PolyMarker.draw Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html#draw Scientific.TkWidgets.TkPlotCanvas.PolyMarker._triangle_down Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html#_triangle_down Scientific.TkWidgets.TkPlotCanvas.PolyPoints.scaleAndShift Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#scaleAndShift Scientific.TkWidgets.TkPlotCanvas.PolyMarker._drawmarkers Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html#_drawmarkers Scientific.TkWidgets.TkPlotCanvas.PolyMarker._circle Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html#_circle Scientific.TkWidgets.TkPlotCanvas.PolyMarker._plus Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html#_plus Scientific.TkWidgets.TkPlotCanvas.PolyMarker._attributes Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html#_attributes Scientific.TkWidgets.TkPlotCanvas.PolyMarker._triangle Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html#_triangle Scientific.TkWidgets.TkPlotCanvas.PolyMarker._cross Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html#_cross Scientific.TkWidgets.TkPlotCanvas.PolyPoints.boundingBox Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#boundingBox Scientific.TkWidgets.TkPlotCanvas.PolyPoints.writeToFile Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#writeToFile Scientific.TkWidgets.TkPlotCanvas.PolyMarker._dot Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html#_dot Scientific.TkWidgets.TkPlotCanvas.PolyMarker._square Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html#_square Scientific.TkWidgets.TkPlotCanvas.PolyMarker.__init__ Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html#__init__ Scientific.TkWidgets.TkPlotCanvas.PolyPoints Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html Scientific.TkWidgets.TkPlotCanvas.PolyPoints.boundingBox Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#boundingBox Scientific.TkWidgets.TkPlotCanvas.PolyPoints.__init__ Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#__init__ Scientific.TkWidgets.TkPlotCanvas.PolyPoints.scaleAndShift Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#scaleAndShift Scientific.TkWidgets.TkPlotCanvas.PolyPoints.writeToFile Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#writeToFile Scientific.TkWidgets.TkPlotCanvas.VerticalLine Scientific.TkWidgets.TkPlotCanvas.VerticalLine-class.html Scientific.TkWidgets.TkPlotCanvas.VerticalLine.draw Scientific.TkWidgets.TkPlotCanvas.VerticalLine-class.html#draw Scientific.TkWidgets.TkPlotCanvas.PolyLine._attributes Scientific.TkWidgets.TkPlotCanvas.PolyLine-class.html#_attributes Scientific.TkWidgets.TkPlotCanvas.PolyPoints.scaleAndShift Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#scaleAndShift Scientific.TkWidgets.TkPlotCanvas.PolyPoints.boundingBox Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html#boundingBox Scientific.TkWidgets.TkPlotCanvas.VerticalLine.writeToFile Scientific.TkWidgets.TkPlotCanvas.VerticalLine-class.html#writeToFile Scientific.TkWidgets.TkPlotCanvas.VerticalLine.__init__ Scientific.TkWidgets.TkPlotCanvas.VerticalLine-class.html#__init__ Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D-class.html Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D.lines Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D-class.html#lines Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D._attributes Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D-class.html#_attributes Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D.__init__ Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D-class.html#__init__ Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html Tkinter.Misc.getdouble float-class.html Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.releasehandler1 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#releasehandler1 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.releasehandler2 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#releasehandler2 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.releasehandler3 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#releasehandler3 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas._setsize Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#_setsize Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.redraw Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#redraw Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.copyViewpointFrom Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#copyViewpointFrom Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.setViewpoint Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#setViewpoint Tkinter.Misc.getint int-class.html Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.reconfigure Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#reconfigure Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.clickhandler1 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#clickhandler1 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.clickhandler3 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#clickhandler3 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.clickhandler2 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#clickhandler2 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.__init__ Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#__init__ Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.draw Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#draw Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas.clear Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.html#clear Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphics Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphics-class.html Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphics.__getitem__ Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphics-class.html#__getitem__ Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphics.__init__ Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphics-class.html#__init__ Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphics.__len__ Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphics-class.html#__len__ Scientific.Visualization.Color.Color Scientific.Visualization.Color.Color-class.html Scientific.Visualization.Color.Color.__str__ Scientific.Visualization.Color.Color-class.html#__str__ Scientific.Visualization.Color.Color.__cmp__ Scientific.Visualization.Color.Color-class.html#__cmp__ Scientific.Visualization.Color.Color.__rmul__ Scientific.Visualization.Color.Color-class.html#__rmul__ Scientific.Visualization.Color.Color.__mul__ Scientific.Visualization.Color.Color-class.html#__mul__ Scientific.Visualization.Color.Color.__add__ Scientific.Visualization.Color.Color-class.html#__add__ Scientific.Visualization.Color.Color.__hash__ Scientific.Visualization.Color.Color-class.html#__hash__ Scientific.Visualization.Color.Color.__init__ Scientific.Visualization.Color.Color-class.html#__init__ Scientific.Visualization.Color.Color.__repr__ Scientific.Visualization.Color.Color-class.html#__repr__ Scientific.Visualization.Color.ColorScale Scientific.Visualization.Color.ColorScale-class.html Scientific.Visualization.Color.ColorScale.__call__ Scientific.Visualization.Color.ColorScale-class.html#__call__ Scientific.Visualization.Color.ColorScale.__init__ Scientific.Visualization.Color.ColorScale-class.html#__init__ Scientific.Visualization.Color.SymmetricColorScale Scientific.Visualization.Color.SymmetricColorScale-class.html Scientific.Visualization.Color.SymmetricColorScale.__call__ Scientific.Visualization.Color.SymmetricColorScale-class.html#__call__ Scientific.Visualization.Color.SymmetricColorScale.__init__ Scientific.Visualization.Color.SymmetricColorScale-class.html#__init__ Scientific.Visualization.PyMOL.Arrow Scientific.Visualization.PyMOL.Arrow-class.html Scientific.Visualization.PyMOL.Group.__add__ Scientific.Visualization.PyMOL.Group-class.html#__add__ Scientific.Visualization.PyMOL.Group.__getitem__ Scientific.Visualization.PyMOL.Group-class.html#__getitem__ Scientific.Visualization.PyMOL.Group.__coerce__ Scientific.Visualization.PyMOL.Group-class.html#__coerce__ Scientific.Visualization.PyMOL.Group.is_group Scientific.Visualization.PyMOL.Group-class.html#is_group Scientific.Visualization.PyMOL.Group.__len__ Scientific.Visualization.PyMOL.Group-class.html#__len__ Scientific.Visualization.PyMOL.Arrow.__init__ Scientific.Visualization.PyMOL.Arrow-class.html#__init__ Scientific.Visualization.PyMOL.Group.getPymolObjects Scientific.Visualization.PyMOL.Group-class.html#getPymolObjects Scientific.Visualization.PyMOL.Cone Scientific.Visualization.PyMOL.Cone-class.html Scientific.Visualization.PyMOL.ShapeObject.use Scientific.Visualization.PyMOL.ShapeObject-class.html#use Scientific.Visualization.PyMOL.Cone.cgoObjects Scientific.Visualization.PyMOL.Cone-class.html#cgoObjects Scientific.Visualization.PyMOL.PyMOLObject.__getitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__getitem__ Scientific.Visualization.PyMOL.ShapeObject.attribute_names Scientific.Visualization.PyMOL.ShapeObject-class.html#attribute_names Scientific.Visualization.PyMOL.PyMOLObject.writeToFile Scientific.Visualization.PyMOL.PyMOLObject-class.html#writeToFile Scientific.Visualization.PyMOL.PyMOLObject.__setitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__setitem__ Scientific.Visualization.PyMOL.Cone.__init__ Scientific.Visualization.PyMOL.Cone-class.html#__init__ Scientific.Visualization.PyMOL.ShapeObject.__add__ Scientific.Visualization.PyMOL.ShapeObject-class.html#__add__ Scientific.Visualization.PyMOL.PyMOLObject.__copy__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__copy__ Scientific.Visualization.PyMOL.ShapeObject.getPymolObjects Scientific.Visualization.PyMOL.ShapeObject-class.html#getPymolObjects Scientific.Visualization.PyMOL.Cube Scientific.Visualization.PyMOL.Cube-class.html Scientific.Visualization.PyMOL.ShapeObject.use Scientific.Visualization.PyMOL.ShapeObject-class.html#use Scientific.Visualization.PyMOL.Cube.cgoObjects Scientific.Visualization.PyMOL.Cube-class.html#cgoObjects Scientific.Visualization.PyMOL.PyMOLObject.__getitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__getitem__ Scientific.Visualization.PyMOL.ShapeObject.attribute_names Scientific.Visualization.PyMOL.ShapeObject-class.html#attribute_names Scientific.Visualization.PyMOL.PyMOLObject.writeToFile Scientific.Visualization.PyMOL.PyMOLObject-class.html#writeToFile Scientific.Visualization.PyMOL.PyMOLObject.__setitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__setitem__ Scientific.Visualization.PyMOL.Cube.__init__ Scientific.Visualization.PyMOL.Cube-class.html#__init__ Scientific.Visualization.PyMOL.ShapeObject.__add__ Scientific.Visualization.PyMOL.ShapeObject-class.html#__add__ Scientific.Visualization.PyMOL.PyMOLObject.__copy__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__copy__ Scientific.Visualization.PyMOL.ShapeObject.getPymolObjects Scientific.Visualization.PyMOL.ShapeObject-class.html#getPymolObjects Scientific.Visualization.PyMOL.Cylinder Scientific.Visualization.PyMOL.Cylinder-class.html Scientific.Visualization.PyMOL.ShapeObject.use Scientific.Visualization.PyMOL.ShapeObject-class.html#use Scientific.Visualization.PyMOL.Cylinder.cgoObjects Scientific.Visualization.PyMOL.Cylinder-class.html#cgoObjects Scientific.Visualization.PyMOL.PyMOLObject.__getitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__getitem__ Scientific.Visualization.PyMOL.ShapeObject.attribute_names Scientific.Visualization.PyMOL.ShapeObject-class.html#attribute_names Scientific.Visualization.PyMOL.PyMOLObject.writeToFile Scientific.Visualization.PyMOL.PyMOLObject-class.html#writeToFile Scientific.Visualization.PyMOL.PyMOLObject.__setitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__setitem__ Scientific.Visualization.PyMOL.Cylinder.__init__ Scientific.Visualization.PyMOL.Cylinder-class.html#__init__ Scientific.Visualization.PyMOL.ShapeObject.__add__ Scientific.Visualization.PyMOL.ShapeObject-class.html#__add__ Scientific.Visualization.PyMOL.PyMOLObject.__copy__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__copy__ Scientific.Visualization.PyMOL.ShapeObject.getPymolObjects Scientific.Visualization.PyMOL.ShapeObject-class.html#getPymolObjects Scientific.Visualization.PyMOL.Group Scientific.Visualization.PyMOL.Group-class.html Scientific.Visualization.PyMOL.Group.__getitem__ Scientific.Visualization.PyMOL.Group-class.html#__getitem__ Scientific.Visualization.PyMOL.Group.__coerce__ Scientific.Visualization.PyMOL.Group-class.html#__coerce__ Scientific.Visualization.PyMOL.Group.is_group Scientific.Visualization.PyMOL.Group-class.html#is_group Scientific.Visualization.PyMOL.Group.__len__ Scientific.Visualization.PyMOL.Group-class.html#__len__ Scientific.Visualization.PyMOL.Group.getPymolObjects Scientific.Visualization.PyMOL.Group-class.html#getPymolObjects Scientific.Visualization.PyMOL.Group.__add__ Scientific.Visualization.PyMOL.Group-class.html#__add__ Scientific.Visualization.PyMOL.Group.__init__ Scientific.Visualization.PyMOL.Group-class.html#__init__ Scientific.Visualization.PyMOL.Line Scientific.Visualization.PyMOL.Line-class.html Scientific.Visualization.PyMOL.ShapeObject.use Scientific.Visualization.PyMOL.ShapeObject-class.html#use Scientific.Visualization.PyMOL.Line.cgoObjects Scientific.Visualization.PyMOL.Line-class.html#cgoObjects Scientific.Visualization.PyMOL.PyMOLObject.__getitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__getitem__ Scientific.Visualization.PyMOL.ShapeObject.attribute_names Scientific.Visualization.PyMOL.ShapeObject-class.html#attribute_names Scientific.Visualization.PyMOL.PyMOLObject.writeToFile Scientific.Visualization.PyMOL.PyMOLObject-class.html#writeToFile Scientific.Visualization.PyMOL.PyMOLObject.__setitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__setitem__ Scientific.Visualization.PyMOL.Line.__init__ Scientific.Visualization.PyMOL.Line-class.html#__init__ Scientific.Visualization.PyMOL.ShapeObject.__add__ Scientific.Visualization.PyMOL.ShapeObject-class.html#__add__ Scientific.Visualization.PyMOL.PyMOLObject.__copy__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__copy__ Scientific.Visualization.PyMOL.ShapeObject.getPymolObjects Scientific.Visualization.PyMOL.ShapeObject-class.html#getPymolObjects Scientific.Visualization.PyMOL.Material Scientific.Visualization.PyMOL.Material-class.html Scientific.Visualization.PyMOL.Material.attribute_names Scientific.Visualization.PyMOL.Material-class.html#attribute_names Scientific.Visualization.PyMOL.PyMOLObject.__getitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__getitem__ Scientific.Visualization.PyMOL.PyMOLObject.writeToFile Scientific.Visualization.PyMOL.PyMOLObject-class.html#writeToFile Scientific.Visualization.PyMOL.PyMOLObject.__setitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__setitem__ Scientific.Visualization.PyMOL.Material.getRGB Scientific.Visualization.PyMOL.Material-class.html#getRGB Scientific.Visualization.PyMOL.PyMOLObject.getPymolObjects Scientific.Visualization.PyMOL.PyMOLObject-class.html#getPymolObjects Scientific.Visualization.PyMOL.PyMOLObject.__copy__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__copy__ Scientific.Visualization.PyMOL.Material.__init__ Scientific.Visualization.PyMOL.Material-class.html#__init__ Scientific.Visualization.PyMOL.Molecules Scientific.Visualization.PyMOL.Molecules-class.html Scientific.Visualization.PyMOL.PyMOLObject.attribute_names Scientific.Visualization.PyMOL.PyMOLObject-class.html#attribute_names Scientific.Visualization.PyMOL.PyMOLObject.__getitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__getitem__ Scientific.Visualization.PyMOL.PyMOLObject.writeToFile Scientific.Visualization.PyMOL.PyMOLObject-class.html#writeToFile Scientific.Visualization.PyMOL.PyMOLObject.__setitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__setitem__ Scientific.Visualization.PyMOL.Molecules.getPymolObjects Scientific.Visualization.PyMOL.Molecules-class.html#getPymolObjects Scientific.Visualization.PyMOL.PyMOLObject.__copy__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__copy__ Scientific.Visualization.PyMOL.Molecules.__init__ Scientific.Visualization.PyMOL.Molecules-class.html#__init__ Scientific.Visualization.PyMOL.PyMOLObject Scientific.Visualization.PyMOL.PyMOLObject-class.html Scientific.Visualization.PyMOL.PyMOLObject.attribute_names Scientific.Visualization.PyMOL.PyMOLObject-class.html#attribute_names Scientific.Visualization.PyMOL.PyMOLObject.__getitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__getitem__ Scientific.Visualization.PyMOL.PyMOLObject.writeToFile Scientific.Visualization.PyMOL.PyMOLObject-class.html#writeToFile Scientific.Visualization.PyMOL.PyMOLObject.__setitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__setitem__ Scientific.Visualization.PyMOL.PyMOLObject.__init__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__init__ Scientific.Visualization.PyMOL.PyMOLObject.__copy__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__copy__ Scientific.Visualization.PyMOL.PyMOLObject.getPymolObjects Scientific.Visualization.PyMOL.PyMOLObject-class.html#getPymolObjects Scientific.Visualization.PyMOL.Scene Scientific.Visualization.PyMOL.Scene-class.html Scientific.Visualization.PyMOL.Scene.addObject Scientific.Visualization.PyMOL.Scene-class.html#addObject Scientific.Visualization.PyMOL.Scene.__getitem__ Scientific.Visualization.PyMOL.Scene-class.html#__getitem__ Scientific.Visualization.PyMOL.Scene.writeToFile Scientific.Visualization.PyMOL.Scene-class.html#writeToFile Scientific.Visualization.PyMOL.Scene.__init__ Scientific.Visualization.PyMOL.Scene-class.html#__init__ Scientific.Visualization.PyMOL.Scene.__len__ Scientific.Visualization.PyMOL.Scene-class.html#__len__ Scientific.Visualization.PyMOL.Scene.view Scientific.Visualization.PyMOL.Scene-class.html#view Scientific.Visualization.PyMOL.ShapeObject Scientific.Visualization.PyMOL.ShapeObject-class.html Scientific.Visualization.PyMOL.ShapeObject.use Scientific.Visualization.PyMOL.ShapeObject-class.html#use Scientific.Visualization.PyMOL.PyMOLObject.__getitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__getitem__ Scientific.Visualization.PyMOL.ShapeObject.attribute_names Scientific.Visualization.PyMOL.ShapeObject-class.html#attribute_names Scientific.Visualization.PyMOL.PyMOLObject.writeToFile Scientific.Visualization.PyMOL.PyMOLObject-class.html#writeToFile Scientific.Visualization.PyMOL.PyMOLObject.__setitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__setitem__ Scientific.Visualization.PyMOL.PyMOLObject.__init__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__init__ Scientific.Visualization.PyMOL.ShapeObject.__add__ Scientific.Visualization.PyMOL.ShapeObject-class.html#__add__ Scientific.Visualization.PyMOL.PyMOLObject.__copy__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__copy__ Scientific.Visualization.PyMOL.ShapeObject.getPymolObjects Scientific.Visualization.PyMOL.ShapeObject-class.html#getPymolObjects Scientific.Visualization.PyMOL.Sphere Scientific.Visualization.PyMOL.Sphere-class.html Scientific.Visualization.PyMOL.ShapeObject.use Scientific.Visualization.PyMOL.ShapeObject-class.html#use Scientific.Visualization.PyMOL.Sphere.cgoObjects Scientific.Visualization.PyMOL.Sphere-class.html#cgoObjects Scientific.Visualization.PyMOL.PyMOLObject.__getitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__getitem__ Scientific.Visualization.PyMOL.ShapeObject.attribute_names Scientific.Visualization.PyMOL.ShapeObject-class.html#attribute_names Scientific.Visualization.PyMOL.PyMOLObject.writeToFile Scientific.Visualization.PyMOL.PyMOLObject-class.html#writeToFile Scientific.Visualization.PyMOL.PyMOLObject.__setitem__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__setitem__ Scientific.Visualization.PyMOL.Sphere.__init__ Scientific.Visualization.PyMOL.Sphere-class.html#__init__ Scientific.Visualization.PyMOL.ShapeObject.__add__ Scientific.Visualization.PyMOL.ShapeObject-class.html#__add__ Scientific.Visualization.PyMOL.PyMOLObject.__copy__ Scientific.Visualization.PyMOL.PyMOLObject-class.html#__copy__ Scientific.Visualization.PyMOL.ShapeObject.getPymolObjects Scientific.Visualization.PyMOL.ShapeObject-class.html#getPymolObjects Scientific.Visualization.VMD.Arrow Scientific.Visualization.VMD.Arrow-class.html Scientific.Visualization.VMD.Group.__getitem__ Scientific.Visualization.VMD.Group-class.html#__getitem__ Scientific.Visualization.VMD.Group.__coerce__ Scientific.Visualization.VMD.Group-class.html#__coerce__ Scientific.Visualization.VMD.Group.is_group Scientific.Visualization.VMD.Group-class.html#is_group Scientific.Visualization.VMD.Group.writeToFile Scientific.Visualization.VMD.Group-class.html#writeToFile Scientific.Visualization.VMD.Arrow.__init__ Scientific.Visualization.VMD.Arrow-class.html#__init__ Scientific.Visualization.VMD.Group.__add__ Scientific.Visualization.VMD.Group-class.html#__add__ Scientific.Visualization.VMD.Group.__len__ Scientific.Visualization.VMD.Group-class.html#__len__ Scientific.Visualization.VMD.Cone Scientific.Visualization.VMD.Cone-class.html Scientific.Visualization.VMD.ShapeObject.attribute_names Scientific.Visualization.VMD.ShapeObject-class.html#attribute_names Scientific.Visualization.VMD.VMDObject.__getitem__ Scientific.Visualization.VMD.VMDObject-class.html#__getitem__ Scientific.Visualization.VMD.Cone.writeSpecification Scientific.Visualization.VMD.Cone-class.html#writeSpecification Scientific.Visualization.VMD.ShapeObject.use Scientific.Visualization.VMD.ShapeObject-class.html#use Scientific.Visualization.VMD.ShapeObject.writeToFile Scientific.Visualization.VMD.ShapeObject-class.html#writeToFile Scientific.Visualization.VMD.VMDObject.__setitem__ Scientific.Visualization.VMD.VMDObject-class.html#__setitem__ Scientific.Visualization.VMD.ShapeObject.__add__ Scientific.Visualization.VMD.ShapeObject-class.html#__add__ Scientific.Visualization.VMD.VMDObject.__copy__ Scientific.Visualization.VMD.VMDObject-class.html#__copy__ Scientific.Visualization.VMD.Cone.__init__ Scientific.Visualization.VMD.Cone-class.html#__init__ Scientific.Visualization.VMD.Cube Scientific.Visualization.VMD.Cube-class.html Scientific.Visualization.VMD.ShapeObject.attribute_names Scientific.Visualization.VMD.ShapeObject-class.html#attribute_names Scientific.Visualization.VMD.VMDObject.__getitem__ Scientific.Visualization.VMD.VMDObject-class.html#__getitem__ Scientific.Visualization.VMD.Cube.writeSpecification Scientific.Visualization.VMD.Cube-class.html#writeSpecification Scientific.Visualization.VMD.ShapeObject.use Scientific.Visualization.VMD.ShapeObject-class.html#use Scientific.Visualization.VMD.ShapeObject.writeToFile Scientific.Visualization.VMD.ShapeObject-class.html#writeToFile Scientific.Visualization.VMD.VMDObject.__setitem__ Scientific.Visualization.VMD.VMDObject-class.html#__setitem__ Scientific.Visualization.VMD.ShapeObject.__add__ Scientific.Visualization.VMD.ShapeObject-class.html#__add__ Scientific.Visualization.VMD.VMDObject.__copy__ Scientific.Visualization.VMD.VMDObject-class.html#__copy__ Scientific.Visualization.VMD.Cube.__init__ Scientific.Visualization.VMD.Cube-class.html#__init__ Scientific.Visualization.VMD.Cylinder Scientific.Visualization.VMD.Cylinder-class.html Scientific.Visualization.VMD.ShapeObject.attribute_names Scientific.Visualization.VMD.ShapeObject-class.html#attribute_names Scientific.Visualization.VMD.VMDObject.__getitem__ Scientific.Visualization.VMD.VMDObject-class.html#__getitem__ Scientific.Visualization.VMD.Cylinder.writeSpecification Scientific.Visualization.VMD.Cylinder-class.html#writeSpecification Scientific.Visualization.VMD.ShapeObject.use Scientific.Visualization.VMD.ShapeObject-class.html#use Scientific.Visualization.VMD.ShapeObject.writeToFile Scientific.Visualization.VMD.ShapeObject-class.html#writeToFile Scientific.Visualization.VMD.VMDObject.__setitem__ Scientific.Visualization.VMD.VMDObject-class.html#__setitem__ Scientific.Visualization.VMD.ShapeObject.__add__ Scientific.Visualization.VMD.ShapeObject-class.html#__add__ Scientific.Visualization.VMD.VMDObject.__copy__ Scientific.Visualization.VMD.VMDObject-class.html#__copy__ Scientific.Visualization.VMD.Cylinder.__init__ Scientific.Visualization.VMD.Cylinder-class.html#__init__ Scientific.Visualization.VMD.Group Scientific.Visualization.VMD.Group-class.html Scientific.Visualization.VMD.Group.__getitem__ Scientific.Visualization.VMD.Group-class.html#__getitem__ Scientific.Visualization.VMD.Group.__coerce__ Scientific.Visualization.VMD.Group-class.html#__coerce__ Scientific.Visualization.VMD.Group.is_group Scientific.Visualization.VMD.Group-class.html#is_group Scientific.Visualization.VMD.Group.writeToFile Scientific.Visualization.VMD.Group-class.html#writeToFile Scientific.Visualization.VMD.Group.__len__ Scientific.Visualization.VMD.Group-class.html#__len__ Scientific.Visualization.VMD.Group.__add__ Scientific.Visualization.VMD.Group-class.html#__add__ Scientific.Visualization.VMD.Group.__init__ Scientific.Visualization.VMD.Group-class.html#__init__ Scientific.Visualization.VMD.Line Scientific.Visualization.VMD.Line-class.html Scientific.Visualization.VMD.ShapeObject.attribute_names Scientific.Visualization.VMD.ShapeObject-class.html#attribute_names Scientific.Visualization.VMD.VMDObject.__getitem__ Scientific.Visualization.VMD.VMDObject-class.html#__getitem__ Scientific.Visualization.VMD.Line.writeSpecification Scientific.Visualization.VMD.Line-class.html#writeSpecification Scientific.Visualization.VMD.ShapeObject.use Scientific.Visualization.VMD.ShapeObject-class.html#use Scientific.Visualization.VMD.ShapeObject.writeToFile Scientific.Visualization.VMD.ShapeObject-class.html#writeToFile Scientific.Visualization.VMD.VMDObject.__setitem__ Scientific.Visualization.VMD.VMDObject-class.html#__setitem__ Scientific.Visualization.VMD.ShapeObject.__add__ Scientific.Visualization.VMD.ShapeObject-class.html#__add__ Scientific.Visualization.VMD.VMDObject.__copy__ Scientific.Visualization.VMD.VMDObject-class.html#__copy__ Scientific.Visualization.VMD.Line.__init__ Scientific.Visualization.VMD.Line-class.html#__init__ Scientific.Visualization.VMD.Material Scientific.Visualization.VMD.Material-class.html Scientific.Visualization.VMD.Material.attribute_names Scientific.Visualization.VMD.Material-class.html#attribute_names Scientific.Visualization.VMD.VMDObject.__getitem__ Scientific.Visualization.VMD.VMDObject-class.html#__getitem__ Scientific.Visualization.VMD.Material.writeToFile Scientific.Visualization.VMD.Material-class.html#writeToFile Scientific.Visualization.VMD.VMDObject.__setitem__ Scientific.Visualization.VMD.VMDObject-class.html#__setitem__ Scientific.Visualization.VMD.VMDObject.__copy__ Scientific.Visualization.VMD.VMDObject-class.html#__copy__ Scientific.Visualization.VMD.Material.__init__ Scientific.Visualization.VMD.Material-class.html#__init__ Scientific.Visualization.VMD.Molecules Scientific.Visualization.VMD.Molecules-class.html Scientific.Visualization.VMD.VMDObject.attribute_names Scientific.Visualization.VMD.VMDObject-class.html#attribute_names Scientific.Visualization.VMD.VMDObject.__getitem__ Scientific.Visualization.VMD.VMDObject-class.html#__getitem__ Scientific.Visualization.VMD.Molecules.writeToFile Scientific.Visualization.VMD.Molecules-class.html#writeToFile Scientific.Visualization.VMD.VMDObject.__setitem__ Scientific.Visualization.VMD.VMDObject-class.html#__setitem__ Scientific.Visualization.VMD.VMDObject.__copy__ Scientific.Visualization.VMD.VMDObject-class.html#__copy__ Scientific.Visualization.VMD.Molecules.__init__ Scientific.Visualization.VMD.Molecules-class.html#__init__ Scientific.Visualization.VMD.Scene Scientific.Visualization.VMD.Scene-class.html Scientific.Visualization.VMD.Scene.addObject Scientific.Visualization.VMD.Scene-class.html#addObject Scientific.Visualization.VMD.Scene.__getitem__ Scientific.Visualization.VMD.Scene-class.html#__getitem__ Scientific.Visualization.VMD.Scene.writeToFile Scientific.Visualization.VMD.Scene-class.html#writeToFile Scientific.Visualization.VMD.Scene.__init__ Scientific.Visualization.VMD.Scene-class.html#__init__ Scientific.Visualization.VMD.Scene.__len__ Scientific.Visualization.VMD.Scene-class.html#__len__ Scientific.Visualization.VMD.Scene.view Scientific.Visualization.VMD.Scene-class.html#view Scientific.Visualization.VMD.SceneFile Scientific.Visualization.VMD.SceneFile-class.html Scientific.Visualization.VMD.SceneFile.writeString Scientific.Visualization.VMD.SceneFile-class.html#writeString Scientific.Visualization.VMD.SceneFile.__del__ Scientific.Visualization.VMD.SceneFile-class.html#__del__ Scientific.Visualization.VMD.SceneFile.writeVector Scientific.Visualization.VMD.SceneFile-class.html#writeVector Scientific.Visualization.VMD.SceneFile.write Scientific.Visualization.VMD.SceneFile-class.html#write Scientific.Visualization.VMD.SceneFile.close Scientific.Visualization.VMD.SceneFile-class.html#close Scientific.Visualization.VMD.SceneFile.__init__ Scientific.Visualization.VMD.SceneFile-class.html#__init__ Scientific.Visualization.VMD.ShapeObject Scientific.Visualization.VMD.ShapeObject-class.html Scientific.Visualization.VMD.ShapeObject.use Scientific.Visualization.VMD.ShapeObject-class.html#use Scientific.Visualization.VMD.VMDObject.__getitem__ Scientific.Visualization.VMD.VMDObject-class.html#__getitem__ Scientific.Visualization.VMD.ShapeObject.attribute_names Scientific.Visualization.VMD.ShapeObject-class.html#attribute_names Scientific.Visualization.VMD.ShapeObject.writeToFile Scientific.Visualization.VMD.ShapeObject-class.html#writeToFile Scientific.Visualization.VMD.VMDObject.__setitem__ Scientific.Visualization.VMD.VMDObject-class.html#__setitem__ Scientific.Visualization.VMD.ShapeObject.__add__ Scientific.Visualization.VMD.ShapeObject-class.html#__add__ Scientific.Visualization.VMD.VMDObject.__copy__ Scientific.Visualization.VMD.VMDObject-class.html#__copy__ Scientific.Visualization.VMD.ShapeObject.__init__ Scientific.Visualization.VMD.ShapeObject-class.html#__init__ Scientific.Visualization.VMD.Sphere Scientific.Visualization.VMD.Sphere-class.html Scientific.Visualization.VMD.ShapeObject.attribute_names Scientific.Visualization.VMD.ShapeObject-class.html#attribute_names Scientific.Visualization.VMD.VMDObject.__getitem__ Scientific.Visualization.VMD.VMDObject-class.html#__getitem__ Scientific.Visualization.VMD.Sphere.writeSpecification Scientific.Visualization.VMD.Sphere-class.html#writeSpecification Scientific.Visualization.VMD.ShapeObject.use Scientific.Visualization.VMD.ShapeObject-class.html#use Scientific.Visualization.VMD.ShapeObject.writeToFile Scientific.Visualization.VMD.ShapeObject-class.html#writeToFile Scientific.Visualization.VMD.VMDObject.__setitem__ Scientific.Visualization.VMD.VMDObject-class.html#__setitem__ Scientific.Visualization.VMD.ShapeObject.__add__ Scientific.Visualization.VMD.ShapeObject-class.html#__add__ Scientific.Visualization.VMD.VMDObject.__copy__ Scientific.Visualization.VMD.VMDObject-class.html#__copy__ Scientific.Visualization.VMD.Sphere.__init__ Scientific.Visualization.VMD.Sphere-class.html#__init__ Scientific.Visualization.VMD.VMDObject Scientific.Visualization.VMD.VMDObject-class.html Scientific.Visualization.VMD.VMDObject.attribute_names Scientific.Visualization.VMD.VMDObject-class.html#attribute_names Scientific.Visualization.VMD.VMDObject.__getitem__ Scientific.Visualization.VMD.VMDObject-class.html#__getitem__ Scientific.Visualization.VMD.VMDObject.writeToFile Scientific.Visualization.VMD.VMDObject-class.html#writeToFile Scientific.Visualization.VMD.VMDObject.__setitem__ Scientific.Visualization.VMD.VMDObject-class.html#__setitem__ Scientific.Visualization.VMD.VMDObject.__copy__ Scientific.Visualization.VMD.VMDObject-class.html#__copy__ Scientific.Visualization.VMD.VMDObject.__init__ Scientific.Visualization.VMD.VMDObject-class.html#__init__ Scientific.Visualization.VPython.Arrow Scientific.Visualization.VPython.Arrow-class.html Scientific.Visualization.VPython.ShapeObject.attribute_names Scientific.Visualization.VPython.ShapeObject-class.html#attribute_names Scientific.Visualization.VPython.GraphicsObject.__getitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__getitem__ Scientific.Visualization.VPython.Arrow.show Scientific.Visualization.VPython.Arrow-class.html#show Scientific.Visualization.VPython.GraphicsObject.__setitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__setitem__ Scientific.Visualization.VPython.ShapeObject.__add__ Scientific.Visualization.VPython.ShapeObject-class.html#__add__ Scientific.Visualization.VPython.GraphicsObject.__copy__ Scientific.Visualization.VPython.GraphicsObject-class.html#__copy__ Scientific.Visualization.VPython.ShapeObject.display Scientific.Visualization.VPython.ShapeObject-class.html#display Scientific.Visualization.VPython.Arrow.__init__ Scientific.Visualization.VPython.Arrow-class.html#__init__ Scientific.Visualization.VPython.Cone Scientific.Visualization.VPython.Cone-class.html Scientific.Visualization.VPython.Cone.attribute_names Scientific.Visualization.VPython.Cone-class.html#attribute_names Scientific.Visualization.VPython.GraphicsObject.__getitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__getitem__ Scientific.Visualization.VPython.Cone.show Scientific.Visualization.VPython.Cone-class.html#show Scientific.Visualization.VPython.GraphicsObject.__setitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__setitem__ Scientific.Visualization.VPython.ShapeObject.__add__ Scientific.Visualization.VPython.ShapeObject-class.html#__add__ Scientific.Visualization.VPython.GraphicsObject.__copy__ Scientific.Visualization.VPython.GraphicsObject-class.html#__copy__ Scientific.Visualization.VPython.ShapeObject.display Scientific.Visualization.VPython.ShapeObject-class.html#display Scientific.Visualization.VPython.Cone.__init__ Scientific.Visualization.VPython.Cone-class.html#__init__ Scientific.Visualization.VPython.Cube Scientific.Visualization.VPython.Cube-class.html Scientific.Visualization.VPython.ShapeObject.attribute_names Scientific.Visualization.VPython.ShapeObject-class.html#attribute_names Scientific.Visualization.VPython.GraphicsObject.__getitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__getitem__ Scientific.Visualization.VPython.Cube.show Scientific.Visualization.VPython.Cube-class.html#show Scientific.Visualization.VPython.GraphicsObject.__setitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__setitem__ Scientific.Visualization.VPython.ShapeObject.__add__ Scientific.Visualization.VPython.ShapeObject-class.html#__add__ Scientific.Visualization.VPython.GraphicsObject.__copy__ Scientific.Visualization.VPython.GraphicsObject-class.html#__copy__ Scientific.Visualization.VPython.ShapeObject.display Scientific.Visualization.VPython.ShapeObject-class.html#display Scientific.Visualization.VPython.Cube.__init__ Scientific.Visualization.VPython.Cube-class.html#__init__ Scientific.Visualization.VPython.Cylinder Scientific.Visualization.VPython.Cylinder-class.html Scientific.Visualization.VPython.Cylinder.attribute_names Scientific.Visualization.VPython.Cylinder-class.html#attribute_names Scientific.Visualization.VPython.GraphicsObject.__getitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__getitem__ Scientific.Visualization.VPython.Cylinder.show Scientific.Visualization.VPython.Cylinder-class.html#show Scientific.Visualization.VPython.GraphicsObject.__setitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__setitem__ Scientific.Visualization.VPython.ShapeObject.__add__ Scientific.Visualization.VPython.ShapeObject-class.html#__add__ Scientific.Visualization.VPython.GraphicsObject.__copy__ Scientific.Visualization.VPython.GraphicsObject-class.html#__copy__ Scientific.Visualization.VPython.ShapeObject.display Scientific.Visualization.VPython.ShapeObject-class.html#display Scientific.Visualization.VPython.Cylinder.__init__ Scientific.Visualization.VPython.Cylinder-class.html#__init__ Scientific.Visualization.VPython.GraphicsObject Scientific.Visualization.VPython.GraphicsObject-class.html Scientific.Visualization.VPython.GraphicsObject.__init__ Scientific.Visualization.VPython.GraphicsObject-class.html#__init__ Scientific.Visualization.VPython.GraphicsObject.attribute_names Scientific.Visualization.VPython.GraphicsObject-class.html#attribute_names Scientific.Visualization.VPython.GraphicsObject.__copy__ Scientific.Visualization.VPython.GraphicsObject-class.html#__copy__ Scientific.Visualization.VPython.GraphicsObject.__setitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__setitem__ Scientific.Visualization.VPython.GraphicsObject.__getitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__getitem__ Scientific.Visualization.VPython.Group Scientific.Visualization.VPython.Group-class.html Scientific.Visualization.VPython.Group.__getitem__ Scientific.Visualization.VPython.Group-class.html#__getitem__ Scientific.Visualization.VPython.Group.show Scientific.Visualization.VPython.Group-class.html#show Scientific.Visualization.VPython.Group.__coerce__ Scientific.Visualization.VPython.Group-class.html#__coerce__ Scientific.Visualization.VPython.Group.is_group Scientific.Visualization.VPython.Group-class.html#is_group Scientific.Visualization.VPython.Group.__len__ Scientific.Visualization.VPython.Group-class.html#__len__ Scientific.Visualization.VPython.Group.__add__ Scientific.Visualization.VPython.Group-class.html#__add__ Scientific.Visualization.VPython.Group.__init__ Scientific.Visualization.VPython.Group-class.html#__init__ Scientific.Visualization.VPython.Line Scientific.Visualization.VPython.Line-class.html Scientific.Visualization.VPython.ShapeObject.attribute_names Scientific.Visualization.VPython.ShapeObject-class.html#attribute_names Scientific.Visualization.VPython.GraphicsObject.__getitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__getitem__ Scientific.Visualization.VPython.PolyLines.show Scientific.Visualization.VPython.PolyLines-class.html#show Scientific.Visualization.VPython.GraphicsObject.__setitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__setitem__ Scientific.Visualization.VPython.ShapeObject.__add__ Scientific.Visualization.VPython.ShapeObject-class.html#__add__ Scientific.Visualization.VPython.GraphicsObject.__copy__ Scientific.Visualization.VPython.GraphicsObject-class.html#__copy__ Scientific.Visualization.VPython.ShapeObject.display Scientific.Visualization.VPython.ShapeObject-class.html#display Scientific.Visualization.VPython.Line.__init__ Scientific.Visualization.VPython.Line-class.html#__init__ Scientific.Visualization.VPython.Material Scientific.Visualization.VPython.Material-class.html Scientific.Visualization.VPython.Material.attribute_names Scientific.Visualization.VPython.Material-class.html#attribute_names Scientific.Visualization.VPython.GraphicsObject.__copy__ Scientific.Visualization.VPython.GraphicsObject-class.html#__copy__ Scientific.Visualization.VPython.GraphicsObject.__getitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__getitem__ Scientific.Visualization.VPython.GraphicsObject.__setitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__setitem__ Scientific.Visualization.VPython.Material.__init__ Scientific.Visualization.VPython.Material-class.html#__init__ Scientific.Visualization.VPython.PolyLines Scientific.Visualization.VPython.PolyLines-class.html Scientific.Visualization.VPython.ShapeObject.attribute_names Scientific.Visualization.VPython.ShapeObject-class.html#attribute_names Scientific.Visualization.VPython.GraphicsObject.__getitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__getitem__ Scientific.Visualization.VPython.PolyLines.show Scientific.Visualization.VPython.PolyLines-class.html#show Scientific.Visualization.VPython.GraphicsObject.__setitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__setitem__ Scientific.Visualization.VPython.ShapeObject.__add__ Scientific.Visualization.VPython.ShapeObject-class.html#__add__ Scientific.Visualization.VPython.GraphicsObject.__copy__ Scientific.Visualization.VPython.GraphicsObject-class.html#__copy__ Scientific.Visualization.VPython.ShapeObject.display Scientific.Visualization.VPython.ShapeObject-class.html#display Scientific.Visualization.VPython.PolyLines.__init__ Scientific.Visualization.VPython.PolyLines-class.html#__init__ Scientific.Visualization.VPython.Polygons Scientific.Visualization.VPython.Polygons-class.html Scientific.Visualization.VPython.ShapeObject.attribute_names Scientific.Visualization.VPython.ShapeObject-class.html#attribute_names Scientific.Visualization.VPython.GraphicsObject.__getitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__getitem__ Scientific.Visualization.VPython.Polygons.show Scientific.Visualization.VPython.Polygons-class.html#show Scientific.Visualization.VPython.GraphicsObject.__setitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__setitem__ Scientific.Visualization.VPython.ShapeObject.__add__ Scientific.Visualization.VPython.ShapeObject-class.html#__add__ Scientific.Visualization.VPython.GraphicsObject.__copy__ Scientific.Visualization.VPython.GraphicsObject-class.html#__copy__ Scientific.Visualization.VPython.ShapeObject.display Scientific.Visualization.VPython.ShapeObject-class.html#display Scientific.Visualization.VPython.Polygons.__init__ Scientific.Visualization.VPython.Polygons-class.html#__init__ Scientific.Visualization.VPython.Scene Scientific.Visualization.VPython.Scene-class.html Scientific.Visualization.VPython.Scene.addObject Scientific.Visualization.VPython.Scene-class.html#addObject Scientific.Visualization.VPython.Scene.__len__ Scientific.Visualization.VPython.Scene-class.html#__len__ Scientific.Visualization.VPython.Scene.__init__ Scientific.Visualization.VPython.Scene-class.html#__init__ Scientific.Visualization.VPython.Scene.__getitem__ Scientific.Visualization.VPython.Scene-class.html#__getitem__ Scientific.Visualization.VPython.Scene.view Scientific.Visualization.VPython.Scene-class.html#view Scientific.Visualization.VPython.ShapeObject Scientific.Visualization.VPython.ShapeObject-class.html Scientific.Visualization.VPython.ShapeObject.attribute_names Scientific.Visualization.VPython.ShapeObject-class.html#attribute_names Scientific.Visualization.VPython.GraphicsObject.__getitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__getitem__ Scientific.Visualization.VPython.GraphicsObject.__setitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__setitem__ Scientific.Visualization.VPython.ShapeObject.__add__ Scientific.Visualization.VPython.ShapeObject-class.html#__add__ Scientific.Visualization.VPython.GraphicsObject.__copy__ Scientific.Visualization.VPython.GraphicsObject-class.html#__copy__ Scientific.Visualization.VPython.ShapeObject.display Scientific.Visualization.VPython.ShapeObject-class.html#display Scientific.Visualization.VPython.GraphicsObject.__init__ Scientific.Visualization.VPython.GraphicsObject-class.html#__init__ Scientific.Visualization.VPython.Sphere Scientific.Visualization.VPython.Sphere-class.html Scientific.Visualization.VPython.ShapeObject.attribute_names Scientific.Visualization.VPython.ShapeObject-class.html#attribute_names Scientific.Visualization.VPython.GraphicsObject.__getitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__getitem__ Scientific.Visualization.VPython.Sphere.show Scientific.Visualization.VPython.Sphere-class.html#show Scientific.Visualization.VPython.GraphicsObject.__setitem__ Scientific.Visualization.VPython.GraphicsObject-class.html#__setitem__ Scientific.Visualization.VPython.ShapeObject.__add__ Scientific.Visualization.VPython.ShapeObject-class.html#__add__ Scientific.Visualization.VPython.GraphicsObject.__copy__ Scientific.Visualization.VPython.GraphicsObject-class.html#__copy__ Scientific.Visualization.VPython.ShapeObject.display Scientific.Visualization.VPython.ShapeObject-class.html#display Scientific.Visualization.VPython.Sphere.__init__ Scientific.Visualization.VPython.Sphere-class.html#__init__ Scientific.Visualization.VRML.Arrow Scientific.Visualization.VRML.Arrow-class.html Scientific.Visualization.VRML.Group.__getitem__ Scientific.Visualization.VRML.Group-class.html#__getitem__ Scientific.Visualization.VRML.Group.__coerce__ Scientific.Visualization.VRML.Group-class.html#__coerce__ Scientific.Visualization.VRML.Group.is_group Scientific.Visualization.VRML.Group-class.html#is_group Scientific.Visualization.VRML.Group.writeToFile Scientific.Visualization.VRML.Group-class.html#writeToFile Scientific.Visualization.VRML.Arrow.__init__ Scientific.Visualization.VRML.Arrow-class.html#__init__ Scientific.Visualization.VRML.Group.__add__ Scientific.Visualization.VRML.Group-class.html#__add__ Scientific.Visualization.VRML.Group.__len__ Scientific.Visualization.VRML.Group-class.html#__len__ Scientific.Visualization.VRML.Cone Scientific.Visualization.VRML.Cone-class.html Scientific.Visualization.VRML.ShapeObject.attribute_names Scientific.Visualization.VRML.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML.VRMLObject.__getitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML.Cone.writeSpecification Scientific.Visualization.VRML.Cone-class.html#writeSpecification Scientific.Visualization.VRML.Cone.memoKey Scientific.Visualization.VRML.Cone-class.html#memoKey Scientific.Visualization.VRML.ShapeObject.use Scientific.Visualization.VRML.ShapeObject-class.html#use Scientific.Visualization.VRML.ShapeObject.writeToFile Scientific.Visualization.VRML.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML.VRMLObject.__setitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML.ShapeObject.__add__ Scientific.Visualization.VRML.ShapeObject-class.html#__add__ Scientific.Visualization.VRML.VRMLObject.__copy__ Scientific.Visualization.VRML.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML.Cone.__init__ Scientific.Visualization.VRML.Cone-class.html#__init__ Scientific.Visualization.VRML.Cube Scientific.Visualization.VRML.Cube-class.html Scientific.Visualization.VRML.ShapeObject.attribute_names Scientific.Visualization.VRML.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML.VRMLObject.__getitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML.Cube.writeSpecification Scientific.Visualization.VRML.Cube-class.html#writeSpecification Scientific.Visualization.VRML.Cube.memoKey Scientific.Visualization.VRML.Cube-class.html#memoKey Scientific.Visualization.VRML.ShapeObject.use Scientific.Visualization.VRML.ShapeObject-class.html#use Scientific.Visualization.VRML.ShapeObject.writeToFile Scientific.Visualization.VRML.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML.VRMLObject.__setitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML.ShapeObject.__add__ Scientific.Visualization.VRML.ShapeObject-class.html#__add__ Scientific.Visualization.VRML.VRMLObject.__copy__ Scientific.Visualization.VRML.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML.Cube.__init__ Scientific.Visualization.VRML.Cube-class.html#__init__ Scientific.Visualization.VRML.Cylinder Scientific.Visualization.VRML.Cylinder-class.html Scientific.Visualization.VRML.ShapeObject.attribute_names Scientific.Visualization.VRML.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML.VRMLObject.__getitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML.Cylinder.writeSpecification Scientific.Visualization.VRML.Cylinder-class.html#writeSpecification Scientific.Visualization.VRML.Cylinder.memoKey Scientific.Visualization.VRML.Cylinder-class.html#memoKey Scientific.Visualization.VRML.ShapeObject.use Scientific.Visualization.VRML.ShapeObject-class.html#use Scientific.Visualization.VRML.ShapeObject.writeToFile Scientific.Visualization.VRML.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML.VRMLObject.__setitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML.ShapeObject.__add__ Scientific.Visualization.VRML.ShapeObject-class.html#__add__ Scientific.Visualization.VRML.VRMLObject.__copy__ Scientific.Visualization.VRML.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML.Cylinder.__init__ Scientific.Visualization.VRML.Cylinder-class.html#__init__ Scientific.Visualization.VRML.Group Scientific.Visualization.VRML.Group-class.html Scientific.Visualization.VRML.Group.__getitem__ Scientific.Visualization.VRML.Group-class.html#__getitem__ Scientific.Visualization.VRML.Group.__coerce__ Scientific.Visualization.VRML.Group-class.html#__coerce__ Scientific.Visualization.VRML.Group.is_group Scientific.Visualization.VRML.Group-class.html#is_group Scientific.Visualization.VRML.Group.writeToFile Scientific.Visualization.VRML.Group-class.html#writeToFile Scientific.Visualization.VRML.Group.__len__ Scientific.Visualization.VRML.Group-class.html#__len__ Scientific.Visualization.VRML.Group.__add__ Scientific.Visualization.VRML.Group-class.html#__add__ Scientific.Visualization.VRML.Group.__init__ Scientific.Visualization.VRML.Group-class.html#__init__ Scientific.Visualization.VRML.Line Scientific.Visualization.VRML.Line-class.html Scientific.Visualization.VRML.ShapeObject.attribute_names Scientific.Visualization.VRML.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML.VRMLObject.__getitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML.Line.writeSpecification Scientific.Visualization.VRML.Line-class.html#writeSpecification Scientific.Visualization.VRML.Line.memoKey Scientific.Visualization.VRML.Line-class.html#memoKey Scientific.Visualization.VRML.ShapeObject.use Scientific.Visualization.VRML.ShapeObject-class.html#use Scientific.Visualization.VRML.ShapeObject.writeToFile Scientific.Visualization.VRML.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML.VRMLObject.__setitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML.ShapeObject.__add__ Scientific.Visualization.VRML.ShapeObject-class.html#__add__ Scientific.Visualization.VRML.VRMLObject.__copy__ Scientific.Visualization.VRML.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML.Line.__init__ Scientific.Visualization.VRML.Line-class.html#__init__ Scientific.Visualization.VRML.LinearOrientedObject Scientific.Visualization.VRML.LinearOrientedObject-class.html Scientific.Visualization.VRML.ShapeObject.use Scientific.Visualization.VRML.ShapeObject-class.html#use Scientific.Visualization.VRML.VRMLObject.__getitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML.ShapeObject.attribute_names Scientific.Visualization.VRML.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML.ShapeObject.writeToFile Scientific.Visualization.VRML.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML.VRMLObject.__setitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML.ShapeObject.__add__ Scientific.Visualization.VRML.ShapeObject-class.html#__add__ Scientific.Visualization.VRML.VRMLObject.__copy__ Scientific.Visualization.VRML.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML.LinearOrientedObject.__init__ Scientific.Visualization.VRML.LinearOrientedObject-class.html#__init__ Scientific.Visualization.VRML.Material Scientific.Visualization.VRML.Material-class.html Scientific.Visualization.VRML.Material.use Scientific.Visualization.VRML.Material-class.html#use Scientific.Visualization.VRML.VRMLObject.__copy__ Scientific.Visualization.VRML.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML.VRMLObject.__getitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML.Material.attribute_names Scientific.Visualization.VRML.Material-class.html#attribute_names Scientific.Visualization.VRML.Material.writeToFile Scientific.Visualization.VRML.Material-class.html#writeToFile Scientific.Visualization.VRML.VRMLObject.__setitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML.Material.attribute_conversion Scientific.Visualization.VRML.Material-class.html#attribute_conversion Scientific.Visualization.VRML.Material.__init__ Scientific.Visualization.VRML.Material-class.html#__init__ Scientific.Visualization.VRML.PolyLines Scientific.Visualization.VRML.PolyLines-class.html Scientific.Visualization.VRML.ShapeObject.attribute_names Scientific.Visualization.VRML.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML.VRMLObject.__getitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML.PolyLines.writeSpecification Scientific.Visualization.VRML.PolyLines-class.html#writeSpecification Scientific.Visualization.VRML.PolyLines.memoKey Scientific.Visualization.VRML.PolyLines-class.html#memoKey Scientific.Visualization.VRML.ShapeObject.use Scientific.Visualization.VRML.ShapeObject-class.html#use Scientific.Visualization.VRML.ShapeObject.writeToFile Scientific.Visualization.VRML.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML.VRMLObject.__setitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML.ShapeObject.__add__ Scientific.Visualization.VRML.ShapeObject-class.html#__add__ Scientific.Visualization.VRML.VRMLObject.__copy__ Scientific.Visualization.VRML.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML.PolyLines.__init__ Scientific.Visualization.VRML.PolyLines-class.html#__init__ Scientific.Visualization.VRML.Polygons Scientific.Visualization.VRML.Polygons-class.html Scientific.Visualization.VRML.ShapeObject.attribute_names Scientific.Visualization.VRML.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML.VRMLObject.__getitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML.Polygons.writeSpecification Scientific.Visualization.VRML.Polygons-class.html#writeSpecification Scientific.Visualization.VRML.Polygons.memoKey Scientific.Visualization.VRML.Polygons-class.html#memoKey Scientific.Visualization.VRML.ShapeObject.use Scientific.Visualization.VRML.ShapeObject-class.html#use Scientific.Visualization.VRML.ShapeObject.writeToFile Scientific.Visualization.VRML.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML.VRMLObject.__setitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML.ShapeObject.__add__ Scientific.Visualization.VRML.ShapeObject-class.html#__add__ Scientific.Visualization.VRML.VRMLObject.__copy__ Scientific.Visualization.VRML.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML.Polygons.__init__ Scientific.Visualization.VRML.Polygons-class.html#__init__ Scientific.Visualization.VRML.Scene Scientific.Visualization.VRML.Scene-class.html Scientific.Visualization.VRML.Scene.addObject Scientific.Visualization.VRML.Scene-class.html#addObject Scientific.Visualization.VRML.Scene.addCamera Scientific.Visualization.VRML.Scene-class.html#addCamera Scientific.Visualization.VRML.Scene.__getitem__ Scientific.Visualization.VRML.Scene-class.html#__getitem__ Scientific.Visualization.VRML.Scene.writeToFile Scientific.Visualization.VRML.Scene-class.html#writeToFile Scientific.Visualization.VRML.Scene.__len__ Scientific.Visualization.VRML.Scene-class.html#__len__ Scientific.Visualization.VRML.Scene.__init__ Scientific.Visualization.VRML.Scene-class.html#__init__ Scientific.Visualization.VRML.Scene.view Scientific.Visualization.VRML.Scene-class.html#view Scientific.Visualization.VRML.SceneFile Scientific.Visualization.VRML.SceneFile-class.html Scientific.Visualization.VRML.SceneFile.writeString Scientific.Visualization.VRML.SceneFile-class.html#writeString Scientific.Visualization.VRML.SceneFile.__del__ Scientific.Visualization.VRML.SceneFile-class.html#__del__ Scientific.Visualization.VRML.SceneFile.write Scientific.Visualization.VRML.SceneFile-class.html#write Scientific.Visualization.VRML.SceneFile.uniqueName Scientific.Visualization.VRML.SceneFile-class.html#uniqueName Scientific.Visualization.VRML.SceneFile.close Scientific.Visualization.VRML.SceneFile-class.html#close Scientific.Visualization.VRML.SceneFile.__init__ Scientific.Visualization.VRML.SceneFile-class.html#__init__ Scientific.Visualization.VRML.ShapeObject Scientific.Visualization.VRML.ShapeObject-class.html Scientific.Visualization.VRML.ShapeObject.use Scientific.Visualization.VRML.ShapeObject-class.html#use Scientific.Visualization.VRML.VRMLObject.__getitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML.ShapeObject.attribute_names Scientific.Visualization.VRML.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML.ShapeObject.writeToFile Scientific.Visualization.VRML.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML.VRMLObject.__setitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML.ShapeObject.__add__ Scientific.Visualization.VRML.ShapeObject-class.html#__add__ Scientific.Visualization.VRML.VRMLObject.__copy__ Scientific.Visualization.VRML.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML.ShapeObject.__init__ Scientific.Visualization.VRML.ShapeObject-class.html#__init__ Scientific.Visualization.VRML.Sphere Scientific.Visualization.VRML.Sphere-class.html Scientific.Visualization.VRML.ShapeObject.attribute_names Scientific.Visualization.VRML.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML.VRMLObject.__getitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML.Sphere.writeSpecification Scientific.Visualization.VRML.Sphere-class.html#writeSpecification Scientific.Visualization.VRML.Sphere.memoKey Scientific.Visualization.VRML.Sphere-class.html#memoKey Scientific.Visualization.VRML.ShapeObject.use Scientific.Visualization.VRML.ShapeObject-class.html#use Scientific.Visualization.VRML.ShapeObject.writeToFile Scientific.Visualization.VRML.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML.VRMLObject.__setitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML.ShapeObject.__add__ Scientific.Visualization.VRML.ShapeObject-class.html#__add__ Scientific.Visualization.VRML.VRMLObject.__copy__ Scientific.Visualization.VRML.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML.Sphere.__init__ Scientific.Visualization.VRML.Sphere-class.html#__init__ Scientific.Visualization.VRML.VRMLObject Scientific.Visualization.VRML.VRMLObject-class.html Scientific.Visualization.VRML.VRMLObject.attribute_names Scientific.Visualization.VRML.VRMLObject-class.html#attribute_names Scientific.Visualization.VRML.VRMLObject.__getitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML.VRMLObject.writeToFile Scientific.Visualization.VRML.VRMLObject-class.html#writeToFile Scientific.Visualization.VRML.VRMLObject.__setitem__ Scientific.Visualization.VRML.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML.VRMLObject.__copy__ Scientific.Visualization.VRML.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML.VRMLObject.__init__ Scientific.Visualization.VRML.VRMLObject-class.html#__init__ Scientific.Visualization.VRML2.Arrow Scientific.Visualization.VRML2.Arrow-class.html Scientific.Visualization.VRML2.Group.__getitem__ Scientific.Visualization.VRML2.Group-class.html#__getitem__ Scientific.Visualization.VRML2.Group.__coerce__ Scientific.Visualization.VRML2.Group-class.html#__coerce__ Scientific.Visualization.VRML2.Group.is_group Scientific.Visualization.VRML2.Group-class.html#is_group Scientific.Visualization.VRML2.Group.writeToFile Scientific.Visualization.VRML2.Group-class.html#writeToFile Scientific.Visualization.VRML2.Arrow.__init__ Scientific.Visualization.VRML2.Arrow-class.html#__init__ Scientific.Visualization.VRML2.Group.__add__ Scientific.Visualization.VRML2.Group-class.html#__add__ Scientific.Visualization.VRML2.Group.__len__ Scientific.Visualization.VRML2.Group-class.html#__len__ Scientific.Visualization.VRML2.Camera Scientific.Visualization.VRML2.Camera-class.html Scientific.Visualization.VRML2.Camera.__init__ Scientific.Visualization.VRML2.Camera-class.html#__init__ Scientific.Visualization.VRML2.Camera.writeToFile Scientific.Visualization.VRML2.Camera-class.html#writeToFile Scientific.Visualization.VRML2.Cone Scientific.Visualization.VRML2.Cone-class.html Scientific.Visualization.VRML2.ShapeObject.attribute_names Scientific.Visualization.VRML2.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML2.VRMLObject.__getitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML2.Cone.writeSpecification Scientific.Visualization.VRML2.Cone-class.html#writeSpecification Scientific.Visualization.VRML2.Cone.memoKey Scientific.Visualization.VRML2.Cone-class.html#memoKey Scientific.Visualization.VRML2.ShapeObject.use Scientific.Visualization.VRML2.ShapeObject-class.html#use Scientific.Visualization.VRML2.ShapeObject.writeToFile Scientific.Visualization.VRML2.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML2.VRMLObject.__setitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML2.ShapeObject.__add__ Scientific.Visualization.VRML2.ShapeObject-class.html#__add__ Scientific.Visualization.VRML2.VRMLObject.__copy__ Scientific.Visualization.VRML2.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML2.Cone.__init__ Scientific.Visualization.VRML2.Cone-class.html#__init__ Scientific.Visualization.VRML2.Cube Scientific.Visualization.VRML2.Cube-class.html Scientific.Visualization.VRML2.ShapeObject.attribute_names Scientific.Visualization.VRML2.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML2.VRMLObject.__getitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML2.Cube.writeSpecification Scientific.Visualization.VRML2.Cube-class.html#writeSpecification Scientific.Visualization.VRML2.Cube.memoKey Scientific.Visualization.VRML2.Cube-class.html#memoKey Scientific.Visualization.VRML2.ShapeObject.use Scientific.Visualization.VRML2.ShapeObject-class.html#use Scientific.Visualization.VRML2.ShapeObject.writeToFile Scientific.Visualization.VRML2.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML2.VRMLObject.__setitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML2.ShapeObject.__add__ Scientific.Visualization.VRML2.ShapeObject-class.html#__add__ Scientific.Visualization.VRML2.VRMLObject.__copy__ Scientific.Visualization.VRML2.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML2.Cube.__init__ Scientific.Visualization.VRML2.Cube-class.html#__init__ Scientific.Visualization.VRML2.Cylinder Scientific.Visualization.VRML2.Cylinder-class.html Scientific.Visualization.VRML2.ShapeObject.attribute_names Scientific.Visualization.VRML2.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML2.VRMLObject.__getitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML2.Cylinder.writeSpecification Scientific.Visualization.VRML2.Cylinder-class.html#writeSpecification Scientific.Visualization.VRML2.Cylinder.memoKey Scientific.Visualization.VRML2.Cylinder-class.html#memoKey Scientific.Visualization.VRML2.ShapeObject.use Scientific.Visualization.VRML2.ShapeObject-class.html#use Scientific.Visualization.VRML2.ShapeObject.writeToFile Scientific.Visualization.VRML2.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML2.VRMLObject.__setitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML2.ShapeObject.__add__ Scientific.Visualization.VRML2.ShapeObject-class.html#__add__ Scientific.Visualization.VRML2.VRMLObject.__copy__ Scientific.Visualization.VRML2.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML2.Cylinder.__init__ Scientific.Visualization.VRML2.Cylinder-class.html#__init__ Scientific.Visualization.VRML2.Group Scientific.Visualization.VRML2.Group-class.html Scientific.Visualization.VRML2.Group.__getitem__ Scientific.Visualization.VRML2.Group-class.html#__getitem__ Scientific.Visualization.VRML2.Group.__coerce__ Scientific.Visualization.VRML2.Group-class.html#__coerce__ Scientific.Visualization.VRML2.Group.is_group Scientific.Visualization.VRML2.Group-class.html#is_group Scientific.Visualization.VRML2.Group.writeToFile Scientific.Visualization.VRML2.Group-class.html#writeToFile Scientific.Visualization.VRML2.Group.__len__ Scientific.Visualization.VRML2.Group-class.html#__len__ Scientific.Visualization.VRML2.Group.__add__ Scientific.Visualization.VRML2.Group-class.html#__add__ Scientific.Visualization.VRML2.Group.__init__ Scientific.Visualization.VRML2.Group-class.html#__init__ Scientific.Visualization.VRML2.Line Scientific.Visualization.VRML2.Line-class.html Scientific.Visualization.VRML2.ShapeObject.attribute_names Scientific.Visualization.VRML2.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML2.VRMLObject.__getitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML2.Line.writeSpecification Scientific.Visualization.VRML2.Line-class.html#writeSpecification Scientific.Visualization.VRML2.Line.memoKey Scientific.Visualization.VRML2.Line-class.html#memoKey Scientific.Visualization.VRML2.ShapeObject.use Scientific.Visualization.VRML2.ShapeObject-class.html#use Scientific.Visualization.VRML2.ShapeObject.writeToFile Scientific.Visualization.VRML2.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML2.VRMLObject.__setitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML2.ShapeObject.__add__ Scientific.Visualization.VRML2.ShapeObject-class.html#__add__ Scientific.Visualization.VRML2.VRMLObject.__copy__ Scientific.Visualization.VRML2.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML2.Line.__init__ Scientific.Visualization.VRML2.Line-class.html#__init__ Scientific.Visualization.VRML2.LinearOrientedObject Scientific.Visualization.VRML2.LinearOrientedObject-class.html Scientific.Visualization.VRML2.ShapeObject.use Scientific.Visualization.VRML2.ShapeObject-class.html#use Scientific.Visualization.VRML2.VRMLObject.__getitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML2.ShapeObject.attribute_names Scientific.Visualization.VRML2.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML2.ShapeObject.writeToFile Scientific.Visualization.VRML2.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML2.VRMLObject.__setitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML2.ShapeObject.__add__ Scientific.Visualization.VRML2.ShapeObject-class.html#__add__ Scientific.Visualization.VRML2.VRMLObject.__copy__ Scientific.Visualization.VRML2.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML2.LinearOrientedObject.__init__ Scientific.Visualization.VRML2.LinearOrientedObject-class.html#__init__ Scientific.Visualization.VRML2.Material Scientific.Visualization.VRML2.Material-class.html Scientific.Visualization.VRML2.Material.use Scientific.Visualization.VRML2.Material-class.html#use Scientific.Visualization.VRML2.VRMLObject.__copy__ Scientific.Visualization.VRML2.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML2.VRMLObject.__getitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML2.Material.attribute_names Scientific.Visualization.VRML2.Material-class.html#attribute_names Scientific.Visualization.VRML2.Material.writeToFile Scientific.Visualization.VRML2.Material-class.html#writeToFile Scientific.Visualization.VRML2.VRMLObject.__setitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML2.Material.attribute_conversion Scientific.Visualization.VRML2.Material-class.html#attribute_conversion Scientific.Visualization.VRML2.Material.__init__ Scientific.Visualization.VRML2.Material-class.html#__init__ Scientific.Visualization.VRML2.NavigationInfo Scientific.Visualization.VRML2.NavigationInfo-class.html Scientific.Visualization.VRML2.NavigationInfo.__init__ Scientific.Visualization.VRML2.NavigationInfo-class.html#__init__ Scientific.Visualization.VRML2.NavigationInfo.writeToFile Scientific.Visualization.VRML2.NavigationInfo-class.html#writeToFile Scientific.Visualization.VRML2.PolyLines Scientific.Visualization.VRML2.PolyLines-class.html Scientific.Visualization.VRML2.ShapeObject.attribute_names Scientific.Visualization.VRML2.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML2.VRMLObject.__getitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML2.PolyLines.writeSpecification Scientific.Visualization.VRML2.PolyLines-class.html#writeSpecification Scientific.Visualization.VRML2.PolyLines.memoKey Scientific.Visualization.VRML2.PolyLines-class.html#memoKey Scientific.Visualization.VRML2.ShapeObject.use Scientific.Visualization.VRML2.ShapeObject-class.html#use Scientific.Visualization.VRML2.ShapeObject.writeToFile Scientific.Visualization.VRML2.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML2.VRMLObject.__setitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML2.ShapeObject.__add__ Scientific.Visualization.VRML2.ShapeObject-class.html#__add__ Scientific.Visualization.VRML2.VRMLObject.__copy__ Scientific.Visualization.VRML2.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML2.PolyLines.__init__ Scientific.Visualization.VRML2.PolyLines-class.html#__init__ Scientific.Visualization.VRML2.Polygons Scientific.Visualization.VRML2.Polygons-class.html Scientific.Visualization.VRML2.ShapeObject.attribute_names Scientific.Visualization.VRML2.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML2.VRMLObject.__getitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML2.Polygons.writeSpecification Scientific.Visualization.VRML2.Polygons-class.html#writeSpecification Scientific.Visualization.VRML2.Polygons.memoKey Scientific.Visualization.VRML2.Polygons-class.html#memoKey Scientific.Visualization.VRML2.ShapeObject.use Scientific.Visualization.VRML2.ShapeObject-class.html#use Scientific.Visualization.VRML2.ShapeObject.writeToFile Scientific.Visualization.VRML2.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML2.VRMLObject.__setitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML2.ShapeObject.__add__ Scientific.Visualization.VRML2.ShapeObject-class.html#__add__ Scientific.Visualization.VRML2.VRMLObject.__copy__ Scientific.Visualization.VRML2.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML2.Polygons.__init__ Scientific.Visualization.VRML2.Polygons-class.html#__init__ Scientific.Visualization.VRML2.Scene Scientific.Visualization.VRML2.Scene-class.html Scientific.Visualization.VRML2.Scene.addObject Scientific.Visualization.VRML2.Scene-class.html#addObject Scientific.Visualization.VRML2.Scene.addCamera Scientific.Visualization.VRML2.Scene-class.html#addCamera Scientific.Visualization.VRML2.Scene.__getitem__ Scientific.Visualization.VRML2.Scene-class.html#__getitem__ Scientific.Visualization.VRML2.Scene.writeToFile Scientific.Visualization.VRML2.Scene-class.html#writeToFile Scientific.Visualization.VRML2.Scene.__len__ Scientific.Visualization.VRML2.Scene-class.html#__len__ Scientific.Visualization.VRML2.Scene.__init__ Scientific.Visualization.VRML2.Scene-class.html#__init__ Scientific.Visualization.VRML2.Scene.view Scientific.Visualization.VRML2.Scene-class.html#view Scientific.Visualization.VRML2.SceneFile Scientific.Visualization.VRML2.SceneFile-class.html Scientific.Visualization.VRML2.SceneFile.writeString Scientific.Visualization.VRML2.SceneFile-class.html#writeString Scientific.Visualization.VRML2.SceneFile.__del__ Scientific.Visualization.VRML2.SceneFile-class.html#__del__ Scientific.Visualization.VRML2.SceneFile.write Scientific.Visualization.VRML2.SceneFile-class.html#write Scientific.Visualization.VRML2.SceneFile.uniqueName Scientific.Visualization.VRML2.SceneFile-class.html#uniqueName Scientific.Visualization.VRML2.SceneFile.close Scientific.Visualization.VRML2.SceneFile-class.html#close Scientific.Visualization.VRML2.SceneFile.__init__ Scientific.Visualization.VRML2.SceneFile-class.html#__init__ Scientific.Visualization.VRML2.ShapeObject Scientific.Visualization.VRML2.ShapeObject-class.html Scientific.Visualization.VRML2.ShapeObject.use Scientific.Visualization.VRML2.ShapeObject-class.html#use Scientific.Visualization.VRML2.VRMLObject.__getitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML2.ShapeObject.attribute_names Scientific.Visualization.VRML2.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML2.ShapeObject.writeToFile Scientific.Visualization.VRML2.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML2.VRMLObject.__setitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML2.ShapeObject.__add__ Scientific.Visualization.VRML2.ShapeObject-class.html#__add__ Scientific.Visualization.VRML2.VRMLObject.__copy__ Scientific.Visualization.VRML2.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML2.ShapeObject.__init__ Scientific.Visualization.VRML2.ShapeObject-class.html#__init__ Scientific.Visualization.VRML2.Sphere Scientific.Visualization.VRML2.Sphere-class.html Scientific.Visualization.VRML2.ShapeObject.attribute_names Scientific.Visualization.VRML2.ShapeObject-class.html#attribute_names Scientific.Visualization.VRML2.VRMLObject.__getitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML2.Sphere.writeSpecification Scientific.Visualization.VRML2.Sphere-class.html#writeSpecification Scientific.Visualization.VRML2.Sphere.memoKey Scientific.Visualization.VRML2.Sphere-class.html#memoKey Scientific.Visualization.VRML2.ShapeObject.use Scientific.Visualization.VRML2.ShapeObject-class.html#use Scientific.Visualization.VRML2.ShapeObject.writeToFile Scientific.Visualization.VRML2.ShapeObject-class.html#writeToFile Scientific.Visualization.VRML2.VRMLObject.__setitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML2.ShapeObject.__add__ Scientific.Visualization.VRML2.ShapeObject-class.html#__add__ Scientific.Visualization.VRML2.VRMLObject.__copy__ Scientific.Visualization.VRML2.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML2.Sphere.__init__ Scientific.Visualization.VRML2.Sphere-class.html#__init__ Scientific.Visualization.VRML2.VRMLObject Scientific.Visualization.VRML2.VRMLObject-class.html Scientific.Visualization.VRML2.VRMLObject.attribute_names Scientific.Visualization.VRML2.VRMLObject-class.html#attribute_names Scientific.Visualization.VRML2.VRMLObject.__getitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__getitem__ Scientific.Visualization.VRML2.VRMLObject.writeToFile Scientific.Visualization.VRML2.VRMLObject-class.html#writeToFile Scientific.Visualization.VRML2.VRMLObject.__setitem__ Scientific.Visualization.VRML2.VRMLObject-class.html#__setitem__ Scientific.Visualization.VRML2.VRMLObject.__copy__ Scientific.Visualization.VRML2.VRMLObject-class.html#__copy__ Scientific.Visualization.VRML2.VRMLObject.__init__ Scientific.Visualization.VRML2.VRMLObject-class.html#__init__ float float-class.html float.__int__ float-class.html#__int__ float.__rtruediv__ float-class.html#__rtruediv__ float.__str__ float-class.html#__str__ float.__getattribute__ float-class.html#__getattribute__ float.__radd__ float-class.html#__radd__ float.__getformat__ float-class.html#__getformat__ float.__truediv__ float-class.html#__truediv__ float.__rsub__ float-class.html#__rsub__ float.__rdiv__ float-class.html#__rdiv__ float.__rmul__ float-class.html#__rmul__ float.__lt__ float-class.html#__lt__ float.__getnewargs__ float-class.html#__getnewargs__ float.__rmod__ float-class.html#__rmod__ float.__float__ float-class.html#__float__ float.__rpow__ float-class.html#__rpow__ float.__new__ float-class.html#__new__ float.__abs__ float-class.html#__abs__ float.__pos__ float-class.html#__pos__ float.__sub__ float-class.html#__sub__ float.__rfloordiv__ float-class.html#__rfloordiv__ float.__neg__ float-class.html#__neg__ float.__ne__ float-class.html#__ne__ float.__rdivmod__ float-class.html#__rdivmod__ float.__coerce__ float-class.html#__coerce__ float.__divmod__ float-class.html#__divmod__ float.__add__ float-class.html#__add__ float.__gt__ float-class.html#__gt__ float.__eq__ float-class.html#__eq__ float.__repr__ float-class.html#__repr__ float.__nonzero__ float-class.html#__nonzero__ float.__mod__ float-class.html#__mod__ float.__div__ float-class.html#__div__ float.__le__ float-class.html#__le__ float.__mul__ float-class.html#__mul__ float.__floordiv__ float-class.html#__floordiv__ float.__hash__ float-class.html#__hash__ float.__setformat__ float-class.html#__setformat__ float.__long__ float-class.html#__long__ float.__ge__ float-class.html#__ge__ float.__pow__ float-class.html#__pow__ int int-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__add__ int-class.html#__add__ int.__cmp__ int-class.html#__cmp__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__divmod__ int-class.html#__divmod__ int.__new__ int-class.html#__new__ int.__abs__ int-class.html#__abs__ int.__pos__ int-class.html#__pos__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__mul__ int-class.html#__mul__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ int.__coerce__ int-class.html#__coerce__ int.__pow__ int-class.html#__pow__ int.__rlshift__ int-class.html#__rlshift__ int.__lshift__ int-class.html#__lshift__ int.__sub__ int-class.html#__sub__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__neg__ int-class.html#__neg__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__repr__ int-class.html#__repr__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__index__ int-class.html#__index__ int.__long__ int-class.html#__long__ int.__or__ int-class.html#__or__ qt.QPaintDevice.PDevCmd qt.QPaintDevice.PDevCmd-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.QPaintDevice.PDevCmd.__reduce__ qt.QPaintDevice.PDevCmd-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.QWidget.BackgroundOrigin qt.QWidget.BackgroundOrigin-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.QWidget.BackgroundOrigin.__reduce__ qt.QWidget.BackgroundOrigin-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.QWidget.FocusPolicy qt.QWidget.FocusPolicy-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.QWidget.FocusPolicy.__reduce__ qt.QWidget.FocusPolicy-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.AlignmentFlags qt.Qt.AlignmentFlags-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.AlignmentFlags.__reduce__ qt.Qt.AlignmentFlags-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.AnchorAttribute qt.Qt.AnchorAttribute-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.AnchorAttribute.__reduce__ qt.Qt.AnchorAttribute-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.ArrowType qt.Qt.ArrowType-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.ArrowType.__reduce__ qt.Qt.ArrowType-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.BGMode qt.Qt.BGMode-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.BGMode.__reduce__ qt.Qt.BGMode-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.BackgroundMode qt.Qt.BackgroundMode-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.BackgroundMode.__reduce__ qt.Qt.BackgroundMode-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.BrushStyle qt.Qt.BrushStyle-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.BrushStyle.__reduce__ qt.Qt.BrushStyle-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.ButtonState qt.Qt.ButtonState-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.ButtonState.__reduce__ qt.Qt.ButtonState-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.Corner qt.Qt.Corner-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.Corner.__reduce__ qt.Qt.Corner-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.CursorShape qt.Qt.CursorShape-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.CursorShape.__reduce__ qt.Qt.CursorShape-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.DateFormat qt.Qt.DateFormat-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.DateFormat.__reduce__ qt.Qt.DateFormat-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.Dock qt.Qt.Dock-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.Dock.__reduce__ qt.Qt.Dock-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.GUIStyle qt.Qt.GUIStyle-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.GUIStyle.__reduce__ qt.Qt.GUIStyle-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.ImageConversionFlags qt.Qt.ImageConversionFlags-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.ImageConversionFlags.__reduce__ qt.Qt.ImageConversionFlags-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.Key qt.Qt.Key-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.Key.__reduce__ qt.Qt.Key-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.MacintoshVersion qt.Qt.MacintoshVersion-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.MacintoshVersion.__reduce__ qt.Qt.MacintoshVersion-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.Modifier qt.Qt.Modifier-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.Modifier.__reduce__ qt.Qt.Modifier-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.Orientation qt.Qt.Orientation-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.Orientation.__reduce__ qt.Qt.Orientation-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.PenCapStyle qt.Qt.PenCapStyle-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.PenCapStyle.__reduce__ qt.Qt.PenCapStyle-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.PenJoinStyle qt.Qt.PenJoinStyle-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.PenJoinStyle.__reduce__ qt.Qt.PenJoinStyle-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.PenStyle qt.Qt.PenStyle-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.PenStyle.__reduce__ qt.Qt.PenStyle-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.RasterOp qt.Qt.RasterOp-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.RasterOp.__reduce__ qt.Qt.RasterOp-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.SequenceMatch qt.Qt.SequenceMatch-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.SequenceMatch.__reduce__ qt.Qt.SequenceMatch-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.SortOrder qt.Qt.SortOrder-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.SortOrder.__reduce__ qt.Qt.SortOrder-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.StringComparisonMode qt.Qt.StringComparisonMode-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.StringComparisonMode.__reduce__ qt.Qt.StringComparisonMode-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.TextFlags qt.Qt.TextFlags-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.TextFlags.__reduce__ qt.Qt.TextFlags-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.TextFormat qt.Qt.TextFormat-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.TextFormat.__reduce__ qt.Qt.TextFormat-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.TimeSpec qt.Qt.TimeSpec-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.TimeSpec.__reduce__ qt.Qt.TimeSpec-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.UIEffect qt.Qt.UIEffect-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.UIEffect.__reduce__ qt.Qt.UIEffect-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.WidgetFlags qt.Qt.WidgetFlags-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.WidgetFlags.__reduce__ qt.Qt.WidgetFlags-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.WidgetState qt.Qt.WidgetState-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.WidgetState.__reduce__ qt.Qt.WidgetState-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.WindowState qt.Qt.WindowState-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.WindowState.__reduce__ qt.Qt.WindowState-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ qt.Qt.WindowsVersion qt.Qt.WindowsVersion-class.html int.__int__ int-class.html#__int__ int.__ror__ int-class.html#__ror__ int.__rtruediv__ int-class.html#__rtruediv__ int.__lshift__ int-class.html#__lshift__ int.__str__ int-class.html#__str__ int.__getattribute__ int-class.html#__getattribute__ int.__radd__ int-class.html#__radd__ int.__and__ int-class.html#__and__ int.__truediv__ int-class.html#__truediv__ int.__rrshift__ int-class.html#__rrshift__ int.__rsub__ int-class.html#__rsub__ int.__rdiv__ int-class.html#__rdiv__ int.__rmul__ int-class.html#__rmul__ int.__rmod__ int-class.html#__rmod__ int.__getnewargs__ int-class.html#__getnewargs__ int.__float__ int-class.html#__float__ int.__rpow__ int-class.html#__rpow__ int.__rand__ int-class.html#__rand__ int.__new__ int-class.html#__new__ int.__pos__ int-class.html#__pos__ int.__or__ int-class.html#__or__ int.__rlshift__ int-class.html#__rlshift__ int.__cmp__ int-class.html#__cmp__ int.__abs__ int-class.html#__abs__ int.__rfloordiv__ int-class.html#__rfloordiv__ int.__coerce__ int-class.html#__coerce__ int.__neg__ int-class.html#__neg__ int.__rshift__ int-class.html#__rshift__ int.__rdivmod__ int-class.html#__rdivmod__ int.__invert__ int-class.html#__invert__ qt.Qt.WindowsVersion.__reduce__ qt.Qt.WindowsVersion-class.html#__reduce__ int.__divmod__ int-class.html#__divmod__ int.__add__ int-class.html#__add__ int.__index__ int-class.html#__index__ int.__hex__ int-class.html#__hex__ int.__oct__ int-class.html#__oct__ int.__rxor__ int-class.html#__rxor__ int.__repr__ int-class.html#__repr__ int.__nonzero__ int-class.html#__nonzero__ int.__mod__ int-class.html#__mod__ int.__xor__ int-class.html#__xor__ int.__div__ int-class.html#__div__ int.__mul__ int-class.html#__mul__ int.__floordiv__ int-class.html#__floordiv__ int.__hash__ int-class.html#__hash__ int.__sub__ int-class.html#__sub__ int.__long__ int-class.html#__long__ int.__pow__ int-class.html#__pow__ ScientificPython-2.9.4/Doc/Reference/class-tree.html0000644000076600000240000017230111501734223022755 0ustar hinsenstaff00000000000000 Class Hierarchy
 
[frames] | no frames]
[ Module Hierarchy | Class Hierarchy ]

Class Hierarchy

ScientificPython-2.9.4/Doc/Reference/crarr.png0000644000076600000240000000052411501734224021642 0ustar hinsenstaff00000000000000PNG  IHDR eE,tEXtCreation TimeTue 22 Aug 2006 00:43:10 -0500` XtIME)} pHYsnu>gAMA aEPLTEðf4sW ЊrD`@bCܖX{`,lNo@xdE螊dƴ~TwvtRNS@fMIDATxc`@0&+(;; /EXؑ? n  b;'+Y#(r<"IENDB`ScientificPython-2.9.4/Doc/Reference/epydoc.css0000644000076600000240000003722711501734224022032 0ustar hinsenstaff00000000000000 /* Epydoc CSS Stylesheet * * This stylesheet can be used to customize the appearance of epydoc's * HTML output. * */ /* Default Colors & Styles * - Set the default foreground & background color with 'body'; and * link colors with 'a:link' and 'a:visited'. * - Use bold for decision list terms. * - The heading styles defined here are used for headings *within* * docstring descriptions. All headings used by epydoc itself use * either class='epydoc' or class='toc' (CSS styles for both * defined below). */ body { background: #ffffff; color: #000000; } p { margin-top: 0.5em; margin-bottom: 0.5em; } a:link { color: #0000ff; } a:visited { color: #204080; } dt { font-weight: bold; } h1 { font-size: +140%; font-style: italic; font-weight: bold; } h2 { font-size: +125%; font-style: italic; font-weight: bold; } h3 { font-size: +110%; font-style: italic; font-weight: normal; } code { font-size: 100%; } /* N.B.: class, not pseudoclass */ a.link { font-family: monospace; } /* Page Header & Footer * - The standard page header consists of a navigation bar (with * pointers to standard pages such as 'home' and 'trees'); a * breadcrumbs list, which can be used to navigate to containing * classes or modules; options links, to show/hide private * variables and to show/hide frames; and a page title (using *

). The page title may be followed by a link to the * corresponding source code (using 'span.codelink'). * - The footer consists of a navigation bar, a timestamp, and a * pointer to epydoc's homepage. */ h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; } h2.epydoc { font-size: +130%; font-weight: bold; } h3.epydoc { font-size: +115%; font-weight: bold; margin-top: 0.2em; } td h3.epydoc { font-size: +115%; font-weight: bold; margin-bottom: 0; } table.navbar { background: #a0c0ff; color: #000000; border: 2px groove #c0d0d0; } table.navbar table { color: #000000; } th.navbar-select { background: #70b0ff; color: #000000; } table.navbar a { text-decoration: none; } table.navbar a:link { color: #0000ff; } table.navbar a:visited { color: #204080; } span.breadcrumbs { font-size: 85%; font-weight: bold; } span.options { font-size: 70%; } span.codelink { font-size: 85%; } td.footer { font-size: 85%; } /* Table Headers * - Each summary table and details section begins with a 'header' * row. This row contains a section title (marked by * 'span.table-header') as well as a show/hide private link * (marked by 'span.options', defined above). * - Summary tables that contain user-defined groups mark those * groups using 'group header' rows. */ td.table-header { background: #70b0ff; color: #000000; border: 1px solid #608090; } td.table-header table { color: #000000; } td.table-header table a:link { color: #0000ff; } td.table-header table a:visited { color: #204080; } span.table-header { font-size: 120%; font-weight: bold; } th.group-header { background: #c0e0f8; color: #000000; text-align: left; font-style: italic; font-size: 115%; border: 1px solid #608090; } /* Summary Tables (functions, variables, etc) * - Each object is described by a single row of the table with * two cells. The left cell gives the object's type, and is * marked with 'code.summary-type'. The right cell gives the * object's name and a summary description. * - CSS styles for the table's header and group headers are * defined above, under 'Table Headers' */ table.summary { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; margin-bottom: 0.5em; } td.summary { border: 1px solid #608090; } code.summary-type { font-size: 85%; } table.summary a:link { color: #0000ff; } table.summary a:visited { color: #204080; } /* Details Tables (functions, variables, etc) * - Each object is described in its own div. * - A single-row summary table w/ table-header is used as * a header for each details section (CSS style for table-header * is defined above, under 'Table Headers'). */ table.details { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; margin: .2em 0 0 0; } table.details table { color: #000000; } table.details a:link { color: #0000ff; } table.details a:visited { color: #204080; } /* Fields */ dl.fields { margin-left: 2em; margin-top: 1em; margin-bottom: 1em; } dl.fields dd ul { margin-left: 0em; padding-left: 0em; } dl.fields dd ul li ul { margin-left: 2em; padding-left: 0em; } div.fields { margin-left: 2em; } div.fields p { margin-bottom: 0.5em; } /* Index tables (identifier index, term index, etc) * - link-index is used for indices containing lists of links * (namely, the identifier index & term index). * - index-where is used in link indices for the text indicating * the container/source for each link. * - metadata-index is used for indices containing metadata * extracted from fields (namely, the bug index & todo index). */ table.link-index { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; } td.link-index { border-width: 0px; } table.link-index a:link { color: #0000ff; } table.link-index a:visited { color: #204080; } span.index-where { font-size: 70%; } table.metadata-index { border-collapse: collapse; background: #e8f0f8; color: #000000; border: 1px solid #608090; margin: .2em 0 0 0; } td.metadata-index { border-width: 1px; border-style: solid; } table.metadata-index a:link { color: #0000ff; } table.metadata-index a:visited { color: #204080; } /* Function signatures * - sig* is used for the signature in the details section. * - .summary-sig* is used for the signature in the summary * table, and when listing property accessor functions. * */ .sig-name { color: #006080; } .sig-arg { color: #008060; } .sig-default { color: #602000; } .summary-sig { font-family: monospace; } .summary-sig-name { color: #006080; font-weight: bold; } table.summary a.summary-sig-name:link { color: #006080; font-weight: bold; } table.summary a.summary-sig-name:visited { color: #006080; font-weight: bold; } .summary-sig-arg { color: #006040; } .summary-sig-default { color: #501800; } /* Subclass list */ ul.subclass-list { display: inline; } ul.subclass-list li { display: inline; } /* To render variables, classes etc. like functions */ table.summary .summary-name { color: #006080; font-weight: bold; font-family: monospace; } table.summary a.summary-name:link { color: #006080; font-weight: bold; font-family: monospace; } table.summary a.summary-name:visited { color: #006080; font-weight: bold; font-family: monospace; } /* Variable values * - In the 'variable details' sections, each varaible's value is * listed in a 'pre.variable' box. The width of this box is * restricted to 80 chars; if the value's repr is longer than * this it will be wrapped, using a backslash marked with * class 'variable-linewrap'. If the value's repr is longer * than 3 lines, the rest will be ellided; and an ellipsis * marker ('...' marked with 'variable-ellipsis') will be used. * - If the value is a string, its quote marks will be marked * with 'variable-quote'. * - If the variable is a regexp, it is syntax-highlighted using * the re* CSS classes. */ pre.variable { padding: .5em; margin: 0; background: #dce4ec; color: #000000; border: 1px solid #708890; } .variable-linewrap { color: #604000; font-weight: bold; } .variable-ellipsis { color: #604000; font-weight: bold; } .variable-quote { color: #604000; font-weight: bold; } .variable-group { color: #008000; font-weight: bold; } .variable-op { color: #604000; font-weight: bold; } .variable-string { color: #006030; } .variable-unknown { color: #a00000; font-weight: bold; } .re { color: #000000; } .re-char { color: #006030; } .re-op { color: #600000; } .re-group { color: #003060; } .re-ref { color: #404040; } /* Base tree * - Used by class pages to display the base class hierarchy. */ pre.base-tree { font-size: 80%; margin: 0; } /* Frames-based table of contents headers * - Consists of two frames: one for selecting modules; and * the other listing the contents of the selected module. * - h1.toc is used for each frame's heading * - h2.toc is used for subheadings within each frame. */ h1.toc { text-align: center; font-size: 105%; margin: 0; font-weight: bold; padding: 0; } h2.toc { font-size: 100%; font-weight: bold; margin: 0.5em 0 0 -0.3em; } /* Syntax Highlighting for Source Code * - doctest examples are displayed in a 'pre.py-doctest' block. * If the example is in a details table entry, then it will use * the colors specified by the 'table pre.py-doctest' line. * - Source code listings are displayed in a 'pre.py-src' block. * Each line is marked with 'span.py-line' (used to draw a line * down the left margin, separating the code from the line * numbers). Line numbers are displayed with 'span.py-lineno'. * The expand/collapse block toggle button is displayed with * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not * modify the font size of the text.) * - If a source code page is opened with an anchor, then the * corresponding code block will be highlighted. The code * block's header is highlighted with 'py-highlight-hdr'; and * the code block's body is highlighted with 'py-highlight'. * - The remaining py-* classes are used to perform syntax * highlighting (py-string for string literals, py-name for names, * etc.) */ pre.py-doctest { padding: .5em; margin: 1em; background: #e8f0f8; color: #000000; border: 1px solid #708890; } table pre.py-doctest { background: #dce4ec; color: #000000; } pre.py-src { border: 2px solid #000000; background: #f0f0f0; color: #000000; } .py-line { border-left: 2px solid #000000; margin-left: .2em; padding-left: .4em; } .py-lineno { font-style: italic; font-size: 90%; padding-left: .5em; } a.py-toggle { text-decoration: none; } div.py-highlight-hdr { border-top: 2px solid #000000; border-bottom: 2px solid #000000; background: #d8e8e8; } div.py-highlight { border-bottom: 2px solid #000000; background: #d0e0e0; } .py-prompt { color: #005050; font-weight: bold;} .py-more { color: #005050; font-weight: bold;} .py-string { color: #006030; } .py-comment { color: #003060; } .py-keyword { color: #600000; } .py-output { color: #404040; } .py-name { color: #000050; } .py-name:link { color: #000050 !important; } .py-name:visited { color: #000050 !important; } .py-number { color: #005000; } .py-defname { color: #000060; font-weight: bold; } .py-def-name { color: #000060; font-weight: bold; } .py-base-class { color: #000060; } .py-param { color: #000060; } .py-docstring { color: #006030; } .py-decorator { color: #804020; } /* Use this if you don't want links to names underlined: */ /*a.py-name { text-decoration: none; }*/ /* Graphs & Diagrams * - These CSS styles are used for graphs & diagrams generated using * Graphviz dot. 'img.graph-without-title' is used for bare * diagrams (to remove the border created by making the image * clickable). */ img.graph-without-title { border: none; } img.graph-with-title { border: 1px solid #000000; } span.graph-title { font-weight: bold; } span.graph-caption { } /* General-purpose classes * - 'p.indent-wrapped-lines' defines a paragraph whose first line * is not indented, but whose subsequent lines are. * - The 'nomargin-top' class is used to remove the top margin (e.g. * from lists). The 'nomargin' class is used to remove both the * top and bottom margin (but not the left or right margin -- * for lists, that would cause the bullets to disappear.) */ p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em; margin: 0; } .nomargin-top { margin-top: 0; } .nomargin { margin-top: 0; margin-bottom: 0; } /* HTML Log */ div.log-block { padding: 0; margin: .5em 0 .5em 0; background: #e8f0f8; color: #000000; border: 1px solid #000000; } div.log-error { padding: .1em .3em .1em .3em; margin: 4px; background: #ffb0b0; color: #000000; border: 1px solid #000000; } div.log-warning { padding: .1em .3em .1em .3em; margin: 4px; background: #ffffb0; color: #000000; border: 1px solid #000000; } div.log-info { padding: .1em .3em .1em .3em; margin: 4px; background: #b0ffb0; color: #000000; border: 1px solid #000000; } h2.log-hdr { background: #70b0ff; color: #000000; margin: 0; padding: 0em 0.5em 0em 0.5em; border-bottom: 1px solid #000000; font-size: 110%; } p.log { font-weight: bold; margin: .5em 0 .5em 0; } tr.opt-changed { color: #000000; font-weight: bold; } tr.opt-default { color: #606060; } pre.log { margin: 0; padding: 0; padding-left: 1em; } ScientificPython-2.9.4/Doc/Reference/epydoc.js0000644000076600000240000002452511501734224021653 0ustar hinsenstaff00000000000000function toggle_private() { // Search for any private/public links on this page. Store // their old text in "cmd," so we will know what action to // take; and change their text to the opposite action. var cmd = "?"; var elts = document.getElementsByTagName("a"); for(var i=0; i...
"; elt.innerHTML = s; } } function toggle(id) { elt = document.getElementById(id+"-toggle"); if (elt.innerHTML == "-") collapse(id); else expand(id); return false; } function highlight(id) { var elt = document.getElementById(id+"-def"); if (elt) elt.className = "py-highlight-hdr"; var elt = document.getElementById(id+"-expanded"); if (elt) elt.className = "py-highlight"; var elt = document.getElementById(id+"-collapsed"); if (elt) elt.className = "py-highlight"; } function num_lines(s) { var n = 1; var pos = s.indexOf("\n"); while ( pos > 0) { n += 1; pos = s.indexOf("\n", pos+1); } return n; } // Collapse all blocks that mave more than `min_lines` lines. function collapse_all(min_lines) { var elts = document.getElementsByTagName("div"); for (var i=0; i 0) if (elt.id.substring(split, elt.id.length) == "-expanded") if (num_lines(elt.innerHTML) > min_lines) collapse(elt.id.substring(0, split)); } } function expandto(href) { var start = href.indexOf("#")+1; if (start != 0 && start != href.length) { if (href.substring(start, href.length) != "-") { collapse_all(4); pos = href.indexOf(".", start); while (pos != -1) { var id = href.substring(start, pos); expand(id); pos = href.indexOf(".", pos+1); } var id = href.substring(start, href.length); expand(id); highlight(id); } } } function kill_doclink(id) { var parent = document.getElementById(id); parent.removeChild(parent.childNodes.item(0)); } function auto_kill_doclink(ev) { if (!ev) var ev = window.event; if (!this.contains(ev.toElement)) { var parent = document.getElementById(this.parentID); parent.removeChild(parent.childNodes.item(0)); } } function doclink(id, name, targets_id) { var elt = document.getElementById(id); // If we already opened the box, then destroy it. // (This case should never occur, but leave it in just in case.) if (elt.childNodes.length > 1) { elt.removeChild(elt.childNodes.item(0)); } else { // The outer box: relative + inline positioning. var box1 = document.createElement("div"); box1.style.position = "relative"; box1.style.display = "inline"; box1.style.top = 0; box1.style.left = 0; // A shadow for fun var shadow = document.createElement("div"); shadow.style.position = "absolute"; shadow.style.left = "-1.3em"; shadow.style.top = "-1.3em"; shadow.style.background = "#404040"; // The inner box: absolute positioning. var box2 = document.createElement("div"); box2.style.position = "relative"; box2.style.border = "1px solid #a0a0a0"; box2.style.left = "-.2em"; box2.style.top = "-.2em"; box2.style.background = "white"; box2.style.padding = ".3em .4em .3em .4em"; box2.style.fontStyle = "normal"; box2.onmouseout=auto_kill_doclink; box2.parentID = id; // Get the targets var targets_elt = document.getElementById(targets_id); var targets = targets_elt.getAttribute("targets"); var links = ""; target_list = targets.split(","); for (var i=0; i" + target[0] + ""; } // Put it all together. elt.insertBefore(box1, elt.childNodes.item(0)); //box1.appendChild(box2); box1.appendChild(shadow); shadow.appendChild(box2); box2.innerHTML = "Which "+name+" do you want to see documentation for?" + ""; } return false; } function get_anchor() { var href = location.href; var start = href.indexOf("#")+1; if ((start != 0) && (start != href.length)) return href.substring(start, href.length); } function redirect_url(dottedName) { // Scan through each element of the "pages" list, and check // if "name" matches with any of them. for (var i=0; i-m" or "-c"; // extract the portion & compare it to dottedName. var pagename = pages[i].substring(0, pages[i].length-2); if (pagename == dottedName.substring(0,pagename.length)) { // We've found a page that matches `dottedName`; // construct its URL, using leftover `dottedName` // content to form an anchor. var pagetype = pages[i].charAt(pages[i].length-1); var url = pagename + ((pagetype=="m")?"-module.html": "-class.html"); if (dottedName.length > pagename.length) url += "#" + dottedName.substring(pagename.length+1, dottedName.length); return url; } } } ScientificPython-2.9.4/Doc/Reference/float-class.html0000644000076600000240000010361411501734223023124 0ustar hinsenstaff00000000000000 float
float :: Class float
[frames] | no frames]

Class float

object --+
         |
        float

float(x) -> floating point number

Convert a string or number to a floating point number, if possible.

Instance Methods
 
__abs__(x)
abs(x)
 
__add__(x, y)
x+y
 
__coerce__(x, y)
coerce(x, y)
 
__div__(x, y)
x/y
 
__divmod__(x, y)
divmod(x, y)
 
__eq__(x, y)
x==y
 
__float__(x)
float(x)
 
__floordiv__(x, y)
x//y
 
__ge__(x, y)
x>=y
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
string
__getformat__(float, typestr)
You probably don't want to use this function.
 
__getnewargs__(...)
 
__gt__(x, y)
x>y
 
__hash__(x)
hash(x)
 
__int__(x)
int(x)
 
__le__(x, y)
x<=y
 
__long__(x)
long(x)
 
__lt__(x, y)
x<y
 
__mod__(x, y)
x%y
 
__mul__(x, y)
x*y
 
__ne__(x, y)
x!=y
 
__neg__(x)
-x
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__nonzero__(x)
x != 0
 
__pos__(x)
+x
 
__pow__(x, y, z=...)
pow(x, y[, z])
 
__radd__(x, y)
y+x
 
__rdiv__(x, y)
y/x
 
__rdivmod__(x, y)
divmod(y, x)
 
__repr__(x)
repr(x)
 
__rfloordiv__(x, y)
y//x
 
__rmod__(x, y)
y%x
 
__rmul__(x, y)
y*x
 
__rpow__(y, x, z=...)
pow(x, y[, z])
 
__rsub__(x, y)
y-x
 
__rtruediv__(x, y)
y/x
None
__setformat__(float, typestr, fmt)
You probably don't want to use this function.
 
__str__(x)
str(x)
 
__sub__(x, y)
x-y
 
__truediv__(x, y)
x/y

Inherited from object: __delattr__, __init__, __reduce__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__getattribute__(...)

 

x.__getattribute__('name') <==> x.name

Overrides: object.__getattribute__

__getformat__(float, typestr)

 

You probably don't want to use this function. It exists mainly to be used in Python's test suite.

typestr must be 'double' or 'float'. This function returns whichever of 'unknown', 'IEEE, big-endian' or 'IEEE, little-endian' best describes the format of floating point numbers used by the C type named by typestr.

Returns: string

__hash__(x)
(Hashing function)

 

hash(x)

Overrides: object.__hash__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__repr__(x)
(Representation operator)

 

repr(x)

Overrides: object.__repr__

__setformat__(float, typestr, fmt)

 

You probably don't want to use this function. It exists mainly to be used in Python's test suite.

typestr must be 'double' or 'float'. fmt must be one of 'unknown', 'IEEE, big-endian' or 'IEEE, little-endian', and in addition can only be one of the latter two if it appears to match the underlying C reality.

Overrides the automatic determination of C-level floating point type. This affects how floats are converted to and from binary strings.

Returns: None

__str__(x)
(Informal representation operator)

 

str(x)

Overrides: object.__str__

ScientificPython-2.9.4/Doc/Reference/frames.html0000644000076600000240000000112011501734223022156 0ustar hinsenstaff00000000000000 Scientific Python ScientificPython-2.9.4/Doc/Reference/help.html0000644000076600000240000002561311501734224021647 0ustar hinsenstaff00000000000000 Help
 
[frames] | no frames]

API Documentation

This document contains the API (Application Programming Interface) documentation for Scientific Python. Documentation for the Python objects defined by the project is divided into separate pages for each package, module, and class. The API documentation also includes two pages containing information about the project as a whole: a trees page, and an index page.

Object Documentation

Each Package Documentation page contains:

  • A description of the package.
  • A list of the modules and sub-packages contained by the package.
  • A summary of the classes defined by the package.
  • A summary of the functions defined by the package.
  • A summary of the variables defined by the package.
  • A detailed description of each function defined by the package.
  • A detailed description of each variable defined by the package.

Each Module Documentation page contains:

  • A description of the module.
  • A summary of the classes defined by the module.
  • A summary of the functions defined by the module.
  • A summary of the variables defined by the module.
  • A detailed description of each function defined by the module.
  • A detailed description of each variable defined by the module.

Each Class Documentation page contains:

  • A class inheritance diagram.
  • A list of known subclasses.
  • A description of the class.
  • A summary of the methods defined by the class.
  • A summary of the instance variables defined by the class.
  • A summary of the class (static) variables defined by the class.
  • A detailed description of each method defined by the class.
  • A detailed description of each instance variable defined by the class.
  • A detailed description of each class (static) variable defined by the class.

Project Documentation

The Trees page contains the module and class hierarchies:

  • The module hierarchy lists every package and module, with modules grouped into packages. At the top level, and within each package, modules and sub-packages are listed alphabetically.
  • The class hierarchy lists every class, grouped by base class. If a class has more than one base class, then it will be listed under each base class. At the top level, and under each base class, classes are listed alphabetically.

The Index page contains indices of terms and identifiers:

  • The term index lists every term indexed by any object's documentation. For each term, the index provides links to each place where the term is indexed.
  • The identifier index lists the (short) name of every package, module, class, method, function, variable, and parameter. For each identifier, the index provides a short description, and a link to its documentation.

The Table of Contents

The table of contents occupies the two frames on the left side of the window. The upper-left frame displays the project contents, and the lower-left frame displays the module contents:

Project
Contents
...
API
Documentation
Frame


Module
Contents
 
...
 

The project contents frame contains a list of all packages and modules that are defined by the project. Clicking on an entry will display its contents in the module contents frame. Clicking on a special entry, labeled "Everything," will display the contents of the entire project.

The module contents frame contains a list of every submodule, class, type, exception, function, and variable defined by a module or package. Clicking on an entry will display its documentation in the API documentation frame. Clicking on the name of the module, at the top of the frame, will display the documentation for the module itself.

The "frames" and "no frames" buttons below the top navigation bar can be used to control whether the table of contents is displayed or not.

The Navigation Bar

A navigation bar is located at the top and bottom of every page. It indicates what type of page you are currently viewing, and allows you to go to related pages. The following table describes the labels on the navigation bar. Note that not some labels (such as [Parent]) are not displayed on all pages.

Label Highlighted when... Links to...
[Parent] (never highlighted) the parent of the current package
[Package] viewing a package the package containing the current object
[Module] viewing a module the module containing the current object
[Class] viewing a class the class containing the current object
[Trees] viewing the trees page the trees page
[Index] viewing the index page the index page
[Help] viewing the help page the help page

The "show private" and "hide private" buttons below the top navigation bar can be used to control whether documentation for private objects is displayed. Private objects are usually defined as objects whose (short) names begin with a single underscore, but do not end with an underscore. For example, "_x", "__pprint", and "epydoc.epytext._tokenize" are private objects; but "re.sub", "__init__", and "type_" are not. However, if a module defines the "__all__" variable, then its contents are used to decide which objects are private.

A timestamp below the bottom navigation bar indicates when each page was last updated.

ScientificPython-2.9.4/Doc/Reference/identifier-index.html0000644000076600000240000136247111501734224024155 0ustar hinsenstaff00000000000000 Identifier Index
 
[frames] | no frames]
[ Identifiers | Term Definitions ]

Identifier Index

[ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ ]

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

_



ScientificPython-2.9.4/Doc/Reference/index.html0000644000076600000240000000112011501734224022011 0ustar hinsenstaff00000000000000 Scientific Python ScientificPython-2.9.4/Doc/Reference/int-class.html0000644000076600000240000011502211501734224022606 0ustar hinsenstaff00000000000000 int
int :: Class int
[frames] | no frames]

Class int

object --+
         |
        int
Known Subclasses:

int(x[, base]) -> integer

Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string. If the argument is outside the integer range a long object will be returned instead.

Instance Methods
 
__abs__(x)
abs(x)
 
__add__(x, y)
x+y
 
__and__(x, y)
x&y
 
__cmp__(x, y)
cmp(x,y)
 
__coerce__(x, y)
coerce(x, y)
 
__div__(x, y)
x/y
 
__divmod__(x, y)
divmod(x, y)
 
__float__(x)
float(x)
 
__floordiv__(x, y)
x//y
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
 
__getnewargs__(...)
 
__hash__(x)
hash(x)
 
__hex__(x)
hex(x)
 
__index__(...)
x[y:z] <==> x[y.__index__():z.__index__()]
 
__int__(x)
int(x)
 
__invert__(x)
~x
 
__long__(x)
long(x)
 
__lshift__(x, y)
x<<y
 
__mod__(x, y)
x%y
 
__mul__(x, y)
x*y
 
__neg__(x)
-x
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__nonzero__(x)
x != 0
 
__oct__(x)
oct(x)
 
__or__(x, y)
x|y
 
__pos__(x)
+x
 
__pow__(x, y, z=...)
pow(x, y[, z])
 
__radd__(x, y)
y+x
 
__rand__(x, y)
y&x
 
__rdiv__(x, y)
y/x
 
__rdivmod__(x, y)
divmod(y, x)
 
__repr__(x)
repr(x)
 
__rfloordiv__(x, y)
y//x
 
__rlshift__(x, y)
y<<x
 
__rmod__(x, y)
y%x
 
__rmul__(x, y)
y*x
 
__ror__(x, y)
y|x
 
__rpow__(y, x, z=...)
pow(x, y[, z])
 
__rrshift__(x, y)
y>>x
 
__rshift__(x, y)
x>>y
 
__rsub__(x, y)
y-x
 
__rtruediv__(x, y)
y/x
 
__rxor__(x, y)
y^x
 
__str__(x)
str(x)
 
__sub__(x, y)
x-y
 
__truediv__(x, y)
x/y
 
__xor__(x, y)
x^y

Inherited from object: __delattr__, __init__, __reduce__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__getattribute__(...)

 

x.__getattribute__('name') <==> x.name

Overrides: object.__getattribute__

__hash__(x)
(Hashing function)

 

hash(x)

Overrides: object.__hash__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__repr__(x)
(Representation operator)

 

repr(x)

Overrides: object.__repr__

__str__(x)
(Informal representation operator)

 

str(x)

Overrides: object.__str__

ScientificPython-2.9.4/Doc/Reference/module-tree.html0000644000076600000240000003655211501734223023144 0ustar hinsenstaff00000000000000 Module Hierarchy
 
[frames] | no frames]
[ Module Hierarchy | Class Hierarchy ]

Module Hierarchy

ScientificPython-2.9.4/Doc/Reference/qt.QPaintDevice.PDevCmd-class.html0000644000076600000240000002410211501734224026232 0ustar hinsenstaff00000000000000 qt.QPaintDevice.PDevCmd
qt :: QPaintDevice :: PDevCmd :: Class PDevCmd
[frames] | no frames]

Class PDevCmd

object --+    
         |    
       int --+
             |
            QPaintDevice.PDevCmd

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.AlignmentFlags-class.html0000644000076600000240000002410111501734224025712 0ustar hinsenstaff00000000000000 qt.Qt.AlignmentFlags
qt :: Qt :: AlignmentFlags :: Class AlignmentFlags
[frames] | no frames]

Class AlignmentFlags

object --+    
         |    
       int --+
             |
            Qt.AlignmentFlags

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.AnchorAttribute-class.html0000644000076600000240000002411011501734224026115 0ustar hinsenstaff00000000000000 qt.Qt.AnchorAttribute
qt :: Qt :: AnchorAttribute :: Class AnchorAttribute
[frames] | no frames]

Class AnchorAttribute

object --+    
         |    
       int --+
             |
            Qt.AnchorAttribute

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.ArrowType-class.html0000644000076600000240000002403611501734224024762 0ustar hinsenstaff00000000000000 qt.Qt.ArrowType
qt :: Qt :: ArrowType :: Class ArrowType
[frames] | no frames]

Class ArrowType

object --+    
         |    
       int --+
             |
            Qt.ArrowType

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.BackgroundMode-class.html0000644000076600000240000002410111501734223025702 0ustar hinsenstaff00000000000000 qt.Qt.BackgroundMode
qt :: Qt :: BackgroundMode :: Class BackgroundMode
[frames] | no frames]

Class BackgroundMode

object --+    
         |    
       int --+
             |
            Qt.BackgroundMode

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.BGMode-class.html0000644000076600000240000002401111501734223024113 0ustar hinsenstaff00000000000000 qt.Qt.BGMode
qt :: Qt :: BGMode :: Class BGMode
[frames] | no frames]

Class BGMode

object --+    
         |    
       int --+
             |
            Qt.BGMode

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.BrushStyle-class.html0000644000076600000240000002404511501734223025131 0ustar hinsenstaff00000000000000 qt.Qt.BrushStyle
qt :: Qt :: BrushStyle :: Class BrushStyle
[frames] | no frames]

Class BrushStyle

object --+    
         |    
       int --+
             |
            Qt.BrushStyle

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.ButtonState-class.html0000644000076600000240000002405411501734223025301 0ustar hinsenstaff00000000000000 qt.Qt.ButtonState
qt :: Qt :: ButtonState :: Class ButtonState
[frames] | no frames]

Class ButtonState

object --+    
         |    
       int --+
             |
            Qt.ButtonState

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.Corner-class.html0000644000076600000240000002401111501734224024247 0ustar hinsenstaff00000000000000 qt.Qt.Corner
qt :: Qt :: Corner :: Class Corner
[frames] | no frames]

Class Corner

object --+    
         |    
       int --+
             |
            Qt.Corner

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.CursorShape-class.html0000644000076600000240000002405411501734224025264 0ustar hinsenstaff00000000000000 qt.Qt.CursorShape
qt :: Qt :: CursorShape :: Class CursorShape
[frames] | no frames]

Class CursorShape

object --+    
         |    
       int --+
             |
            Qt.CursorShape

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.DateFormat-class.html0000644000076600000240000002404511501734224025054 0ustar hinsenstaff00000000000000 qt.Qt.DateFormat
qt :: Qt :: DateFormat :: Class DateFormat
[frames] | no frames]

Class DateFormat

object --+    
         |    
       int --+
             |
            Qt.DateFormat

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.Dock-class.html0000644000076600000240000002377311501734224023715 0ustar hinsenstaff00000000000000 qt.Qt.Dock
qt :: Qt :: Dock :: Class Dock
[frames] | no frames]

Class Dock

object --+    
         |    
       int --+
             |
            Qt.Dock

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.GUIStyle-class.html0000644000076600000240000002402711501734224024473 0ustar hinsenstaff00000000000000 qt.Qt.GUIStyle
qt :: Qt :: GUIStyle :: Class GUIStyle
[frames] | no frames]

Class GUIStyle

object --+    
         |    
       int --+
             |
            Qt.GUIStyle

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.ImageConversionFlags-class.html0000644000076600000240000002415311501734224027073 0ustar hinsenstaff00000000000000 qt.Qt.ImageConversionFlags
qt :: Qt :: ImageConversionFlags :: Class ImageConversionFlags
[frames] | no frames]

Class ImageConversionFlags

object --+    
         |    
       int --+
             |
            Qt.ImageConversionFlags

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.Key-class.html0000644000076600000240000002376411501734224023565 0ustar hinsenstaff00000000000000 qt.Qt.Key
qt :: Qt :: Key :: Class Key
[frames] | no frames]

Class Key

object --+    
         |    
       int --+
             |
            Qt.Key

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.MacintoshVersion-class.html0000644000076600000240000002411711501734224026321 0ustar hinsenstaff00000000000000 qt.Qt.MacintoshVersion
qt :: Qt :: MacintoshVersion :: Class MacintoshVersion
[frames] | no frames]

Class MacintoshVersion

object --+    
         |    
       int --+
             |
            Qt.MacintoshVersion

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.Modifier-class.html0000644000076600000240000002402711501734224024564 0ustar hinsenstaff00000000000000 qt.Qt.Modifier
qt :: Qt :: Modifier :: Class Modifier
[frames] | no frames]

Class Modifier

object --+    
         |    
       int --+
             |
            Qt.Modifier

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.Orientation-class.html0000644000076600000240000002405411501734225025322 0ustar hinsenstaff00000000000000 qt.Qt.Orientation
qt :: Qt :: Orientation :: Class Orientation
[frames] | no frames]

Class Orientation

object --+    
         |    
       int --+
             |
            Qt.Orientation

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.PenCapStyle-class.html0000644000076600000240000002405411501734225025216 0ustar hinsenstaff00000000000000 qt.Qt.PenCapStyle
qt :: Qt :: PenCapStyle :: Class PenCapStyle
[frames] | no frames]

Class PenCapStyle

object --+    
         |    
       int --+
             |
            Qt.PenCapStyle

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.PenJoinStyle-class.html0000644000076600000240000002406311501734225025412 0ustar hinsenstaff00000000000000 qt.Qt.PenJoinStyle
qt :: Qt :: PenJoinStyle :: Class PenJoinStyle
[frames] | no frames]

Class PenJoinStyle

object --+    
         |    
       int --+
             |
            Qt.PenJoinStyle

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.PenStyle-class.html0000644000076600000240000002402711501734225024572 0ustar hinsenstaff00000000000000 qt.Qt.PenStyle
qt :: Qt :: PenStyle :: Class PenStyle
[frames] | no frames]

Class PenStyle

object --+    
         |    
       int --+
             |
            Qt.PenStyle

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.RasterOp-class.html0000644000076600000240000002402711501734225024566 0ustar hinsenstaff00000000000000 qt.Qt.RasterOp
qt :: Qt :: RasterOp :: Class RasterOp
[frames] | no frames]

Class RasterOp

object --+    
         |    
       int --+
             |
            Qt.RasterOp

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.SequenceMatch-class.html0000644000076600000240000002407211501734224025553 0ustar hinsenstaff00000000000000 qt.Qt.SequenceMatch
qt :: Qt :: SequenceMatch :: Class SequenceMatch
[frames] | no frames]

Class SequenceMatch

object --+    
         |    
       int --+
             |
            Qt.SequenceMatch

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.SortOrder-class.html0000644000076600000240000002403611501734224024751 0ustar hinsenstaff00000000000000 qt.Qt.SortOrder
qt :: Qt :: SortOrder :: Class SortOrder
[frames] | no frames]

Class SortOrder

object --+    
         |    
       int --+
             |
            Qt.SortOrder

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.StringComparisonMode-class.html0000644000076600000240000002415311501734225027135 0ustar hinsenstaff00000000000000 qt.Qt.StringComparisonMode
qt :: Qt :: StringComparisonMode :: Class StringComparisonMode
[frames] | no frames]

Class StringComparisonMode

object --+    
         |    
       int --+
             |
            Qt.StringComparisonMode

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.TextFlags-class.html0000644000076600000240000002403611501734225024730 0ustar hinsenstaff00000000000000 qt.Qt.TextFlags
qt :: Qt :: TextFlags :: Class TextFlags
[frames] | no frames]

Class TextFlags

object --+    
         |    
       int --+
             |
            Qt.TextFlags

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.TextFormat-class.html0000644000076600000240000002404511501734225025124 0ustar hinsenstaff00000000000000 qt.Qt.TextFormat
qt :: Qt :: TextFormat :: Class TextFormat
[frames] | no frames]

Class TextFormat

object --+    
         |    
       int --+
             |
            Qt.TextFormat

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.TimeSpec-class.html0000644000076600000240000002402711501734225024540 0ustar hinsenstaff00000000000000 qt.Qt.TimeSpec
qt :: Qt :: TimeSpec :: Class TimeSpec
[frames] | no frames]

Class TimeSpec

object --+    
         |    
       int --+
             |
            Qt.TimeSpec

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.UIEffect-class.html0000644000076600000240000002402711501734224024460 0ustar hinsenstaff00000000000000 qt.Qt.UIEffect
qt :: Qt :: UIEffect :: Class UIEffect
[frames] | no frames]

Class UIEffect

object --+    
         |    
       int --+
             |
            Qt.UIEffect

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.WidgetFlags-class.html0000644000076600000240000002405411501734225025227 0ustar hinsenstaff00000000000000 qt.Qt.WidgetFlags
qt :: Qt :: WidgetFlags :: Class WidgetFlags
[frames] | no frames]

Class WidgetFlags

object --+    
         |    
       int --+
             |
            Qt.WidgetFlags

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.WidgetState-class.html0000644000076600000240000002405411501734225025253 0ustar hinsenstaff00000000000000 qt.Qt.WidgetState
qt :: Qt :: WidgetState :: Class WidgetState
[frames] | no frames]

Class WidgetState

object --+    
         |    
       int --+
             |
            Qt.WidgetState

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.WindowState-class.html0000644000076600000240000002405411501734225025277 0ustar hinsenstaff00000000000000 qt.Qt.WindowState
qt :: Qt :: WindowState :: Class WindowState
[frames] | no frames]

Class WindowState

object --+    
         |    
       int --+
             |
            Qt.WindowState

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.Qt.WindowsVersion-class.html0000644000076600000240000002410111501734225026020 0ustar hinsenstaff00000000000000 qt.Qt.WindowsVersion
qt :: Qt :: WindowsVersion :: Class WindowsVersion
[frames] | no frames]

Class WindowsVersion

object --+    
         |    
       int --+
             |
            Qt.WindowsVersion

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.QWidget.BackgroundOrigin-class.html0000644000076600000240000002415011501734225027233 0ustar hinsenstaff00000000000000 qt.QWidget.BackgroundOrigin
qt :: QWidget :: BackgroundOrigin :: Class BackgroundOrigin
[frames] | no frames]

Class BackgroundOrigin

object --+    
         |    
       int --+
             |
            QWidget.BackgroundOrigin

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/qt.QWidget.FocusPolicy-class.html0000644000076600000240000002410511501734225026243 0ustar hinsenstaff00000000000000 qt.QWidget.FocusPolicy
qt :: QWidget :: FocusPolicy :: Class FocusPolicy
[frames] | no frames]

Class FocusPolicy

object --+    
         |    
       int --+
             |
            QWidget.FocusPolicy

Instance Methods
 
__reduce__(...)
helper for pickle

Inherited from int: __abs__, __add__, __and__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __new__, __nonzero__, __oct__, __or__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __repr__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __str__, __sub__, __truediv__, __xor__

Inherited from object: __delattr__, __init__, __reduce_ex__, __setattr__

Properties

Inherited from object: __class__

Method Details

__reduce__(...)

 

helper for pickle

Overrides: object.__reduce__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/redirect.html0000644000076600000240000003116311501734225022516 0ustar hinsenstaff00000000000000Epydoc Redirect Page

Epydoc Auto-redirect page

When javascript is enabled, this page will redirect URLs of the form redirect.html#dotted.name to the documentation for the object with the given fully-qualified dotted name.

 

ScientificPython-2.9.4/Doc/Reference/Scientific-module.html0000644000076600000240000004202411501734224024255 0ustar hinsenstaff00000000000000 Scientific
Package Scientific
[frames] | no frames]

Package Scientific

ScientificPython is a collection of Python modules that are useful for scientific computing. In this collection you will find modules that cover basic geometry (vectors, tensors, transformations, vector and tensor fields), quaternions, automatic derivatives, (linear) interpolation, polynomials, elementary statistics, nonlinear least-squares fits, unit calculations, Fortran-compatible text formatting, 3D visualization via VRML, and two Tk widgets for simple line plots and 3D wireframe models. There are also interfaces to the netCDF library (portable structured binary files), to MPI (Message Passing Interface, message-based parallel programming), and to BSPlib (Bulk Synchronous Parallel programming). For details consult the manual.


Version: 2.9.0

Submodules

Classes
  IterationCountExceededError
ScientificPython-2.9.4/Doc/Reference/Scientific.BSP-module.html0000644000076600000240000003070711501734224024705 0ustar hinsenstaff00000000000000 Scientific.BSP
Package Scientific :: Package BSP
[frames] | no frames]

Package BSP

High-level parallelization constructs based on the Bulk Synchronous Parallel (BSP) model.

Parallelization requires a low-level communications library, which can be either BSPlib or MPI. Programs must be run with the bsppython or mpipython executables in order to use several processors. When run with a standard Python interpreter, only one processor is available.

A warning about object identity: when a communication operation transmits a Python object to the same processor, the object in the return list can either be the sent object or a copy of it. Application programs thus should not make any assumptions about received objects being different from sent objects.

Submodules

Classes
  ParAccumulator
Global accumulator
  ParBase
Distributed data base class
  ParClass
Global class
  ParConstant
Global constant
  ParData
Global data
  ParFunction
Global function
  ParIndex
Parallel index value
  ParIndexIterator
Parallel index iterator
  ParIterator
Parallel iterator
  ParMessages
Global message list
  ParRootFunction
Asymmetric global function
  ParRootSequence
Global distributed sequence with data taken from processor 0
  ParSequence
Global distributed sequence
  ParTuple
Global data tuple
  ParValue
Global data
Variables
  ParInvalid = <Scientific.BSP.core._ParInvalid object at 0x2573...
  name = 'world'
  numberOfProcessors = 1
  processorID = 0
Variables Details

ParInvalid

Value:
<Scientific.BSP.core._ParInvalid object at 0x2573910>

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.Console-module.html0000644000076600000240000002436111501734225026306 0ustar hinsenstaff00000000000000 Scientific.BSP.Console
Package Scientific :: Package BSP :: Module Console
[frames] | no frames]

Module Console

Interactive console for parallel computing

Classes
  BSPSyncError
  OKToken
  OutputStream
  ParallelConsole
  ParallelInterpreter
Functions
 
console()
 
interpreter()
 
isOK(object)
 
syncCheck()
 
synchronize()
 
typePar(object)
Variables
  numberOfProcessors = 1
  ok = <Scientific.BSP.Console.OKToken instance at 0x2585e68>
  processorID = 0
ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.Console.BSPSyncError-class.html0000644000076600000240000001422511501734225030416 0ustar hinsenstaff00000000000000 Scientific.BSP.Console.BSPSyncError
Package Scientific :: Package BSP :: Module Console :: Class BSPSyncError
[frames] | no frames]

Class BSPSyncError

              object --+        
                       |        
exceptions.BaseException --+    
                           |    
        exceptions.Exception --+
                               |
                              BSPSyncError

Instance Methods

Inherited from exceptions.Exception: __init__, __new__

Inherited from exceptions.BaseException: __delattr__, __getattribute__, __getitem__, __reduce__, __repr__, __setattr__, __setstate__, __str__

Inherited from object: __hash__, __reduce_ex__

Properties

Inherited from exceptions.BaseException: args, message

Inherited from object: __class__

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.Console.OKToken-class.html0000644000076600000240000001167211501734224027437 0ustar hinsenstaff00000000000000 Scientific.BSP.Console.OKToken
Package Scientific :: Package BSP :: Module Console :: Class OKToken
[frames] | no frames]

Class OKToken

Instance Methods
 
__init__(self)
ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.Console.OutputStream-class.html0000644000076600000240000001422311501734224030574 0ustar hinsenstaff00000000000000 Scientific.BSP.Console.OutputStream
Package Scientific :: Package BSP :: Module Console :: Class OutputStream
[frames] | no frames]

Class OutputStream

Instance Methods
 
__getattr__(self, attr)
 
__init__(self, stream)
 
write(self, string)
ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.Console.ParallelConsole-class.html0000644000076600000240000002272411501734225031205 0ustar hinsenstaff00000000000000 Scientific.BSP.Console.ParallelConsole
Package Scientific :: Package BSP :: Module Console :: Class ParallelConsole
[frames] | no frames]

Class ParallelConsole

code.InteractiveInterpreter --+    
                              |    
        code.InteractiveConsole --+
                                  |
                                 ParallelConsole

Instance Methods
 
__init__(self)
Constructor.
 
mainloop(self)
 
push(self, line)
Push a line to the interpreter.

Inherited from code.InteractiveConsole: interact, raw_input, resetbuffer

Inherited from code.InteractiveInterpreter: runcode, runsource, showsyntaxerror, showtraceback, write

Method Details

__init__(self)
(Constructor)

 

Constructor.

The optional locals argument will be passed to the InteractiveInterpreter base class.

The optional filename argument should specify the (file)name of the input stream; it will show up in tracebacks.

Overrides: code.InteractiveInterpreter.__init__
(inherited documentation)

push(self, line)

 

Push a line to the interpreter.

The line should not have a trailing newline; it may have internal newlines. The line is appended to a buffer and the interpreter's runsource() method is called with the concatenated contents of the buffer as source. If this indicates that the command was executed or invalid, the buffer is reset; otherwise, the command is incomplete, and the buffer is left as it was after the line was appended. The return value is 1 if more input is required, 0 if the line was dealt with in some way (this is the same as runsource()).

Overrides: code.InteractiveConsole.push
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.Console.ParallelInterpreter-class.html0000644000076600000240000001657011501734225032110 0ustar hinsenstaff00000000000000 Scientific.BSP.Console.ParallelInterpreter
Package Scientific :: Package BSP :: Module Console :: Class ParallelInterpreter
[frames] | no frames]

Class ParallelInterpreter

code.InteractiveInterpreter --+
                              |
                             ParallelInterpreter

Instance Methods
 
__init__(self)
Constructor.
 
mainloop(self)

Inherited from code.InteractiveInterpreter: runcode, runsource, showsyntaxerror, showtraceback, write

Method Details

__init__(self)
(Constructor)

 

Constructor.

The optional 'locals' argument specifies the dictionary in which code will be executed; it defaults to a newly created dictionary with key "__name__" set to "__console__" and key "__doc__" set to None.

Overrides: code.InteractiveInterpreter.__init__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.IO-module.html0000644000076600000240000001540111501734224025205 0ustar hinsenstaff00000000000000 Scientific.BSP.IO
Package Scientific :: Package BSP :: Module IO
[frames] | no frames]

Module IO

Parallel acces to netCDF files

One netCDF dimension is defined for splitting the data among processors such that each processor is responsible for one slice of the file along that dimension.

Since netCDF files can be very big, the distribution algorithm gives priority to memory efficiency over CPU time efficiency. The processor that handles the file treats only one slice per superstep, which means that at no time more than one slice must be stored in any processor.

Variables
  ParInvalid = <Scientific.BSP.core._ParInvalid object at 0x2573...
  ParNetCDFFile = <Scientific.BSP.ParClass object at 0x25982d0>
  ParNetCDFVariable = <Scientific.BSP.ParClass object at 0x2598290>
Variables Details

ParInvalid

Value:
<Scientific.BSP.core._ParInvalid object at 0x2573910>

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParAccumulator-class.html0000644000076600000240000003256511501734225027453 0ustar hinsenstaff00000000000000 Scientific.BSP.ParAccumulator
Package Scientific :: Package BSP :: Class ParAccumulator
[frames] | no frames]

Class ParAccumulator

object --+    
         |    
  ParValue --+
             |
            ParAccumulator

Global accumulator

ParAccumulator objects are used to perform iterative reduction operations in loops. The initial local value is zero (i.e. the passed-in zero object, not the number 0), which is modified by subsequent calls to the method addValue.

Instance Methods
 
__init__(self, operator, zero)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
addValue(self, value)
Replace the internal value of the accumulator by internal_value = operator(internal_value, value).
ParValue
calculateTotal(self)
Returns: a reduction over the local values on all processors

Inherited from ParValue: __add__, __call__, __div__, __divmod__, __eq__, __ge__, __getattr__, __getitem__, __gt__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __pow__, __repr__, __str__, __sub__, accumulate, alltrue, anytrue, broadcast, fullExchange, get, getattr, map, put, reduce

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables

Inherited from ParValue: is_parvalue

Properties

Inherited from object: __class__

Method Details

__init__(self, operator, zero)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • operator (function of two variables) - a local function taking two arguments and returning one argument of the same type
  • zero - the initial value for reduction
Overrides: object.__init__

calculateTotal(self)

 
Returns: ParValue
a reduction over the local values on all processors

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParBase-class.html0000644000076600000240000003301111501734224026030 0ustar hinsenstaff00000000000000 Scientific.BSP.ParBase
Package Scientific :: Package BSP :: Class ParBase
[frames] | no frames]

Class ParBase

object --+
         |
        ParBase
Known Subclasses:
  • IO._ParNetCDFFile
  • , IO._ParNetCDFVariable
  • , Tasks._ParTaskList

Distributed data base class

Local classes that are to be used in global classes must inherit from this class.

Instance Methods
any
broadcast(self, data, from_pid=0)
Send a local value of one processor to all processors.
list
exchangeMessages(self, message_list)
Returns: the incoming data
list
get(self, data, pid_list)
Request the local values of other processors.
list
put(self, data, pid_list)
Send data to other processors

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables
  is_parclass = 1
Properties

Inherited from object: __class__

Method Details

broadcast(self, data, from_pid=0)

 

Send a local value of one processor to all processors.

Parameters:
  • data - the data to be transmitted. This value is used only on one processor.
  • from_pid (any) - the processor whose data is broadcast
Returns: any
the received data

exchangeMessages(self, message_list)

 
Parameters:
  • message_list (list) - a list of (pid, data) pairs to be transmitted
Returns: list
the incoming data

get(self, data, pid_list)

 

Request the local values of other processors.

Parameters:
  • data (any) - the data to be sent to processors who request it
  • pid_list (list) - the list of processor numbers to which data requests are sent
Returns: list
the values received from other processors

put(self, data, pid_list)

 

Send data to other processors

Parameters:
  • data (any) - the data to be sent
  • pid_list (list) - the list of processor numbers to which the data is sent
Returns: list
the values received from other processors

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParClass-class.html0000644000076600000240000002177011501734225026235 0ustar hinsenstaff00000000000000 Scientific.BSP.ParClass
Package Scientific :: Package BSP :: Class ParClass
[frames] | no frames]

Class ParClass

object --+
         |
        ParClass

Global class

Global classes are needed to construct global objects that have more functionalities than offered by the ParValue class hierarchy. When an instance of a global class is generated, each processor generates an instance of the local class that becomes the local value of the new global object. Attribute requests and method calls are passed through to the local objects and the results are assembled into global objects (ParValue or ParFunction). The arguments to methods of a global class must be global objects, the local class methods are then called with the corresponding local values.

The local objects are initialized via the special method __parinit__ instead of the usual __init__. This method is called with two special arguments (processor number and total number of processors) followed by the local values of the arguments to the global object initialization call.

The local classes must inherit from the base class ParBase (see below), which also provides communication routines.

Instance Methods
 
__call__(self, *args, **kwargs)
 
__init__(self, local_class)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, local_class)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • local_class - a standard Python class
Overrides: object.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParConstant-class.html0000644000076600000240000002573211501734225026763 0ustar hinsenstaff00000000000000 Scientific.BSP.ParConstant
Package Scientific :: Package BSP :: Class ParConstant
[frames] | no frames]

Class ParConstant

object --+    
         |    
  ParValue --+
             |
            ParConstant

Global constant

A subclass of ParValue that stores an identical value on each processor. It must be called with the same argument on all processors, but this is not verified in the current implementation.

Instance Methods
 
__init__(self, value)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Inherited from ParValue: __add__, __call__, __div__, __divmod__, __eq__, __ge__, __getattr__, __getitem__, __gt__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __pow__, __repr__, __str__, __sub__, accumulate, alltrue, anytrue, broadcast, fullExchange, get, getattr, map, put, reduce

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables

Inherited from ParValue: is_parvalue

Properties

Inherited from object: __class__

Method Details

__init__(self, value)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • value (any) - any local or global object
Overrides: object.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParData-class.html0000644000076600000240000002602611501734224026037 0ustar hinsenstaff00000000000000 Scientific.BSP.ParData
Package Scientific :: Package BSP :: Class ParData
[frames] | no frames]

Class ParData

object --+    
         |    
  ParValue --+
             |
            ParData

Global data

A subclass of ParValue that calculates its local value from the processor number.

Instance Methods
 
__init__(self, function)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Inherited from ParValue: __add__, __call__, __div__, __divmod__, __eq__, __ge__, __getattr__, __getitem__, __gt__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __pow__, __repr__, __str__, __sub__, accumulate, alltrue, anytrue, broadcast, fullExchange, get, getattr, map, put, reduce

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables

Inherited from ParValue: is_parvalue

Properties

Inherited from object: __class__

Method Details

__init__(self, function)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • function (function of two arguments) - a function that is called with two arguments (processor number and number of processors in the system) and whose return value becomes the local value of the global object.
Overrides: object.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParFunction-class.html0000644000076600000240000003050211501734224026745 0ustar hinsenstaff00000000000000 Scientific.BSP.ParFunction
Package Scientific :: Package BSP :: Class ParFunction
[frames] | no frames]

Class ParFunction

object --+    
         |    
  ParValue --+
             |
            ParFunction
Known Subclasses:

Global function

Global functions are called with global object arguments. The local values of these arguments are then passed to the local function, and the result is returned in a ParValue object.

Instance Methods
 
__init__(self, local_function)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__repr__(self)
repr(x)

Inherited from ParValue: __add__, __call__, __div__, __divmod__, __eq__, __ge__, __getattr__, __getitem__, __gt__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __pow__, __str__, __sub__, accumulate, alltrue, anytrue, broadcast, fullExchange, get, getattr, map, put, reduce

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables

Inherited from ParValue: is_parvalue

Properties

Inherited from object: __class__

Method Details

__init__(self, local_function)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • local_function (callable) - any function
Overrides: object.__init__

__repr__(self)
(Representation operator)

 

repr(x)

Overrides: object.__repr__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParIndex-class.html0000644000076600000240000002272211501734225026235 0ustar hinsenstaff00000000000000 Scientific.BSP.ParIndex
Package Scientific :: Package BSP :: Class ParIndex
[frames] | no frames]

Class ParIndex

object --+
         |
        ParIndex
Known Subclasses:
  • core.ParSlice

Parallel index value

ParIndex objects are returned by ParIndexIterator. They are not meant ot be created in any other way.

Instance Methods
 
__init__(self, index, valid=1)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__repr__(self)
repr(x)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Variables
  is_parindex = 1
Properties

Inherited from object: __class__

Method Details

__init__(self, index, valid=1)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

 

repr(x)

Overrides: object.__repr__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParIndexIterator-class.html0000644000076600000240000002073711501734224027752 0ustar hinsenstaff00000000000000 Scientific.BSP.ParIndexIterator
Package Scientific :: Package BSP :: Class ParIndexIterator
[frames] | no frames]

Class ParIndexIterator

object --+
         |
        ParIndexIterator

Parallel index iterator

A ParIndexIterator is used to loop index by index over one or more distributed sequences. At each iteration, the returned item (a ParIndex object) contains indices of different elements of the distributed sequence(s). The index objects can be used to index any ParValue object whose local value is a sequence object.

Instance Methods
 
__getitem__(self, item)
 
__init__(self, sequence)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, sequence)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • sequence (ParSequence) - a global object representing a distributed sequence
Overrides: object.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParIterator-class.html0000644000076600000240000002047511501734225026762 0ustar hinsenstaff00000000000000 Scientific.BSP.ParIterator
Package Scientific :: Package BSP :: Class ParIterator
[frames] | no frames]

Class ParIterator

object --+
         |
        ParIterator

Parallel iterator

Constructor: ParIterator(|global_sequence|)

Arguments:

A ParIterator is used to loop element by element over a distributed sequence. At each iteration, the returned item (a global object) contains different elements of the distributed sequence.

Instance Methods
 
__getitem__(self, item)
 
__init__(self, sequence)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, sequence)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • sequence (ParSequence) - a global object representing a distributed sequence
Overrides: object.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParMessages-class.html0000644000076600000240000003600011501734225026727 0ustar hinsenstaff00000000000000 Scientific.BSP.ParMessages
Package Scientific :: Package BSP :: Class ParMessages
[frames] | no frames]

Class ParMessages

object --+    
         |    
  ParValue --+
             |
            ParMessages

Global message list

Instance Methods
 
__init__(self, messages)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
ParValue
data(self)
Returns: a global object whose local value is a list of all data items in the messages.
ParValue
exchange(self)
Transmit all the messages
ParValue
processorIds(self)
Returns: a global object whose local value is a list of all processor Ids referenced in a message

Inherited from ParValue: __add__, __call__, __div__, __divmod__, __eq__, __ge__, __getattr__, __getitem__, __gt__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __pow__, __repr__, __str__, __sub__, accumulate, alltrue, anytrue, broadcast, fullExchange, get, getattr, map, put, reduce

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables

Inherited from ParValue: is_parvalue

Properties

Inherited from object: __class__

Method Details

__init__(self, messages)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • messages (Global sequence) - a global object whose local value is a list of (pid, data) pairs.
Overrides: object.__init__

data(self)

 
Returns: ParValue
a global object whose local value is a list of all data items in the messages.

exchange(self)

 

Transmit all the messages

Returns: ParValue
a global object containing the received messages

processorIds(self)

 
Returns: ParValue
a global object whose local value is a list of all processor Ids referenced in a message

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParRootFunction-class.html0000644000076600000240000002773611501734224027630 0ustar hinsenstaff00000000000000 Scientific.BSP.ParRootFunction
Package Scientific :: Package BSP :: Class ParRootFunction
[frames] | no frames]

Class ParRootFunction

object --+        
         |        
  ParValue --+    
             |    
   ParFunction --+
                 |
                ParRootFunction

Asymmetric global function

Constructor: ParRootFunction(|root_function|, |other_function|=None)

Arguments:

Global functions are called with global object arguments. The local values of these arguments are then passed to the local function, and the result is returned in a ParValue object.

A ParRootFunction differs from a ParFunction in that it uses a different local function for processor 0 than for the other processors. ParRootFunction objects are commonly used for I/O operations.

Instance Methods
 
__init__(self, local_function, other_function=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Inherited from ParFunction: __repr__

Inherited from ParValue: __add__, __call__, __div__, __divmod__, __eq__, __ge__, __getattr__, __getitem__, __gt__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __pow__, __str__, __sub__, accumulate, alltrue, anytrue, broadcast, fullExchange, get, getattr, map, put, reduce

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables

Inherited from ParValue: is_parvalue

Properties

Inherited from object: __class__

Method Details

__init__(self, local_function, other_function=None)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • local_function (callable) - the local function for processor 0
  • other_function (callable) - the local function for all other processors. The default is a function that returns None.
Overrides: object.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParRootSequence-class.html0000644000076600000240000002731711501734225027607 0ustar hinsenstaff00000000000000 Scientific.BSP.ParRootSequence
Package Scientific :: Package BSP :: Class ParRootSequence
[frames] | no frames]

Class ParRootSequence

object --+        
         |        
  ParValue --+    
             |    
   ParSequence --+
                 |
                ParRootSequence

Global distributed sequence with data taken from processor 0

The local value of a ParRootSequence object is a slice of the input sequence, which is constructed such that the concatenation of the local values of all processors equals the input sequence while making the number of elements on each processor as equal as possible.

Instance Methods
 
__init__(self, full_sequence)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Inherited from ParSequence: __getitem__, totalLength

Inherited from ParValue: __add__, __call__, __div__, __divmod__, __eq__, __ge__, __getattr__, __gt__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __pow__, __repr__, __str__, __sub__, accumulate, alltrue, anytrue, broadcast, fullExchange, get, getattr, map, put, reduce

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables

Inherited from ParValue: is_parvalue

Properties

Inherited from object: __class__

Method Details

__init__(self, full_sequence)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • full_sequence (ParValue) - on processor 0: the full sequence, equal to the concatenation of the local values of all processors. The local values on the other processors are not used.
Overrides: object.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParSequence-class.html0000644000076600000240000003466311501734224026744 0ustar hinsenstaff00000000000000 Scientific.BSP.ParSequence
Package Scientific :: Package BSP :: Class ParSequence
[frames] | no frames]

Class ParSequence

object --+    
         |    
  ParValue --+
             |
            ParSequence
Known Subclasses:

Global distributed sequence

The local value of a ParSequence object is a slice of the input sequence, which is constructed such that the concatenation of the local values of all processors equals the input sequence while making the number of elements on each processor as equal as possible.

Instance Methods
any
__getitem__(self, item)
Returns: the element referred to by the index, if it is in the local subset
 
__init__(self, full_sequence)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
int
totalLength(self)
Returns: the sum of the lengths of the local values

Inherited from ParValue: __add__, __call__, __div__, __divmod__, __eq__, __ge__, __getattr__, __gt__, __le__, __len__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __pow__, __repr__, __str__, __sub__, accumulate, alltrue, anytrue, broadcast, fullExchange, get, getattr, map, put, reduce

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables

Inherited from ParValue: is_parvalue

Properties

Inherited from object: __class__

Method Details

__getitem__(self, item)
(Indexing operator)

 
Parameters:
  • item (int or ParIndex) - an index into the total sequence
Returns: any
the element referred to by the index, if it is in the local subset
Raises:
  • IndexError - if the index refers to an item on another processor
Overrides: ParValue.__getitem__

__init__(self, full_sequence)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • full_sequence (arbitrary sequence object) - the full sequence, equal to the concatenation of the local values of all processors
Overrides: object.__init__

totalLength(self)

 
Returns: int
the sum of the lengths of the local values

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParTuple-class.html0000644000076600000240000003252511501734224026260 0ustar hinsenstaff00000000000000 Scientific.BSP.ParTuple
Package Scientific :: Package BSP :: Class ParTuple
[frames] | no frames]

Class ParTuple

object --+    
         |    
  ParValue --+
             |
            ParTuple

Global data tuple

ParTuple objects are used to speed up communication when many data items need to be sent to the same processors. The construct a, b, c = ParTuple(a, b, c).put(pids) is logically equivalent to a = a.put(pids); b = b.put(pids); c = c.put(pids) but more efficient.

Instance Methods
 
__getitem__(self, item)
 
__init__(self, *args)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__len__(self)

Inherited from ParValue: __add__, __call__, __div__, __divmod__, __eq__, __ge__, __getattr__, __gt__, __le__, __lt__, __mod__, __mul__, __ne__, __neg__, __nonzero__, __pow__, __repr__, __str__, __sub__, accumulate, alltrue, anytrue, broadcast, fullExchange, get, getattr, map, put, reduce

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables

Inherited from ParValue: is_parvalue

Properties

Inherited from object: __class__

Method Details

__getitem__(self, item)
(Indexing operator)

 
Overrides: ParValue.__getitem__

__init__(self, *args)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • args (tuple) - any global objects
Overrides: object.__init__

__len__(self)
(Length operator)

 
Overrides: ParValue.__len__

ScientificPython-2.9.4/Doc/Reference/Scientific.BSP.ParValue-class.html0000644000076600000240000011161411501734224026240 0ustar hinsenstaff00000000000000 Scientific.BSP.ParValue
Package Scientific :: Package BSP :: Class ParValue
[frames] | no frames]

Class ParValue

object --+
         |
        ParValue
Known Subclasses:

Global data

ParValue instances are created internally, but are not meant to be created directly by application programs. Use the subclasses instead.

ParValue objects (and those of subclasses) implement the standard arithmetic and comparison operations. They also support attribute requests which are passed on to the local values; the return values are ParValue objects. ParValue objects can also be called if their local values are callable.

Instance Methods
 
__add__(self, other)
 
__call__(self, *args, **kwargs)
 
__div__(self, other)
 
__divmod__(self, other)
 
__eq__(self, other)
 
__ge__(self, other)
 
__getattr__(self, attr)
 
__getitem__(self, item)
 
__gt__(self, other)
 
__init__(self, value, valid=True)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__le__(self, other)
 
__len__(self)
 
__lt__(self, other)
 
__mod__(self, other)
 
__mul__(self, other)
 
__ne__(self, other)
 
__neg__(self)
 
__nonzero__(self)
 
__pow__(self, other)
 
__repr__(self)
str(x)
 
__str__(self)
str(x)
 
__sub__(self, other)
ParValue
accumulate(self, operator, zero)
Perform an accumulation over the local values of all processors.
Local bool
alltrue(self)
Returns: True if the local values on all processors are true.
Local bool
anytrue(self)
Returns: True if at least one of the local values on all processors is true.
ParValue
broadcast(self, from_pid=0)
Transmit the local data of one processor to all processors.
ParValue
fullExchange(self)
Transmit the local data of each processor to all other processors.
ParValue
get(self, pid_list)
Request the local data from all specified processors.
 
getattr(self, attr)
 
map(self, function)
ParValue
put(self, pid_list)
Send the local data to all specified processors.
ParValue
reduce(self, operator, zero)
Perform a reduction over the local values of all processors.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Class Variables
  is_parvalue = 1
Properties

Inherited from object: __class__

Method Details

__init__(self, value, valid=True)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • value (any) - the local value
  • valid - True if the value is valid, False if it is not. Invalid values are not treated, any operation on them produces an invalid result.
Overrides: object.__init__

__repr__(self)
(Representation operator)

 

str(x)

Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

accumulate(self, operator, zero)

 

Perform an accumulation over the local values of all processors.

Parameters:
  • operator (function of two variables) - the binary operator used in the accumulation
  • zero (any) - the initial value of the accumulation
Returns: ParValue
on each processor, the reduction of the values from processors with a lower or equal number

alltrue(self)

 
Returns: Local bool
True if the local values on all processors are true.

anytrue(self)

 
Returns: Local bool
True if at least one of the local values on all processors is true.

broadcast(self, from_pid=0)

 

Transmit the local data of one processor to all processors.

Parameters:
  • from_pid (int) - the ID of the processor that sends data
Returns: ParValue
the transmitted data on all processors

fullExchange(self)

 

Transmit the local data of each processor to all other processors.

Returns: ParValue
the transmitted data on all processors

get(self, pid_list)

 

Request the local data from all specified processors.

Parameters:
  • pid_list (Global list of int) - a list of processor IDs to which the data is sent.
Returns: ParValue
a global object whose local value is a list of all the data received from other processors. The order of the data in that list is not defined.

put(self, pid_list)

 

Send the local data to all specified processors.

Parameters:
  • pid_list (Global list of int) - a list of processor IDs to which the data is sent.
Returns: ParValue
a global object whose local value is a list of all the data received from other processors. The order of the data in that list is not defined.

reduce(self, operator, zero)

 

Perform a reduction over the local values of all processors.

Parameters:
  • operator (function of two variables) - the binary operator used in the reduction
  • zero (any) - the initial value of the reduction
Returns: ParValue
the reduction on processor 0, zero elsewhere

ScientificPython-2.9.4/Doc/Reference/Scientific.Clustering-module.html0000644000076600000240000001104611501734225026374 0ustar hinsenstaff00000000000000 Scientific.Clustering
Package Scientific :: Package Clustering
[frames] | no frames]

Package Clustering

Submodules

ScientificPython-2.9.4/Doc/Reference/Scientific.Clustering.AffinityPropagation-module.html0000644000076600000240000001266211501734225032355 0ustar hinsenstaff00000000000000 Scientific.Clustering.AffinityPropagation
Package Scientific :: Package Clustering :: Module AffinityPropagation
[frames] | no frames]

Module AffinityPropagation

Clustering by Affinity Propagation

This clustering algorithm identifies clusters in a set of data items based on a list of similarities between the items. The result is a list of clusters, each cluster being defined by one 'exemplar' (the item that is most representative of the cluster) and by other items. The number of clusters is not specified in advance. Instead, a parameter called 'preference' indicates how likely each item is to be an exemplar. Often it is set to the same value for all items. Low preference values yield few big clusters, whereas high preference values yield many small clusters.

The algorithm is described in: B.J. Frey & D. Dueck, Science 315, 972-976 (2007)

Classes
  DataSet
A collection of data items with similarities
ScientificPython-2.9.4/Doc/Reference/Scientific.Clustering.AffinityPropagation.DataSet-class.html0000644000076600000240000003054511501734224033520 0ustar hinsenstaff00000000000000 Scientific.Clustering.AffinityPropagation.DataSet
Package Scientific :: Package Clustering :: Module AffinityPropagation :: Class DataSet
[frames] | no frames]

Class DataSet

object --+
         |
        DataSet

A collection of data items with similarities

Instance Methods
 
__init__(self, items, similarities, symmetric=False, minimal_similarity=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
findClusters(self, preferences, max_iterations=500, convergence=50, damping=0.5)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, items, similarities, symmetric=False, minimal_similarity=None)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • items (sequence) - a sequence of data items
  • similarities - similarity values for item pairs. This parameter can have one of three forms:
    • a list if triples (index1, index2, similarity), where the indices point into the item list and the similarity is a real number.
    • a callable object (typically a function or a bound method) that is called with two items and returns the similarity.
    • an array of shape (N, N), where N is the number of items, containing the similarities. The diagonal elements are not used.
  • symmetric (bool) - if True, the similarity measure is assumed to be symmetric. If False, no such assumption is made and the input data (if a list) must contain both directions for each pair. If the similarity is defined by a function, it will be called twice of symmtric=False and once if symmetric=True. If the similarity is defined by an array, this parameter is not used.
  • minimal_similarity (float) - a cutoff value for the similarities; values smaller than this cutoff are discarded. This is of use for large data sets because both the runtime and the memory consumption increase with the number of similarity values.
Overrides: object.__init__

findClusters(self, preferences, max_iterations=500, convergence=50, damping=0.5)

 
Parameters:
  • preferences (float or sequence of float) - the preference values for the cluster identification. This can be either a single number, or a sequence with one value per item.
  • max_iterations (int) - the number of iterations at which the algorithm is stopped even if there is no convergence.
  • convergence (int) - the number of iterations during which the cluster decomposition must remain stable before it is returned as converged.
  • damping (float) - a number between 0 and 1 that influences by fast affinity and responsibility values can change.

ScientificPython-2.9.4/Doc/Reference/Scientific.DictWithDefault-module.html0000644000076600000240000001145211501734224027301 0ustar hinsenstaff00000000000000 Scientific.DictWithDefault
Package Scientific :: Module DictWithDefault
[frames] | no frames]

Module DictWithDefault

Dictionary with default values

Note: this module has become obsolete by the introduction of the get method for standard Python dictionaries. It is maintained only in order not to break old code that uses it.

Classes
  DictWithDefault
Dictionary with default values
ScientificPython-2.9.4/Doc/Reference/Scientific.DictWithDefault.DictWithDefault-class.html0000644000076600000240000002534311501734224032150 0ustar hinsenstaff00000000000000 Scientific.DictWithDefault.DictWithDefault
Package Scientific :: Module DictWithDefault :: Class DictWithDefault
[frames] | no frames]

Class DictWithDefault

UserDict.UserDict --+
                    |
                   DictWithDefault

Dictionary with default values

Instances of this class act like standard Python dictionaries, except that they return a *copy* of |default| for a key that has no associated value.

Instance Methods
 
__delitem__(self, key)
 
__getitem__(self, key)
Returns: the associated value.
 
__init__(self, default)

Inherited from UserDict.UserDict: __cmp__, __contains__, __len__, __repr__, __setitem__, clear, copy, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Class Methods

Inherited from UserDict.UserDict: fromkeys

Method Details

__delitem__(self, key)
(Index deletion operator)

 
Overrides: UserDict.UserDict.__delitem__

__getitem__(self, key)
(Indexing operator)

 
Parameters:
  • key - the key whose associated value is requested
Returns:
the associated value. If none is defined, the return value is a copy of the default value.
Overrides: UserDict.UserDict.__getitem__

__init__(self, default)
(Constructor)

 
Parameters:
  • default - the default value that is returned for a key that has no associated value
Overrides: UserDict.UserDict.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing-module.html0000644000076600000240000001140511501734224030423 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing
Package Scientific :: Package DistributedComputing
[frames] | no frames]

Package DistributedComputing

Submodules

ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.MasterSlave-module.html0000644000076600000240000004436111501734224032657 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing.MasterSlave
Package Scientific :: Package DistributedComputing :: Module MasterSlave
[frames] | no frames]

Module MasterSlave

Distributed computing using a master-slave model

The classes in this module provide a simple way to parallelize independent computations in a program. The communication is handled by the Pyro package, which must be installed before this module can be used. Pyro can be obtained from http://pyro.sourceforge.net/. By default, the Pyro name server is used to initialize communication. Please read the Pyro documentation for learning how to use the name server.

The principle of the master-slave model is that there is a single master process that defines computational tasks and any number of slave processes that execute these tasks. The master defines task requests and then waits for the results to come in. The slaves wait for a task request, execute it, return the result, and wait for the next task. There can be any number of slave processes, which can be started and terminated independently, the only condition being that no slave process can be started before its master process. This setup makes it possible to perform a lengthy computation using a variable number of processors.

Communication between the master and the slave processes passes through a TaskManager object that is created automatically as part of the master process. The task manager stores and hands out task requests and results. The task manager also keeps track of the slave processes. When a slave process disappears (because it was killed or because of a hardware failure), the task manager re-schedules its active task(s) to another slave process. This makes the master-slave system very fault tolerant.

Each task manager has a label that makes it possible to distinguish between several master-slave groups running at the same time. It is by the label that slave processes identify the master process for which they work.

The script "task_manager" prints statistics about a currently active task manager; it takes the label as an argument. It shows the number of currently active processes (master plus slaves), the number of waiting and running tasks, and the number of results waiting to be picked up.

The script Examples/master_slave_demo.py illustrates the use of the master-slave setup in a simple script. Both master and slave processes are defined in the same script. The scripts Examples/master.py and Examples/slave.py show a master-slave setup using two distinct scripts. This is more flexible because task requests and result retrievals can be made from anywhere in the master code.

Classes
  GlobalStateValue
  MasterProcess
Master process in a master-slave setup
  SlaveProcess
Slave process in a master-slave setup
Functions
 
getMachineInfo()
MasterProcess
initializeMasterProcess(label, slave_script=None, slave_module=None, use_name_server=True)
Initializes a master process.
 
runJob(label, master_class, slave_class, watchdog_period=120.0, launch_slaves=0)
Creates an instance of the master_class and runs it.
 
startSlaveProcess(label=None, master_host=None)
Starts a slave process.
Variables
  debug = False
Function Details

initializeMasterProcess(label, slave_script=None, slave_module=None, use_name_server=True)

 

Initializes a master process.

Parameters:
  • label (str) - the label that identifies the task manager
  • slave_script (str) - the file name of the script that defines the corresponding slave process
  • slave_module (str) - the name of the module that defines the corresponding slave process
  • use_name_server (bool) - If True (default), the task manager is registered with the Pyro name server. If False, the name server is not used and slave processes need to know the host on which the master process is running.
Returns: MasterProcess
a process object on which the methods requestTask() and retrieveResult() can be called.

runJob(label, master_class, slave_class, watchdog_period=120.0, launch_slaves=0)

 

Creates an instance of the master_class and runs it. A copy of the script and the current working directory are stored in the TaskManager object to enable the task_manager script to launch slave processes.

Parameters:
  • label (str) - the label that identifies the task manager
  • master_class - the class implementing the master process (a subclass of MasterProcess)
  • slave_class - the class implementing the slave process (a subclass of SlaveProcess)
  • watchdog_period (int or NoneType) - the interval (in seconds) at which the slave process sends messages to the manager to signal that it is still alive. If None, no messages are sent at all. In that case, the manager cannot recognize if the slave job has crashed or been killed.
  • launch_slaves (int) - the number of slaves jobs to launch immediately on the same machine that runs the master process

startSlaveProcess(label=None, master_host=None)

 

Starts a slave process. Must be called at the end of a script that defines or imports all task handlers.

Parameters:
  • label (str or NoneType) - the label that identifies the task manager. May be omitted if the slave process is started through the task_manager script.
  • master_host (str or NoneType) - If None (default), the task manager of the master process is located using the Pyro name server. If no name server is used, this parameter must be the hostname of the machine on which the master process runs, plus the port number if it is different from the default (7766).

././@LongLink0000000000000000000000000000015500000000000011216 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.MasterSlave.GlobalStateValue-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.MasterSlave.GlobalStateValue-cl0000644000076600000240000001710011501734224034211 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing.MasterSlave.GlobalStateValue
Package Scientific :: Package DistributedComputing :: Module MasterSlave :: Class GlobalStateValue
[frames] | no frames]

Class GlobalStateValue

object --+
         |
        GlobalStateValue

Instance Methods
 
__init__(self, state_id, name)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, state_id, name)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

././@LongLink0000000000000000000000000000015200000000000011213 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.MasterSlave.MasterProcess-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.MasterSlave.MasterProcess-class0000644000076600000240000004512511501734224034324 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing.MasterSlave.MasterProcess
Package Scientific :: Package DistributedComputing :: Module MasterSlave :: Class MasterProcess
[frames] | no frames]

Class MasterProcess

object --+
         |
        MasterProcess

Master process in a master-slave setup

A master process in a program is implemented by subclassing this class and overriding the method "run", which calls the methods "requestTask" and "retrieveResult". The process is then launched by calling the method "start".

Instance Methods
 
__init__(self, label, use_name_server=True)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
deleteGlobalState(self, state_id)
 
launchSlaveJobs(self, n=1)
Launch n slave jobs on the machine that also runs the master job.
str
requestTask(self, tag, *parameters)
Launches a task request.
tuple
retrieveResult(self, tag=None)
Returns: a tuple containing three values: the task id to which the result corresponds, the tag of the computational task, and the result returned by the slave method that handled the task
 
run(self)
The main routine of the master process.
 
setGlobalState(self, **kw)
 
shutdown(self)
 
start(self)
Starts the master process.
 
taskManagerThread(self)
This method represents the code that is executed in a background thread for remote access to the task manager.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, label, use_name_server=True)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • label (str) - the label that identifies the task manager
  • use_name_server (bool) - If True (default), the task manager is registered with the Pyro name server. If False, the name server is not used and slave processes need to know the host on which the master process is running.
Overrides: object.__init__

launchSlaveJobs(self, n=1)

 

Launch n slave jobs on the machine that also runs the master job.

Parameters:
  • n (int) - the number of slave jobs to be launched.

requestTask(self, tag, *parameters)

 

Launches a task request. The task will be executed by a slave process in a method called "do_"+tag that is called with the parameters given in the task request. Note that the order of task executions is not defined.

Parameters:
  • tag (str) - a tag identifying the computational task. It corresponds to the name of a method in the slave process.
  • parameters - the parameters passed to the corresponding method in the slave process. The only restriction on their types is that all parameters must be picklable.
Returns: str
a unique task id

retrieveResult(self, tag=None)

 
Parameters:
  • tag (str) - a tag identifying the computational task from which a return value is requested. If None, results from any task will be accepted.
Returns: tuple
a tuple containing three values: the task id to which the result corresponds, the tag of the computational task, and the result returned by the slave method that handled the task
Raises:

run(self)

 

The main routine of the master process. This method must be overridden in subclasses.


././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.MasterSlave.SlaveProcess-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.MasterSlave.SlaveProcess-class.0000644000076600000240000002712511501734224034221 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing.MasterSlave.SlaveProcess
Package Scientific :: Package DistributedComputing :: Module MasterSlave :: Class SlaveProcess
[frames] | no frames]

Class SlaveProcess

object --+
         |
        SlaveProcess

Slave process in a master-slave setup

A concrete slave process in a program is implemented by subclassing this class and adding the methods that handle the computational tasks. Such a method has the name "do_" followed by the tag of the computational task. The process is then launched by calling the method "start".

Instance Methods
 
__init__(self, label, master_host=None, watchdog_period=120.0)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
processParameter(self, parameter)
 
start(self, namespace=None)
Starts the slave process.
 
terminationTest(self)
 
watchdogThread(self)
This method is run in a separate thread that pings the master process regularly to signal that it is still alive.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, label, master_host=None, watchdog_period=120.0)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • label (str) - the label that identifies the task manager
  • master_host (str or NoneType) - If None (default), the task manager of the master process is located using the Pyro name server. If no name server is used, this parameter must be the hostname of the machine on which the master process runs, plus the port number if it is different from the default (7766).
  • watchdog_period (int or NoneType) - the interval (in seconds) at which the slave process sends messages to the manager to signal that it is still alive. If None, no messages are sent at all. In that case, the manager cannot recognize if the slave job has crashed or been killed.
Overrides: object.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.TaskManager-module.html0000644000076600000240000001614011501734225032621 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing.TaskManager
Package Scientific :: Package DistributedComputing :: Module TaskManager
[frames] | no frames]

Module TaskManager

Classes
  Task
Describes a task inside the task manager.
  TaskManager
Manager for computational tasks.
  TaskManagerTermination
Signals that the task manager has no more tasks to handle.
  TaskQueue
A FIFO queue for tasks.
  TaskRaisedException
Signals that an exception was raised inside a task.
  Watchdog
A background process that watches compute tasks and unregisters those that do not ping the task manager at the promised interval.
Variables
  debug = False
ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.TaskManager.Task-class.html0000644000076600000240000001776111501734225033354 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing.TaskManager.Task
Package Scientific :: Package DistributedComputing :: Module TaskManager :: Class Task
[frames] | no frames]

Class Task

object --+
         |
        Task

Describes a task inside the task manager.

Instance Methods
 
__init__(self, tag, parameters, task_id)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, tag, parameters, task_id)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • tag (str) - the tag of the computational task
  • parameters (tuple) - the parameters of the task
  • task_id (str) - the task id
Overrides: object.__init__

././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.TaskManager.TaskManager-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.TaskManager.TaskManager-class.h0000644000076600000240000011301711501734225034121 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing.TaskManager.TaskManager
Package Scientific :: Package DistributedComputing :: Module TaskManager :: Class TaskManager
[frames] | no frames]

Class TaskManager

Pyro.core.ObjBase --+
                    |
                   TaskManager

Manager for computational tasks.

A TaskManager accepts task requests and hands them out to other processes. It stores the results that can then be picked up by the requester. A TaskManager also keeps track of its compute processes. If a process disappears, its running tasks are re-scheduled for execution by another compute process. TaskManangers are thread-safe.

Instance Methods
 
__init__(self)
str
activeProcessInfo(self, pid)
Returns: information about the active process number pid
str
addTaskRequest(self, tag, parameters, process_id=None)
Returns: the task id
 
deleteData(self, label)
tuple

Returns the result of an arbitrary finished task. The task is removed from the list of finished tasks.

getAnyResult(self)
Returns: the task id, the task tag, and the result of the task
tuple

Returns a waiting task of arbitrary tag. The task is removed from the list of waiting tasks and added to the list of running tasks.

getAnyTask(self, process_id=None)
Returns: the task id, the task tag, and the parameters
tuple

Returns the result of a finished task that has the given tag. The task is removed from the list of finished tasks.

getResultWithTag(self, tag)
Returns: the task id and the result of the task
tuple

Returns a waiting task with the given tag. The task is removed from the list of waiting tasks and added to the list of running tasks.

getTaskWithTag(self, tag, process_id=None)
Returns: the task id and the parameters
int
numberOfActiveProcesses(self)
Returns: the number of active processes
tuple
numberOfTasks(self)
Returns: a tuple of dictionaries containing the number of waiting tasks, the number of running tasks, and the number of results waiting to be retrieved.
 
ping(self, process_id)
int

Registers a process with the task manager. All processes must call this method before making any other task manager calls.

registerProcess(self, watchdog_period=None, info=None)
Returns: a unique process id
 
retrieveData(self, label)
 
returnTask(self, task_id)
 
storeData(self, **kw)
 
storeException(self, task_id, exception, traceback)
 
storeResult(self, task_id, result)
 
terminate(self)
Signals that no more tasks or results will be requested.
 
unregisterProcess(self, process_id)

Inherited from Pyro.core.ObjBase: GUID, Pyro_dyncall, delegateTo, getAttrProxy, getDaemon, getLocalStorage, getProxy, remote_retrieve_code, remote_supply_code, setCodeValidator, setDaemon, setGUID

Method Details

__init__(self)
(Constructor)

 
Overrides: Pyro.core.ObjBase.__init__

activeProcessInfo(self, pid)

 
Parameters:
  • pid (int) - the number of an active process
Returns: str
information about the active process number pid

addTaskRequest(self, tag, parameters, process_id=None)

 
Parameters:
  • tag (str) - the tag of the task being requested
  • parameters - the parameters to be passed to the task
  • process_id (int) - the id of the requesting process (optional)
Returns: str
the task id

deleteData(self, label)

 
Parameters:
  • label (str) - the label of the data item to be deleted

getAnyResult(self)

 
Returns: tuple

Returns the result of an arbitrary finished task. The task is removed from the list of finished tasks.

the task id, the task tag, and the result of the task

getAnyTask(self, process_id=None)

 
Parameters:
  • process_id (int) - the id of the retrieving process (optional)
Returns: tuple

Returns a waiting task of arbitrary tag. The task is removed from the list of waiting tasks and added to the list of running tasks.

the task id, the task tag, and the parameters

getResultWithTag(self, tag)

 
Parameters:
  • tag - a task tag
Returns: tuple

Returns the result of a finished task that has the given tag. The task is removed from the list of finished tasks.

the task id and the result of the task

getTaskWithTag(self, tag, process_id=None)

 
Parameters:
  • tag (str) - a task tag
  • process_id (int) - the id of the retrieving process (optional)
Returns: tuple

Returns a waiting task with the given tag. The task is removed from the list of waiting tasks and added to the list of running tasks.

the task id and the parameters

numberOfActiveProcesses(self)

 
Returns: int
the number of active processes

numberOfTasks(self)

 
Returns: tuple
a tuple of dictionaries containing the number of waiting tasks, the number of running tasks, and the number of results waiting to be retrieved. Each dictionary contains the count for each tag.

ping(self, process_id)

 
Parameters:
  • process_id (int

    Tells the task manager that a process is still alive.

    ) - the id of the process

registerProcess(self, watchdog_period=None, info=None)

 
Parameters:
  • watchdog_period (int or NoneType) - the period at which the registering process promises to ping the task manager to signal that is still alive. If None, no pings are expected.
  • info (str) - an information string telling something about the machine running the process
Returns: int

Registers a process with the task manager. All processes must call this method before making any other task manager calls.

a unique process id

retrieveData(self, label)

 
Parameters:
  • label (str) - the label of the data item to be retrieved

returnTask(self, task_id)

 
Parameters:
  • task_id (str

    Removes a task from the list of running tasks and put its back at the beginning of the list of waiting tasks. This method should be called by a process that has obtained a task but cannot handle it.

    ) - the id of the task for which the result is provided

storeData(self, **kw)

 
Parameters:
  • kw (dict

    This routine permits processes to exchange arbitrary data items through the task manager.

    ) - a keyword list of data items to be stored

storeException(self, task_id, exception, traceback)

 
Parameters:
  • task_id (str) - the id of the task for which the result is provided
  • exception - the exception raised by the task
  • traceback (str

    Stores the exception associated with the task. The task is removed from the list of running tasks and added to the list of finished tasks. When the result is retrieved by another process, TaskRaisedException is raised.

    ) - a text version of the stack traceback at the time of the exception

storeResult(self, task_id, result)

 
Parameters:
  • task_id (str) - the id of the task for which the result is provided
  • result - the result of the task

    Stores the result associated with the task. The task is removed from the list of running tasks and added to the list of finished tasks.

terminate(self)

 

Signals that no more tasks or results will be requested. All waiting threads will be terminated by raising TaskManagerTermination.

unregisterProcess(self, process_id)

 
Parameters:
  • process_id (int

    Removes the process from the task manager's process list. All processes should unregister when they are no longer available for accepting tasks. The task manager will also unregister processes itself if they do not ping the task manager at the promised frequency.

    ) - the id of the process

././@LongLink0000000000000000000000000000016300000000000011215 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.TaskManager.TaskManagerTermination-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.TaskManager.TaskManagerTerminat0000644000076600000240000001455711501734225034305 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing.TaskManager.TaskManagerTermination
Package Scientific :: Package DistributedComputing :: Module TaskManager :: Class TaskManagerTermination
[frames] | no frames]

Class TaskManagerTermination

              object --+        
                       |        
exceptions.BaseException --+    
                           |    
        exceptions.Exception --+
                               |
                              TaskManagerTermination

Signals that the task manager has no more tasks to handle.

Instance Methods

Inherited from exceptions.Exception: __init__, __new__

Inherited from exceptions.BaseException: __delattr__, __getattribute__, __getitem__, __reduce__, __repr__, __setattr__, __setstate__, __str__

Inherited from object: __hash__, __reduce_ex__

Properties

Inherited from exceptions.BaseException: args, message

Inherited from object: __class__

././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.TaskManager.TaskQueue-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.TaskManager.TaskQueue-class.htm0000644000076600000240000004440611501734225034201 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing.TaskManager.TaskQueue
Package Scientific :: Package DistributedComputing :: Module TaskManager :: Class TaskQueue
[frames] | no frames]

Class TaskQueue

object --+
         |
        TaskQueue

A FIFO queue for tasks. This class is thread-safe.

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
int
__len__(self)
Returns: the number of tasks in the queue
 
addTask(self, task, in_front=False)
Task

Removes the first task from the queue and returns it. If the task queue is empty, the method blocks until a task becomes available.

firstTask(self)
Returns: the first task in the queue
Task

Removes the first task with the given tag from the queue and returns it. If no task with the requested tag is available, the method blocks until a matching task becomes available.

firstTaskWithTag(self, tag)
Returns: the first task in the queue
dict
taskCount(self)
Returns: a dictionary listing the number of tasks for each tag
Task

Removes the task with the given task_id from the queue and returns it. If the task is not in the queue, the method blocks until it becomes available.

taskWithId(self, task_id)
Returns: the task with the given task_id
 
terminateWaitingThreads(self)
Makes all threads waiting for a task raise TaskManagerTermination.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__len__(self)
(Length operator)

 
Returns: int
the number of tasks in the queue

addTask(self, task, in_front=False)

 
Parameters:
  • task (Task) - the task to be added
  • in_front (bool) - if True, add the task at the beginning of the queue (this is for re-scheduling tasks that were rejected or not properly handled). Otherwise, add the task at the end of the queue.

firstTask(self)

 
Returns: Task

Removes the first task from the queue and returns it. If the task queue is empty, the method blocks until a task becomes available.

the first task in the queue

firstTaskWithTag(self, tag)

 
Parameters:
  • tag (str) - a task tag
Returns: Task

Removes the first task with the given tag from the queue and returns it. If no task with the requested tag is available, the method blocks until a matching task becomes available.

the first task in the queue

taskCount(self)

 
Returns: dict
a dictionary listing the number of tasks for each tag

taskWithId(self, task_id)

 
Parameters:
  • task_id (str) - a task id
Returns: Task

Removes the task with the given task_id from the queue and returns it. If the task is not in the queue, the method blocks until it becomes available.

the task with the given task_id

././@LongLink0000000000000000000000000000016000000000000011212 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.TaskManager.TaskRaisedException-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.TaskManager.TaskRaisedException0000644000076600000240000002142511501734225034305 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing.TaskManager.TaskRaisedException
Package Scientific :: Package DistributedComputing :: Module TaskManager :: Class TaskRaisedException
[frames] | no frames]

Class TaskRaisedException

              object --+        
                       |        
exceptions.BaseException --+    
                           |    
        exceptions.Exception --+
                               |
                              TaskRaisedException

Signals that an exception was raised inside a task. Four attributes provide information about the task and the exception: "task_id" is the task's id, "tag" is its tag, "exception" contains the original exception object, and "traceback" contains a text representation of the stack traceback at the time of the exception.

Instance Methods
 
__init__(self, task_id, tag, exception, traceback)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Inherited from exceptions.Exception: __new__

Inherited from exceptions.BaseException: __delattr__, __getattribute__, __getitem__, __reduce__, __repr__, __setattr__, __setstate__, __str__

Inherited from object: __hash__, __reduce_ex__

Properties

Inherited from exceptions.BaseException: args, message

Inherited from object: __class__

Method Details

__init__(self, task_id, tag, exception, traceback)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.DistributedComputing.TaskManager.Watchdog-class.html0000644000076600000240000002503411501734225034202 0ustar hinsenstaff00000000000000 Scientific.DistributedComputing.TaskManager.Watchdog
Package Scientific :: Package DistributedComputing :: Module TaskManager :: Class Watchdog
[frames] | no frames]

Class Watchdog

object --+
         |
        Watchdog

A background process that watches compute tasks and unregisters those that do not ping the task manager at the promised interval.

Instance Methods
 
__init__(self, task_manager)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
ping(self, process_id)
 
registerProcess(self, process_id, ping_period)
 
terminate(self, blocking=False)
 
unregisterProcess(self, process_id)
 
watchdogThread(self)

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, task_manager)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.FFT-module.html0000644000076600000240000001113111501734225024667 0ustar hinsenstaff00000000000000 Scientific.FFT
Package Scientific :: Module FFT
[frames] | no frames]

Module FFT

Variables
  package = 'NumPy'
ScientificPython-2.9.4/Doc/Reference/Scientific.Functions-module.html0000644000076600000240000001404411501734225026226 0ustar hinsenstaff00000000000000 Scientific.Functions
Package Scientific :: Package Functions
[frames] | no frames]

Package Functions

Submodules

ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Derivatives-module.html0000644000076600000240000003130711501734225030513 0ustar hinsenstaff00000000000000 Scientific.Functions.Derivatives
Package Scientific :: Package Functions :: Module Derivatives
[frames] | no frames]

Module Derivatives

Automatic differentiation for functions of any number of variables up to any order

An instance of the class DerivVar represents the value of a function and the values of its partial derivatives with respect to a list of variables. All common mathematical operations and functions are available for these numbers. There is no restriction on the type of the numbers fed into the code; it works for real and complex numbers as well as for any Python type that implements the necessary operations.

If only first-order derivatives are required, the module FirstDerivatives should be used. It is compatible to this one, but significantly faster.

Example:

 print sin(DerivVar(2))

produces the output:

 (0.909297426826, [-0.416146836547])

The first number is the value of sin(2); the number in the following list is the value of the derivative of sin(x) at x=2, i.e. cos(2).

When there is more than one variable, DerivVar must be called with an integer second argument that specifies the number of the variable.

Example:

   >>>x = DerivVar(7., 0)
   >>>y = DerivVar(42., 1)
   >>>z = DerivVar(pi, 2)
   >>>print (sqrt(pow(x,2)+pow(y,2)+pow(z,2)))

   produces the output

   >>>(42.6950770511, [0.163953328662, 0.98371997197, 0.0735820818365])

The numbers in the list are the partial derivatives with respect to x, y, and z, respectively.

Higher-order derivatives are requested with an optional third argument to DerivVar.

Example:

   >>>x = DerivVar(3., 0, 3)
   >>>y = DerivVar(5., 1, 3)
   >>>print sqrt(x*y)

   produces the output

   >>>(3.87298334621,
   >>>    [0.645497224368, 0.387298334621],
   >>>      [[-0.107582870728, 0.0645497224368],
   >>>        [0.0645497224368, -0.0387298334621]],
   >>>          [[[0.053791435364, -0.0107582870728],
   >>>            [-0.0107582870728, -0.00645497224368]],
   >>>           [[-0.0107582870728, -0.00645497224368],
   >>>            [-0.00645497224368, 0.0116189500386]]])

The individual orders can be extracted by indexing:

   >>>print sqrt(x*y)[0]
   >>>3.87298334621
   >>>print sqrt(x*y)[1]
   >>>[0.645497224368, 0.387298334621]

An n-th order derivative is represented by a nested list of depth n.

When variables with different differentiation orders are mixed, the result has the lower one of the two orders. An exception are zeroth-order variables, which are treated as constants.

Caution: Higher-order derivatives are implemented by recursively using DerivVars to represent derivatives. This makes the code very slow for high orders.

Note: It doesn't make sense to use multiple DerivVar objects with different values for the same variable index in one calculation, but there is no check for this. I.e.:

   >>>print DerivVar(3, 0)+DerivVar(5, 0)

   produces

   >>>(8, [2])

but this result is meaningless.

Classes
  DerivVar
Numerical variable with automatic derivatives of arbitrary order
Functions
Scientific.Geometry.Vector
DerivVector(x, y, z, index=0, order=1)
Returns: a vector whose components are DerivVar objects
bool
isDerivVar(x)
Returns: True if x is a DerivVar object, False otherwise
Function Details

DerivVector(x, y, z, index=0, order=1)

 
Parameters:
  • x (number) - x component of the vector
  • y (number) - y component of the vector
  • z (number) - z component of the vector
  • index (int) - the DerivVar index for the x component. The y and z components receive consecutive indices.
  • order (int) - the derivative order
Returns: Scientific.Geometry.Vector
a vector whose components are DerivVar objects

isDerivVar(x)

 
Parameters:
  • x - an arbitrary object
Returns: bool
True if x is a DerivVar object, False otherwise

ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Derivatives.DerivVar-class.html0000644000076600000240000007104011501734225032052 0ustar hinsenstaff00000000000000 Scientific.Functions.Derivatives.DerivVar
Package Scientific :: Package Functions :: Module Derivatives :: Class DerivVar
[frames] | no frames]

Class DerivVar

Numerical variable with automatic derivatives of arbitrary order

Instance Methods
 
__abs__(self)
 
__add__(self, other)
 
__cmp__(self, other)
 
__coerce__(self, other)
 
__div__(self, other)
list
__getitem__(self, order)
Returns: a list of all derivatives of the given order
 
__init__(self, value, index=0, order=1, recursive=None)
 
__mul__(self, other)
 
__neg__(self)
 
__nonzero__(self)
 
__pos__(self)
 
__pow__(self, other, z=None)
 
__radd__(self, other)
 
__rdiv__(self, other)
 
__repr__(self)
 
__rmul__(self, other)
 
__rpow__(self, other)
 
__rsub__(self, other)
 
__str__(self)
 
__sub__(self, other)
 
arccos(self)
 
arcsin(self)
 
arctan(self)
 
arctan2(self, other)
 
cos(self)
 
cosh(self)
 
exp(self)
 
log(self)
 
log10(self)
 
sign(self)
 
sin(self)
 
sinh(self)
 
sqrt(self)
 
tan(self)
 
tanh(self)
DerivVar
toOrder(self, order)
Returns: a DerivVar object with a lower derivative order
Method Details

__getitem__(self, order)
(Indexing operator)

 
Parameters:
  • order (int) - derivative order
Returns: list
a list of all derivatives of the given order
Raises:
  • ValueError - if order < 0 or order > self.order

__init__(self, value, index=0, order=1, recursive=None)
(Constructor)

 
Parameters:
  • value (number) - the numerical value of the variable
  • index (int) - the variable index, which serves to distinguish between variables and as an index for the derivative lists. Each explicitly created instance of DerivVar must have a unique index.
  • order (int) - the derivative order
Raises:
  • ValueError - if order < 0

toOrder(self, order)

 
Parameters:
  • order (int) - the highest derivative order to be kept
Returns: DerivVar
a DerivVar object with a lower derivative order

ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.FindRoot-module.html0000644000076600000240000002004511501734225027747 0ustar hinsenstaff00000000000000 Scientific.Functions.FindRoot
Package Scientific :: Package Functions :: Module FindRoot
[frames] | no frames]

Module FindRoot

Newton-Raphson for numerical root finding

Example:

   >>>from Scientific.Functions.FindRoot import newtonRaphson
   >>>from Scientific.N import pi, sin, cos
   >>>def func(x):
   >>>    return (2*x*cos(x) - sin(x))*cos(x) - x + pi/4.0
   >>>newtonRaphson(func, 0.0, 1.0, 1.0e-12)

   yields 0.952847864655.
Functions
float
newtonRaphson(function, lox, hix, xacc)
Newton-Raphson algorithm for root finding.
Function Details

newtonRaphson(function, lox, hix, xacc)

 

Newton-Raphson algorithm for root finding. The algorithm used is a safe version of Newton-Raphson (see page 366 of Numerical Recipes in C, 2ed).

Parameters:
  • function (callable) - function of one numerical variable that uses only those operations that are defined for DerivVar objects in the module Scientific.Functions.FirstDerivatives
  • lox (float) - lower limit of the search interval
  • hix (C[{loat}) - upper limit of the search interval
  • xacc (float) - requested absolute precision of the root
Returns: float
a root of function between lox and hix
Raises:
  • ValueError - if function(lox) and function(hix) have the same sign, or if there is no convergence after 500 iterations

ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.FirstDerivatives-module.html0000644000076600000240000002602111501734225031520 0ustar hinsenstaff00000000000000 Scientific.Functions.FirstDerivatives
Package Scientific :: Package Functions :: Module FirstDerivatives
[frames] | no frames]

Module FirstDerivatives

Automatic differentiation for functions with any number of variables

Instances of the class DerivVar represent the values of a function and its partial derivatives with respect to a list of variables. All common mathematical operations and functions are available for these numbers. There is no restriction on the type of the numbers fed into the code; it works for real and complex numbers as well as for any Python type that implements the necessary operations.

This module is as far as possible compatible with the n-th order derivatives module Derivatives. If only first-order derivatives are required, this module is faster than the general one.

Example:

 print sin(DerivVar(2))

produces the output:

 (0.909297426826, [-0.416146836547])

The first number is the value of sin(2); the number in the following list is the value of the derivative of sin(x) at x=2, i.e. cos(2).

When there is more than one variable, DerivVar must be called with an integer second argument that specifies the number of the variable.

Example:

   >>>x = DerivVar(7., 0)
   >>>y = DerivVar(42., 1)
   >>>z = DerivVar(pi, 2)
   >>>print (sqrt(pow(x,2)+pow(y,2)+pow(z,2)))

   produces the output

   >>>(42.6950770511, [0.163953328662, 0.98371997197, 0.0735820818365])

The numbers in the list are the partial derivatives with respect to x, y, and z, respectively.

Note: It doesn't make sense to use DerivVar with different values for the same variable index in one calculation, but there is no check for this. I.e.:

   >>>print DerivVar(3, 0)+DerivVar(5, 0)

   produces

   >>>(8, [2])

but this result is meaningless.

Classes
  DerivVar
Numerical variable with automatic derivatives of first order
Functions
Scientific.Geometry.Vector
DerivVector(x, y, z, index=0)
Returns: a vector whose components are DerivVar objects
bool
isDerivVar(x)
Returns: True if x is a DerivVar object, False otherwise
Function Details

DerivVector(x, y, z, index=0)

 
Parameters:
  • x (number) - x component of the vector
  • y (number) - y component of the vector
  • z (number) - z component of the vector
  • index (int) - the DerivVar index for the x component. The y and z components receive consecutive indices.
Returns: Scientific.Geometry.Vector
a vector whose components are DerivVar objects

isDerivVar(x)

 
Parameters:
  • x - an arbitrary object
Returns: bool
True if x is a DerivVar object, False otherwise

ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.FirstDerivatives.DerivVar-class.html0000644000076600000240000006637111501734225033075 0ustar hinsenstaff00000000000000 Scientific.Functions.FirstDerivatives.DerivVar
Package Scientific :: Package Functions :: Module FirstDerivatives :: Class DerivVar
[frames] | no frames]

Class DerivVar

Numerical variable with automatic derivatives of first order

Instance Methods
 
__abs__(self)
 
__add__(self, other)
 
__cmp__(self, other)
 
__coerce__(self, other)
 
__div__(self, other)
list
__getitem__(self, order)
Returns: a list of all derivatives of the given order
 
__init__(self, value, index=0, order=1)
 
__mul__(self, other)
 
__neg__(self)
 
__nonzero__(self)
 
__pos__(self)
 
__pow__(self, other, z=None)
 
__radd__(self, other)
 
__rdiv__(self, other)
 
__repr__(self)
 
__rmul__(self, other)
 
__rpow__(self, other)
 
__rsub__(self, other)
 
__str__(self)
 
__sub__(self, other)
 
arccos(self)
 
arcsin(self)
 
arctan(self)
 
arctan2(self, other)
 
cos(self)
 
cosh(self)
 
exp(self)
 
gamma(self)
 
log(self)
 
log10(self)
 
sign(self)
 
sin(self)
 
sinh(self)
 
sqrt(self)
 
tan(self)
 
tanh(self)
Method Details

__getitem__(self, order)
(Indexing operator)

 
Parameters:
  • order (int) - derivative order
Returns: list
a list of all derivatives of the given order
Raises:
  • ValueError - if order < 0 or order > 1

__init__(self, value, index=0, order=1)
(Constructor)

 
Parameters:
  • value (number) - the numerical value of the variable
  • index (int) - the variable index, which serves to distinguish between variables and as an index for the derivative lists. Each explicitly created instance of DerivVar must have a unique index.
  • order (int) - the derivative order, must be zero or one
Raises:
  • ValueError - if order < 0 or order > 1

ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Interpolation-module.html0000644000076600000240000001602111501734225031051 0ustar hinsenstaff00000000000000 Scientific.Functions.Interpolation
Package Scientific :: Package Functions :: Module Interpolation
[frames] | no frames]

Module Interpolation

Interpolation of functions defined on a grid

Classes
  InterpolatingFunction
Function defined by values on a grid using interpolation
  NetCDFInterpolatingFunction
Function defined by values on a grid in a netCDF file
Variables
  index_expression = <Scientific.indexing._index_expression_clas...
Variables Details

index_expression

Value:
<Scientific.indexing._index_expression_class instance at 0x2220418>

././@LongLink0000000000000000000000000000015100000000000011212 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Interpolation.InterpolatingFunction-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Interpolation.InterpolatingFunction-class.0000644000076600000240000010424411501734225034335 0ustar hinsenstaff00000000000000 Scientific.Functions.Interpolation.InterpolatingFunction
Package Scientific :: Package Functions :: Module Interpolation :: Class InterpolatingFunction
[frames] | no frames]

Class InterpolatingFunction

Known Subclasses:

Function defined by values on a grid using interpolation

An interpolating function of n variables with m-dimensional values is defined by an (n+m)-dimensional array of values and n one-dimensional arrays that define the variables values corresponding to the grid points. The grid does not have to be equidistant.

An InterpolatingFunction object has attributes real and imag like a complex function (even if its values are real).

Instance Methods
 
__abs__(self)
number
__call__(self, *points)
Returns: the function value obtained by linear interpolation
 
__getattr__(self, attr)
InterpolatingFunction or number
__getitem__(self, i)
Returns: an InterpolatingFunction whose number of variables is reduced, or a number if no variable is left
InterpolatingFunction or number
__getslice__(self, i, j)
Returns: an InterpolatingFunction whose number of variables is reduced by one, or a number if no variable is left
 
__init__(self, axes, values, default=None, period=None)
int
__len__(self)
Returns: number of variables
 
arccos(self)
 
arcsin(self)
 
arctan(self)
 
cos(self)
 
cosh(self)
InterpolatingFunction or number
definiteIntegral(self, variable=0)
Returns: a new InterpolatingFunction containing the numerical integral.
InterpolatingFunction
derivative(self, variable=0)
Returns: a new InterpolatingFunction containing the numerical derivative
 
exp(self)
Scientific.Functions.Polynomial
fitPolynomial(self, order)
Returns: a polynomial whose coefficients have been obtained by a least-squares fit to the grid values
InterpolatingFunction
integral(self, variable=0)
Returns: a new InterpolatingFunction containing the numerical integral.
 
log(self)
InterpolatingFunction
selectInterval(self, first, last, variable=0)
Returns: a new InterpolatingFunction whose grid is restricted
 
sin(self)
 
sinh(self)
 
sqrt(self)
 
tan(self)
 
tanh(self)
Method Details

__call__(self, *points)
(Call operator)

 
Returns: number
the function value obtained by linear interpolation
Raises:
  • TypeError - if the number of arguments (len(points)) does not match the number of variables of the function
  • ValueError - if the evaluation point is outside of the domain of definition and no default value is defined

__getitem__(self, i)
(Indexing operator)

 
Parameters:
  • i (indexing expression) - any indexing expression possible for N.array that does not use N.NewAxis
Returns: InterpolatingFunction or number
an InterpolatingFunction whose number of variables is reduced, or a number if no variable is left
Raises:
  • TypeError - if i is not an allowed index expression

__getslice__(self, i, j)
(Slicling operator)

 
Parameters:
  • i (int) - lower slice index
  • j (int) - upper slice index
Returns: InterpolatingFunction or number
an InterpolatingFunction whose number of variables is reduced by one, or a number if no variable is left

__init__(self, axes, values, default=None, period=None)
(Constructor)

 
Parameters:
  • axes (sequence of N.array) - a sequence of one-dimensional arrays, one for each variable, specifying the values of the variables at the grid points
  • values (N.array) - the function values on the grid
  • default (number or None) - the value of the function outside the grid. A value of None means that the function is undefined outside the grid and that any attempt to evaluate it there raises an exception.
  • period (sequence of numbers or None) - the period for each of the variables, or None for variables in which the function is not periodic.

__len__(self)
(Length operator)

 
Returns: int
number of variables

definiteIntegral(self, variable=0)

 
Parameters:
  • variable (int) - the index of the variable of the function with respect to which the integration is performed
Returns: InterpolatingFunction or number
a new InterpolatingFunction containing the numerical integral. The integration constant is defined such that the integral at the first grid point is zero. If the original function has only one free variable, the definite integral is a number

derivative(self, variable=0)

 
Parameters:
  • variable (int) - the index of the variable of the function with respect to which the derivative is taken
Returns: InterpolatingFunction
a new InterpolatingFunction containing the numerical derivative

fitPolynomial(self, order)

 
Parameters:
  • order (int) - the order of the polynomial to be fitted
Returns: Scientific.Functions.Polynomial
a polynomial whose coefficients have been obtained by a least-squares fit to the grid values

integral(self, variable=0)

 
Parameters:
  • variable (int) - the index of the variable of the function with respect to which the integration is performed
Returns: InterpolatingFunction
a new InterpolatingFunction containing the numerical integral. The integration constant is defined such that the integral at the first grid point is zero.

selectInterval(self, first, last, variable=0)

 
Parameters:
  • first (float) - lower limit of an axis interval
  • last (float) - upper limit of an axis interval
  • variable (int) - the index of the variable of the function along which the interval restriction is applied
Returns: InterpolatingFunction
a new InterpolatingFunction whose grid is restricted

././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Interpolation.NetCDFInterpolatingFunction-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Interpolation.NetCDFInterpolatingFunction-0000644000076600000240000002652011501734225034215 0ustar hinsenstaff00000000000000 Scientific.Functions.Interpolation.NetCDFInterpolatingFunction
Package Scientific :: Package Functions :: Module Interpolation :: Class NetCDFInterpolatingFunction
[frames] | no frames]

Class NetCDFInterpolatingFunction

InterpolatingFunction --+
                        |
                       NetCDFInterpolatingFunction

Function defined by values on a grid in a netCDF file

A subclass of InterpolatingFunction.

Instance Methods
 
__init__(self, filename, axesnames, variablename, default=None, period=None)

Inherited from InterpolatingFunction: __abs__, __call__, __getattr__, __getitem__, __getslice__, __len__, arccos, arcsin, arctan, cos, cosh, definiteIntegral, derivative, exp, fitPolynomial, integral, log, selectInterval, sin, sinh, sqrt, tan, tanh

Method Details

__init__(self, filename, axesnames, variablename, default=None, period=None)
(Constructor)

 
Parameters:
  • filename (str) - the name of the netCDF file
  • axesnames (sequence of str) - the names of the netCDF variables that contain the axes information
  • variablename (str) - the name of the netCDF variable that contains the data values
  • default (number or None) - the value of the function outside the grid. A value of None means that the function is undefined outside the grid and that any attempt to evaluate it there raises an exception.
  • period (sequence of numbers or None) - the period for each of the variables, or None for variables in which the function is not periodic.
Overrides: InterpolatingFunction.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.LeastSquares-module.html0000644000076600000240000002632411501734225030645 0ustar hinsenstaff00000000000000 Scientific.Functions.LeastSquares
Package Scientific :: Package Functions :: Module LeastSquares
[frames] | no frames]

Module LeastSquares

Non-linear least squares fitting

Usage example:

   from Scientific.N import exp

   def f(param, t):
       return param[0]*exp(-param[1]/t)

   data_quantum = [(100, 3.445e+6),(200, 2.744e+7),
                   (300, 2.592e+8),(400, 1.600e+9)]
   data_classical = [(100, 4.999e-8),(200, 5.307e+2),
                     (300, 1.289e+6),(400, 6.559e+7)]

   print leastSquaresFit(f, (1e13,4700), data_classical)

   def f2(param, t):
       return 1e13*exp(-param[0]/t)

   print leastSquaresFit(f2, (3000.,), data_quantum)
Functions
(list, float)
leastSquaresFit(model, parameters, data, max_iterations=None, stopping_limit=0.005)
General non-linear least-squares fit using the Levenberg-Marquardt algorithm and automatic differentiation.
 
polynomialLeastSquaresFit(parameters, data)
Least-squares fit to a polynomial whose order is defined by the number of parameter values.
Function Details

leastSquaresFit(model, parameters, data, max_iterations=None, stopping_limit=0.005)

 

General non-linear least-squares fit using the Levenberg-Marquardt algorithm and automatic differentiation.

Parameters:
  • model (callable) - the function to be fitted. It will be called with two parameters: the first is a tuple containing all fit parameters, and the second is the first element of a data point (see below). The return value must be a number. Since automatic differentiation is used to obtain the derivatives with respect to the parameters, the function may only use the mathematical functions known to the module FirstDerivatives.
  • parameters (tuple of numbers) - a tuple of initial values for the fit parameters
  • data (list) - a list of data points to which the model is to be fitted. Each data point is a tuple of length two or three. Its first element specifies the independent variables of the model. It is passed to the model function as its first parameter, but not used in any other way. The second element of each data point tuple is the number that the return value of the model function is supposed to match as well as possible. The third element (which defaults to 1.) is the statistical variance of the data point, i.e. the inverse of its statistical weight in the fitting procedure.
Returns: (list, float)
a list containing the optimal parameter values and the chi-squared value describing the quality of the fit

polynomialLeastSquaresFit(parameters, data)

 

Least-squares fit to a polynomial whose order is defined by the number of parameter values.

Parameters:
  • parameters (tuple) - a tuple of initial values for the polynomial coefficients
  • data (list) - the data points, as for leastSquaresFit

Note: This could also be done with a linear least squares fit from Scientific.LA


ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Polynomial-module.html0000644000076600000240000001147311501734225030353 0ustar hinsenstaff00000000000000 Scientific.Functions.Polynomial
Package Scientific :: Package Functions :: Module Polynomial
[frames] | no frames]

Module Polynomial

Polynomials in any number of variables

Classes
  Polynomial
Multivariate polynomial
ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Polynomial.Polynomial-class.html0000644000076600000240000004436411501734225032322 0ustar hinsenstaff00000000000000 Scientific.Functions.Polynomial.Polynomial
Package Scientific :: Package Functions :: Module Polynomial :: Class Polynomial
[frames] | no frames]

Class Polynomial

Multivariate polynomial

Instances of this class represent polynomials of any order and in any number of variables. The coefficients and thus the values can be real or complex. Polynomials can be evaluated like functions.

Instance Methods
 
__add__(self, other)
number
__call__(self, *args)
Returns: the value of the polynomial at the given point
 
__coerce__(self, other)
 
__div__(self, other)
 
__init__(self, coefficients)
 
__mul__(self, other)
 
__rdiv__(self, other)
 
__repr__(self)
Polynomial
derivative(self, variable=0)
Returns: a polynomial of reduced order in one variable
Polynomial
integral(self, variable=0)
Returns: a polynomial of higher order in one variable
Numeric.array
zeros(self)
Find the zeros (roots) of the polynomial by diagonalization of the associated Frobenius matrix.
Class Variables
  is_polynomial = 1
Method Details

__call__(self, *args)
(Call operator)

 
Parameters:
  • args (tuple of numbers) - tuple of values, one for each variable of the polynomial
Returns: number
the value of the polynomial at the given point
Raises:
  • TypeError - if the number of arguments is not equal to the number of variable of the polynomial

__init__(self, coefficients)
(Constructor)

 
Parameters:
  • coefficients (Numeric.array or nested list of numbers) - an N-dimnesional array for a polynomial in N variables. coeffcients[i, j, ...] is the coefficient of x_1^i x_2^j ...

derivative(self, variable=0)

 
Parameters:
  • variable (int) - the index of the variable with respect to which the derivative is taken
Returns: Polynomial
a polynomial of reduced order in one variable

integral(self, variable=0)

 
Parameters:
  • variable (int) - the index of the variable with respect to which the integral is computed
Returns: Polynomial
a polynomial of higher order in one variable

zeros(self)

 

Find the zeros (roots) of the polynomial by diagonalization of the associated Frobenius matrix.

Returns: Numeric.array
an array containing the zeros
Raises:
  • ValueError - is the polynomial has more than one variable

Note: this is defined only for polynomials in one variable


ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Rational-module.html0000644000076600000240000001125711501734225030001 0ustar hinsenstaff00000000000000 Scientific.Functions.Rational
Package Scientific :: Package Functions :: Module Rational
[frames] | no frames]

Module Rational

Rational functions in one variable

Classes
  RationalFunction
Rational Function
ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Rational.RationalFunction-class.html0000644000076600000240000004713311501734225033101 0ustar hinsenstaff00000000000000 Scientific.Functions.Rational.RationalFunction
Package Scientific :: Package Functions :: Module Rational :: Class RationalFunction
[frames] | no frames]

Class RationalFunction

Rational Function

Instances of this class represent rational functions in a single variable. They can be evaluated like functions.

Rational functions support addition, subtraction, multiplication, and division.

Instance Methods
 
__add__(self, other)
 
__call__(self, value)
 
__coerce__(self, other)
 
__div__(self, other)
 
__init__(self, numerator, denominator=[1.0])
 
__mul__(self, other)
 
__radd__(self, other)
 
__rdiv__(self, other)
 
__repr__(self)
 
__rmul__(self, other)
 
__rsub__(self, other)
 
__sub__(self, other)
(Scientific.Functions.Polynomial.Polynomial, RationalFunction)
divide(self, shift=0)
Returns: a polynomial and a rational function such that the sum of the two is equal to the original rational function.
Numeric.array
poles(self)
Find the poles (zeros of the denominator) by diagonalization of the associated Frobenius matrix.
Numeric.array
zeros(self)
Find the zeros (roots) of the numerator by diagonalization of the associated Frobenius matrix.
Class Variables
  is_rational_function = 1
Method Details

__init__(self, numerator, denominator=[1.0])
(Constructor)

 
Parameters:

divide(self, shift=0)

 
Parameters:
  • shift (int (non-negative)) - the power of the independent variable by which the numerator is multiplied prior to division
Returns: (Scientific.Functions.Polynomial.Polynomial, RationalFunction)
a polynomial and a rational function such that the sum of the two is equal to the original rational function. The returned rational function's numerator is of lower order than its denominator.

poles(self)

 

Find the poles (zeros of the denominator) by diagonalization of the associated Frobenius matrix.

Returns: Numeric.array
an array containing the poles

zeros(self)

 

Find the zeros (roots) of the numerator by diagonalization of the associated Frobenius matrix.

Returns: Numeric.array
an array containing the zeros

ScientificPython-2.9.4/Doc/Reference/Scientific.Functions.Romberg-module.html0000644000076600000240000002316511501734225027626 0ustar hinsenstaff00000000000000 Scientific.Functions.Romberg
Package Scientific :: Package Functions :: Module Romberg
[frames] | no frames]

Module Romberg

Numerical integration using the Romberg algorithm

Functions
number
romberg(function, interval, accuracy=1e-07)
Numerical integration using the Romberg method
number
trapezoid(function, interval, numtraps)
Numerical integration using the trapezoidal rule
Function Details

romberg(function, interval, accuracy=1e-07)

 

Numerical integration using the Romberg method

Example:

 >>>from Scientific.Functions.Romberg import romberg
 >>>from Scientific.N import pi, tan
 >>>romberg(tan, (0.0, pi/3.0))

 yields '0.693147180562'
Parameters:
  • function (callable) - a function of one variable
  • interval (sequence of two floats) - the lower and upper limit of the integration interval
  • accuracy (float) - convergence criterion (absolute error)
Returns: number
the numerical integral of the function over the interval

trapezoid(function, interval, numtraps)

 

Numerical integration using the trapezoidal rule

Example:

 >>>from Scientific.Functions.Romberg import trapezoid
 >>>from Scientific.N import pi, tan
 >>>trapezoid(tan, (0.0, pi/3.0), 100)

 yields 0.69317459482518262
Parameters:
  • function (callable) - a function of one variable
  • interval (sequence of two floats) - the lower and upper limit of the integration interval
  • numtraps (int) - the number of trapezoids
Returns: number
the numerical integral of the function over the interval

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry-module.html0000644000076600000240000002423111501734225026050 0ustar hinsenstaff00000000000000 Scientific.Geometry
Package Scientific :: Package Geometry
[frames] | no frames]

Package Geometry

Geometrical quantities and objects

The geometrical quantities are vectors and tensors, transformations, and quaternions as descriptions of rotations. There are also tensor fields, which were included here (rather than in Scientific.Functions) because they are most often used in a geometric context. Finally, there are classes for elementary geometrical objects such as spheres and planes.

Submodules

Classes
  Tensor
Tensor in 3D space
  Vector
Vector in 3D space
Variables
  delta = Tensor([[1 0...
  epsilon = Tensor([[[ 0 0 ...
  ex = Vector(1.000000,0.000000,0.000000)
  ey = Vector(0.000000,1.000000,0.000000)
  ez = Vector(0.000000,0.000000,1.000000)
  nullVector = Vector(0.000000,0.000000,0.000000)
Variables Details

delta

Value:
Tensor([[1 0 0]
 [0 1 0]
 [0 0 1]])

epsilon

Value:
Tensor([[[ 0  0  0]
  [ 0  0  1]
  [ 0 -1  0]]

 [[ 0  0 -1]
  [ 0  0  0]
  [ 1  0  0]]

...

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Objects3D-module.html0000644000076600000240000002153211501734225027630 0ustar hinsenstaff00000000000000 Scientific.Geometry.Objects3D
Package Scientific :: Package Geometry :: Module Objects3D
[frames] | no frames]

Module Objects3D

Geometrical objects in 3D space

Classes
  BravaisLattice
General Bravais lattice
  Circle
Circle
  Cone
Cone
  GeometricalObject3D
Geometrical object in 3D space
  Lattice
  Line
Line
  Plane
Plane
  RhombicLattice
Lattice with rhombic elementary cell
  SCLattice
Simple cubic lattice
  Sphere
Sphere
Functions
 
rotateDirection(vector, axis, angle)
 
rotatePoint(point, axis, angle)
ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Objects3D.BravaisLattice-class.html0000644000076600000240000002225311501734225032345 0ustar hinsenstaff00000000000000 Scientific.Geometry.Objects3D.BravaisLattice
Package Scientific :: Package Geometry :: Module Objects3D :: Class BravaisLattice
[frames] | no frames]

Class BravaisLattice

   Lattice --+    
             |    
RhombicLattice --+
                 |
                BravaisLattice
Known Subclasses:

General Bravais lattice

This is a subclass of RhombicLattice, describing the special case of an elementary cell containing one point.

Instance Methods
 
__init__(self, lattice_vectors, cells, function=None, base=None)

Inherited from RhombicLattice: makeLattice

Inherited from Lattice: __getitem__, __len__, __setitem__

Method Details

__init__(self, lattice_vectors, cells, function=None, base=None)
(Constructor)

 
Parameters:
  • lattice_vectors (tuple of three Scientific.Geometry.Vector) - the edges of the elementary cell
  • cells - a tuple of three integers, indicating how often the elementary cell should be replicated along each lattice vector
  • cells - tuple of int
  • function (callable) - the function to be applied to each point in the lattice in order to obtain the value stored in the lattice. If no function is specified, the point itself becomes the value stored in the lattice.
  • base (Scientific.Geometry.Vector) - an offset added to all lattice points
Overrides: Lattice.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Objects3D.Circle-class.html0000644000076600000240000002221411501734225030646 0ustar hinsenstaff00000000000000 Scientific.Geometry.Objects3D.Circle
Package Scientific :: Package Geometry :: Module Objects3D :: Class Circle
[frames] | no frames]

Class Circle

GeometricalObject3D --+
                      |
                     Circle

Circle

Instance Methods
 
__init__(self, center, normal, radius)
float or NoneType
volume(self)
Returns: the volume of the object.

Inherited from GeometricalObject3D: distanceFrom, hasPoint, intersectWith

Method Details

__init__(self, center, normal, radius)
(Constructor)

 
Parameters:

volume(self)

 
Returns: float or NoneType
the volume of the object. The result is None for unbounded objects and zero for lower-dimensional objects.
Overrides: GeometricalObject3D.volume
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Objects3D.Cone-class.html0000644000076600000240000002216311501734225030334 0ustar hinsenstaff00000000000000 Scientific.Geometry.Objects3D.Cone
Package Scientific :: Package Geometry :: Module Objects3D :: Class Cone
[frames] | no frames]

Class Cone

GeometricalObject3D --+
                      |
                     Cone

Cone

Instance Methods
 
__init__(self, tip, axis, angle)
float or NoneType
volume(self)
Returns: the volume of the object.

Inherited from GeometricalObject3D: distanceFrom, hasPoint, intersectWith

Method Details

__init__(self, tip, axis, angle)
(Constructor)

 
Parameters:

volume(self)

 
Returns: float or NoneType
the volume of the object. The result is None for unbounded objects and zero for lower-dimensional objects.
Overrides: GeometricalObject3D.volume
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Objects3D.GeometricalObject3D-class.html0000644000076600000240000003030511501734225033216 0ustar hinsenstaff00000000000000 Scientific.Geometry.Objects3D.GeometricalObject3D
Package Scientific :: Package Geometry :: Module Objects3D :: Class GeometricalObject3D
[frames] | no frames]

Class GeometricalObject3D

Known Subclasses:

Geometrical object in 3D space

This is an abstract base class; to create instances, use one of the subclasses.

Instance Methods
float
distanceFrom(self, point)
bool
hasPoint(self, point)
Returns: True if point is in the object
GeometricalObject3D or NoneType
intersectWith(self, other)
Returns: the geometrical object that results from the intersection with other.
float or NoneType
volume(self)
Returns: the volume of the object.
Method Details

distanceFrom(self, point)

 
Parameters:
Returns: float

hasPoint(self, point)

 
Parameters:
Returns: bool
True if point is in the object

intersectWith(self, other)

 
Parameters:
Returns: GeometricalObject3D or NoneType
the geometrical object that results from the intersection with other. If there is no intersection, the result is None.

Note: Intersection is not implemented for all possible pairs of objects. A 'ValueError' is raised for combinations that haven't been implemented yet.

volume(self)

 
Returns: float or NoneType
the volume of the object. The result is None for unbounded objects and zero for lower-dimensional objects.

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Objects3D.Lattice-class.html0000644000076600000240000001565711501734225031047 0ustar hinsenstaff00000000000000 Scientific.Geometry.Objects3D.Lattice
Package Scientific :: Package Geometry :: Module Objects3D :: Class Lattice
[frames] | no frames]

Class Lattice

Known Subclasses:

Instance Methods
 
__getitem__(self, item)
 
__init__(self, function)
 
__len__(self)
 
__setitem__(self, item, value)
ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Objects3D.Line-class.html0000644000076600000240000003012211501734225030331 0ustar hinsenstaff00000000000000 Scientific.Geometry.Objects3D.Line
Package Scientific :: Package Geometry :: Module Objects3D :: Class Line
[frames] | no frames]

Class Line

GeometricalObject3D --+
                      |
                     Line

Line

Instance Methods
 
__init__(self, point, direction)
float
distanceFrom(self, point)
Scientific.Geometry.Vector
projectionOf(self, point)
Returns: the projection of point onto the line
float or NoneType
volume(self)
Returns: the volume of the object.

Inherited from GeometricalObject3D: hasPoint, intersectWith

Method Details

__init__(self, point, direction)
(Constructor)

 
Parameters:

distanceFrom(self, point)

 
Parameters:
  • point - a point in space
Returns: float
Overrides: GeometricalObject3D.distanceFrom
(inherited documentation)

projectionOf(self, point)

 
Parameters:
Returns: Scientific.Geometry.Vector
the projection of point onto the line

volume(self)

 
Returns: float or NoneType
the volume of the object. The result is None for unbounded objects and zero for lower-dimensional objects.
Overrides: GeometricalObject3D.volume
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Objects3D.Plane-class.html0000644000076600000240000003360111501734225030506 0ustar hinsenstaff00000000000000 Scientific.Geometry.Objects3D.Plane
Package Scientific :: Package Geometry :: Module Objects3D :: Class Plane
[frames] | no frames]

Class Plane

GeometricalObject3D --+
                      |
                     Plane

Plane

Instance Methods
 
__init__(self, *args)
There are two calling patterns:
float
distanceFrom(self, point)
Scientific.Geometry.Vector
projectionOf(self, point)
Returns: the projection of point onto the plane
Plane
rotate(self, axis, angle)
Returns: a copy of the plane rotated around the coordinate origin
float or NoneType
volume(self)
Returns: the volume of the object.

Inherited from GeometricalObject3D: hasPoint, intersectWith

Method Details

__init__(self, *args)
(Constructor)

 

There are two calling patterns:

  • Plane(point, normal), where point (a vector) is an arbitrary point in the plane and normal (a vector) indicated the direction normal to the plane.
  • Plane(p1, p2, p3), where each argument is a vector and describes a point in the plane. The three points may not be colinear.

distanceFrom(self, point)

 
Parameters:
  • point - a point in space
Returns: float
Overrides: GeometricalObject3D.distanceFrom
(inherited documentation)

projectionOf(self, point)

 
Parameters:
Returns: Scientific.Geometry.Vector
the projection of point onto the plane

rotate(self, axis, angle)

 
Parameters:
Returns: Plane
a copy of the plane rotated around the coordinate origin

volume(self)

 
Returns: float or NoneType
the volume of the object. The result is None for unbounded objects and zero for lower-dimensional objects.
Overrides: GeometricalObject3D.volume
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Objects3D.RhombicLattice-class.html0000644000076600000240000002401311501734225032335 0ustar hinsenstaff00000000000000 Scientific.Geometry.Objects3D.RhombicLattice
Package Scientific :: Package Geometry :: Module Objects3D :: Class RhombicLattice
[frames] | no frames]

Class RhombicLattice

Lattice --+
          |
         RhombicLattice
Known Subclasses:

Lattice with rhombic elementary cell

A lattice object contains values defined on a finite periodic structure that is created by replicating a given elementary cell along the three lattice vectors. The elementary cell can contain any number of points.

Instance Methods
 
__init__(self, elementary_cell, lattice_vectors, cells, function=None, base=None)
 
makeLattice(self, elementary_cell, lattice_vectors, cells, base)

Inherited from Lattice: __getitem__, __len__, __setitem__

Method Details

__init__(self, elementary_cell, lattice_vectors, cells, function=None, base=None)
(Constructor)

 
Parameters:
  • elementary_cell (list of Scientific.Geometry.Vector) - a list of the points in the elementary cell
  • lattice_vectors (tuple of three Scientific.Geometry.Vector) - the edges of the elementary cell
  • cells - a tuple of three integers, indicating how often the elementary cell should be replicated along each lattice vector
  • cells - tuple of int
  • function (callable) - the function to be applied to each point in the lattice in order to obtain the value stored in the lattice. If no function is specified, the point itself becomes the value stored in the lattice.
  • base (Scientific.Geometry.Vector) - an offset added to all lattice points
Overrides: Lattice.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Objects3D.SCLattice-class.html0000644000076600000240000002172111501734225031262 0ustar hinsenstaff00000000000000 Scientific.Geometry.Objects3D.SCLattice
Package Scientific :: Package Geometry :: Module Objects3D :: Class SCLattice
[frames] | no frames]

Class SCLattice

   Lattice --+        
             |        
RhombicLattice --+    
                 |    
    BravaisLattice --+
                     |
                    SCLattice

Simple cubic lattice

This is a subclass of BravaisLattice, describing the special case of a cubic elementary cell.

Instance Methods
 
__init__(self, cellsize, cells, function=None, base=None)

Inherited from RhombicLattice: makeLattice

Inherited from Lattice: __getitem__, __len__, __setitem__

Method Details

__init__(self, cellsize, cells, function=None, base=None)
(Constructor)

 
Parameters:
  • cellsize (float) - the edge length of the cubic elementary cell
  • cells - a tuple of three integers, indicating how often the elementary cell should be replicated along each lattice vector
  • cells - tuple of int
  • function (callable) - the function to be applied to each point in the lattice in order to obtain the value stored in the lattice. If no function is specified, the point itself becomes the value stored in the lattice.
  • base (Scientific.Geometry.Vector) - an offset added to all lattice points
Overrides: Lattice.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Objects3D.Sphere-class.html0000644000076600000240000002444311501734225030701 0ustar hinsenstaff00000000000000 Scientific.Geometry.Objects3D.Sphere
Package Scientific :: Package Geometry :: Module Objects3D :: Class Sphere
[frames] | no frames]

Class Sphere

GeometricalObject3D --+
                      |
                     Sphere

Sphere

Instance Methods
 
__init__(self, center, radius)
float
distanceFrom(self, point)
float or NoneType
volume(self)
Returns: the volume of the object.

Inherited from GeometricalObject3D: hasPoint, intersectWith

Method Details

__init__(self, center, radius)
(Constructor)

 
Parameters:

distanceFrom(self, point)

 
Parameters:
  • point - a point in space
Returns: float
Overrides: GeometricalObject3D.distanceFrom
(inherited documentation)

volume(self)

 
Returns: float or NoneType
the volume of the object. The result is None for unbounded objects and zero for lower-dimensional objects.
Overrides: GeometricalObject3D.volume
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Quaternion-module.html0000644000076600000240000001542511501734225030201 0ustar hinsenstaff00000000000000 Scientific.Geometry.Quaternion
Package Scientific :: Package Geometry :: Module Quaternion
[frames] | no frames]

Module Quaternion

Quaternions as representations of rotations in 3D space

Classes
  Quaternion
Quaternion (hypercomplex number)
Functions
 
isQuaternion(x)
Returns: True if x is a quaternion
Function Details

isQuaternion(x)

 
Parameters:
  • x (any) - any object
Returns:
True if x is a quaternion

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Quaternion.Quaternion-class.html0000644000076600000240000004626011501734225032146 0ustar hinsenstaff00000000000000 Scientific.Geometry.Quaternion.Quaternion
Package Scientific :: Package Geometry :: Module Quaternion :: Class Quaternion
[frames] | no frames]

Class Quaternion

Quaternion (hypercomplex number)

This implementation of quaternions is not complete; only the features needed for representing rotation matrices by quaternions are implemented.

Quaternions support addition, subtraction, and multiplication, as well as multiplication and division by scalars. Division by quaternions is not provided, because quaternion multiplication is not associative. Use multiplication by the inverse instead.

The four components can be extracted by indexing.

Instance Methods
 
__add__(self, other)
 
__div__(self, other)
 
__getitem__(self, item)
 
__init__(self, *data)
There are two calling patterns:
 
__mul__(self, other)
 
__rdiv__(self, other)
 
__repr__(self)
 
__rmul__(self, other)
 
__sub__(self, other)
Numeric.array
asMatrix(self)
Returns: a 4x4 matrix representation
Scientific.Geometry.Transformation.Rotation
asRotation(self)
Returns: the corresponding rotation matrix
 
dot(self, other)
Quaternion
inverse(self)
Returns: the inverse
float
norm(self)
Returns: the norm
Quaternion
normalized(self)
Returns: the quaternion scaled such that its norm is 1
Class Variables
  is_quaternion = 1
Method Details

__init__(self, *data)
(Constructor)

 

There are two calling patterns:

  • Quaternion(q0, q1, q2, q3) (from four real components)
  • Quaternion(q) (from a sequence containing the four components)

asMatrix(self)

 
Returns: Numeric.array
a 4x4 matrix representation

asRotation(self)

 
Returns: Scientific.Geometry.Transformation.Rotation
the corresponding rotation matrix
Raises:
  • ValueError - if the quaternion is not normalized

inverse(self)

 
Returns: Quaternion
the inverse

norm(self)

 
Returns: float
the norm

normalized(self)

 
Returns: Quaternion
the quaternion scaled such that its norm is 1

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Tensor-class.html0000644000076600000240000007334711501734225027155 0ustar hinsenstaff00000000000000 Scientific.Geometry.Tensor
Package Scientific :: Package Geometry :: Class Tensor
[frames] | no frames]

Class Tensor

Tensor in 3D space

Tensors support the usual arithmetic operations ('t1', 't2': tensors, 'v': vector, 's': scalar):

  • 't1+t2' (addition)
  • 't1-t2' (subtraction)
  • 't1*t2' (tensorial (outer) product)
  • 't1*v' (contraction with a vector, same as t1.dot(v.asTensor()))
  • 's*t1', 't1*s' (multiplication with a scalar)
  • 't1/s' (division by a scalar)

The coordinates can be extracted by indexing; a tensor of rank N can be indexed like an array of dimension N.

Tensors are immutable, i.e. their elements cannot be changed.

Tensor elements can be any objects on which the standard arithmetic operations are defined. However, eigenvalue calculation is supported only for float elements.

Instance Methods
 
__add__(self, other)
 
__cmp__(self, other)
 
__div__(self, other)
 
__getitem__(self, index)
 
__init__(self, elements, nocheck=None)
 
__len__(self)
 
__mul__(self, other)
 
__neg__(self)
 
__radd__(self, other)
 
__rdiv__(self, other)
 
__repr__(self)
 
__rmul__(self, other)
 
__rsub__(self, other)
 
__str__(self)
 
__sub__(self, other)
Scientific.Geometry.Vector
asVector(self)
Returns: an equivalent vector object
Tensor
asymmetricalPart(self)
Returns: the asymmetrical part of the tensor
 
diagonal(self, axis1=0, axis2=1)
(Numeric.array, Tensor)
diagonalization(self)
Returns: the eigenvalues of the tensor and a tensor representing the rotation matrix to the diagonal form
Tensor
dot(self, other)
Returns: the contraction with other
Numeric.array
eigenvalues(self)
Returns: the eigenvalues of the tensor
Tensor
inverse(self)
Returns: the inverse of the tensor
Tensor
symmetricalPart(self)
Returns: the symmetrical part of the tensor
type of tensor elements
trace(self, axis1=0, axis2=1)
Returns: the trace of the tensor
Tensor
transpose(self)
Returns: the transposed (index reversed) tensor
Class Variables
  is_tensor = 1
Method Details

__init__(self, elements, nocheck=None)
(Constructor)

 
Parameters:
  • elements (Numeric.array or list) - 2D array or nested list specifying the nine tensor components [[xx, xy, xz], [yx, yy, yz], [zx, zy, zz]]

asVector(self)

 
Returns: Scientific.Geometry.Vector
an equivalent vector object
Raises:
  • ValueError - if rank > 1

asymmetricalPart(self)

 
Returns: Tensor
the asymmetrical part of the tensor
Raises:
  • ValueError - if rank !=2

diagonalization(self)

 
Returns: (Numeric.array, Tensor)
the eigenvalues of the tensor and a tensor representing the rotation matrix to the diagonal form
Raises:
  • ValueError - if rank !=2

dot(self, other)

 
Returns: Tensor
the contraction with other

eigenvalues(self)

 
Returns: Numeric.array
the eigenvalues of the tensor
Raises:
  • ValueError - if rank !=2

inverse(self)

 
Returns: Tensor
the inverse of the tensor
Raises:
  • ValueError - if rank !=2

symmetricalPart(self)

 
Returns: Tensor
the symmetrical part of the tensor
Raises:
  • ValueError - if rank !=2

trace(self, axis1=0, axis2=1)

 
Returns: type of tensor elements
the trace of the tensor
Raises:
  • ValueError - if rank !=2

transpose(self)

 
Returns: Tensor
the transposed (index reversed) tensor

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.TensorAnalysis-module.html0000644000076600000240000001576311501734225031037 0ustar hinsenstaff00000000000000 Scientific.Geometry.TensorAnalysis
Package Scientific :: Package Geometry :: Module TensorAnalysis
[frames] | no frames]

Module TensorAnalysis

Vector and tensor fields with derivatives

Classes
  ScalarField
Scalar field (tensor field of rank 0)
  TensorField
Tensor field of arbitrary rank
  VectorField
Vector field (tensor field of rank 1)
Variables
  index_expression = <Scientific.indexing._index_expression_clas...
Variables Details

index_expression

Value:
<Scientific.indexing._index_expression_class instance at 0x2220418>

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.TensorAnalysis.ScalarField-class.html0000644000076600000240000003636511501734225033030 0ustar hinsenstaff00000000000000 Scientific.Geometry.TensorAnalysis.ScalarField
Package Scientific :: Package Geometry :: Module TensorAnalysis :: Class ScalarField
[frames] | no frames]

Class ScalarField

Functions.Interpolation.InterpolatingFunction --+    
                                                |    
                                      TensorField --+
                                                    |
                                                   ScalarField

Scalar field (tensor field of rank 0)

A subclass of TensorField.

Instance Methods
 
__init__(self, axes, values, default=None, period=(None, None, None), check=True)
VectorField
gradient(self)
Returns: the gradient
 
laplacian(self)
Returns: the laplacian (gradient of divergence) @rtype ScalarField

Inherited from TensorField: __add__, __call__, __getitem__, __sub__, allDerivatives, derivative, zero

Inherited from Functions.Interpolation.InterpolatingFunction: __abs__, __getattr__, __getslice__, __len__, arccos, arcsin, arctan, cos, cosh, definiteIntegral, exp, fitPolynomial, integral, log, selectInterval, sin, sinh, sqrt, tan, tanh

Method Details

__init__(self, axes, values, default=None, period=(None, None, None), check=True)
(Constructor)

 
Parameters:
  • axes (sequence of Numeric.array of rank 1) - three arrays specifying the axis ticks for the three axes
  • values (Numeric.array of 3 dimensions) - an array containing the field values. The three dimensions correspond to the x, y, z directions and must have lengths compatible with the axis arrays.
  • default (number or NoneType) - the value of the field for points outside the grid. A value of 'None' means that an exception will be raised for an attempt to evaluate the field outside the grid. Any other value must a tensor of the correct rank.
  • period (sequence of length three) - the period for each of the variables, or None for variables in which the function is not periodic.
Raises:
  • ValueError - if the arguments are not consistent
Overrides: Functions.Interpolation.InterpolatingFunction.__init__

gradient(self)

 
Returns: VectorField
the gradient

laplacian(self)

 
Returns:
the laplacian (gradient of divergence) @rtype ScalarField

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.TensorAnalysis.TensorField-class.html0000644000076600000240000005637311501734225033076 0ustar hinsenstaff00000000000000 Scientific.Geometry.TensorAnalysis.TensorField
Package Scientific :: Package Geometry :: Module TensorAnalysis :: Class TensorField
[frames] | no frames]

Class TensorField

Functions.Interpolation.InterpolatingFunction --+
                                                |
                                               TensorField
Known Subclasses:

Tensor field of arbitrary rank

A tensor field is described by a tensor at each point of a three-dimensional rectangular grid. The grid spacing must be uniform. Tensor fields are implemented as a subclass of InterpolatingFunction from the module Scientific.Functions.Interpolation and thus share all methods defined in that class.

Evaluation:

  • 'tensorfield(x, y, z)' (three coordinates)
  • 'tensorfield(coordinates)' (sequence containing three coordinates)
Instance Methods
 
__add__(self, other)
number
__call__(self, *points)
Returns: the function value obtained by linear interpolation
InterpolatingFunction or number
__getitem__(self, index)
Returns: an InterpolatingFunction whose number of variables is reduced, or a number if no variable is left
 
__init__(self, rank, axes, values, default=None, period=(None, None, None), check=True)
 
__sub__(self, other)
(TensorField, TensorField, TensorField)
allDerivatives(self)
Returns: all three derivatives (x, y, z) on equal-sized grids
TensorField
derivative(self, variable)
Returns: the derivative with respect to variable
Scientifc.Geometry.Tensor
zero(self)
Returns: a tensor of the same rank as the field values with all elements equal to zero

Inherited from Functions.Interpolation.InterpolatingFunction: __abs__, __getattr__, __getslice__, __len__, arccos, arcsin, arctan, cos, cosh, definiteIntegral, exp, fitPolynomial, integral, log, selectInterval, sin, sinh, sqrt, tan, tanh

Method Details

__call__(self, *points)
(Call operator)

 
Returns: number
the function value obtained by linear interpolation
Raises:
  • TypeError - if the number of arguments (len(points)) does not match the number of variables of the function
  • ValueError - if the evaluation point is outside of the domain of definition and no default value is defined
Overrides: Functions.Interpolation.InterpolatingFunction.__call__
(inherited documentation)

__getitem__(self, index)
(Indexing operator)

 
Parameters:
  • i - any indexing expression possible for N.array that does not use N.NewAxis
Returns: InterpolatingFunction or number
an InterpolatingFunction whose number of variables is reduced, or a number if no variable is left
Raises:
  • TypeError - if i is not an allowed index expression
Overrides: Functions.Interpolation.InterpolatingFunction.__getitem__
(inherited documentation)

__init__(self, rank, axes, values, default=None, period=(None, None, None), check=True)
(Constructor)

 
Parameters:
  • rank (int) - the tensor rank
  • axes (sequence of Numeric.array of rank 1) - three arrays specifying the axis ticks for the three axes
  • values (Numeric.array of rank+3 dimensions) - an array containing the field values. Its first three dimensions correspond to the x, y, z directions and must have lengths compatible with the axis arrays. The remaining dimensions must have length 3.
  • default (Scientific.Geometry.Tensor or NoneType) - the value of the field for points outside the grid. A value of 'None' means that an exception will be raised for an attempt to evaluate the field outside the grid. Any other value must a tensor of the correct rank.
  • period (sequence of length three) - the period for each of the variables, or None for variables in which the function is not periodic.
Raises:
  • ValueError - if the arguments are not consistent
Overrides: Functions.Interpolation.InterpolatingFunction.__init__

allDerivatives(self)

 
Returns: (TensorField, TensorField, TensorField)
all three derivatives (x, y, z) on equal-sized grids

derivative(self, variable)

 
Parameters:
  • variable (int) - 0 for x, 1 for y, 2 for z
Returns: TensorField
the derivative with respect to variable
Overrides: Functions.Interpolation.InterpolatingFunction.derivative

zero(self)

 
Returns: Scientifc.Geometry.Tensor
a tensor of the same rank as the field values with all elements equal to zero

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.TensorAnalysis.VectorField-class.html0000644000076600000240000005614711501734225033065 0ustar hinsenstaff00000000000000 Scientific.Geometry.TensorAnalysis.VectorField
Package Scientific :: Package Geometry :: Module TensorAnalysis :: Class VectorField
[frames] | no frames]

Class VectorField

Functions.Interpolation.InterpolatingFunction --+    
                                                |    
                                      TensorField --+
                                                    |
                                                   VectorField

Vector field (tensor field of rank 1)

A subclass of TensorField.

Instance Methods
 
__init__(self, axes, values, default=None, period=(None, None, None), check=True)
 
curl(self)
Returns: the curl @rtype VectorField
 
divergence(self)
Returns: the divergence @rtype ScalarField
 
divergenceCurlAndStrain(self)
Returns: all derivative fields: divergence, curl, and strain @rtype (ScalarField, VectorField, TensorField)
 
laplacian(self)
Returns: the laplacian @rtype VectorField
ScalarField
length(self)
Returns: a scalar field corresponding to the length (norm) of the vector field.
 
strain(self)
Returns: the strain @rtype TensorField of rank 2
Scientifc.Geometry.Tensor
zero(self)
Returns: a tensor of the same rank as the field values with all elements equal to zero

Inherited from TensorField: __add__, __call__, __getitem__, __sub__, allDerivatives, derivative

Inherited from Functions.Interpolation.InterpolatingFunction: __abs__, __getattr__, __getslice__, __len__, arccos, arcsin, arctan, cos, cosh, definiteIntegral, exp, fitPolynomial, integral, log, selectInterval, sin, sinh, sqrt, tan, tanh

Method Details

__init__(self, axes, values, default=None, period=(None, None, None), check=True)
(Constructor)

 
Parameters:
  • axes (sequence of Numeric.array of rank 1) - three arrays specifying the axis ticks for the three axes
  • values (Numeric.array of four dimensions) - an array containing the field values. Its first three dimensions correspond to the x, y, z directions and must have lengths compatible with the axis arrays. The fourth dimension must have length 3.
  • default (Scientific.Geometry.Vector or NoneType) - the value of the field for points outside the grid. A value of 'None' means that an exception will be raised for an attempt to evaluate the field outside the grid. Any other value must a vector
  • period (sequence of length three) - the period for each of the variables, or None for variables in which the function is not periodic.
Raises:
  • ValueError - if the arguments are not consistent
Overrides: Functions.Interpolation.InterpolatingFunction.__init__

curl(self)

 
Returns:
the curl @rtype VectorField

divergence(self)

 
Returns:
the divergence @rtype ScalarField

divergenceCurlAndStrain(self)

 
Returns:
all derivative fields: divergence, curl, and strain @rtype (ScalarField, VectorField, TensorField)

laplacian(self)

 
Returns:
the laplacian @rtype VectorField

length(self)

 
Returns: ScalarField
a scalar field corresponding to the length (norm) of the vector field.

strain(self)

 
Returns:
the strain @rtype TensorField of rank 2

zero(self)

 
Returns: Scientifc.Geometry.Tensor
a tensor of the same rank as the field values with all elements equal to zero
Overrides: TensorField.zero
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation-module.html0000644000076600000240000002125611501734225031061 0ustar hinsenstaff00000000000000 Scientific.Geometry.Transformation
Package Scientific :: Package Geometry :: Module Transformation
[frames] | no frames]

Module Transformation

Linear transformations in 3D space

Classes
  Inversion
  LinearTransformation
General linear transformation.
  RigidBodyTransformation
Combination of translations and rotations
  Rotation
Rotational transformation
  RotationTranslation
Combined translational and rotational transformation.
  Scaling
Scaling
  Shear
  Transformation
Linear coordinate transformation.
  Translation
Translational transformation
Functions
 
angleFromSineAndCosine(y, x)
 
mod_angle(angle, mod)
ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.Inversion-class.html0000644000076600000240000001774011501734225032657 0ustar hinsenstaff00000000000000 Scientific.Geometry.Transformation.Inversion
Package Scientific :: Package Geometry :: Module Transformation :: Class Inversion
[frames] | no frames]

Class Inversion

Transformation --+    
                 |    
           Scaling --+
                     |
                    Inversion

Instance Methods
 
__init__(self)

Inherited from Scaling: __call__, __mul__, asLinearTransformation, inverse

Class Variables

Inherited from Scaling: is_scaling

Method Details

__init__(self)
(Constructor)

 
Parameters:
  • scale_factor - the scale factor
Overrides: Scaling.__init__
(inherited documentation)

././@LongLink0000000000000000000000000000015000000000000011211 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.LinearTransformation-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.LinearTransformation-class.h0000644000076600000240000002472311501734225034326 0ustar hinsenstaff00000000000000 Scientific.Geometry.Transformation.LinearTransformation
Package Scientific :: Package Geometry :: Module Transformation :: Class LinearTransformation
[frames] | no frames]

Class LinearTransformation

Transformation --+
                 |
                LinearTransformation

General linear transformation.

Objects of this class are not created directly, but can be the result of a composition of transformations.

Instance Methods
Scientific.Geometry.Vector
__call__(self, vector)
Returns: the transformed vector
 
__init__(self, tensor, vector)
 
__mul__(self, other)
 
asLinearTransformation(self)
Transformation
inverse(self)
Returns: the inverse transformation
Method Details

__call__(self, vector)
(Call operator)

 
Parameters:
  • vector - the input vector
Returns: Scientific.Geometry.Vector
the transformed vector
Overrides: Transformation.__call__
(inherited documentation)

inverse(self)

 
Returns: Transformation
the inverse transformation
Overrides: Transformation.inverse
(inherited documentation)

././@LongLink0000000000000000000000000000015300000000000011214 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.RigidBodyTransformation-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.RigidBodyTransformation-clas0000644000076600000240000002537211501734225034360 0ustar hinsenstaff00000000000000 Scientific.Geometry.Transformation.RigidBodyTransformation
Package Scientific :: Package Geometry :: Module Transformation :: Class RigidBodyTransformation
[frames] | no frames]

Class RigidBodyTransformation

Transformation --+
                 |
                RigidBodyTransformation
Known Subclasses:

Combination of translations and rotations

Instance Methods
Rotation
rotation(self)
Returns: the rotational component
 
screwMotion(self)
Returns: the four parameters (reference, direction, angle, distance) of a screw-like motion that is equivalent to the transformation.
Translation
translation(self)
Returns: the translational component.

Inherited from Transformation: __call__, inverse

Method Details

rotation(self)

 
Returns: Rotation
the rotational component

screwMotion(self)

 
Returns:
the four parameters (reference, direction, angle, distance) of a screw-like motion that is equivalent to the transformation. The screw motion consists of a displacement of distance (a float) along direction (a normalized Scientific.Geometry.Vector) plus a rotation of angle radians around an axis pointing along direction and passing through the point reference (a Scientific.Geometry.Vector).

translation(self)

 
Returns: Translation
the translational component. In the case of a mixed rotation/translation, this translation is executed after the rotation.

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.Rotation-class.html0000644000076600000240000005660411501734225032504 0ustar hinsenstaff00000000000000 Scientific.Geometry.Transformation.Rotation
Package Scientific :: Package Geometry :: Module Transformation :: Class Rotation
[frames] | no frames]

Class Rotation

     Transformation --+    
                      |    
RigidBodyTransformation --+
                          |
                         Rotation

Rotational transformation

Instance Methods
Scientific.Geometry.Vector
__call__(self, other)
Returns: the transformed vector
 
__init__(self, *args)
There are two calling patterns:
 
__mul__(self, other)
 
asLinearTransformation(self)
Scientific.Geometry.Quaternion.Quaternion
asQuaternion(self)
Returns: a quaternion representing the same rotation
(Scientific.Geometry.Vector, float)
axisAndAngle(self)
Returns: the axis (a normalized vector) and angle (in radians).
Transformation
inverse(self)
Returns: the inverse transformation
Rotation
rotation(self)
Returns: the rotational component
 
screwMotion(self)
Returns: the four parameters (reference, direction, angle, distance) of a screw-like motion that is equivalent to the transformation.
list of N.array
threeAngles(self, e1, e2, e3, tolerance=1e-07)
Find three angles a1, a2, a3 such that Rotation(a1*e1)*Rotation(a2*e2)*Rotation(a3*e3) is equal to the rotation object.
Translation
translation(self)
Returns: the translational component.
Class Variables
  is_rotation = 1
Method Details

__call__(self, other)
(Call operator)

 
Parameters:
  • vector - the input vector
Returns: Scientific.Geometry.Vector
the transformed vector
Overrides: Transformation.__call__
(inherited documentation)

__init__(self, *args)
(Constructor)

 

There are two calling patterns:

asQuaternion(self)

 
Returns: Scientific.Geometry.Quaternion.Quaternion
a quaternion representing the same rotation

axisAndAngle(self)

 
Returns: (Scientific.Geometry.Vector, float)
the axis (a normalized vector) and angle (in radians). The angle is in the interval (-pi, pi]

inverse(self)

 
Returns: Transformation
the inverse transformation
Overrides: Transformation.inverse
(inherited documentation)

rotation(self)

 
Returns: Rotation
the rotational component
Overrides: RigidBodyTransformation.rotation
(inherited documentation)

screwMotion(self)

 
Returns:
the four parameters (reference, direction, angle, distance) of a screw-like motion that is equivalent to the transformation. The screw motion consists of a displacement of distance (a float) along direction (a normalized Scientific.Geometry.Vector) plus a rotation of angle radians around an axis pointing along direction and passing through the point reference (a Scientific.Geometry.Vector).
Overrides: RigidBodyTransformation.screwMotion
(inherited documentation)

threeAngles(self, e1, e2, e3, tolerance=1e-07)

 

Find three angles a1, a2, a3 such that Rotation(a1*e1)*Rotation(a2*e2)*Rotation(a3*e3) is equal to the rotation object. e1, e2, and e3 are non-zero vectors. There are two solutions, both of which are computed.

Parameters:
Returns: list of N.array
a list containing two arrays of shape (3,), each containing the three angles of one solution
Raises:
  • ValueError - if two consecutive axes are parallel

translation(self)

 
Returns: Translation
the translational component. In the case of a mixed rotation/translation, this translation is executed after the rotation.
Overrides: RigidBodyTransformation.translation
(inherited documentation)

././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.RotationTranslation-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.RotationTranslation-class.ht0000644000076600000240000004135211501734225034364 0ustar hinsenstaff00000000000000 Scientific.Geometry.Transformation.RotationTranslation
Package Scientific :: Package Geometry :: Module Transformation :: Class RotationTranslation
[frames] | no frames]

Class RotationTranslation

     Transformation --+    
                      |    
RigidBodyTransformation --+
                          |
                         RotationTranslation

Combined translational and rotational transformation.

Objects of this class are not created directly, but can be the result of a composition of rotations and translations.

Instance Methods
Scientific.Geometry.Vector
__call__(self, vector)
Returns: the transformed vector
 
__init__(self, tensor, vector)
 
__mul__(self, other)
 
asLinearTransformation(self)
Transformation
inverse(self)
Returns: the inverse transformation
Rotation
rotation(self)
Returns: the rotational component
 
screwMotion(self)
Returns: the four parameters (reference, direction, angle, distance) of a screw-like motion that is equivalent to the transformation.
Translation
translation(self)
Returns: the translational component.
Class Variables
  is_rotation_translation = 1
Method Details

__call__(self, vector)
(Call operator)

 
Parameters:
  • vector - the input vector
Returns: Scientific.Geometry.Vector
the transformed vector
Overrides: Transformation.__call__
(inherited documentation)

inverse(self)

 
Returns: Transformation
the inverse transformation
Overrides: Transformation.inverse
(inherited documentation)

rotation(self)

 
Returns: Rotation
the rotational component
Overrides: RigidBodyTransformation.rotation
(inherited documentation)

screwMotion(self)

 
Returns:
the four parameters (reference, direction, angle, distance) of a screw-like motion that is equivalent to the transformation. The screw motion consists of a displacement of distance (a float) along direction (a normalized Scientific.Geometry.Vector) plus a rotation of angle radians around an axis pointing along direction and passing through the point reference (a Scientific.Geometry.Vector).
Overrides: RigidBodyTransformation.screwMotion
(inherited documentation)

translation(self)

 
Returns: Translation
the translational component. In the case of a mixed rotation/translation, this translation is executed after the rotation.
Overrides: RigidBodyTransformation.translation
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.Scaling-class.html0000644000076600000240000002745511501734225032267 0ustar hinsenstaff00000000000000 Scientific.Geometry.Transformation.Scaling
Package Scientific :: Package Geometry :: Module Transformation :: Class Scaling
[frames] | no frames]

Class Scaling

Transformation --+
                 |
                Scaling
Known Subclasses:

Scaling

Instance Methods
Scientific.Geometry.Vector
__call__(self, vector)
Returns: the transformed vector
 
__init__(self, scale_factor)
 
__mul__(self, other)
 
asLinearTransformation(self)
Transformation
inverse(self)
Returns: the inverse transformation
Class Variables
  is_scaling = 1
Method Details

__call__(self, vector)
(Call operator)

 
Parameters:
  • vector - the input vector
Returns: Scientific.Geometry.Vector
the transformed vector
Overrides: Transformation.__call__
(inherited documentation)

__init__(self, scale_factor)
(Constructor)

 
Parameters:
  • scale_factor (float) - the scale factor

inverse(self)

 
Returns: Transformation
the inverse transformation
Overrides: Transformation.inverse
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.Shear-class.html0000644000076600000240000002422611501734225031742 0ustar hinsenstaff00000000000000 Scientific.Geometry.Transformation.Shear
Package Scientific :: Package Geometry :: Module Transformation :: Class Shear
[frames] | no frames]

Class Shear

Transformation --+
                 |
                Shear

Instance Methods
Scientific.Geometry.Vector
__call__(self, vector)
Returns: the transformed vector
 
__init__(self, *args)
 
__mul__(self, other)
 
asLinearTransformation(self)
Transformation
inverse(self)
Returns: the inverse transformation
Method Details

__call__(self, vector)
(Call operator)

 
Parameters:
  • vector - the input vector
Returns: Scientific.Geometry.Vector
the transformed vector
Overrides: Transformation.__call__
(inherited documentation)

inverse(self)

 
Returns: Transformation
the inverse transformation
Overrides: Transformation.inverse
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.Transformation-class.html0000644000076600000240000002210711501734225033702 0ustar hinsenstaff00000000000000 Scientific.Geometry.Transformation.Transformation
Package Scientific :: Package Geometry :: Module Transformation :: Class Transformation
[frames] | no frames]

Class Transformation

Known Subclasses:

Linear coordinate transformation.

Transformation objects represent linear coordinate transformations in a 3D space. They can be applied to vectors, returning another vector. If t is a transformation and v is a vector, t(v) returns the transformed vector.

Transformations support composition: if t1 and t2 are transformation objects, t1*t2 is another transformation object which corresponds to applying t1 after t2.

This class is an abstract base class. Instances can only be created of concrete subclasses, i.e. translations or rotations.

Instance Methods
Scientific.Geometry.Vector
__call__(self, vector)
Returns: the transformed vector
Transformation
inverse(self)
Returns: the inverse transformation
Method Details

__call__(self, vector)
(Call operator)

 
Parameters:
Returns: Scientific.Geometry.Vector
the transformed vector

inverse(self)

 
Returns: Transformation
the inverse transformation

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Transformation.Translation-class.html0000644000076600000240000004477111501734225033205 0ustar hinsenstaff00000000000000 Scientific.Geometry.Transformation.Translation
Package Scientific :: Package Geometry :: Module Transformation :: Class Translation
[frames] | no frames]

Class Translation

     Transformation --+    
                      |    
RigidBodyTransformation --+
                          |
                         Translation

Translational transformation

Instance Methods
Scientific.Geometry.Vector
__call__(self, vector)
Returns: the transformed vector
 
__init__(self, vector)
 
__mul__(self, other)
 
asLinearTransformation(self)
 
displacement(self)
Returns: the displacement vector
Transformation
inverse(self)
Returns: the inverse transformation
Rotation
rotation(self)
Returns: the rotational component
 
screwMotion(self)
Returns: the four parameters (reference, direction, angle, distance) of a screw-like motion that is equivalent to the transformation.
Translation
translation(self)
Returns: the translational component.
Class Variables
  is_translation = 1
Method Details

__call__(self, vector)
(Call operator)

 
Parameters:
  • vector - the input vector
Returns: Scientific.Geometry.Vector
the transformed vector
Overrides: Transformation.__call__
(inherited documentation)

__init__(self, vector)
(Constructor)

 
Parameters:

displacement(self)

 
Returns:
the displacement vector

inverse(self)

 
Returns: Transformation
the inverse transformation
Overrides: Transformation.inverse
(inherited documentation)

rotation(self)

 
Returns: Rotation
the rotational component
Overrides: RigidBodyTransformation.rotation
(inherited documentation)

screwMotion(self)

 
Returns:
the four parameters (reference, direction, angle, distance) of a screw-like motion that is equivalent to the transformation. The screw motion consists of a displacement of distance (a float) along direction (a normalized Scientific.Geometry.Vector) plus a rotation of angle radians around an axis pointing along direction and passing through the point reference (a Scientific.Geometry.Vector).
Overrides: RigidBodyTransformation.screwMotion
(inherited documentation)

translation(self)

 
Returns: Translation
the translational component. In the case of a mixed rotation/translation, this translation is executed after the rotation.
Overrides: RigidBodyTransformation.translation
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Geometry.Vector-class.html0000644000076600000240000007541611501734225027144 0ustar hinsenstaff00000000000000 Scientific.Geometry.Vector
Package Scientific :: Package Geometry :: Class Vector
[frames] | no frames]

Class Vector

Vector in 3D space

Constructor:

Vectors support the usual arithmetic operations ('v1', 'v2': vectors, 's': scalar):

  • 'v1+v2' (addition)
  • 'v1-v2' (subtraction)
  • 'v1*v2' (scalar product)
  • 's*v1', 'v1*s' (multiplication with a scalar)
  • 'v1/s' (division by a scalar)

The three coordinates can be extracted by indexing.

Vectors are immutable, i.e. their elements cannot be changed.

Vector elements can be any objects on which the standard arithmetic operations plus the functions sqrt and arccos are defined.

Instance Methods
 
__add__(self, other)
 
__cmp__(self, other)
 
__copy__(self, memo=None)
 
__deepcopy__(self, memo=None)
 
__div__(self, other)
 
__getitem__(self, index)
 
__getstate__(self)
 
__init__(self, x=None, y=None, z=None)
There are two supported calling patterns:
 
__len__(self)
 
__mul__(self, other)
 
__neg__(self)
 
__radd__(self, other)
 
__rdiv__(self, other)
 
__repr__(self)
 
__rmul__(self, other)
 
__rsub__(self, other)
 
__setstate__(self, state)
 
__str__(self)
 
__sub__(self, other)
float
angle(self, other)
Returns: the angle to other
Scientific.Geometry.Tensor
asTensor(self)
Returns: an equivalent rank-1 tensor object
Vector
cross(self, other)
Returns: cross product with other
Scientific.Geometry.Tensor
dyadicProduct(self, other)
Returns: the dyadic product with other
type of vector elements
length(self)
Returns: the length (norm) of the vector
Vector
normal(self)
Returns: a normalized (length 1) copy of the vector
type of vector elements
x(self)
Returns: the x coordinate
type of vector elements
y(self)
Returns: the y coordinate
type of vector elements
z(self)
Returns: the z coordinate
Class Variables
  is_vector = 1
Method Details

__init__(self, x=None, y=None, z=None)
(Constructor)

 

There are two supported calling patterns:

  1. Vector(x, y, z) (from three coordinates)
  2. Vector(coordinates) (from any sequence containing three coordinates)

angle(self, other)

 
Parameters:
Returns: float
the angle to other
Raises:
  • TypeError - if other is not a vector

asTensor(self)

 
Returns: Scientific.Geometry.Tensor
an equivalent rank-1 tensor object

cross(self, other)

 
Parameters:
Returns: Vector
cross product with other

dyadicProduct(self, other)

 
Parameters:
Returns: Scientific.Geometry.Tensor
the dyadic product with other
Raises:
  • TypeError - if other is not a vector or a tensor

length(self)

 
Returns: type of vector elements
the length (norm) of the vector

normal(self)

 
Returns: Vector
a normalized (length 1) copy of the vector
Raises:
  • ZeroDivisionError - if vector length is zero

x(self)

 
Returns: type of vector elements
the x coordinate

y(self)

 
Returns: type of vector elements
the y coordinate

z(self)

 
Returns: type of vector elements
the z coordinate

ScientificPython-2.9.4/Doc/Reference/Scientific.indexing-module.html0000644000076600000240000001444511501734225026070 0ustar hinsenstaff00000000000000 Scientific.indexing
Package Scientific :: Module indexing
[frames] | no frames]

Module indexing

Array indexing utility

This module provides a convenient method for constructing array indices algorithmically. It provides one importable object, index_expression.

For any index combination, including slicing and axis insertion, a[indices] is the same as a[index_expression[indices]] for any array {a}. However, index_expression[indices] can be used anywhere in Python code and returns a tuple of indexing objects that can be used in the construction of complex index expressions.

Sole restriction: Slices must be specified in the double-colon form, i.e. a[::] is allowed, whereas a[:] is not.

Variables
  index_expression = <Scientific.indexing._index_expression_clas...
Variables Details

index_expression

Value:
<Scientific.indexing._index_expression_class instance at 0x2220418>

ScientificPython-2.9.4/Doc/Reference/Scientific.IO-module.html0000644000076600000240000001266711501734225024576 0ustar hinsenstaff00000000000000 Scientific.IO
Package Scientific :: Package IO
[frames] | no frames]

Package IO

Submodules

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.ArrayIO-module.html0000644000076600000240000003547511501734225026105 0ustar hinsenstaff00000000000000 Scientific.IO.ArrayIO
Package Scientific :: Package IO :: Module ArrayIO
[frames] | no frames]

Module ArrayIO

Basic support for I/O of one- and two-dimensional numerical arrays to and from plain text files

The text file format is very simple and used by many other programs as well:

  • each line corresponds to one row of the array
  • the numbers within a line are separated by white space
  • lines starting with # are ignored (comment lines)

An array containing only one line or one column is returned as a one-dimensional array on reading. One-dimensional arrays are written as one item per line.

Numbers in files to be read must conform to Python/C syntax. For reading files containing Fortran-style double-precision numbers (exponent prefixed by D), use the module Scientific.IO.FortranFormat.

Functions
Numeric.array
readArray(filename)
Read array data from a file
Numeric.array of float
readFloatArray(filename)
Read array data from a file into an array of floats
Numeric.array of int
readIntegerArray(filename)
Read array data from a file into an array of integers
 
writeArray(array, filename, mode='w')
Write a text representation of an array to a file.
 
writeDataSets(datasets, filename, separator='')
Write multiple datasets to a text file.
Function Details

readArray(filename)

 

Read array data from a file

This function works for arbitrary data types (every array element can be given by an arbitrary Python expression), but at the price of being slow. For large arrays, use readFloatArray or readIntegerArray if possible.

Parameters:
  • filename (str) - the name of the file to read
Returns: Numeric.array
an array containing the data from the file

readFloatArray(filename)

 

Read array data from a file into an array of floats

Parameters:
  • filename (str) - the name of the file to read
Returns: Numeric.array of float
an array containing the data from the file

readIntegerArray(filename)

 

Read array data from a file into an array of integers

Parameters:
  • filename (str) - the name of the file to read
Returns: Numeric.array of int
an array containing the data from the file

writeArray(array, filename, mode='w')

 

Write a text representation of an array to a file.

Parameters:
  • array (Numeric.array) - the array to be written
  • filename (str) - the name of the output file
  • mode (str) - the file access mode, 'w' (new file) or 'a' (append)

writeDataSets(datasets, filename, separator='')

 

Write multiple datasets to a text file.

Parameters:
  • datasets - a sequence of datasets describing a curve to be plotted. Each dataset is either a 1d-array (list of values) or a 2d-array of shape N x 2 (list of (x, y) pairs). Nested lists can be used instead of arrays.
  • filename (str) - the name of the output file
  • separator (str) - the contents of the line that is written between two datasets

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.FortranFormat-module.html0000644000076600000240000001311111501734225027342 0ustar hinsenstaff00000000000000 Scientific.IO.FortranFormat
Package Scientific :: Package IO :: Module FortranFormat
[frames] | no frames]

Module FortranFormat

Fortran-style formatted input/output

This module provides two classes that aid in reading and writing Fortran-formatted text files.

Examples:

 Input::

   >>>s = '   59999'
   >>>format = FortranFormat('2I4')
   >>>line = FortranLine(s, format)
   >>>print line[0]
   >>>print line[1]

 prints::

   >>>5
   >>>9999


 Output::

   >>>format = FortranFormat('2D15.5')
   >>>line = FortranLine([3.1415926, 2.71828], format)
   >>>print str(line)

 prints::

   '3.14159D+00    2.71828D+00'
Classes
  FortranFormat
Parsed Fortran-style format string
  FortranLine
Fortran-style record in formatted files
ScientificPython-2.9.4/Doc/Reference/Scientific.IO.FortranFormat.FortranFormat-class.html0000644000076600000240000001761311501734225031760 0ustar hinsenstaff00000000000000 Scientific.IO.FortranFormat.FortranFormat
Package Scientific :: Package IO :: Module FortranFormat :: Class FortranFormat
[frames] | no frames]

Class FortranFormat

Parsed Fortran-style format string

FortranFormat objects can be used as arguments when constructing FortranLine objects instead of the plain format string. If a format string is used more than once, embedding it into a FortranFormat object has the advantage that the format string is parsed only once.

Instance Methods
 
__getitem__(self, i)
 
__init__(self, format, nested=False)
 
__len__(self)
Method Details

__init__(self, format, nested=False)
(Constructor)

 
Parameters:
  • format (str) - a Fortran format specification
  • nested - for internal use

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.FortranFormat.FortranLine-class.html0000644000076600000240000003570711501734225031423 0ustar hinsenstaff00000000000000 Scientific.IO.FortranFormat.FortranLine
Package Scientific :: Package IO :: Module FortranFormat :: Class FortranLine
[frames] | no frames]

Class FortranLine

Fortran-style record in formatted files

FortranLine objects represent the content of one record of a Fortran-style formatted file. Indexing yields the contents as Python objects, whereas transformation to a string (using the built-in function 'str') yields the text representation.

Restrictions:

  1. Only A, D, E, F, G, I, and X formats are supported (plus string constants for output).
  2. No direct support for complex numbers; they must be split into real and imaginary parts before output.
  3. No overflow check. If an output field gets too large, it will take more space, instead of being replaced by stars according to Fortran conventions.
Instance Methods
 
__getitem__(self, i)
Returns: the ith data element
 
__getslice__(self, i, j)
Returns: a list containing the ith to jth data elements
 
__init__(self, line, format, length=80)
int
__len__(self)
Returns: the number of data elements in the record
str
__str__(self)
Returns: a Fortran-formatted text representation of the data record
bool
isBlank(self)
Returns: True if the line contains only whitespace
Method Details

__getitem__(self, i)
(Indexing operator)

 
Parameters:
  • i (int) - index
Returns:
the ith data element

__getslice__(self, i, j)
(Slicling operator)

 
Parameters:
  • i (int) - start index
  • j (int) - end index
Returns:
a list containing the ith to jth data elements

__init__(self, line, format, length=80)
(Constructor)

 
Parameters:
  • line - either a sequence of Python objects, or a string formatted according to Fortran rules
  • format - either a Fortran-style format string, or a FortranFormat object. A FortranFormat should be used when the same format string is used repeatedly, because then the rather slow parsing of the string is performed only once.
  • length - the length of the Fortran record. This is relevant only when data is a string; this string is then extended by spaces to have the indicated length. The default value of 80 is almost always correct.

__len__(self)
(Length operator)

 
Returns: int
the number of data elements in the record

__str__(self)
(Informal representation operator)

 
Returns: str
a Fortran-formatted text representation of the data record

isBlank(self)

 
Returns: bool
True if the line contains only whitespace

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.NetCDF-module.html0000644000076600000240000001173311501734225025631 0ustar hinsenstaff00000000000000 Scientific.IO.NetCDF
Package Scientific :: Package IO :: Module NetCDF
[frames] | no frames]

Module NetCDF

Python interface to the netCDF library

Classes
  NetCDFFile
netCDF file
  NetCDFVariable
Variable in a netCDF file
ScientificPython-2.9.4/Doc/Reference/Scientific.IO.NetCDF.NetCDFFile-class.html0000644000076600000240000003457111501734225027320 0ustar hinsenstaff00000000000000 Scientific.IO.NetCDF.NetCDFFile
Package Scientific :: Package IO :: Module NetCDF :: Class NetCDFFile
[frames] | no frames]

Class NetCDFFile

netCDF file

A NetCDFFile object has two standard attributes: 'dimensions' and 'variables'. The values of both are dictionaries, mapping dimension names to their associated lengths and variable names to variables, respectively. Application programs should never modify these dictionaries.

All other attributes correspond to global attributes defined in the netCDF file. Global file attributes are created by assigning to an attribute of the NetCDFFile object.

Instance Methods
 
__init__(self, filename, mode)
 
close(self)
Close the file.
 
createDimension(self, name, length)
NetCDFVariable
createVariable(self, name, type, dimensions)
Returns: the object corresponding to the new variable
 
flush(self)
Write all buffered data to the disk file.
 
sync(self)
Write all buffered data to the disk file.
Method Details

__init__(self, filename, mode)
(Constructor)

 
Parameters:
  • filename (str) - name of the netCDF file. By convention, netCDF files have the extension ".nc", but this is not enforced. The filename may contain a home directory indication starting with "~".
  • mode (str) - access mode. "r" means read-only; no data can be modified. "w" means write; a new file is created, an existing file with the same name is deleted. "a" means append (in analogy with serial files); an existing file is opened for reading and writing, if the file does not exist it is created. "r+" is similar to "a", but the file must already exist. An "s" can be appended to any of the modes listed above; it indicates that the file will be opened or created in "share" mode, which reduces buffering in order to permit simultaneous read access by other processes to a file that is being written. When creating a file in write mode, an "l" or "4" can be appended to use the large-file format (introduced with netCDF 3.6) or the HDF5 format (introduced with netCDF 4).

close(self)

 

Close the file. Any read or write access to the file or one of its variables after closing raises an exception.

createDimension(self, name, length)

 
Parameters:
  • name (str) - the name of the dimension
  • length (int or NoneType) - the length of the new dimension. None stands for the unlimited dimension. Note that there can be only one unlimited dimension per file.

createVariable(self, name, type, dimensions)

 
Parameters:
  • name (str) - the name of the new variable
  • type (str) - the data type of the elements; the same one-letter codes as in Numeric are used and the use of the pre-defined constants (Numeric.Float etc.) is strongly recommended.
  • dimensions (tuple of str) - a tuple of dimension names that have been defined earlier
Returns: NetCDFVariable
the object corresponding to the new variable

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.NetCDF.NetCDFVariable-class.html0000644000076600000240000002535411501734225030165 0ustar hinsenstaff00000000000000 Scientific.IO.NetCDF.NetCDFVariable
Package Scientific :: Package IO :: Module NetCDF :: Class NetCDFVariable
[frames] | no frames]

Class NetCDFVariable

Variable in a netCDF file

NetCDFVariable objects are constructed by calling the method 'createVariable' on the NetCDFFile object.

NetCDFVariable objects behave much like array objects defined in module Numeric, except that their data resides in a file. Data is read by indexing and written by assigning to an indexed subset; the entire array can be accessed by the index '[:]' or using the methods 'getValue' and 'assignValue'. NetCDFVariable objects also have attribute "shape" with the same meaning as for arrays, but the shape cannot be modified. There is another read-only attribute "dimensions", whose value is the tuple of dimension names.

All other attributes correspond to variable attributes defined in the netCDF file. Variable attributes are created by assigning to an attribute of the NetCDFVariable object.

Note: If a file open for reading is simultaneously written by another program, the size of the unlimited dimension may change. Every time the shape of a variable is requested, the current size will be obtained from the file. For reading and writing, the size obtained during the last shape request is used. This ensures consistency: foo[-1] means the same thing no matter how often it is evaluated, as long as the shape is not re-evaluated in between.

Instance Methods
 
__init__(self, *args)
 
assignValue(self, value)
Assign a new value to the variable.
 
getValue(self)
Return the value of the variable.
str
typecode(self)
Returns: the variable's type code
Method Details

assignValue(self, value)

 

Assign a new value to the variable. This method allows assignment to scalar variables, which cannot be indexed.

Parameters:
  • value - the new value for the variable

getValue(self)

 

Return the value of the variable. This method allows access to scalar variables, which cannot be indexed.

Returns:
the current value of the variable

typecode(self)

 
Returns: str
the variable's type code

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB-module.html0000644000076600000240000005204411501734225025173 0ustar hinsenstaff00000000000000 Scientific.IO.PDB
Package Scientific :: Package IO :: Module PDB
[frames] | no frames]

Module PDB

Parsing and writing of Protein Data Bank (PDB) files

This module provides classes that represent PDB (Protein Data Bank) files and configurations contained in PDB files. It provides access to PDB files on two levels: low-level (line by line) and high-level (chains, residues, and atoms).

Caution: The PDB file format has been heavily abused, and it is probably impossible to write code that can deal with all variants correctly. This modules tries to read the widest possible range of PDB files, but gives priority to a correct interpretation of the PDB format as defined by the Brookhaven National Laboratory.

A special problem are atom names. The PDB file format specifies that the first two letters contain the right-justified chemical element name. A later modification allowed the initial space in hydrogen names to be replaced by a digit. Many programs ignore all this and treat the name as an arbitrary left-justified four-character name. This makes it difficult to extract the chemical element accurately; most programs write the '"CA"' for C_alpha in such a way that it actually stands for a calcium atom. For this reason a special element field has been added later, but only few files use it. In the absence of an element field, the code in this module attempts to guess the element using all information available.

The low-level routines in this module do not try to deal with the atom name problem; they return and expect four-character atom names including spaces in the correct positions. The high-level routines use atom names without leading or trailing spaces, but provide and use the element field whenever possible. For output, they use the element field to place the atom name correctly, and for input, they construct the element field content from the atom name if no explicit element field is found in the file.

Except where indicated, numerical values use the same units and conventions as specified in the PDB format description.

Example:

 >>>conf = Structure('example.pdb')
 >>>print conf
 >>>for residue in conf.residues:
 >>>    for atom in residue:
 >>>        print atom
Classes
  AminoAcidResidue
Amino acid residue in a PDB file
  Atom
Atom in a PDB structure
  Chain
Chain of PDB residues
  Group
Atom group (residue or molecule) in a PDB file
  HetAtom
HetAtom in a PDB structure
  Molecule
Molecule in a PDB file
  NucleotideChain
Nucleotide chain in a PDB file
  NucleotideResidue
Nucleotide residue in a PDB file
  PDBFile
PDB file with access at the record level
  PeptideChain
Peptide chain in a PDB file
  Residue
  ResidueNumber
PDB residue number
  Structure
A high-level representation of the contents of a PDB file
Functions
 
defineAminoAcidResidue(symbol)
Make the parser recognize a particular residue type as an amino acid residue
 
defineNucleicAcidResidue(symbol)
Make the parser recognize a particular residue type as an nucleic acid residue
Variables
  amino_acids = ['ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'CYX', 'GLN'...
  nucleic_acids = ['A', 'C', 'G', 'I', 'T', 'U', '+A', '+C', '+G...
Function Details

defineAminoAcidResidue(symbol)

 

Make the parser recognize a particular residue type as an amino acid residue

Parameters:
  • symbol (str) - the three-letter code for an amino acid

defineNucleicAcidResidue(symbol)

 

Make the parser recognize a particular residue type as an nucleic acid residue

Parameters:
  • symbol (str) - the one-letter code for a nucleic acid

Variables Details

amino_acids

Value:
['ALA',
 'ARG',
 'ASN',
 'ASP',
 'CYS',
 'CYX',
 'GLN',
 'GLU',
...

nucleic_acids

Value:
['A',
 'C',
 'G',
 'I',
 'T',
 'U',
 '+A',
 '+C',
...

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.AminoAcidResidue-class.html0000644000076600000240000003115011501734225030152 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.AminoAcidResidue
Package Scientific :: Package IO :: Module PDB :: Class AminoAcidResidue
[frames] | no frames]

Class AminoAcidResidue

Group --+    
        |    
  Residue --+
            |
           AminoAcidResidue

Amino acid residue in a PDB file

Instance Methods
 
addAtom(self, atom)
Add an atom to the group
bool
isCTerminus(self)
Returns: True if the residue is in C-terminal configuration, i.e.
bool
isNTerminus(self)
Returns: True if the residue is in N-terminal configuration, i.e.
 
writeToFile(self, file)
Write the group to a file

Inherited from Group: __getitem__, __init__, __len__, __repr__, __str__, changeName, deleteAtom, deleteHydrogens, isCompatible

Class Variables
  is_amino_acid = 1
Method Details

addAtom(self, atom)

 

Add an atom to the group

Parameters:
  • atom - the atom
Overrides: Group.addAtom
(inherited documentation)

isCTerminus(self)

 
Returns: bool
True if the residue is in C-terminal configuration, i.e. if it has a second oxygen bound to the carbon atom of the peptide group. False otherwise.

isNTerminus(self)

 
Returns: bool
True if the residue is in N-terminal configuration, i.e. if it contains more than one hydrogen bound to be nitrogen atom of the peptide group. False otherwise.

writeToFile(self, file)

 

Write the group to a file

Parameters:
  • file - a PDBFile object or a file name
Overrides: Group.writeToFile
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.Atom-class.html0000644000076600000240000003335311501734225025714 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.Atom
Package Scientific :: Package IO :: Module PDB :: Class Atom
[frames] | no frames]

Class Atom

Known Subclasses:

Atom in a PDB structure

Instance Methods
 
__getitem__(self, item)
Returns: the property value
 
__init__(self, name, position, **properties)
 
__repr__(self)
 
__setitem__(self, item, value)
 
__str__(self)
str
type(self)
Returns: the six-letter record type, ATOM or HETATM
 
writeToFile(self, file)
Write an atom record to a file
Method Details

__getitem__(self, item)
(Indexing operator)

 
Parameters:
  • item (str) - the name of a property, including "name" or "position"
Returns:
the property value

__init__(self, name, position, **properties)
(Constructor)

 
Parameters:
  • name (str) - the atom name
  • position (Scientific.Geometry.Vector) - the atom position
  • properties - any other atom properties as keyword parameters. These properties are stored in the atom object and can be accessed by indexing, as for dictionaries.

__setitem__(self, item, value)
(Index assignment operator)

 
Parameters:
  • item (str) - the name of an existing or to be defined property
  • value - the new value for the property

type(self)

 
Returns: str
the six-letter record type, ATOM or HETATM

writeToFile(self, file)

 

Write an atom record to a file

Parameters:
  • file (PDBFile or str) - a PDB file object or a filename

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.Chain-class.html0000644000076600000240000004725511501734225026044 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.Chain
Package Scientific :: Package IO :: Module PDB :: Class Chain
[frames] | no frames]

Class Chain

Known Subclasses:

Chain of PDB residues

This is an abstract base class. Instances can be created using one of the subclasses (PeptideChain, NucleotideChain).

Chain objects respond to len() and return their residues by indexing with integers.

Instance Methods
AminoAcidResidue or NucleotideResidue
__getitem__(self, index)
Returns: the residue corresponding to the index
PeptideChain or NucleotideChain
__getslice__(self, i1, i2)
Returns: the subchain from i1 to i2
 
__init__(self, residues=None, chain_id=None, segment_id=None)
int
__len__(self)
Returns: the number of residues in the chain
 
addResidue(self, residue)
Add a residue at the end of the chain
 
deleteHydrogens(self)
Remove all hydrogen atoms in the chain
 
removeResidues(self, first, last)
Remove residues in a given index range.
list of str
sequence(self)
Returns: the list of residue names
 
writeToFile(self, file)
Write the chain to a file
Method Details

__getitem__(self, index)
(Indexing operator)

 
Parameters:
  • index (int) - an index into the chain
Returns: AminoAcidResidue or NucleotideResidue
the residue corresponding to the index
Raises:
  • IndexError - if index exceeds the chain length

__getslice__(self, i1, i2)
(Slicling operator)

 
Parameters:
  • i1 (int) - in index into the chain
  • i2 - in index into the chain @type i12 int
Returns: PeptideChain or NucleotideChain
the subchain from i1 to i2

__init__(self, residues=None, chain_id=None, segment_id=None)
(Constructor)

 
Parameters:
  • residues (list or NoneType) - a list of residue objects, or None meaning that the chain is initially empty
  • chain_id (str or NoneType) - a one-letter chain identifier or None
  • segment_id (str or NoneType) - a multi-character segment identifier or None

__len__(self)
(Length operator)

 
Returns: int
the number of residues in the chain

addResidue(self, residue)

 

Add a residue at the end of the chain

Parameters:

removeResidues(self, first, last)

 

Remove residues in a given index range.

Parameters:
  • first (int) - the index of the first residue to be removed
  • last (int or NoneType) - the index of the first residue to be kept, or None meaning remove everything to the end of the chain.

sequence(self)

 
Returns: list of str
the list of residue names

writeToFile(self, file)

 

Write the chain to a file

Parameters:
  • file (PDBFile or str) - a PDBFile object or a file name

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.Group-class.html0000644000076600000240000004300111501734225026077 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.Group
Package Scientific :: Package IO :: Module PDB :: Class Group
[frames] | no frames]

Class Group

Known Subclasses:

Atom group (residue or molecule) in a PDB file

This is an abstract base class. Instances can be created using one of the subclasses (Molecule, AminoAcidResidue, NucleotideResidue).

Group objects permit iteration over atoms with for-loops, as well as extraction of atoms by indexing with the atom name.

Instance Methods
 
__getitem__(self, item)
 
__init__(self, name, atoms=None, number=None)
 
__len__(self)
 
__repr__(self)
 
__str__(self)
 
addAtom(self, atom)
Add an atom to the group
 
changeName(self, name)
Set the PDB residue name
 
deleteAtom(self, atom)
Remove an atom from the group
 
deleteHydrogens(self)
Remove all hydrogen atoms of the group
 
isCompatible(self, residue_data)
 
writeToFile(self, file)
Write the group to a file
Method Details

__getitem__(self, item)
(Indexing operator)

 
Parameters:
  • item (int or str) - an integer index or an atom name

__init__(self, name, atoms=None, number=None)
(Constructor)

 
Parameters:
  • name (str) - the name of the group
  • atoms (list or NoneType) - a list of atoms (or None for no atoms)
  • number (int or NoneType) - the PDB residue number (or None)

addAtom(self, atom)

 

Add an atom to the group

Parameters:
  • atom (Atom) - the atom

changeName(self, name)

 

Set the PDB residue name

Parameters:
  • name (str) - the new name

deleteAtom(self, atom)

 

Remove an atom from the group

Parameters:
  • atom (Atom) - the atom to be removed
Raises:
  • KeyError - if the atom is not part of the group

writeToFile(self, file)

 

Write the group to a file

Parameters:
  • file (PDBFile or str) - a PDBFile object or a file name

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.HetAtom-class.html0000644000076600000240000001615011501734225026351 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.HetAtom
Package Scientific :: Package IO :: Module PDB :: Class HetAtom
[frames] | no frames]

Class HetAtom

Atom --+
       |
      HetAtom

HetAtom in a PDB structure

A subclass of Atom, which differs only in the return value of the method type().

Instance Methods
str
type(self)
Returns: the six-letter record type, ATOM or HETATM

Inherited from Atom: __getitem__, __init__, __repr__, __setitem__, __str__, writeToFile

Method Details

type(self)

 
Returns: str
the six-letter record type, ATOM or HETATM
Overrides: Atom.type
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.Molecule-class.html0000644000076600000240000001375111501734225026561 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.Molecule
Package Scientific :: Package IO :: Module PDB :: Class Molecule
[frames] | no frames]

Class Molecule

Group --+
        |
       Molecule

Molecule in a PDB file

Note: In PDB files, non-chain molecules are treated as residues, there is no separate molecule definition. This module defines every residue as a molecule that is not an amino acid residue or a nucleotide residue.

Instance Methods

Inherited from Group: __getitem__, __init__, __len__, __repr__, __str__, addAtom, changeName, deleteAtom, deleteHydrogens, isCompatible, writeToFile

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.NucleotideChain-class.html0000644000076600000240000002021611501734225030044 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.NucleotideChain
Package Scientific :: Package IO :: Module PDB :: Class NucleotideChain
[frames] | no frames]

Class NucleotideChain

Chain --+
        |
       NucleotideChain

Nucleotide chain in a PDB file

Instance Methods
 
isCompatible(self, chain_data, residue_data)
bool
isTerminated(self)
Returns: True if the last residue is in 3-terminal configuration

Inherited from Chain: __getitem__, __getslice__, __init__, __len__, addResidue, deleteHydrogens, removeResidues, sequence, writeToFile

Method Details

isTerminated(self)

 
Returns: bool
True if the last residue is in 3-terminal configuration

Note: There is no way to perform this test with standard PDB files. The algorithm used works for certain non-standard files only.


ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.NucleotideResidue-class.html0000644000076600000240000004401111501734225030421 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.NucleotideResidue
Package Scientific :: Package IO :: Module PDB :: Class NucleotideResidue
[frames] | no frames]

Class NucleotideResidue

Group --+    
        |    
  Residue --+
            |
           NucleotideResidue

Nucleotide residue in a PDB file

Instance Methods
 
__init__(self, name, atoms=None, number=None)
 
addAtom(self, atom)
Add an atom to the group
bool
hasDesoxyribose(self)
Returns: True if the residue has no atom named O2*
bool
hasPhosphate(self)
Returns: True if the residue has a phosphate group
bool
hasRibose(self)
Returns: True if the residue has an atom named O2*
bool
hasTerminalH(self)
Returns: True if the residue has a 3-terminal H atom
 
isCompatible(self, residue_data)
 
writeToFile(self, file)
Write the group to a file

Inherited from Group: __getitem__, __len__, __repr__, __str__, changeName, deleteAtom, deleteHydrogens

Class Variables
  is_nucleotide = 1
Method Details

__init__(self, name, atoms=None, number=None)
(Constructor)

 
Parameters:
  • name - the name of the group
  • atoms - a list of atoms (or None for no atoms)
  • number - the PDB residue number (or None)
Overrides: Group.__init__
(inherited documentation)

addAtom(self, atom)

 

Add an atom to the group

Parameters:
  • atom - the atom
Overrides: Group.addAtom
(inherited documentation)

hasDesoxyribose(self)

 
Returns: bool
True if the residue has no atom named O2*

hasPhosphate(self)

 
Returns: bool
True if the residue has a phosphate group

hasRibose(self)

 
Returns: bool
True if the residue has an atom named O2*

hasTerminalH(self)

 
Returns: bool
True if the residue has a 3-terminal H atom

isCompatible(self, residue_data)

 
Overrides: Group.isCompatible

writeToFile(self, file)

 

Write the group to a file

Parameters:
  • file - a PDBFile object or a file name
Overrides: Group.writeToFile
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.PDBFile-class.html0000644000076600000240000005561411501734225026225 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.PDBFile
Package Scientific :: Package IO :: Module PDB :: Class PDBFile
[frames] | no frames]

Class PDBFile

PDB file with access at the record level

The low-level file access is handled by the module Scientific.IO.TextFile, therefore compressed files and URLs (for reading) can be used as well.

Instance Methods
 
__del__(self)
 
__init__(self, file_or_filename, mode='r', subformat=None)
 
close(self)
Close the file.
 
nextChain(self, chain_id=None, segment_id='')
Signal the beginning of a new chain.
 
nextResidue(self, name, number=None, terminus=None)
Signal the beginning of a new residue, starting with the next call to writeAtom.
tuple
readLine(self)
Return the contents of the next non-blank line (= record) The return value is a tuple whose first element (a string) contains the record type.
 
terminateChain(self)
Signal the end of a chain.
 
writeAtom(self, name, position, occupancy=0.0, temperature_factor=0.0, element='')
Write an ATOM or HETATM record using the information supplied.
 
writeComment(self, text)
Write text into one or several comment lines.
 
writeLine(self, type, data)
Write a line using record type and data dictionary in the same format as returned by readLine().
Method Details

__init__(self, file_or_filename, mode='r', subformat=None)
(Constructor)

 
Parameters:
  • file_or_filename (str or file) - the name of the PDB file, or a file object
  • mode (str) - the file access mode, 'r' (read) or 'w' (write)
  • subformat (str or NoneType) - indicates a specific dialect of the PDB format. Subformats are defined in Scientific.IO.PDBExportFilters; they are used only when writing.

close(self)

 

Close the file. This method must be called for write mode because otherwise the file will be incomplete.

nextChain(self, chain_id=None, segment_id='')

 

Signal the beginning of a new chain.

Parameters:
  • chain_id (str or NoneType) - a chain identifier. If None, consecutive letters from the alphabet are used.
  • segment_id (str) - a chain identifier

nextResidue(self, name, number=None, terminus=None)

 

Signal the beginning of a new residue, starting with the next call to writeAtom.

Parameters:
  • name (str) - the residue name
  • number (int or NoneType) - the residue number. If None, the residues will be numbered sequentially, starting from 1.
  • terminus - None, "C", or "N". This information is passed to export filters that can use this information in order to use different atom or residue names in terminal residues.

readLine(self)

 

Return the contents of the next non-blank line (= record) The return value is a tuple whose first element (a string) contains the record type. For supported record types (HEADER, CRYST1, SCALEn, MTRIXn, ATOM, HETATM, ANISOU, TERM, MODEL, CONECT), the items from the remaining fields are put into a dictionary which is returned as the second tuple element. Most dictionary elements are strings or numbers; atom positions are returned as a vector, and anisotropic temperature factors are returned as a rank-2 tensor, already multiplied by 1.e-4. White space is stripped from all strings except for atom names, whose correct interpretation can depend on an initial space. For unsupported record types, the second tuple element is a string containing the remaining part of the record.

Returns: tuple
the contents of one PDB record

writeAtom(self, name, position, occupancy=0.0, temperature_factor=0.0, element='')

 

Write an ATOM or HETATM record using the information supplied. The residue and chain information is taken from the last calls to the methods nextResidue and nextChain.

Parameters:
  • name (str) - the atom name
  • position (Scientific.Geometry.Vector) - the atom position
  • occupancy (float) - the occupancy
  • temperature_factor (float) - the temperature factor (B-factor)
  • element (str) - the chemical element

writeComment(self, text)

 

Write text into one or several comment lines. Each line of the text is prefixed with 'REMARK' and written to the file.

Parameters:
  • text (str) - the comment contents

writeLine(self, type, data)

 

Write a line using record type and data dictionary in the same format as returned by readLine(). Default values are provided for non-essential information, so the data dictionary need not contain all entries.

Parameters:
  • type (str) - PDB record type
  • data (tuple) - PDB record data

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.PeptideChain-class.html0000644000076600000240000001764711501734225027361 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.PeptideChain
Package Scientific :: Package IO :: Module PDB :: Class PeptideChain
[frames] | no frames]

Class PeptideChain

Chain --+
        |
       PeptideChain

Peptide chain in a PDB file

Instance Methods
 
isCompatible(self, chain_data, residue_data)
bool
isTerminated(self)
Returns: True if the last residue is in C-terminal configuration

Inherited from Chain: __getitem__, __getslice__, __init__, __len__, addResidue, deleteHydrogens, removeResidues, sequence, writeToFile

Method Details

isTerminated(self)

 
Returns: bool
True if the last residue is in C-terminal configuration

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.Residue-class.html0000644000076600000240000001373511501734225026416 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.Residue
Package Scientific :: Package IO :: Module PDB :: Class Residue
[frames] | no frames]

Class Residue

Group --+
        |
       Residue
Known Subclasses:

Instance Methods

Inherited from Group: __getitem__, __init__, __len__, __repr__, __str__, addAtom, changeName, deleteAtom, deleteHydrogens, isCompatible, writeToFile

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.ResidueNumber-class.html0000644000076600000240000002036411501734225027563 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.ResidueNumber
Package Scientific :: Package IO :: Module PDB :: Class ResidueNumber
[frames] | no frames]

Class ResidueNumber

PDB residue number

Most PDB residue numbers are simple integers, but when insertion codes are used a number can consist of an integer plus a letter. Such compound residue numbers are represented by this class.

Instance Methods
 
__cmp__(self, other)
 
__init__(self, number, insertion_code)
 
__repr__(self)
 
__str__(self)
Method Details

__init__(self, number, insertion_code)
(Constructor)

 
Parameters:
  • number (int) - the numeric part of the residue number
  • insertion_code (str) - the letter part of the residue number

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDB.Structure-class.html0000644000076600000240000006420011501734226027010 0ustar hinsenstaff00000000000000 Scientific.IO.PDB.Structure
Package Scientific :: Package IO :: Module PDB :: Class Structure
[frames] | no frames]

Class Structure

A high-level representation of the contents of a PDB file

The components of a structure can be accessed in several ways ('s' is an instance of this class):

  • 's.residues' is a list of all PDB residues, in the order in which they occurred in the file.
  • 's.peptide_chains' is a list of PeptideChain objects, containing all peptide chains in the file in their original order.
  • 's.nucleotide_chains' is a list of NucleotideChain objects, containing all nucleotide chains in the file in their original order.
  • 's.molecules' is a list of all PDB residues that are neither amino acid residues nor nucleotide residues, in their original order.
  • 's.objects' is a list of all high-level objects (peptide chains, nucleotide chains, and molecules) in their original order.
  • 's.to_fractional' is the transformation from real-space coordinates to fractional coordinates, as read from the SCALEn records.
  • 's.from_fractional' is the transformation from fractional coordinates to real-space coordinates, the inverse of s.to_fractional.
  • 's.ncs_transformations' is a list of transformations that describe non-crystallographic symmetries, as read from the MTRIXn records.
  • if a CRYST1 record exists, 's.a', 's.b', 's.c', 's.alpha', 's.beta', 's.gamma' are the parameters of the unit cell and 's.space_group' is a string indicating the space group. If no CRYST1 record exists, all those values are None. Furthermore, 's.cs_transformations' is a list of transformations that describe crystallographic symmetries. If no CRYST1 record exists, the list is empty.

An iteration over a Structure instance by a for-loop is equivalent to an iteration over the residue list.

Nested Classes
  molecule_constructor
Molecule in a PDB file
  nucleotide_chain_constructor
Nucleotide chain in a PDB file
  peptide_chain_constructor
Peptide chain in a PDB file
Instance Methods
 
__getitem__(self, item)
 
__init__(self, file_or_filename, model=0, alternate_code='A')
 
__len__(self)
 
__repr__(self)
 
addMolecule(self, molecule)
 
deleteHydrogens(self)
Remove all hydrogen atoms
 
deleteResidue(self, residue)
 
extractData(self, data)
 
findSpaceGroupTransformations(self)
 
joinNucleotideChains(self, first, second)
Join two nucleotide chains into a single one.
 
joinPeptideChains(self, first, second)
Join two peptide chains into a single one.
 
newChain(self, residue, chain_data)
 
newResidue(self, residue_data)
 
parseFile(self, file)
 
renumberAtoms(self)
Renumber all atoms sequentially starting with 1
 
splitNucleotideChain(self, number, position)
Split a nucleotide chain into two chains
 
splitPeptideChain(self, number, position)
Split a peptide chain into two chains
 
writeToFile(self, file)
Write everything to a file
Method Details

__init__(self, file_or_filename, model=0, alternate_code='A')
(Constructor)

 
Parameters:
  • file_or_filename (str or file) - the name of the PDB file, or a file object. Compressed files and URLs are accepted, as for class PDBFile.
  • model (int) - the number of the model to read from a multiple-model file. Only one model can be treated at a time.
  • alternate_code (single-letter str) - the version of the positions to be read from a file with alternate positions.

joinNucleotideChains(self, first, second)

 

Join two nucleotide chains into a single one. The new chain occupies the position of the first chain, the second one is removed from the nucleotide chain list.

Parameters:
  • first (int) - the number of the first chain
  • second (int) - the number of the second chain

joinPeptideChains(self, first, second)

 

Join two peptide chains into a single one. The new chain occupies the position of the first chain, the second one is removed from the peptide chain list.

Parameters:
  • first (int) - the number of the first chain
  • second (int) - the number of the second chain

splitNucleotideChain(self, number, position)

 

Split a nucleotide chain into two chains

The two chain fragments remain adjacent in the nucleotide chain list, i.e. the numbers of all following chains increase by one.

Parameters:
  • number (int) - the number of the nucleotide chain to be split
  • position (int) - the residue index at which the chain is split.

splitPeptideChain(self, number, position)

 

Split a peptide chain into two chains

The two chain fragments remain adjacent in the peptide chain list, i.e. the numbers of all following chains increase by one.

Parameters:
  • number (int) - the number of the peptide chain to be split
  • position (int) - the residue index at which the chain is split.

writeToFile(self, file)

 

Write everything to a file

Parameters:
  • file (PDBFile or str) - a PDB file object or a filename

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDBSpaceGroups-module.html0000644000076600000240000001615111501734225027346 0ustar hinsenstaff00000000000000 Scientific.IO.PDBSpaceGroups
Package Scientific :: Package IO :: Module PDBSpaceGroups
[frames] | no frames]

Module PDBSpaceGroups

Classes
  SpaceGroup
Functions
 
getSpaceGroupTransformations(space_group_label_or_number)
Variables
  sg = <Scientific.IO.PDBSpaceGroups.SpaceGroup object at 0x22ad...
Variables Details

sg

Value:
<Scientific.IO.PDBSpaceGroups.SpaceGroup object at 0x22ad550>

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.PDBSpaceGroups.SpaceGroup-class.html0000644000076600000240000001706311501734226031241 0ustar hinsenstaff00000000000000 Scientific.IO.PDBSpaceGroups.SpaceGroup
Package Scientific :: Package IO :: Module PDBSpaceGroups :: Class SpaceGroup
[frames] | no frames]

Class SpaceGroup

object --+
         |
        SpaceGroup

Instance Methods
 
__init__(self, number, labels, transformations)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, number, labels, transformations)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.IO.TextFile-module.html0000644000076600000240000001127511501734225026313 0ustar hinsenstaff00000000000000 Scientific.IO.TextFile
Package Scientific :: Package IO :: Module TextFile
[frames] | no frames]

Module TextFile

Text files with line iteration and transparent compression

Classes
  TextFile
Text files with line iteration and transparent compression
ScientificPython-2.9.4/Doc/Reference/Scientific.IO.TextFile.TextFile-class.html0000644000076600000240000003041511501734225027653 0ustar hinsenstaff00000000000000 Scientific.IO.TextFile.TextFile
Package Scientific :: Package IO :: Module TextFile :: Class TextFile
[frames] | no frames]

Class TextFile

Text files with line iteration and transparent compression

TextFile instances can be used like normal file objects (i.e. by calling read(), readline(), readlines(), and write()), but can also be used as sequences of lines in for-loops.

TextFile objects also handle compression transparently. i.e. it is possible to read lines from a compressed text file as if it were not compressed. Compression is deduced from the file name suffixes '.Z' (compress/uncompress), '.gz' (gzip/gunzip), and '.bz2' (bzip2).

Finally, TextFile objects accept file names that start with '~' or '~user' to indicate a home directory, as well as URLs (for reading only).

Instance Methods
 
__del__(self)
 
__getitem__(self, item)
 
__init__(self, filename, mode='r')
 
close(self)
 
flush(self)
 
read(self, size=-1)
 
readline(self)
 
readlines(self)
 
write(self, data)
 
writelines(self, list)
Method Details

__init__(self, filename, mode='r')
(Constructor)

 
Parameters:
  • filename (str) - file name or URL
  • mode (str) - file access mode: 'r' (read), 'w' (write), or 'a' (append)

ScientificPython-2.9.4/Doc/Reference/Scientific.IterationCountExceededError-class.html0000644000076600000240000001442011501734225031504 0ustar hinsenstaff00000000000000 Scientific.IterationCountExceededError
Package Scientific :: Class IterationCountExceededError
[frames] | no frames]

Class IterationCountExceededError

              object --+                
                       |                
exceptions.BaseException --+            
                           |            
        exceptions.Exception --+        
                               |        
        exceptions.StandardError --+    
                                   |    
               exceptions.ValueError --+
                                       |
                                      IterationCountExceededError

Instance Methods

Inherited from exceptions.ValueError: __init__, __new__

Inherited from exceptions.BaseException: __delattr__, __getattribute__, __getitem__, __reduce__, __repr__, __setattr__, __setstate__, __str__

Inherited from object: __hash__, __reduce_ex__

Properties

Inherited from exceptions.BaseException: args, message

Inherited from object: __class__

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI-module.html0000644000076600000240000002752311501734225024711 0ustar hinsenstaff00000000000000 Scientific.MPI
Package Scientific :: Package MPI
[frames] | no frames]

Package MPI

Python interface to the Message Passing Interface (MPI)

This module contains a Python interface to the Message Passing Interface (MPI), and standardized library for message-passing parallel computing. Please read an introduction to MPI before using this module; some terms in the documentation do not make much sense unless you understand the principles of MPI.

This module contains an object, 'world', which represents the default communicator in MPI. This communicator can be used directly for sending and receiving data, or other communicators can be derived from it.

A number of global constants are also defined (max, min, prod, sum, land, lor, lxor, band, bor, bxor, maxloc), and minloc). They are used to specify the desired operator in calls to the 'reduce' and 'allreduce' methods of the communicator objects.

Submodules

Classes
  MPICommunicator
MPI Communicator
  MPIOperationObject
  MPIRequest
MPI Request
  band
The 'bitwise and' operation in reduce/allreduce communications.
  bor
The 'bitwise or' operation in reduce/allreduce communications.
  bxor
The 'bitwise exclusive-or' operation.
  land
The 'logical and' operation in reduce/allreduce communications.
  lor
The 'logical or' operation in reduce/allreduce communications.
  lxor
The 'logical exclusive-or' operation.
  max
The 'maximum' operation in reduce/allreduce communications.
  maxloc
The 'location of the maximum' operation.
  min
The 'minimum' operation in reduce/allreduce communications.
  minloc
The 'location of the minimum' operation.
  prod
The 'product' operation in reduce/allreduce communications.
  replace
The 'replace' operation.
  sum
The 'sum' operation in reduce/allreduce communications.
Variables
  world = <Scientific.MPI.MPICommunicator instance at 0x25786e8>
ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.band-class.html0000644000076600000240000001031711501734225025425 0ustar hinsenstaff00000000000000 Scientific.MPI.band
Package Scientific :: Package MPI :: Class band
[frames] | no frames]

Class band

MPIOperationObject --+
                     |
                    band

The 'bitwise and' operation in reduce/allreduce communications.

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.bor-class.html0000644000076600000240000001031111501734225025275 0ustar hinsenstaff00000000000000 Scientific.MPI.bor
Package Scientific :: Package MPI :: Class bor
[frames] | no frames]

Class bor

MPIOperationObject --+
                     |
                    bor

The 'bitwise or' operation in reduce/allreduce communications.

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.bxor-class.html0000644000076600000240000001026511501734225025475 0ustar hinsenstaff00000000000000 Scientific.MPI.bxor
Package Scientific :: Package MPI :: Class bxor
[frames] | no frames]

Class bxor

MPIOperationObject --+
                     |
                    bxor

The 'bitwise exclusive-or' operation.

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.IO-module.html0000644000076600000240000001117711501734225025215 0ustar hinsenstaff00000000000000 Scientific.MPI.IO
Package Scientific :: Package MPI :: Module IO
[frames] | no frames]

Module IO

I/O utilities for use with MPI programs

Classes
  LogFile
File for logging events from all processes
ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.IO.LogFile-class.html0000644000076600000240000002350011501734226026347 0ustar hinsenstaff00000000000000 Scientific.MPI.IO.LogFile
Package Scientific :: Package MPI :: Module IO :: Class LogFile
[frames] | no frames]

Class LogFile

File for logging events from all processes

The purpose of LogFile objects is to collect short text output from all processors into a single file. All processes can write whatever they want at any time; the date is simply stored locally. After the file has been closed by all processes, the data is sent to process 0, which then writes everything to one text file, neatly separated by process rank number.

Note that due to the intermediate storage of the data, LogFile objects should not be used for large amounts of data. Also note that all data is lost if a process crashes before closing the file.

Instance Methods
 
__init__(self, filename, communicator=None)
 
close(self)
Close the file, causing the real text file to be written
 
flush(self)
Write buffered data to the text file
 
write(self, string)
Write a string to the file
Method Details

__init__(self, filename, communicator=None)
(Constructor)

 
Parameters:
  • filename (str) - the name of the log file
  • communicator (Scientific.MPI.MPICommunicator) - the communicator in which the file is accessible. The default value of None means to use the global world communicator, i.e. all possible processes.

write(self, string)

 

Write a string to the file

Parameters:
  • string (str) - the string data

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.land-class.html0000644000076600000240000001031711501734226025440 0ustar hinsenstaff00000000000000 Scientific.MPI.land
Package Scientific :: Package MPI :: Class land
[frames] | no frames]

Class land

MPIOperationObject --+
                     |
                    land

The 'logical and' operation in reduce/allreduce communications.

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.lor-class.html0000644000076600000240000001031111501734225025307 0ustar hinsenstaff00000000000000 Scientific.MPI.lor
Package Scientific :: Package MPI :: Class lor
[frames] | no frames]

Class lor

MPIOperationObject --+
                     |
                    lor

The 'logical or' operation in reduce/allreduce communications.

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.lxor-class.html0000644000076600000240000001026511501734225025507 0ustar hinsenstaff00000000000000 Scientific.MPI.lxor
Package Scientific :: Package MPI :: Class lxor
[frames] | no frames]

Class lxor

MPIOperationObject --+
                     |
                    lxor

The 'logical exclusive-or' operation.

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.max-class.html0000644000076600000240000001030611501734225025304 0ustar hinsenstaff00000000000000 Scientific.MPI.max
Package Scientific :: Package MPI :: Class max
[frames] | no frames]

Class max

MPIOperationObject --+
                     |
                    max

The 'maximum' operation in reduce/allreduce communications.

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.maxloc-class.html0000644000076600000240000001030211501734225025776 0ustar hinsenstaff00000000000000 Scientific.MPI.maxloc
Package Scientific :: Package MPI :: Class maxloc
[frames] | no frames]

Class maxloc

MPIOperationObject --+
                     |
                    maxloc

The 'location of the maximum' operation.

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.min-class.html0000644000076600000240000001030611501734226025303 0ustar hinsenstaff00000000000000 Scientific.MPI.min
Package Scientific :: Package MPI :: Class min
[frames] | no frames]

Class min

MPIOperationObject --+
                     |
                    min

The 'minimum' operation in reduce/allreduce communications.

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.minloc-class.html0000644000076600000240000001030211501734226025775 0ustar hinsenstaff00000000000000 Scientific.MPI.minloc
Package Scientific :: Package MPI :: Class minloc
[frames] | no frames]

Class minloc

MPIOperationObject --+
                     |
                    minloc

The 'location of the minimum' operation.

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.MPICommunicator-class.html0000644000076600000240000010572611501734226027541 0ustar hinsenstaff00000000000000 Scientific.MPI.MPICommunicator
Package Scientific :: Package MPI :: Class MPICommunicator
[frames] | no frames]

Class MPICommunicator

MPI Communicator

There is no constructor for MPI Communicator objects. The default communicator is given by Scientific.MPI.world, and other communicators can only be created by methods on an existing communicator object.

A communicator object has two read-only attributes: 'rank' is an integer which indicates the rank of the current process in the communicator, and 'size' is an integer equal to the number of processes that participate in the communicator.

Instance Methods
 
abort(self, error_code)
Abort all processes associated with the communicator.
 
allreduce(self, sendbuffer, receivebuffer, operation)
Combine data from all processes and send result to all
 
barrier(self)
Wait until all processes in the communicator have called the same method, then all processes continue.
 
broadcast(self, array, root)
Send data to all processes
MPICommunicator
duplicate(self)
Returns: a new communicator with the same properties as the original one
NoneType or tuple
nonblockingProbe(self, source=None, tag=None)
Check for incoming messages
MPIRequest
nonblockingReceive(self, data, source=None, tag=None)
Receive data from another process (non-blocking)
MPIRequest
nonblockingSend(self, data, destination, tag)
Send data to another process (non-blocking)
tuple
receive(self, data, source=None, tag=None)
Receive data from another process (blocking)
tuple
receiveString(self, source=None, tag=None)
Receive string data from another process (blocking)
 
reduce(self, sendbuffer, receivebuffer, operation, root)
Combine data from all processes and send result to one
 
send(self, data, destination, tag)
Send data to another process (blocking)
 
share(self, send, receive)
Distribute data from each processpr to all other processesors
 
subset(self, ranks)
Create a communicator for a subset of the processes
Method Details

abort(self, error_code)

 

Abort all processes associated with the communicator. For emergency use only.

Parameters:
  • error_code (int) - error code passed back to the calling program (usually a shell) under most Unix implementations of MPI

allreduce(self, sendbuffer, receivebuffer, operation)

 

Combine data from all processes and send result to all

Parameters:
  • sendbuffer (Numeric.array) - an array holding the data that each process contributes
  • receivebuffer (Numeric.array) - an array acting as a buffer for the result of the reduction
  • operation (MPIOperationObject) - one of the operation objects: max, min, prod, sum, land, lor, lxor, band, bor, bxor, maxloc and minloc

broadcast(self, array, root)

 

Send data to all processes

Parameters:
  • array (Numeric.array) - an array containing the data to be sent on the sending process and serving as a buffer for the incoming data on all processes. The shape and type of the array must be the same on all processes.
  • root (int) - the rank of the sending process

Note: The data is sent to all processes, including the sending one.

duplicate(self)

 
Returns: MPICommunicator
a new communicator with the same properties as the original one

nonblockingProbe(self, source=None, tag=None)

 

Check for incoming messages

Parameters:
  • source (int or NoneType) - the rank of the process from which messages are accepted. None means data is accepted from any process.
  • tag (int or NoneType) - Identifier that acts as a filter; only messages with a matching tag are considered. A value of None means that any tag will match.
Returns: NoneType or tuple
None if no messages are available, otherwise a tuple containing the source rank and the tag

nonblockingReceive(self, data, source=None, tag=None)

 

Receive data from another process (non-blocking)

Parameters:
  • data (Numeric.array) - a contiguous array object to which the incoming data is copied. It must have the right shape.
  • source (int or NoneType) - the rank of the process from which data is accepted. None means data is accepted from any process.
  • tag (int or NoneType) - Identifier that acts as a filter; only messages with a matching tag are received. A value of None means that any tag will match.
Returns: MPIRequest
MPI request object (used to wait for completion and obtain the received data)

nonblockingSend(self, data, destination, tag)

 

Send data to another process (non-blocking)

Parameters:
  • data (str or Numeric.array. Array arguments must have contiguous storage. General object arrays are not allowed.) - the data to be sent
  • destination (int) - the rank of the destination process
  • tag (int) - Identifier
Returns: MPIRequest
MPI request object (used to wait for completion)

receive(self, data, source=None, tag=None)

 

Receive data from another process (blocking)

Parameters:
  • data (Numeric.array or str) - either a contiguous array object, or a one-letter typecode (in practice, one would use Numeric.Int, Numeric.Float, etc.). If an array, the data is copied to the array, whic must have the right shape. If a typecode, an array of that type is created and used as the buffer for incoming data.
  • source (int or NoneType) - the rank of the process from which data is accepted. None means data is accepted from any process.
  • tag (int or NoneType) - Identifier that acts as a filter; only messages with a matching tag are received. A value of None means that any tag will match.
Returns: tuple
a tuple containing four elements: the array containing the data, the source process rank (an int), the message tag (an int), and the number of elements that were received (an int).

receiveString(self, source=None, tag=None)

 

Receive string data from another process (blocking)

Parameters:
  • source (int or NoneType) - the rank of the process from which data is accepted. None means data is accepted from any process.
  • tag (int or NoneType) - Identifier that acts as a filter; only messages with a matching tag are received. A value of None means that any tag will match.
Returns: tuple
a tuple containing three elements: the string containing the data, the source process rank (an int), the message tag (an int).

reduce(self, sendbuffer, receivebuffer, operation, root)

 

Combine data from all processes and send result to one

Parameters:
  • sendbuffer (Numeric.array) - an array holding the data that each process contributes
  • receivebuffer (Numeric.array) - an array acting as a buffer for the result of the reduction. Used only by the process whose rank is root
  • operation (MPIOperationObject) - one of the operation objects: max, min, prod, sum, land, lor, lxor, band, bor, bxor, maxloc and minloc
  • root (int) - the rank of the process that received the result

send(self, data, destination, tag)

 

Send data to another process (blocking)

Parameters:
  • data (str or Numeric.array. Array arguments must have contiguous storage. General object arrays are not allowed.) - the data to be sent
  • destination (int) - the rank of the destination process
  • tag (int) - Identifier

share(self, send, receive)

 

Distribute data from each processpr to all other processesors

Parameters:
  • send (Numeric.array) - an array of identical shape and type on all processes. It contains on each process the data that is sent.
  • receive (Numeric.array) - an array whose type is the same as for the send array and which has an additional dimension (the first one) whose length is the number of processes. After the call, the value of receive[i] is equal to the contents of the array send in process i.

subset(self, ranks)

 

Create a communicator for a subset of the processes

The method should be called by all processes simultaneously. The return value will be the new communicator on those processes listed in ranks and None for the rest.

Parameters:
  • ranks (list of int) - a list of ranks, one for each process that should belong to the new communicator
Returns:
a new communicator containing a subset of the processes participating in the original one

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.MPIOperationObject-class.html0000644000076600000240000001154211501734226030160 0ustar hinsenstaff00000000000000 Scientific.MPI.MPIOperationObject
Package Scientific :: Package MPI :: Class MPIOperationObject
[frames] | no frames]

Class MPIOperationObject

Known Subclasses:

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.MPIRequest-class.html0000644000076600000240000002007711501734226026524 0ustar hinsenstaff00000000000000 Scientific.MPI.MPIRequest
Package Scientific :: Package MPI :: Class MPIRequest
[frames] | no frames]

Class MPIRequest

MPI Request

There is no constructor for MPI Request objects. They are returned by nonblocking send and receives, and are used to query the status of the message.

Instance Methods
 
test(self)
Test if communications have completed.
 
wait(self)
Wait till the communication has completed.
Method Details

test(self)

 

Test if communications have completed.

If the operation was a nonblocking send, it returns 0 if the operation has not completed, and 1 if it has.

If the operation was a nonblocking receive, 0 is returned if the operation was not completed, and a tuple containing four elements if it was completed. The four elements are: the array containing the data, the source process rank (an integer), the message tag (an integer), and the number of elements that were received (an integer).

Once a test has been successful (i.e. the operation has completed), it is no longer possible to call wait() or test() on the MPI Request object.

wait(self)

 

Wait till the communication has completed.

If the operation was a nonblocking send, there is no return value. If the operation was a nonblocking receive, the return value is a tuple containing four elements: the array containing the data, the source process rank (an integer), the message tag (an integer), and the number of elements that were received (an integer).


ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.prod-class.html0000644000076600000240000001031311501734225025461 0ustar hinsenstaff00000000000000 Scientific.MPI.prod
Package Scientific :: Package MPI :: Class prod
[frames] | no frames]

Class prod

MPIOperationObject --+
                     |
                    prod

The 'product' operation in reduce/allreduce communications.

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.replace-class.html0000644000076600000240000001030111501734225026125 0ustar hinsenstaff00000000000000 Scientific.MPI.replace
Package Scientific :: Package MPI :: Class replace
[frames] | no frames]

Class replace

MPIOperationObject --+
                     |
                    replace

The 'replace' operation. (MPI 2.0)

ScientificPython-2.9.4/Doc/Reference/Scientific.MPI.sum-class.html0000644000076600000240000001030211501734225025317 0ustar hinsenstaff00000000000000 Scientific.MPI.sum
Package Scientific :: Package MPI :: Class sum
[frames] | no frames]

Class sum

MPIOperationObject --+
                     |
                    sum

The 'sum' operation in reduce/allreduce communications.

ScientificPython-2.9.4/Doc/Reference/Scientific.NRNG-module.html0000644000076600000240000001536711501734226025034 0ustar hinsenstaff00000000000000 Scientific.NRNG
Package Scientific :: Module NRNG
[frames] | no frames]

Module NRNG

Variables
  default_distribution = <numpy.oldnumeric.rng.UniformDistributi...
  package = 'NumPy'
  standard_generator = <numpy.oldnumeric.rng.CreateGenerator obj...
Variables Details

default_distribution

Value:
<numpy.oldnumeric.rng.UniformDistribution object at 0x2228fb0>

standard_generator

Value:
<numpy.oldnumeric.rng.CreateGenerator object at 0x2231050>

ScientificPython-2.9.4/Doc/Reference/Scientific.NumberDict-module.html0000644000076600000240000001112111501734225026303 0ustar hinsenstaff00000000000000 Scientific.NumberDict
Package Scientific :: Module NumberDict
[frames] | no frames]

Module NumberDict

Dictionary storing numerical values

Classes
  NumberDict
Dictionary storing numerical values
ScientificPython-2.9.4/Doc/Reference/Scientific.NumberDict.NumberDict-class.html0000644000076600000240000002747211501734225030176 0ustar hinsenstaff00000000000000 Scientific.NumberDict.NumberDict
Package Scientific :: Module NumberDict :: Class NumberDict
[frames] | no frames]

Class NumberDict

object --+    
         |    
      dict --+
             |
            NumberDict

Dictionary storing numerical values

Constructor: NumberDict()

An instance of this class acts like an array of number with generalized (non-integer) indices. A value of zero is assumed for undefined entries. NumberDict instances support addition, and subtraction with other NumberDict instances, and multiplication and division by scalars.

Instance Methods
 
__add__(self, other)
 
__coerce__(self, other)
 
__div__(self, other)
 
__getitem__(self, item)
x[y]
 
__mul__(self, other)
 
__rmul__(self, other)
 
__sub__(self, other)

Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __gt__, __hash__, __init__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, clear, copy, fromkeys, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__getitem__(self, item)
(Indexing operator)

 

x[y]

Overrides: dict.__getitem__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Physics-module.html0000644000076600000240000001135611501734225025703 0ustar hinsenstaff00000000000000 Scientific.Physics
Package Scientific :: Package Physics
[frames] | no frames]

Package Physics

Submodules

ScientificPython-2.9.4/Doc/Reference/Scientific.Physics.PhysicalQuantities-module.html0000644000076600000240000004651511501734225031532 0ustar hinsenstaff00000000000000 Scientific.Physics.PhysicalQuantities
Package Scientific :: Package Physics :: Module PhysicalQuantities
[frames] | no frames]

Module PhysicalQuantities

Physical quantities with units.

This module provides a data type that represents a physical quantity together with its unit. It is possible to add and subtract these quantities if the units are compatible, and a quantity can be converted to another compatible unit. Multiplication, subtraction, and raising to integer powers is allowed without restriction, and the result will have the correct unit. A quantity can be raised to a non-integer power only if the result can be represented by integer powers of the base units.

The values of physical constants are taken from the 1986 recommended values from CODATA. Other conversion factors (e.g. for British units) come from various sources. I can't guarantee for the correctness of all entries in the unit table, so use this at your own risk.

SI derived units; these automatically get prefixes: Y (1E+24), Z (1E+21), E (1E+18), P (1E+15), T (1E+12), G (1E+09), M (1E+06), k (1E+03), h (1E+02), da (1E+01), d (1E-01), c (1E-02), m (1E-03), mu (1E-06), n (1E-09), p (1E-12), f (1E-15), a (1E-18), z (1E-21), y (1E-24)

Hz Hertz 1/s N Newton m*kg/s**2 Pa Pascal N/m**2 J Joule N*m W Watt J/s C Coulomb s*A V Volt W/A F Farad C/V ohm Ohm V/A S Siemens A/V Wb Weber V*s T Tesla Wb/m**2 H Henry Wb/A lm Lumen cd*sr lx Lux lm/m**2 Bq Becquerel 1/s Gy Gray J/kg Sv Sievert J/kg

Prefixed units for ohm:

Yohm, Zohm, Eohm, Pohm, Tohm, Gohm, Mohm, kohm, hohm, daohm, dohm, cohm, mohm, muohm, nohm, pohm, fohm, aohm, zohm, yohm

Prefixed units for rad:

Yrad, Zrad, Erad, Prad, Trad, Grad, Mrad, krad, hrad, darad, drad, crad, mrad, murad, nrad, prad, frad, arad, zrad, yrad

Prefixed units for mol:

Ymol, Zmol, Emol, Pmol, Tmol, Gmol, Mmol, kmol, hmol, damol, dmol, cmol, mmol, mumol, nmol, pmol, fmol, amol, zmol, ymol

Prefixed units for cd:

Ycd, Zcd, Ecd, Pcd, Tcd, Gcd, Mcd, kcd, hcd, dacd, dcd, ccd, mcd, mucd, ncd, pcd, fcd, acd, zcd, ycd

Prefixed units for Pa:

YPa, ZPa, EPa, PPa, TPa, GPa, MPa, kPa, hPa, daPa, dPa, cPa, mPa, muPa, nPa, pPa, fPa, aPa, zPa, yPa

Prefixed units for Hz:

YHz, ZHz, EHz, PHz, THz, GHz, MHz, kHz, hHz, daHz, dHz, cHz, mHz, muHz, nHz, pHz, fHz, aHz, zHz, yHz

Prefixed units for Wb:

YWb, ZWb, EWb, PWb, TWb, GWb, MWb, kWb, hWb, daWb, dWb, cWb, mWb, muWb, nWb, pWb, fWb, aWb, zWb, yWb

Prefixed units for lm:

Ylm, Zlm, Elm, Plm, Tlm, Glm, Mlm, klm, hlm, dalm, dlm, clm, mlm, mulm, nlm, plm, flm, alm, zlm, ylm

Prefixed units for Bq:

YBq, ZBq, EBq, PBq, TBq, GBq, MBq, kBq, hBq, daBq, dBq, cBq, mBq, muBq, nBq, pBq, fBq, aBq, zBq, yBq

Prefixed units for lx:

Ylx, Zlx, Elx, Plx, Tlx, Glx, Mlx, klx, hlx, dalx, dlx, clx, mlx, mulx, nlx, plx, flx, alx, zlx, ylx

Prefixed units for A:

YA, ZA, EA, PA, TA, GA, MA, kA, hA, daA, dA, cA, mA, muA, nA, pA, fA, aA, zA, yA

Prefixed units for C:

YC, ZC, EC, PC, TC, GC, MC, kC, hC, daC, dC, cC, mC, muC, nC, pC, fC, aC, zC, yC

Prefixed units for F:

YF, ZF, EF, PF, TF, GF, MF, kF, hF, daF, dF, cF, mF, muF, nF, pF, fF, aF, zF, yF

Prefixed units for H:

YH, ZH, EH, PH, TH, GH, MH, kH, hH, daH, dH, cH, mH, muH, nH, pH, fH, aH, zH, yH

Prefixed units for K:

YK, ZK, EK, PK, TK, GK, MK, kK, hK, daK, dK, cK, mK, muK, nK, pK, fK, aK, zK, yK

Prefixed units for J:

YJ, ZJ, EJ, PJ, TJ, GJ, MJ, kJ, hJ, daJ, dJ, cJ, mJ, muJ, nJ, pJ, fJ, aJ, zJ, yJ

Prefixed units for Sv:

YSv, ZSv, ESv, PSv, TSv, GSv, MSv, kSv, hSv, daSv, dSv, cSv, mSv, muSv, nSv, pSv, fSv, aSv, zSv, ySv

Prefixed units for N:

YN, ZN, EN, PN, TN, GN, MN, kN, hN, daN, dN, cN, mN, muN, nN, pN, fN, aN, zN, yN

Prefixed units for S:

YS, ZS, ES, PS, TS, GS, MS, kS, hS, daS, dS, cS, mS, muS, nS, pS, fS, aS, zS, yS

Prefixed units for T:

YT, ZT, ET, PT, TT, GT, MT, kT, hT, daT, dT, cT, mT, muT, nT, pT, fT, aT, zT, yT

Prefixed units for W:

YW, ZW, EW, PW, TW, GW, MW, kW, hW, daW, dW, cW, mW, muW, nW, pW, fW, aW, zW, yW

Prefixed units for V:

YV, ZV, EV, PV, TV, GV, MV, kV, hV, daV, dV, cV, mV, muV, nV, pV, fV, aV, zV, yV

Prefixed units for g:

Yg, Zg, Eg, Pg, Tg, Gg, Mg, kg, hg, dag, dg, cg, mg, mug, ng, pg, fg, ag, zg, yg

Prefixed units for sr:

Ysr, Zsr, Esr, Psr, Tsr, Gsr, Msr, ksr, hsr, dasr, dsr, csr, msr, musr, nsr, psr, fsr, asr, zsr, ysr

Prefixed units for m:

Ym, Zm, Em, Pm, Tm, Gm, Mm, km, hm, dam, dm, cm, mm, mum, nm, pm, fm, am, zm, ym

Prefixed units for Gy:

YGy, ZGy, EGy, PGy, TGy, GGy, MGy, kGy, hGy, daGy, dGy, cGy, mGy, muGy, nGy, pGy, fGy, aGy, zGy, yGy

Prefixed units for s:

Ys, Zs, Es, Ps, Ts, Gs, Ms, ks, hs, das, ds, cs, ms, mus, ns, ps, fs, as, zs, ys

Fundamental constants: c speed of light 299792458.*m/s mu0 permeability of vacuum 4.e-7*pi*N/A**2 eps0 permittivity of vacuum 1/mu0/c**2 Grav gravitational constant 6.67259e-11*m**3/kg/s**2 hplanck Planck constant 6.6260755e-34*J*s hbar Planck constant / 2pi hplanck/(2*pi) e elementary charge 1.60217733e-19*C me electron mass 9.1093897e-31*kg mp proton mass 1.6726231e-27*kg Nav Avogadro number 6.0221367e23/mol k Boltzmann constant 1.380658e-23*J/K

Time units: min minute 60*s h hour 60*min d day 24*h wk week 7*d yr year 365.25*d

Length units: inch inch 2.54*cm ft foot 12*inch yd yard 3*ft mi (British) mile 5280.*ft nmi Nautical mile 1852.*m Ang Angstrom 1.e-10*m lyr light year c*yr Bohr Bohr radius 4*pi*eps0*hbar**2/me/e**2

Area units: ha hectare 10000*m**2 acres acre mi**2/640 b barn 1.e-28*m

Volume units: l liter dm**3 dl deci liter 0.1*l cl centi liter 0.01*l ml milli liter 0.001*l tsp teaspoon 4.92892159375*ml tbsp tablespoon 3*tsp floz fluid ounce 2*tbsp cup cup 8*floz pt pint 16*floz qt quart 2*pt galUS US gallon 4*qt galUK British gallon 4.54609*l

Mass units: amu atomic mass units 1.6605402e-27*kg oz ounce 28.349523125*g lb pound 16*oz ton ton 2000*lb

Force units: dyn dyne (cgs unit) 1.e-5*N

Energy units: erg erg (cgs unit) 1.e-7*J eV electron volt e*V Hartree Wavenumbers/inverse cm me*e**4/16/pi**2/eps0**2/hbar**2 Ken Kelvin as energy unit k*K cal thermochemical calorie 4.184*J kcal thermochemical kilocalorie 1000*cal cali international calorie 4.1868*J kcali international kilocalorie 1000*cali Btu British thermal unit 1055.05585262*J

Prefixed units for eV:

YeV, ZeV, EeV, PeV, TeV, GeV, MeV, keV, heV, daeV, deV, ceV, meV, mueV, neV, peV, feV, aeV, zeV, yeV

Power units: hp horsepower 745.7*W

Pressure units: bar bar (cgs unit) 1.e5*Pa atm standard atmosphere 101325.*Pa torr torr = mm of mercury atm/760 psi pounds per square inch 6894.75729317*Pa

Angle units: deg degrees pi*rad/180

Temperature units: degR degrees Rankine (5./9.)*K degC degrees Celcius <PhysicalUnit degC> degF degree Fahrenheit <PhysicalUnit degF>

Classes
  PhysicalQuantity
Physical quantity with units
  PhysicalUnit
Physical unit
Functions
 
description()
Return a string describing all available units.
bool
isPhysicalQuantity(x)
Returns: True if x is a PhysicalQuantity
bool
isPhysicalUnit(x)
Returns: True if x is a PhysicalUnit
Variables
  prefix = 'y'
  unit = 's'
  value = 1e-24
Function Details

isPhysicalQuantity(x)

 
Parameters:
  • x (any) - an object
Returns: bool
True if x is a PhysicalQuantity

isPhysicalUnit(x)

 
Parameters:
  • x (any) - an object
Returns: bool
True if x is a PhysicalUnit

././@LongLink0000000000000000000000000000014700000000000011217 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.Physics.PhysicalQuantities.PhysicalQuantity-class.ht0000644000076600000240000007551611501734225034336 0ustar hinsenstaff00000000000000 Scientific.Physics.PhysicalQuantities.PhysicalQuantity
Package Scientific :: Package Physics :: Module PhysicalQuantities :: Class PhysicalQuantity
[frames] | no frames]

Class PhysicalQuantity

Physical quantity with units

PhysicalQuantity instances allow addition, subtraction, multiplication, and division with each other as well as multiplication, division, and exponentiation with numbers. Addition and subtraction check that the units of the two operands are compatible and return the result in the units of the first operand. A limited set of mathematical functions (from module Numeric) is applicable as well:

  • sqrt: equivalent to exponentiation with 0.5.
  • sin, cos, tan: applicable only to objects whose unit is compatible with 'rad'.

See the documentation of the PhysicalQuantities module for a list of the available units.

Here is an example on usage:

>>> from PhysicalQuantities import PhysicalQuantity as p  # short hand
>>> distance1 = p('10 m')
>>> distance2 = p('10 km')
>>> total = distance1 + distance2
>>> total
PhysicalQuantity(10010.0,'m')
>>> total.convertToUnit('km')
>>> total.getValue()
10.01
>>> total.getUnitName()
'km'
>>> total = total.inBaseUnits()
>>> total
PhysicalQuantity(10010.0,'m')
>>> 
>>> t = p(314159., 's')
>>> # convert to days, hours, minutes, and second:
>>> t2 = t.inUnitsOf('d','h','min','s')
>>> t2_print = ' '.join([str(i) for i in t2])
>>> t2_print
'3.0 d 15.0 h 15.0 min 59.0 s'
>>> 
>>> e = p('2.7 Hartree*Nav')
>>> e.convertToUnit('kcal/mol')
>>> e
PhysicalQuantity(1694.2757596034764,'kcal/mol')
>>> e = e.inBaseUnits()
>>> str(e)
'7088849.77818 kg*m**2/s**2/mol'
>>> 
>>> freeze = p('0 degC')
>>> freeze = freeze.inUnitsOf ('degF')
>>> str(freeze)
'32.0 degF'
>>>
Instance Methods
 
__abs__(self)
 
__add__(self, other)
 
__cmp__(self, other)
 
__div__(self, other)
 
__init__(self, *args)
There are two constructor calling patterns:
 
__mul__(self, other)
 
__neg__(self)
 
__nonzero__(self)
 
__pos__(self)
 
__pow__(self, other)
 
__radd__(self, other)
 
__rdiv__(self, other)
 
__repr__(self)
 
__rmul__(self, other)
 
__rpow__(self, other)
 
__rsub__(self, other)
 
__str__(self)
 
__sub__(self, other)
 
convertToUnit(self, unit)
Change the unit and adjust the value such that the combination is equivalent to the original one.
 
cos(self)
 
getUnitName(self)
Return unit (string) of physical quantity.
 
getValue(self)
Return value (float) of physical quantity (no unit).
PhysicalQuantity
inBaseUnits(self)
Returns: the same quantity converted to base units, i.e.
PhysicalQuantity or tuple of PhysicalQuantity
inUnitsOf(self, *units)
Express the quantity in different units.
bool
isCompatible(self, unit)
Returns: True if the specified unit is compatible with the one of the quantity
 
sin(self)
 
sqrt(self)
 
tan(self)
Method Details

__init__(self, *args)
(Constructor)

 

There are two constructor calling patterns:

  1. PhysicalQuantity(value, unit), where value is any number and unit is a string defining the unit
  2. PhysicalQuantity(value_with_unit), where value_with_unit is a string that contains both the value and the unit, i.e. '1.5 m/s'. This form is provided for more convenient interactive use.
Parameters:
  • args ((number, str) or (str,)) - either (value, unit) or (value_with_unit,)

convertToUnit(self, unit)

 

Change the unit and adjust the value such that the combination is equivalent to the original one. The new unit must be compatible with the previous unit of the object.

Parameters:
  • unit (str) - a unit
Raises:
  • TypeError - if the unit string is not a know unit or a unit incompatible with the current one

inBaseUnits(self)

 
Returns: PhysicalQuantity
the same quantity converted to base units, i.e. SI units in most cases

inUnitsOf(self, *units)

 

Express the quantity in different units. If one unit is specified, a new PhysicalQuantity object is returned that expresses the quantity in that unit. If several units are specified, the return value is a tuple of PhysicalObject instances with with one element per unit such that the sum of all quantities in the tuple equals the the original quantity and all the values except for the last one are integers. This is used to convert to irregular unit systems like hour/minute/second.

Parameters:
  • units (str or sequence of str) - one or several units
Returns: PhysicalQuantity or tuple of PhysicalQuantity
one or more physical quantities
Raises:
  • TypeError - if any of the specified units are not compatible with the original unit

isCompatible(self, unit)

 
Parameters:
  • unit (str) - a unit
Returns: bool
True if the specified unit is compatible with the one of the quantity

ScientificPython-2.9.4/Doc/Reference/Scientific.Physics.PhysicalQuantities.PhysicalUnit-class.html0000644000076600000240000004677311501734226033774 0ustar hinsenstaff00000000000000 Scientific.Physics.PhysicalQuantities.PhysicalUnit
Package Scientific :: Package Physics :: Module PhysicalQuantities :: Class PhysicalUnit
[frames] | no frames]

Class PhysicalUnit

Physical unit

A physical unit is defined by a name (possibly composite), a scaling factor, and the exponentials of each of the SI base units that enter into it. Units can be multiplied, divided, and raised to integer powers.

Instance Methods
 
__cmp__(self, other)
 
__div__(self, other)
 
__init__(self, names, factor, powers, offset=0)
 
__mul__(self, other)
 
__pow__(self, other)
 
__rdiv__(self, other)
 
__repr__(self)
 
__rmul__(self, other)
 
__str__(self)
float
conversionFactorTo(self, other)
Returns: the conversion factor from this unit to another unit
(float, float)
conversionTupleTo(self, other)
Returns: the conversion factor and offset from this unit to another unit
 
isAngle(self)
bool
isCompatible(self, other)
Returns: True if the units are compatible, i.e.
 
isDimensionless(self)
 
name(self)
 
setName(self, name)
Method Details

__init__(self, names, factor, powers, offset=0)
(Constructor)

 
Parameters:
  • names (dict or str) - a dictionary mapping each name component to its associated integer power (e.g. {'m': 1, 's': -1}) for m/s). As a shorthand, a string may be passed which is assigned an implicit power 1.
  • factor (float) - a scaling factor
  • powers (list of int) - the integer powers for each of the nine base units
  • offset (float) - an additive offset to the base unit (used only for temperatures)

conversionFactorTo(self, other)

 
Parameters:
Returns: float
the conversion factor from this unit to another unit
Raises:
  • TypeError - if the units are not compatible

conversionTupleTo(self, other)

 
Parameters:
Returns: (float, float)
the conversion factor and offset from this unit to another unit
Raises:
  • TypeError - if the units are not compatible

isCompatible(self, other)

 
Parameters:
Returns: bool
True if the units are compatible, i.e. if the powers of the base units are the same

ScientificPython-2.9.4/Doc/Reference/Scientific.Physics.Potential-module.html0000644000076600000240000002263511501734226027644 0ustar hinsenstaff00000000000000 Scientific.Physics.Potential
Package Scientific :: Package Physics :: Module Potential
[frames] | no frames]

Module Potential

Potential energy functions with automatic gradient evaluation

This module offers two strategies for automagically calculating the gradients (and optionally force constants) of a potential energy function (or any other function of vectors, for that matter). The more convenient strategy is to create an object of the class PotentialWithGradients. It takes a regular Python function object defining the potential energy and is itself a callable object returning the energy and its gradients with respect to all arguments that are vectors.

Example:

 >>>def _harmonic(k,r1,r2):
 >>>    dr = r2-r1
 >>>    return k*dr*dr
 >>>harmonic = PotentialWithGradients(_harmonic)
 >>>energy, gradients = harmonic(1., Vector(0,3,1), Vector(1,2,0))
 >>>print energy, gradients

prints:

 >>>3.0
 >>>[Vector(-2.0,2.0,2.0), Vector(2.0,-2.0,-2.0)]

The disadvantage of this procedure is that if one of the arguments is a vector parameter, rather than a position, an unnecessary gradient will be calculated. A more flexible method is to insert calls to two function from this module into the definition of the energy function. The first, DerivVectors(), is called to indicate which vectors correspond to gradients, and the second, EnergyGradients(), extracts energy and gradients from the result of the calculation. The above example is therefore equivalent to:

 >>>def harmonic(k, r1, r2):
 >>>    r1, r2 = DerivVectors(r1, r2)
 >>>    dr = r2-r1
 >>>    e = k*dr*dr
 >>>    return EnergyGradients(e,2)

To include the force constant matrix, the above example has to be modified as follows:

 >>>def _harmonic(k,r1,r2):
 >>>    dr = r2-r1
 >>>    return k*dr*dr
 >>>harmonic = PotentialWithGradientsAndForceConstants(_harmonic)
 >>>energy, gradients, force_constants = harmonic(1.,Vector(0,3,1),Vector(1,2,0))
 >>>print energy
 >>>print gradients
 >>>print force_constants

The force constants are returned as a nested list representing a matrix. This can easily be converted to an array for further processing if the numerical extensions to Python are available.

Classes
  PotentialWithGradients
  PotentialWithGradientsAndForceConstants
Functions
 
DerivVectors(*args)
 
EnergyGradients(e, n)
 
EnergyGradientsForceConstants(e, n)
ScientificPython-2.9.4/Doc/Reference/Scientific.Physics.Potential.PotentialWithGradients-class.html0000644000076600000240000001321511501734225034110 0ustar hinsenstaff00000000000000 Scientific.Physics.Potential.PotentialWithGradients
Package Scientific :: Package Physics :: Module Potential :: Class PotentialWithGradients
[frames] | no frames]

Class PotentialWithGradients

Instance Methods
 
__call__(self, *args)
 
__init__(self, func)
././@LongLink0000000000000000000000000000016500000000000011217 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.Physics.Potential.PotentialWithGradientsAndForceConstants-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.Physics.Potential.PotentialWithGradientsAndForceCons0000644000076600000240000001332111501734226034266 0ustar hinsenstaff00000000000000 Scientific.Physics.Potential.PotentialWithGradientsAndForceConstants
Package Scientific :: Package Physics :: Module Potential :: Class PotentialWithGradientsAndForceConstants
[frames] | no frames]

Class PotentialWithGradientsAndForceConstants

Instance Methods
 
__call__(self, *args)
 
__init__(self, func)
ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets-module.html0000644000076600000240000001136111501734226026171 0ustar hinsenstaff00000000000000 Scientific.QtWidgets
Package Scientific :: Package QtWidgets
[frames] | no frames]

Package QtWidgets

Submodules

ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtPlotCanvas-module.html0000644000076600000240000004212511501734226030551 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtPlotCanvas
Package Scientific :: Package QtWidgets :: Module QtPlotCanvas
[frames] | no frames]

Module QtPlotCanvas

Plot widget for Qt user interfaces

A plot widget acts like a canvas for special graphics objects that represent curves shown by lines or markers.

Note that this module is not meant to replace a full-featured plot program. It was designed to permit the simple integration of plots into Qt-based user interfaces.

Classes
  HorizontalLine
A horizontal line
  PlotCanvas
Qt plot widget
  PlotGraphics
Compound graphics object
  PolyLine
Multiple connected lines
  PolyMarker
Series of markers
  PolyPoints
  VerticalLine
A vertical line
Variables
  IO_AbortError = 6
  IO_Append = 4
  IO_Async = 128
  IO_Combined = 768
  IO_ConnectError = 5
  IO_Direct = 256
  IO_FatalError = 3
  IO_ModeMask = 255
  IO_Ok = 0
  IO_Open = 4096
  IO_OpenError = 5
  IO_Raw = 64
  IO_ReadError = 1
  IO_ReadOnly = 1
  IO_ReadWrite = 3
  IO_ResourceError = 4
  IO_Sequential = 512
  IO_StateMask = 61440
  IO_TimeOutError = 7
  IO_Translate = 16
  IO_Truncate = 8
  IO_TypeMask = 3840
  IO_UnspecifiedError = 8
  IO_WriteError = 2
  IO_WriteOnly = 2
  PYQT_VERSION = 200964
  PYQT_VERSION_STR = '3.17.4'
  QCOORD_MAX = 2147483647
  QCOORD_MIN = -2147483648
  QT_VERSION = 197384
  QT_VERSION_STR = '3.3.8b'
  QtDebugMsg = 0
  QtFatalMsg = 2
  QtWarningMsg = 1
  colors_by_name = True
  qApp = <qt.QApplication object at 0x285a420>
ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtPlotCanvas.HorizontalLine-class.html0000644000076600000240000002473411501734225033336 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtPlotCanvas.HorizontalLine
Package Scientific :: Package QtWidgets :: Module QtPlotCanvas :: Class HorizontalLine
[frames] | no frames]

Class HorizontalLine

PolyPoints --+    
             |    
      PolyLine --+
                 |
                HorizontalLine

A horizontal line

Instance Methods
 
__init__(self, ypos, **attr)
 
draw(self, canvas, bbox)
 
writeToFile(self, file, separator)

Inherited from PolyPoints: boundingBox, scaleAndShift

Method Details

__init__(self, ypos, **attr)
(Constructor)

 
Parameters:
  • ypos (float) - the y coordinate of the line
  • attr - line attributes
  • width - the line width (default: 1)
  • color - a string whose value is one of the color names defined by X-Windows (default: "black")
  • style - a Qt pen style object (default: Qt.SolidLine)
Overrides: PolyPoints.__init__

draw(self, canvas, bbox)

 
Overrides: PolyLine.draw

writeToFile(self, file, separator)

 
Overrides: PolyPoints.writeToFile

ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtPlotCanvas.PlotCanvas-class.html0000644000076600000240000015212211501734225032440 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtPlotCanvas.PlotCanvas
Package Scientific :: Package QtWidgets :: Module QtPlotCanvas :: Class PlotCanvas
[frames] | no frames]

Class PlotCanvas

 object --+                
          |                
sip.wrapper --+            
              |            
          qt.Qt --+        
                  |        
         qt.QObject --+    
                      |    
     object --+       |    
              |       |    
    sip.wrapper --+   |    
                  |   |    
    qt.QPaintDevice --+    
                      |    
             qt.QWidget --+
                          |
                         PlotCanvas

Qt plot widget

PlotCanvas objects support all operations of Qt widgets.

Nested Classes

Inherited from qt.QWidget: BackgroundOrigin, FocusPolicy

Inherited from qt.Qt: AlignmentFlags, AnchorAttribute, ArrowType, BGMode, BackgroundMode, BrushStyle, ButtonState, Corner, CursorShape, DateFormat, Dock, GUIStyle, ImageConversionFlags, Key, MacintoshVersion, Modifier, Orientation, PenCapStyle, PenJoinStyle, PenStyle, RasterOp, SequenceMatch, SortOrder, StringComparisonMode, TextFlags, TextFormat, TimeSpec, UIEffect, WidgetFlags, WidgetState, WindowState, WindowsVersion

Inherited from qt.QPaintDevice: PDevCmd

Instance Methods
 
__init__(self, parent=None, background='white', font=None, zoom=False, select=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
clear(self)
Clear the canvas
 
draw(self, graphics, xaxis=None, yaxis=None)
Draw something on the canvas
 
mouseMoveEvent(self, event)
 
mousePressEvent(self, event)
 
mouseReleaseEvent(self, event)
 
paintEvent(self, event)
 
redraw(self)
Redraw the most recent canvas contents
 
resizeEvent(self, event)
 
select(self, range)
Highlight a range on the x-axis

Inherited from qt.QWidget: acceptDrops, adjustSize, autoMask, backgroundBrush, backgroundMode, backgroundOffset, backgroundOrigin, baseSize, caption, childAt, childEvent, childrenRect, childrenRegion, clearFocus, clearMask, clearWFlags, clearWState, clipRegion, close, closeEvent, colorGroup, constPolish, contextMenuEvent, create, cursor, customEvent, customWhatsThis, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, drawText, dropEvent, enabledChange, enterEvent, erase, eraseColor, erasePixmap, event, find, focusInEvent, focusNextPrevChild, focusOutEvent, focusPolicy, focusProxy, focusWidget, font, fontChange, fontInfo, fontMetrics, foregroundColor, frameGeometry, frameSize, geometry, getWFlags, getWState, grabKeyboard, grabMouse, hasFocus, hasMouse, hasMouseTracking, height, heightForWidth, hide, hideEvent, icon, iconText, imComposeEvent, imEndEvent, imStartEvent, isActiveWindow, isDesktop, isDialog, isEnabled, isEnabledTo, isEnabledToTLW, isFocusEnabled, isFullScreen, isHidden, isInputMethodEnabled, isMaximized, isMinimized, isModal, isPopup, isShown, isTopLevel, isUpdatesEnabled, isVisible, isVisibleTo, isVisibleToTLW, keyPressEvent, keyReleaseEvent, keyboardGrabber, layout, leaveEvent, lowerW, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, maximumHeight, maximumSize, maximumWidth, metaObject, metric, microFocusHint, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, move, moveEvent, ownCursor, ownFont, ownPalette, palette, paletteBackgroundColor, paletteBackgroundPixmap, paletteChange, paletteForegroundColor, parentWidget, polish, pos, raiseW, rect, releaseKeyboard, releaseMouse, repaint, reparent, resetInputContext, resize, scroll, setAcceptDrops, setActiveWindow, setAutoMask, setBackgroundMode, setBackgroundOrigin, setBaseSize, setCaption, setCursor, setDisabled, setEnabled, setEraseColor, setErasePixmap, setFixedHeight, setFixedSize, setFixedWidth, setFocus, setFocusPolicy, setFocusProxy, setFont, setGeometry, setHidden, setIcon, setIconText, setInputMethodEnabled, setKeyCompression, setMask, setMaximumHeight, setMaximumSize, setMaximumWidth, setMicroFocusHint, setMinimumHeight, setMinimumSize, setMinimumWidth, setMouseTracking, setName, setPalette, setPaletteBackgroundColor, setPaletteBackgroundPixmap, setPaletteForegroundColor, setShown, setSizeIncrement, setSizePolicy, setStyle, setTabOrder, setUpdatesEnabled, setWFlags, setWState, setWindowOpacity, setWindowState, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, style, styleChange, tabletEvent, testWFlags, testWState, timerEvent, topLevelWidget, unsetCursor, unsetFont, unsetPalette, update, updateGeometry, updateMask, visibleRect, wheelEvent, width, winId, windowActivationChange, windowOpacity, windowState, x, y

Inherited from qt.QObject: blockSignals, child, children, className, connect, deleteLater, disconnect, dumpObjectInfo, dumpObjectTree, emit, eventFilter, highPriority, inherits, insertChild, installEventFilter, isA, isWidgetType, killTimer, killTimers, name, objectTrees, parent, property, queryList, removeChild, removeEventFilter, sender, setProperty, signalsBlocked, startTimer, tr, trUtf8

Inherited from qt.QPaintDevice: devType, isExtDev, paintingActive, resolution, setResolution

Inherited from sip.wrapper: __delattr__, __getattribute__, __new__, __setattr__

Inherited from object: __hash__, __reduce__, __reduce_ex__, __repr__, __str__

Class Variables

Inherited from qt.QWidget: AncestorOrigin, ClickFocus, NoFocus, ParentOrigin, StrongFocus, TabFocus, WheelFocus, WidgetOrigin, WindowOrigin

Inherited from qt.Qt: ALT, ASCII_ACCEL, AlignAuto, AlignBottom, AlignCenter, AlignHCenter, AlignHorizontal_Mask, AlignJustify, AlignLeft, AlignRight, AlignTop, AlignVCenter, AlignVertical_Mask, AlphaDither_Mask, AltButton, AnchorHref, AnchorName, AndNotROP, AndROP, ArrowCursor, Ascending, AutoColor, AutoDither, AutoText, AvoidDither, BDiagPattern, BeginsWith, BevelJoin, BitmapCursor, BlankCursor, BottomLeft, BottomRight, BreakAnywhere, BusyCursor, CTRL, CaseSensitive, ClearROP, ColorMode_Mask, ColorOnly, Contains, ControlButton, CopyROP, CrossCursor, CrossPattern, CustomPattern, DashDotDotLine, DashDotLine, DashLine, Dense1Pattern, Dense2Pattern, Dense3Pattern, Dense4Pattern, Dense5Pattern, Dense6Pattern, Dense7Pattern, Descending, DiagCrossPattern, DiffuseAlphaDither, DiffuseDither, DitherMode_Mask, Dither_Mask, DockBottom, DockLeft, DockMinimized, DockRight, DockTop, DockTornOff, DockUnmanaged, DontClip, DontPrint, DotLine, DownArrow, EndsWith, EraseROP, ExactMatch, ExpandTabs, FDiagPattern, FixedColor, FixedPixmap, FlatCap, ForbiddenCursor, HorPattern, Horizontal, ISODate, IbeamCursor, Identical, KeyButtonMask, Key_0, Key_1, Key_2, Key_3, Key_4, Key_5, Key_6, Key_7, Key_8, Key_9, Key_A, Key_AE, Key_Aacute, Key_Acircumflex, Key_Adiaeresis, Key_Agrave, Key_Alt, Key_Ampersand, Key_Any, Key_Apostrophe, Key_Aring, Key_AsciiCircum, Key_AsciiTilde, Key_Asterisk, Key_At, Key_Atilde, Key_B, Key_Back, Key_BackSpace, Key_BackTab, Key_Backslash, Key_Backspace, Key_Backtab, Key_Bar, Key_BassBoost, Key_BassDown, Key_BassUp, Key_BraceLeft, Key_BraceRight, Key_BracketLeft, Key_BracketRight, Key_C, Key_CapsLock, Key_Ccedilla, Key_Clear, Key_Colon, Key_Comma, Key_Control, Key_D, Key_Delete, Key_Direction_L, Key_Direction_R, Key_Dollar, Key_Down, Key_E, Key_ETH, Key_Eacute, Key_Ecircumflex, Key_Ediaeresis, Key_Egrave, Key_End, Key_Enter, Key_Equal, Key_Escape, Key_Exclam, Key_F, Key_F1, Key_F10, Key_F11, Key_F12, Key_F13, Key_F14, Key_F15, Key_F16, Key_F17, Key_F18, Key_F19, Key_F2, Key_F20, Key_F21, Key_F22, Key_F23, Key_F24, Key_F25, Key_F26, Key_F27, Key_F28, Key_F29, Key_F3, Key_F30, Key_F31, Key_F32, Key_F33, Key_F34, Key_F35, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_Favorites, Key_Forward, Key_G, Key_Greater, Key_H, Key_Help, Key_Home, Key_HomePage, Key_Hyper_L, Key_Hyper_R, Key_I, Key_Iacute, Key_Icircumflex, Key_Idiaeresis, Key_Igrave, Key_Insert, Key_J, Key_K, Key_L, Key_Launch0, Key_Launch1, Key_Launch2, Key_Launch3, Key_Launch4, Key_Launch5, Key_Launch6, Key_Launch7, Key_Launch8, Key_Launch9, Key_LaunchA, Key_LaunchB, Key_LaunchC, Key_LaunchD, Key_LaunchE, Key_LaunchF, Key_LaunchMail, Key_LaunchMedia, Key_Left, Key_Less, Key_M, Key_MediaLast, Key_MediaNext, Key_MediaPlay, Key_MediaPrev, Key_MediaRecord, Key_MediaStop, Key_Menu, Key_Meta, Key_Minus, Key_N, Key_Next, Key_Ntilde, Key_NumLock, Key_NumberSign, Key_O, Key_Oacute, Key_Ocircumflex, Key_Odiaeresis, Key_Ograve, Key_Ooblique, Key_OpenUrl, Key_Otilde, Key_P, Key_PageDown, Key_PageUp, Key_ParenLeft, Key_ParenRight, Key_Pause, Key_Percent, Key_Period, Key_Plus, Key_Print, Key_Prior, Key_Q, Key_Question, Key_QuoteDbl, Key_QuoteLeft, Key_R, Key_Refresh, Key_Return, Key_Right, Key_S, Key_ScrollLock, Key_Search, Key_Semicolon, Key_Shift, Key_Slash, Key_Space, Key_Standby, Key_Stop, Key_Super_L, Key_Super_R, Key_SysReq, Key_T, Key_THORN, Key_Tab, Key_TrebleDown, Key_TrebleUp, Key_U, Key_Uacute, Key_Ucircumflex, Key_Udiaeresis, Key_Ugrave, Key_Underscore, Key_Up, Key_V, Key_VolumeDown, Key_VolumeMute, Key_VolumeUp, Key_W, Key_X, Key_Y, Key_Yacute, Key_Z, Key_aacute, Key_acircumflex, Key_acute, Key_adiaeresis, Key_ae, Key_agrave, Key_aring, Key_atilde, Key_brokenbar, Key_ccedilla, Key_cedilla, Key_cent, Key_copyright, Key_currency, Key_degree, Key_diaeresis, Key_division, Key_eacute, Key_ecircumflex, Key_ediaeresis, Key_egrave, Key_eth, Key_exclamdown, Key_guillemotleft, Key_guillemotright, Key_hyphen, Key_iacute, Key_icircumflex, Key_idiaeresis, Key_igrave, Key_macron, Key_masculine, Key_mu, Key_multiply, Key_nobreakspace, Key_notsign, Key_ntilde, Key_oacute, Key_ocircumflex, Key_odiaeresis, Key_ograve, Key_onehalf, Key_onequarter, Key_onesuperior, Key_ordfeminine, Key_oslash, Key_otilde, Key_paragraph, Key_periodcentered, Key_plusminus, Key_questiondown, Key_registered, Key_section, Key_ssharp, Key_sterling, Key_thorn, Key_threequarters, Key_threesuperior, Key_twosuperior, Key_uacute, Key_ucircumflex, Key_udiaeresis, Key_ugrave, Key_unknown, Key_yacute, Key_ydiaeresis, Key_yen, Keypad, LastCursor, LastROP, LeftArrow, LeftButton, LocalDate, LocalTime, LogText, META, MODIFIER_MASK, MPenCapStyle, MPenJoinStyle, MPenStyle, MV_10_DOT_0, MV_10_DOT_1, MV_10_DOT_2, MV_10_DOT_3, MV_10_DOT_4, MV_9, MV_CHEETAH, MV_JAGUAR, MV_PANTHER, MV_PUMA, MV_TIGER, MV_Unknown, MetaButton, MidButton, MiterJoin, MonoOnly, MotifStyle, MouseButtonMask, NandROP, NoAccel, NoBackground, NoBrush, NoButton, NoMatch, NoPen, NopROP, NorROP, NotAndROP, NotCopyROP, NotEraseROP, NotOrROP, NotROP, NotXorROP, OpaqueMode, OrNotROP, OrROP, OrderedAlphaDither, OrderedDither, PaletteBackground, PaletteBase, PaletteBrightText, PaletteButton, PaletteButtonText, PaletteDark, PaletteForeground, PaletteHighlight, PaletteHighlightedText, PaletteLight, PaletteLink, PaletteLinkVisited, PaletteMid, PaletteMidlight, PaletteShadow, PaletteText, PartialMatch, PlainText, PointingHandCursor, PreferDither, RichText, RightArrow, RightButton, RoundCap, RoundJoin, SHIFT, SetROP, ShiftButton, ShowPrefix, SingleLine, SizeAllCursor, SizeBDiagCursor, SizeFDiagCursor, SizeHorCursor, SizeVerCursor, SolidLine, SolidPattern, SplitHCursor, SplitVCursor, SquareCap, TextDate, ThresholdAlphaDither, ThresholdDither, TopLeft, TopRight, TransparentMode, UI_AnimateCombo, UI_AnimateMenu, UI_AnimateToolBox, UI_AnimateTooltip, UI_FadeMenu, UI_FadeTooltip, UI_General, UNICODE_ACCEL, UTC, UpArrow, UpArrowCursor, VerPattern, Vertical, WDestructiveClose, WGroupLeader, WMouseNoMask, WNoAutoErase, WNoMousePropagation, WPaintClever, WPaintDesktop, WPaintUnclipped, WRepaintNoErase, WResizeNoErase, WShowModal, WState_Polished, WStaticContents, WStyle_ContextHelp, WStyle_Customize, WStyle_DialogBorder, WStyle_Mask, WStyle_Maximize, WStyle_MinMax, WStyle_Minimize, WStyle_NoBorder, WStyle_NormalBorder, WStyle_Reserved, WStyle_Splash, WStyle_StaysOnTop, WStyle_SysMenu, WStyle_Title, WStyle_Tool, WSubWindow, WType_Desktop, WType_Dialog, WType_Mask, WType_Popup, WType_TopLevel, WV_2000, WV_2003, WV_32s, WV_95, WV_98, WV_CE, WV_CENET, WV_CE_based, WV_DOS_based, WV_Me, WV_NT, WV_NT_based, WV_VISTA, WV_XP, WWinOwnDC, WX11BypassWM, WaitCursor, WhatsThisCursor, WindowActive, WindowFullScreen, WindowMaximized, WindowMinimized, WindowNoState, WindowsStyle, WordBreak, X11ParentRelative, XorROP, arrowCursor, black, blankCursor, blue, busyCursor, color0, color1, crossCursor, cyan, darkBlue, darkCyan, darkGray, darkGreen, darkMagenta, darkRed, darkYellow, forbiddenCursor, gray, green, ibeamCursor, lightGray, magenta, pointingHandCursor, red, sizeAllCursor, sizeBDiagCursor, sizeFDiagCursor, sizeHorCursor, sizeVerCursor, splitHCursor, splitVCursor, upArrowCursor, waitCursor, whatsThisCursor, white, yellow

Inherited from qt.QPaintDevice: PdcBegin, PdcDrawArc, PdcDrawChord, PdcDrawCubicBezier, PdcDrawEllipse, PdcDrawFirst, PdcDrawImage, PdcDrawLast, PdcDrawLine, PdcDrawLineSegments, PdcDrawPie, PdcDrawPixmap, PdcDrawPoint, PdcDrawPolygon, PdcDrawPolyline, PdcDrawRect, PdcDrawRoundRect, PdcDrawText, PdcDrawText2, PdcDrawText2Formatted, PdcDrawTextFormatted, PdcDrawTextItem, PdcEnd, PdcLineTo, PdcMoveTo, PdcNOP, PdcReservedStart, PdcReservedStop, PdcRestore, PdcRestoreWMatrix, PdcSave, PdcSaveWMatrix, PdcSetBkColor, PdcSetBkMode, PdcSetBrush, PdcSetBrushOrigin, PdcSetClip, PdcSetClipRegion, PdcSetFont, PdcSetPen, PdcSetROP, PdcSetTabArray, PdcSetTabStops, PdcSetUnit, PdcSetVXform, PdcSetViewport, PdcSetWMatrix, PdcSetWXform, PdcSetWindow, PdcSetdev

Properties

Inherited from object: __class__

Method Details

__init__(self, parent=None, background='white', font=None, zoom=False, select=None)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • parent - the parent widget
  • background (str) - the background color
  • font (QFont) - the font for axis labels, default: 10 point Helevetica
  • zoom (bool) - a flag that indicates whether interactive zooming (using the left mouse button) is enabled; the default is False (no zoom)
  • select - enables the user to select a range along the x axis by dragging the mouse (with the left button pressed) in the area under the x axis. If select is 0, no selection is possible. Otherwise the value of select must be a callable object that is called whenever the selection changes, with a single argument that can be None (no selection) or a tuple containing two x values.
Overrides: object.__init__

draw(self, graphics, xaxis=None, yaxis=None)

 

Draw something on the canvas

Parameters:
  • graphics - the graphics object (PolyLine, PolyMarker, or PlotGraphics) to be drawn
  • xaxis - None (no x-axis), "automatic" (automatic scaling), or a pair (x1, x2) defining the range of the x-axis
  • yaxis - None (no y-axis), "automatic" (automatic scaling), or a pair (y1, y2) defining the range of the y-axis

mouseMoveEvent(self, event)

 
Overrides: qt.QWidget.mouseMoveEvent

mousePressEvent(self, event)

 
Overrides: qt.QWidget.mousePressEvent

mouseReleaseEvent(self, event)

 
Overrides: qt.QWidget.mouseReleaseEvent

paintEvent(self, event)

 
Overrides: qt.QWidget.paintEvent

resizeEvent(self, event)

 
Overrides: qt.QWidget.resizeEvent

select(self, range)

 

Highlight a range on the x-axis

Parameters:
  • range - the range on the x-axis to be highlighted. It can be None (no selection) or a sequence of two values on the x-axis.

ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtPlotCanvas.PlotGraphics-class.html0000644000076600000240000001732111501734226032767 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtPlotCanvas.PlotGraphics
Package Scientific :: Package QtWidgets :: Module QtPlotCanvas :: Class PlotGraphics
[frames] | no frames]

Class PlotGraphics

Compound graphics object

Instance Methods
 
__getitem__(self, item)
 
__init__(self, objects)
 
__len__(self)
Method Details

__init__(self, objects)
(Constructor)

 
Parameters:

ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtPlotCanvas.PolyLine-class.html0000644000076600000240000001772611501734226032134 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtPlotCanvas.PolyLine
Package Scientific :: Package QtWidgets :: Module QtPlotCanvas :: Class PolyLine
[frames] | no frames]

Class PolyLine

PolyPoints --+
             |
            PolyLine
Known Subclasses:

Multiple connected lines

Instance Methods
 
__init__(self, points, **attr)

Inherited from PolyPoints: boundingBox, scaleAndShift, writeToFile

Method Details

__init__(self, points, **attr)
(Constructor)

 
Parameters:
  • points - any sequence of (x, y) number pairs
  • attr - line attributes
  • width - the line width (default: 1)
  • color - a string whose value is one of the color names defined by X-Windows (default: "black")
  • style - a Qt pen style object (default: Qt.SolidLine)
Overrides: PolyPoints.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtPlotCanvas.PolyMarker-class.html0000644000076600000240000002156111501734226032456 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtPlotCanvas.PolyMarker
Package Scientific :: Package QtWidgets :: Module QtPlotCanvas :: Class PolyMarker
[frames] | no frames]

Class PolyMarker

PolyPoints --+
             |
            PolyMarker

Series of markers

Instance Methods
 
__init__(self, points, **attr)
 
draw(self, painter, bbox)

Inherited from PolyPoints: boundingBox, scaleAndShift, writeToFile

Method Details

__init__(self, points, **attr)
(Constructor)

 
Parameters:
  • points - any sequence of (x, y) number pairs
  • attr - marker attributes
  • width - the line width for drawing the marker (default: 1)
  • color - a string whose value is one of the color names defined by X-Windows (default: "black")
  • fillcolor - a string whose value is one of the color names defined in X-Windows, defines the color of the interior of the marker (default: "black")
  • fillstyle - a Qt BrushStyle object (default: Qt.SolidPattern)
  • marker - one of 'circle' (default), 'dot', 'square', 'triangle', 'triangle_down', 'cross', 'plus'
Overrides: PolyPoints.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtPlotCanvas.PolyPoints-class.html0000644000076600000240000001635311501734226032514 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtPlotCanvas.PolyPoints
Package Scientific :: Package QtWidgets :: Module QtPlotCanvas :: Class PolyPoints
[frames] | no frames]

Class PolyPoints

Known Subclasses:

Instance Methods
 
__init__(self, points, attr)
 
boundingBox(self)
 
scaleAndShift(self, scale=1, shift=0)
 
writeToFile(self, file, separator)
ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtPlotCanvas.VerticalLine-class.html0000644000076600000240000002471211501734225032752 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtPlotCanvas.VerticalLine
Package Scientific :: Package QtWidgets :: Module QtPlotCanvas :: Class VerticalLine
[frames] | no frames]

Class VerticalLine

PolyPoints --+    
             |    
      PolyLine --+
                 |
                VerticalLine

A vertical line

Instance Methods
 
__init__(self, xpos, **attr)
 
draw(self, canvas, bbox)
 
writeToFile(self, file, separator)

Inherited from PolyPoints: boundingBox, scaleAndShift

Method Details

__init__(self, xpos, **attr)
(Constructor)

 
Parameters:
  • xpos (float) - the x coordinate of the line
  • attr - line attributes
  • width - the line width (default: 1)
  • color - a string whose value is one of the color names defined by X-Windows (default: "black")
  • style - a Qt pen style object (default: Qt.SolidLine)
Overrides: PolyPoints.__init__

draw(self, canvas, bbox)

 
Overrides: PolyLine.draw

writeToFile(self, file, separator)

 
Overrides: PolyPoints.writeToFile

ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtVisualizationCanvas-module.html0000644000076600000240000004021711501734226032474 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtVisualizationCanvas
Package Scientific :: Package QtWidgets :: Module QtVisualizationCanvas
[frames] | no frames]

Module QtVisualizationCanvas

3D wireframe canvas widget for Qt

This module provides a special widget for Qt user interfaces which permits the display of 3D wireframe structures with interactive manipulation.

Note that this widget can become sluggish if two many lines are to be displayed. An OpenGL widget should be used for serious visualization needs. The advantage of this module is that it requires no special graphics libraries in addition to Qt.

Classes
  PolyLine3D
Multiple connected lines
  VisualizationCanvas
Qt visualization widget
  VisualizationGraphics
Compound graphics object
Variables
  IO_AbortError = 6
  IO_Append = 4
  IO_Async = 128
  IO_Combined = 768
  IO_ConnectError = 5
  IO_Direct = 256
  IO_FatalError = 3
  IO_ModeMask = 255
  IO_Ok = 0
  IO_Open = 4096
  IO_OpenError = 5
  IO_Raw = 64
  IO_ReadError = 1
  IO_ReadOnly = 1
  IO_ReadWrite = 3
  IO_ResourceError = 4
  IO_Sequential = 512
  IO_StateMask = 61440
  IO_TimeOutError = 7
  IO_Translate = 16
  IO_Truncate = 8
  IO_TypeMask = 3840
  IO_UnspecifiedError = 8
  IO_WriteError = 2
  IO_WriteOnly = 2
  PYQT_VERSION = 200964
  PYQT_VERSION_STR = '3.17.4'
  QCOORD_MAX = 2147483647
  QCOORD_MIN = -2147483648
  QT_VERSION = 197384
  QT_VERSION_STR = '3.3.8b'
  QtDebugMsg = 0
  QtFatalMsg = 2
  QtWarningMsg = 1
  colors_by_name = True
  qApp = <qt.QApplication object at 0x285a420>
././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D-class.htm0000644000076600000240000001732511501734226034065 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D
Package Scientific :: Package QtWidgets :: Module QtVisualizationCanvas :: Class PolyLine3D
[frames] | no frames]

Class PolyLine3D

PolyPoints3D --+
               |
              PolyLine3D

Multiple connected lines

Instance Methods
 
__init__(self, points, **attr)
 
lines(self)

Inherited from PolyPoints3D: boundingBox, boundingBoxPlane, project, scaleAndShift

Method Details

__init__(self, points, **attr)
(Constructor)

 
Parameters:
  • points - any sequence of (x, y, z) coordinate triples
  • attr - line attributes
  • width (int) - line width (default: 1)
  • color (str) - a Qt color name (default: "black")
Overrides: PolyPoints3D.__init__

././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas-0000644000076600000240000014375311501734226034330 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas
Package Scientific :: Package QtWidgets :: Module QtVisualizationCanvas :: Class VisualizationCanvas
[frames] | no frames]

Class VisualizationCanvas

 object --+                
          |                
sip.wrapper --+            
              |            
          qt.Qt --+        
                  |        
         qt.QObject --+    
                      |    
     object --+       |    
              |       |    
    sip.wrapper --+   |    
                  |   |    
    qt.QPaintDevice --+    
                      |    
             qt.QWidget --+
                          |
                         VisualizationCanvas

Qt visualization widget

VisualizationCanvas objects support all operations of Qt widgets.

Interactive manipulation of the display is possible with click-and-drag operations. The left mouse button rotates the objects, the middle button translates it, and the right button scales it up or down.

Nested Classes

Inherited from qt.QWidget: BackgroundOrigin, FocusPolicy

Inherited from qt.Qt: AlignmentFlags, AnchorAttribute, ArrowType, BGMode, BackgroundMode, BrushStyle, ButtonState, Corner, CursorShape, DateFormat, Dock, GUIStyle, ImageConversionFlags, Key, MacintoshVersion, Modifier, Orientation, PenCapStyle, PenJoinStyle, PenStyle, RasterOp, SequenceMatch, SortOrder, StringComparisonMode, TextFlags, TextFormat, TimeSpec, UIEffect, WidgetFlags, WidgetState, WindowState, WindowsVersion

Inherited from qt.QPaintDevice: PDevCmd

Instance Methods
 
__init__(self, parent=None, background='white')
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
clear(self, keepscale=0)
Clear the canvas
 
copyViewpointFrom(self, other)
 
draw(self, graphics)
Draw something on the canvas
 
mousePressEvent(self, event)
 
mouseReleaseEvent(self, event)
 
paintEvent(self, event)
 
redraw(self)
 
resizeEvent(self, event)
 
setViewpoint(self, axis, plane, scale=None, translate=None)

Inherited from qt.QWidget: acceptDrops, adjustSize, autoMask, backgroundBrush, backgroundMode, backgroundOffset, backgroundOrigin, baseSize, caption, childAt, childEvent, childrenRect, childrenRegion, clearFocus, clearMask, clearWFlags, clearWState, clipRegion, close, closeEvent, colorGroup, constPolish, contextMenuEvent, create, cursor, customEvent, customWhatsThis, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, drawText, dropEvent, enabledChange, enterEvent, erase, eraseColor, erasePixmap, event, find, focusInEvent, focusNextPrevChild, focusOutEvent, focusPolicy, focusProxy, focusWidget, font, fontChange, fontInfo, fontMetrics, foregroundColor, frameGeometry, frameSize, geometry, getWFlags, getWState, grabKeyboard, grabMouse, hasFocus, hasMouse, hasMouseTracking, height, heightForWidth, hide, hideEvent, icon, iconText, imComposeEvent, imEndEvent, imStartEvent, isActiveWindow, isDesktop, isDialog, isEnabled, isEnabledTo, isEnabledToTLW, isFocusEnabled, isFullScreen, isHidden, isInputMethodEnabled, isMaximized, isMinimized, isModal, isPopup, isShown, isTopLevel, isUpdatesEnabled, isVisible, isVisibleTo, isVisibleToTLW, keyPressEvent, keyReleaseEvent, keyboardGrabber, layout, leaveEvent, lowerW, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, maximumHeight, maximumSize, maximumWidth, metaObject, metric, microFocusHint, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, move, moveEvent, ownCursor, ownFont, ownPalette, palette, paletteBackgroundColor, paletteBackgroundPixmap, paletteChange, paletteForegroundColor, parentWidget, polish, pos, raiseW, rect, releaseKeyboard, releaseMouse, repaint, reparent, resetInputContext, resize, scroll, setAcceptDrops, setActiveWindow, setAutoMask, setBackgroundMode, setBackgroundOrigin, setBaseSize, setCaption, setCursor, setDisabled, setEnabled, setEraseColor, setErasePixmap, setFixedHeight, setFixedSize, setFixedWidth, setFocus, setFocusPolicy, setFocusProxy, setFont, setGeometry, setHidden, setIcon, setIconText, setInputMethodEnabled, setKeyCompression, setMask, setMaximumHeight, setMaximumSize, setMaximumWidth, setMicroFocusHint, setMinimumHeight, setMinimumSize, setMinimumWidth, setMouseTracking, setName, setPalette, setPaletteBackgroundColor, setPaletteBackgroundPixmap, setPaletteForegroundColor, setShown, setSizeIncrement, setSizePolicy, setStyle, setTabOrder, setUpdatesEnabled, setWFlags, setWState, setWindowOpacity, setWindowState, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, style, styleChange, tabletEvent, testWFlags, testWState, timerEvent, topLevelWidget, unsetCursor, unsetFont, unsetPalette, update, updateGeometry, updateMask, visibleRect, wheelEvent, width, winId, windowActivationChange, windowOpacity, windowState, x, y

Inherited from qt.QObject: blockSignals, child, children, className, connect, deleteLater, disconnect, dumpObjectInfo, dumpObjectTree, emit, eventFilter, highPriority, inherits, insertChild, installEventFilter, isA, isWidgetType, killTimer, killTimers, name, objectTrees, parent, property, queryList, removeChild, removeEventFilter, sender, setProperty, signalsBlocked, startTimer, tr, trUtf8

Inherited from qt.QPaintDevice: devType, isExtDev, paintingActive, resolution, setResolution

Inherited from sip.wrapper: __delattr__, __getattribute__, __new__, __setattr__

Inherited from object: __hash__, __reduce__, __reduce_ex__, __repr__, __str__

Class Variables

Inherited from qt.QWidget: AncestorOrigin, ClickFocus, NoFocus, ParentOrigin, StrongFocus, TabFocus, WheelFocus, WidgetOrigin, WindowOrigin

Inherited from qt.Qt: ALT, ASCII_ACCEL, AlignAuto, AlignBottom, AlignCenter, AlignHCenter, AlignHorizontal_Mask, AlignJustify, AlignLeft, AlignRight, AlignTop, AlignVCenter, AlignVertical_Mask, AlphaDither_Mask, AltButton, AnchorHref, AnchorName, AndNotROP, AndROP, ArrowCursor, Ascending, AutoColor, AutoDither, AutoText, AvoidDither, BDiagPattern, BeginsWith, BevelJoin, BitmapCursor, BlankCursor, BottomLeft, BottomRight, BreakAnywhere, BusyCursor, CTRL, CaseSensitive, ClearROP, ColorMode_Mask, ColorOnly, Contains, ControlButton, CopyROP, CrossCursor, CrossPattern, CustomPattern, DashDotDotLine, DashDotLine, DashLine, Dense1Pattern, Dense2Pattern, Dense3Pattern, Dense4Pattern, Dense5Pattern, Dense6Pattern, Dense7Pattern, Descending, DiagCrossPattern, DiffuseAlphaDither, DiffuseDither, DitherMode_Mask, Dither_Mask, DockBottom, DockLeft, DockMinimized, DockRight, DockTop, DockTornOff, DockUnmanaged, DontClip, DontPrint, DotLine, DownArrow, EndsWith, EraseROP, ExactMatch, ExpandTabs, FDiagPattern, FixedColor, FixedPixmap, FlatCap, ForbiddenCursor, HorPattern, Horizontal, ISODate, IbeamCursor, Identical, KeyButtonMask, Key_0, Key_1, Key_2, Key_3, Key_4, Key_5, Key_6, Key_7, Key_8, Key_9, Key_A, Key_AE, Key_Aacute, Key_Acircumflex, Key_Adiaeresis, Key_Agrave, Key_Alt, Key_Ampersand, Key_Any, Key_Apostrophe, Key_Aring, Key_AsciiCircum, Key_AsciiTilde, Key_Asterisk, Key_At, Key_Atilde, Key_B, Key_Back, Key_BackSpace, Key_BackTab, Key_Backslash, Key_Backspace, Key_Backtab, Key_Bar, Key_BassBoost, Key_BassDown, Key_BassUp, Key_BraceLeft, Key_BraceRight, Key_BracketLeft, Key_BracketRight, Key_C, Key_CapsLock, Key_Ccedilla, Key_Clear, Key_Colon, Key_Comma, Key_Control, Key_D, Key_Delete, Key_Direction_L, Key_Direction_R, Key_Dollar, Key_Down, Key_E, Key_ETH, Key_Eacute, Key_Ecircumflex, Key_Ediaeresis, Key_Egrave, Key_End, Key_Enter, Key_Equal, Key_Escape, Key_Exclam, Key_F, Key_F1, Key_F10, Key_F11, Key_F12, Key_F13, Key_F14, Key_F15, Key_F16, Key_F17, Key_F18, Key_F19, Key_F2, Key_F20, Key_F21, Key_F22, Key_F23, Key_F24, Key_F25, Key_F26, Key_F27, Key_F28, Key_F29, Key_F3, Key_F30, Key_F31, Key_F32, Key_F33, Key_F34, Key_F35, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_Favorites, Key_Forward, Key_G, Key_Greater, Key_H, Key_Help, Key_Home, Key_HomePage, Key_Hyper_L, Key_Hyper_R, Key_I, Key_Iacute, Key_Icircumflex, Key_Idiaeresis, Key_Igrave, Key_Insert, Key_J, Key_K, Key_L, Key_Launch0, Key_Launch1, Key_Launch2, Key_Launch3, Key_Launch4, Key_Launch5, Key_Launch6, Key_Launch7, Key_Launch8, Key_Launch9, Key_LaunchA, Key_LaunchB, Key_LaunchC, Key_LaunchD, Key_LaunchE, Key_LaunchF, Key_LaunchMail, Key_LaunchMedia, Key_Left, Key_Less, Key_M, Key_MediaLast, Key_MediaNext, Key_MediaPlay, Key_MediaPrev, Key_MediaRecord, Key_MediaStop, Key_Menu, Key_Meta, Key_Minus, Key_N, Key_Next, Key_Ntilde, Key_NumLock, Key_NumberSign, Key_O, Key_Oacute, Key_Ocircumflex, Key_Odiaeresis, Key_Ograve, Key_Ooblique, Key_OpenUrl, Key_Otilde, Key_P, Key_PageDown, Key_PageUp, Key_ParenLeft, Key_ParenRight, Key_Pause, Key_Percent, Key_Period, Key_Plus, Key_Print, Key_Prior, Key_Q, Key_Question, Key_QuoteDbl, Key_QuoteLeft, Key_R, Key_Refresh, Key_Return, Key_Right, Key_S, Key_ScrollLock, Key_Search, Key_Semicolon, Key_Shift, Key_Slash, Key_Space, Key_Standby, Key_Stop, Key_Super_L, Key_Super_R, Key_SysReq, Key_T, Key_THORN, Key_Tab, Key_TrebleDown, Key_TrebleUp, Key_U, Key_Uacute, Key_Ucircumflex, Key_Udiaeresis, Key_Ugrave, Key_Underscore, Key_Up, Key_V, Key_VolumeDown, Key_VolumeMute, Key_VolumeUp, Key_W, Key_X, Key_Y, Key_Yacute, Key_Z, Key_aacute, Key_acircumflex, Key_acute, Key_adiaeresis, Key_ae, Key_agrave, Key_aring, Key_atilde, Key_brokenbar, Key_ccedilla, Key_cedilla, Key_cent, Key_copyright, Key_currency, Key_degree, Key_diaeresis, Key_division, Key_eacute, Key_ecircumflex, Key_ediaeresis, Key_egrave, Key_eth, Key_exclamdown, Key_guillemotleft, Key_guillemotright, Key_hyphen, Key_iacute, Key_icircumflex, Key_idiaeresis, Key_igrave, Key_macron, Key_masculine, Key_mu, Key_multiply, Key_nobreakspace, Key_notsign, Key_ntilde, Key_oacute, Key_ocircumflex, Key_odiaeresis, Key_ograve, Key_onehalf, Key_onequarter, Key_onesuperior, Key_ordfeminine, Key_oslash, Key_otilde, Key_paragraph, Key_periodcentered, Key_plusminus, Key_questiondown, Key_registered, Key_section, Key_ssharp, Key_sterling, Key_thorn, Key_threequarters, Key_threesuperior, Key_twosuperior, Key_uacute, Key_ucircumflex, Key_udiaeresis, Key_ugrave, Key_unknown, Key_yacute, Key_ydiaeresis, Key_yen, Keypad, LastCursor, LastROP, LeftArrow, LeftButton, LocalDate, LocalTime, LogText, META, MODIFIER_MASK, MPenCapStyle, MPenJoinStyle, MPenStyle, MV_10_DOT_0, MV_10_DOT_1, MV_10_DOT_2, MV_10_DOT_3, MV_10_DOT_4, MV_9, MV_CHEETAH, MV_JAGUAR, MV_PANTHER, MV_PUMA, MV_TIGER, MV_Unknown, MetaButton, MidButton, MiterJoin, MonoOnly, MotifStyle, MouseButtonMask, NandROP, NoAccel, NoBackground, NoBrush, NoButton, NoMatch, NoPen, NopROP, NorROP, NotAndROP, NotCopyROP, NotEraseROP, NotOrROP, NotROP, NotXorROP, OpaqueMode, OrNotROP, OrROP, OrderedAlphaDither, OrderedDither, PaletteBackground, PaletteBase, PaletteBrightText, PaletteButton, PaletteButtonText, PaletteDark, PaletteForeground, PaletteHighlight, PaletteHighlightedText, PaletteLight, PaletteLink, PaletteLinkVisited, PaletteMid, PaletteMidlight, PaletteShadow, PaletteText, PartialMatch, PlainText, PointingHandCursor, PreferDither, RichText, RightArrow, RightButton, RoundCap, RoundJoin, SHIFT, SetROP, ShiftButton, ShowPrefix, SingleLine, SizeAllCursor, SizeBDiagCursor, SizeFDiagCursor, SizeHorCursor, SizeVerCursor, SolidLine, SolidPattern, SplitHCursor, SplitVCursor, SquareCap, TextDate, ThresholdAlphaDither, ThresholdDither, TopLeft, TopRight, TransparentMode, UI_AnimateCombo, UI_AnimateMenu, UI_AnimateToolBox, UI_AnimateTooltip, UI_FadeMenu, UI_FadeTooltip, UI_General, UNICODE_ACCEL, UTC, UpArrow, UpArrowCursor, VerPattern, Vertical, WDestructiveClose, WGroupLeader, WMouseNoMask, WNoAutoErase, WNoMousePropagation, WPaintClever, WPaintDesktop, WPaintUnclipped, WRepaintNoErase, WResizeNoErase, WShowModal, WState_Polished, WStaticContents, WStyle_ContextHelp, WStyle_Customize, WStyle_DialogBorder, WStyle_Mask, WStyle_Maximize, WStyle_MinMax, WStyle_Minimize, WStyle_NoBorder, WStyle_NormalBorder, WStyle_Reserved, WStyle_Splash, WStyle_StaysOnTop, WStyle_SysMenu, WStyle_Title, WStyle_Tool, WSubWindow, WType_Desktop, WType_Dialog, WType_Mask, WType_Popup, WType_TopLevel, WV_2000, WV_2003, WV_32s, WV_95, WV_98, WV_CE, WV_CENET, WV_CE_based, WV_DOS_based, WV_Me, WV_NT, WV_NT_based, WV_VISTA, WV_XP, WWinOwnDC, WX11BypassWM, WaitCursor, WhatsThisCursor, WindowActive, WindowFullScreen, WindowMaximized, WindowMinimized, WindowNoState, WindowsStyle, WordBreak, X11ParentRelative, XorROP, arrowCursor, black, blankCursor, blue, busyCursor, color0, color1, crossCursor, cyan, darkBlue, darkCyan, darkGray, darkGreen, darkMagenta, darkRed, darkYellow, forbiddenCursor, gray, green, ibeamCursor, lightGray, magenta, pointingHandCursor, red, sizeAllCursor, sizeBDiagCursor, sizeFDiagCursor, sizeHorCursor, sizeVerCursor, splitHCursor, splitVCursor, upArrowCursor, waitCursor, whatsThisCursor, white, yellow

Inherited from qt.QPaintDevice: PdcBegin, PdcDrawArc, PdcDrawChord, PdcDrawCubicBezier, PdcDrawEllipse, PdcDrawFirst, PdcDrawImage, PdcDrawLast, PdcDrawLine, PdcDrawLineSegments, PdcDrawPie, PdcDrawPixmap, PdcDrawPoint, PdcDrawPolygon, PdcDrawPolyline, PdcDrawRect, PdcDrawRoundRect, PdcDrawText, PdcDrawText2, PdcDrawText2Formatted, PdcDrawTextFormatted, PdcDrawTextItem, PdcEnd, PdcLineTo, PdcMoveTo, PdcNOP, PdcReservedStart, PdcReservedStop, PdcRestore, PdcRestoreWMatrix, PdcSave, PdcSaveWMatrix, PdcSetBkColor, PdcSetBkMode, PdcSetBrush, PdcSetBrushOrigin, PdcSetClip, PdcSetClipRegion, PdcSetFont, PdcSetPen, PdcSetROP, PdcSetTabArray, PdcSetTabStops, PdcSetUnit, PdcSetVXform, PdcSetViewport, PdcSetWMatrix, PdcSetWXform, PdcSetWindow, PdcSetdev

Properties

Inherited from object: __class__

Method Details

__init__(self, parent=None, background='white')
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • parent - the parent widget
  • background (str) - the background color
Overrides: object.__init__

draw(self, graphics)

 

Draw something on the canvas

Parameters:

mousePressEvent(self, event)

 
Overrides: qt.QWidget.mousePressEvent

mouseReleaseEvent(self, event)

 
Overrides: qt.QWidget.mouseReleaseEvent

paintEvent(self, event)

 
Overrides: qt.QWidget.paintEvent

resizeEvent(self, event)

 
Overrides: qt.QWidget.resizeEvent

././@LongLink0000000000000000000000000000016100000000000011213 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphics-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphic0000644000076600000240000001731011501734226034402 0ustar hinsenstaff00000000000000 Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphics
Package Scientific :: Package QtWidgets :: Module QtVisualizationCanvas :: Class VisualizationGraphics
[frames] | no frames]

Class VisualizationGraphics

Compound graphics object

Instance Methods
 
__getitem__(self, item)
 
__init__(self, objects)
 
__len__(self)
Method Details

__init__(self, objects)
(Constructor)

 
Parameters:

ScientificPython-2.9.4/Doc/Reference/Scientific.Signals-module.html0000644000076600000240000001100611501734225025651 0ustar hinsenstaff00000000000000 Scientific.Signals
Package Scientific :: Package Signals
[frames] | no frames]

Package Signals

Submodules

ScientificPython-2.9.4/Doc/Reference/Scientific.Signals.Models-module.html0000644000076600000240000001206611501734225027102 0ustar hinsenstaff00000000000000 Scientific.Signals.Models
Package Scientific :: Package Signals :: Module Models
[frames] | no frames]

Module Models

Auto-regressive model for stochastic processes

Classes
  AutoRegressiveModel
Auto-regressive model for stochastic process
  AveragedAutoRegressiveModel
Averaged auto-regressive model for stochastic process
ScientificPython-2.9.4/Doc/Reference/Scientific.Signals.Models.AutoRegressiveModel-class.html0000644000076600000240000005050311501734226032650 0ustar hinsenstaff00000000000000 Scientific.Signals.Models.AutoRegressiveModel
Package Scientific :: Package Signals :: Module Models :: Class AutoRegressiveModel
[frames] | no frames]

Class AutoRegressiveModel

Known Subclasses:

Auto-regressive model for stochastic process

This implementation uses the Burg algorithm to obtain the coefficients of the AR model.

Instance Methods
 
__init__(self, order, data, delta_t=1)
Scientific.Functions.Interpolation.InterpolatingFunction
correlation(self, nsteps)
Returns: the autocorrelation function of the process as estimated from the AR model
 
frictionConstant(self)
Returns: the friction constant of the process, i.e.
Scientific.Functions.Interpolation.InterpolatingFunction
memoryFunction(self, nsteps)
Returns: the memory function of the process as estimated from the AR model
Scientific.Function.Rational.RationalFunction
memoryFunctionZ(self)
Returns: the z-transform of the process' memory function
Scientific.Function.Rational.RationalFunction
memoryFunctionZapprox(self, den_order)
Returns: an approximation to the z-transform of the process' memory function that correponds to an expansion of the denominator up to order den_order
Numeric.array of complex
poles(self)
Returns: the poles of the model in the complex z-plane
float or complex
predictStep(self)
Calculates the linear prediction of the next step in the series.
Numeric.array of float
spectrum(self, omega)
Returns: the frequency spectrum of the process
Method Details

__init__(self, order, data, delta_t=1)
(Constructor)

 
Parameters:
  • order (int) - the order of the model
  • data (sequence of float or complex) - the time series
  • delta_t (float) - the sampling interval for the time series

correlation(self, nsteps)

 
Parameters:
  • nsteps (int) - the number of time steps for which the autocorrelation function is to be evaluated
Returns: Scientific.Functions.Interpolation.InterpolatingFunction
the autocorrelation function of the process as estimated from the AR model

frictionConstant(self)

 
Returns:
the friction constant of the process, i.e. the integral over the memory function

memoryFunction(self, nsteps)

 
Parameters:
  • nsteps (int) - the number of time steps for which the memory function is to be evaluated
Returns: Scientific.Functions.Interpolation.InterpolatingFunction
the memory function of the process as estimated from the AR model

memoryFunctionZ(self)

 
Returns: Scientific.Function.Rational.RationalFunction
the z-transform of the process' memory function

memoryFunctionZapprox(self, den_order)

 
Parameters:
  • den_order (int)
Returns: Scientific.Function.Rational.RationalFunction
an approximation to the z-transform of the process' memory function that correponds to an expansion of the denominator up to order den_order

poles(self)

 
Returns: Numeric.array of complex
the poles of the model in the complex z-plane

predictStep(self)

 

Calculates the linear prediction of the next step in the series. This step is appended internally to the current trajectory, making it possible to call this method repeatedly in order to obtain a sequence of predicted steps.

Returns: float or complex
the predicted step

spectrum(self, omega)

 
Parameters:
  • omega (Numeric.array of float) - the angular frequencies at which the spectrum is to be evaluated
Returns: Numeric.array of float
the frequency spectrum of the process

././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.Signals.Models.AveragedAutoRegressiveModel-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.Signals.Models.AveragedAutoRegressiveModel-class.htm0000644000076600000240000002456211501734226034141 0ustar hinsenstaff00000000000000 Scientific.Signals.Models.AveragedAutoRegressiveModel
Package Scientific :: Package Signals :: Module Models :: Class AveragedAutoRegressiveModel
[frames] | no frames]

Class AveragedAutoRegressiveModel

AutoRegressiveModel --+
                      |
                     AveragedAutoRegressiveModel

Averaged auto-regressive model for stochastic process

An averaged model is constructed by averaging the model coefficients of several auto-regressive models of the same order. An averaged model is created empty, then individual models are added.

Instance Methods
 
__init__(self, order, delta_t)
 
add(self, model, weight=1)
Adds the coefficients of an autoregressive model to the average.

Inherited from AutoRegressiveModel: correlation, frictionConstant, memoryFunction, memoryFunctionZ, memoryFunctionZapprox, poles, predictStep, spectrum

Method Details

__init__(self, order, delta_t)
(Constructor)

 
Parameters:
  • order (int) - the order of the model
  • delta_t (float) - the sampling interval for the time series
Overrides: AutoRegressiveModel.__init__

add(self, model, weight=1)

 

Adds the coefficients of an autoregressive model to the average.

Parameters:
  • model (AutoRegressiveModel) - an autoregressive model
  • weight (float) - the weight of the model in the average
Raises:
  • ValueError - if the order of the model does not match the order of the average model

ScientificPython-2.9.4/Doc/Reference/Scientific.Statistics-module.html0000644000076600000240000005667111501734226026425 0ustar hinsenstaff00000000000000 Scientific.Statistics
Package Scientific :: Package Statistics
[frames] | no frames]

Package Statistics

Basic monovariate statistics

Submodules

Functions
number
average(data)
Mean (average value, first moment)
number
correlation(data1, data2)
Calculates the correlation coefficient between two data sequences
number
kurtosis(data)
Kurtosis (fourth normalized moment)
number
mean(data)
Mean (average value, first moment)
number
median(data)
Median
 
mode(data)
number
moment(data, order, about=None, theoretical=1)
Calculate the moments of the distribution corresponding to a set of data
number
normalizedMoment(data, order)
Calculate the normalized moments of the distribution corresponding to a set of data.
number
skewness(data)
Skewness (third normalized moment)
number
standardDeviation(data)
Standard deviation
number
variance(data)
Variance (second moment)
tuple of two elements
weightedMean(data, sigma)
Weighted mean of a sequence of numbers with given standard deviations
Function Details

average(data)

 

Mean (average value, first moment)

Parameters:
  • data (list or Numeric.array) - a sequence of numbers
Returns: number
the mean of the number sequence

correlation(data1, data2)

 

Calculates the correlation coefficient between two data sequences

Parameters:
  • data1 (Numeric.array or list) - first data sequence
  • data2 (Numeric.array or list) - second data sequence of length identical to data1
Returns: number
the correlation coefficient between data1 and data2
Raises:
  • ValueError - if data1 and data2 have different lengths

kurtosis(data)

 

Kurtosis (fourth normalized moment)

Parameters:
  • data (list or Numeric.array) - a sequence of numbers
Returns: number
the kurtosis of the number sequence

mean(data)

 

Mean (average value, first moment)

Parameters:
  • data (list or Numeric.array) - a sequence of numbers
Returns: number
the mean of the number sequence

median(data)

 

Median

Parameters:
  • data (list or Numeric.array) - a sequence of numbers
Returns: number
the median of the number sequence

moment(data, order, about=None, theoretical=1)

 

Calculate the moments of the distribution corresponding to a set of data

Parameters:
  • data (Numeric.array of numbers) - a sequence of data points
  • order (int) - the order of the moment to be calculated
  • about (number) - the center of the distribution. If None, use the mean value as the center.
  • theoretical - for internal use
Returns: number
the moment of the given order about the specified center

normalizedMoment(data, order)

 

Calculate the normalized moments of the distribution corresponding to a set of data. Normalization means division by the n-th power of the standard deviation.

Parameters:
  • data (Numeric.array of numbers) - a sequence of data points
  • order (int) - the order of the moment to be calculated
Returns: number
the normalized moment of the given order

skewness(data)

 

Skewness (third normalized moment)

Parameters:
  • data (list or Numeric.array) - a sequence of numbers
Returns: number
the skewness of the number sequence

standardDeviation(data)

 

Standard deviation

Parameters:
  • data (list or Numeric.array) - a sequence of numbers
Returns: number
the standard deviation of the number sequence

variance(data)

 

Variance (second moment)

Parameters:
  • data (list or Numeric.array) - a sequence of numbers
Returns: number
the variance of the number sequence

weightedMean(data, sigma)

 

Weighted mean of a sequence of numbers with given standard deviations

Parameters:
  • data (list or Numeric.array) - a sequence of measurements
  • sigma (list or Numeric.array) - a sequence of corresponding standard deviations
Returns: tuple of two elements
the weighted mean and corresponding standard deviation

ScientificPython-2.9.4/Doc/Reference/Scientific.Statistics.Histogram-module.html0000644000076600000240000001177611501734226030356 0ustar hinsenstaff00000000000000 Scientific.Statistics.Histogram
Package Scientific :: Package Statistics :: Module Histogram
[frames] | no frames]

Module Histogram

Standard and weighted histograms

Classes
  Histogram
Histogram in one variable
  WeightedHistogram
Weighted histogram in one variable
ScientificPython-2.9.4/Doc/Reference/Scientific.Statistics.Histogram.Histogram-class.html0000644000076600000240000005121711501734226032124 0ustar hinsenstaff00000000000000 Scientific.Statistics.Histogram.Histogram
Package Scientific :: Package Statistics :: Module Histogram :: Class Histogram
[frames] | no frames]

Class Histogram

Known Subclasses:

Histogram in one variable

The bin index and the number of points in a bin can be obtained by indexing the histogram with the bin number. Application of len() yields the number of bins. A histogram thus behaves like a sequence of bin index - bin count pairs.

Here is an example on usage:

>>> nsamples = 1000
>>> from numpy import random
>>> data = random.normal(1.0, 0.5, nsamples)
>>> import Scientific.Statistics as S
>>> S.mean(data)
0.9607056871982641
>>> S.standardDeviation(data)
0.50251811830486681
>>> S.median(data)
0.94853870756924152
>>> S.skewness(data)   # should be 0
0.038940041870334556
>>> S.kurtosis(data)   # should be 3
2.865582791273765
>>> 
>>> from Scientific.Statistics.Histogram import Histogram
>>> h = Histogram(data, 50)  # use 50 bins between min & max samples
>>> h.normalizeArea()        # make probabilities in histogram
>>> h[3]                     # bin index and frequency in the 4th bin
array([-0.45791018,  0.01553658])
>>> x = h.getBinIndices()
>>> y = h.getBinCounts()
>>> # can plot the y vector against the x vector (see below)
>>> 
>>> # add many more samples:
>>> nsamples2 = nsamples*100
>>> data = random.normal(1.0, 0.5, nsamples2)
>>> h.addData(data)
>>> h.normalizeArea()
>>> x2 = h.getBinIndices()
>>> y2 = h.getBinCounts()
>>> plot (x,y) and (x2,y2):
>>> import Gnuplot
>>> g = Gnuplot.Gnuplot(persist=1)
>>> g.xlabel('sample value');  g.ylabel('probability')
>>> d1 = Gnuplot.Data(x, y, with='lines',
...                   title='%d samples' % nsamples)
>>> d2 = Gnuplot.Data(x2, y2, with='lines',
...                   title='%d samples' % nsamples2)
>>> g.plot(d1,d2)
Instance Methods
 
__getitem__(self, index)
Returns: an array of shape (2,) containing the bin value and the bin count
 
__getslice__(self, first, last)
 
__init__(self, data, nbins, range=None)
int
__len__(self)
Returns: the number of bins
 
addData(self, data)
Add values to the originally supplied data sequence.
 
getBinCounts(self)
Return an array of all the bin counts.
 
getBinIndices(self)
Return an array of all the bin indices.
 
normalize(self, norm=1.0)
Scale all bin counts by the same factor
 
normalizeArea(self, norm=1.0)
Scale all bin counts by the same factor
Method Details

__getitem__(self, index)
(Indexing operator)

 
Parameters:
  • index (int) - a bin index
Returns:
an array of shape (2,) containing the bin value and the bin count

__init__(self, data, nbins, range=None)
(Constructor)

 
Parameters:
  • data (Numeric.array of float or int) - a sequence of data points
  • nbins (int) - the number of bins into which the data is to be sorted
  • range (tuple or NoneType) - a tuple of two values, specifying the lower and the upper end of the interval spanned by the bins. Any data point outside this interval will be ignored. If no range is given, the smallest and largest data values are used to define the interval.

__len__(self)
(Length operator)

 
Returns: int
the number of bins

addData(self, data)

 

Add values to the originally supplied data sequence. Use this method to feed long data sequences in multiple parts to avoid memory shortages.

Parameters:
  • data (Numeric.array) - a sequence of data points

Note: this does not affect the default range of the histogram, which is fixed when the histogram is created.

normalize(self, norm=1.0)

 

Scale all bin counts by the same factor

Parameters:
  • norm (float or int) - the sum of all bin counts after the rescaling

normalizeArea(self, norm=1.0)

 

Scale all bin counts by the same factor

Parameters:
  • norm (float or int) - the area under the histogram after the rescaling

ScientificPython-2.9.4/Doc/Reference/Scientific.Statistics.Histogram.WeightedHistogram-class.html0000644000076600000240000002607011501734226033604 0ustar hinsenstaff00000000000000 Scientific.Statistics.Histogram.WeightedHistogram
Package Scientific :: Package Statistics :: Module Histogram :: Class WeightedHistogram
[frames] | no frames]

Class WeightedHistogram

Histogram --+
            |
           WeightedHistogram

Weighted histogram in one variable

Constructor: WeightedHistogram(|data|, |weights|, |bins|, |range|=None)

Arguments:

In a weighted histogram, each point has a specific weight. If all weights are one, the result is equivalent to a standard histogram. The bin index and the number of points in a bin can be obtained by indexing the histogram with the bin number. Application of len() yields the number of bins. A histogram thus behaves like a sequence of bin index - bin count pairs.

Instance Methods
 
__init__(self, data, weights, nbins, range=None)
 
addData(self, data, weights)
Add values to the originally supplied data sequence.

Inherited from Histogram: __getitem__, __getslice__, __len__, getBinCounts, getBinIndices, normalize, normalizeArea

Method Details

__init__(self, data, weights, nbins, range=None)
(Constructor)

 
Parameters:
  • data (Numeric.array) - a sequence of data points
  • weights (Numeric.array) - a sequence of weights, same length as data
  • nbins (int) - the number of bins into which the data is to be sorted
  • range (tuple or NoneType) - a tuple of two values, specifying the lower and the upper end of the interval spanned by the bins. Any data point outside this interval will be ignored. If no range is given, the smallest and largest data values are used to define the interval.
Overrides: Histogram.__init__

addData(self, data, weights)

 

Add values to the originally supplied data sequence. Use this method to feed long data sequences in multiple parts to avoid memory shortages.

Parameters:
  • data (Numeric.array) - a sequence of data points
Overrides: Histogram.addData

Note: this does not affect the default range of the histogram, which is fixed when the histogram is created.


ScientificPython-2.9.4/Doc/Reference/Scientific.Threading-module.html0000644000076600000240000001105511501734226026163 0ustar hinsenstaff00000000000000 Scientific.Threading
Package Scientific :: Package Threading
[frames] | no frames]

Package Threading

Submodules

ScientificPython-2.9.4/Doc/Reference/Scientific.Threading.TaskManager-module.html0000644000076600000240000001137711501734226030366 0ustar hinsenstaff00000000000000 Scientific.Threading.TaskManager
Package Scientific :: Package Threading :: Module TaskManager
[frames] | no frames]

Module TaskManager

Parallel task manager for shared-memory multiprocessor machines

Classes
  TaskManager
Parallel task manager for shared-memory multiprocessor machines
ScientificPython-2.9.4/Doc/Reference/Scientific.Threading.TaskManager.TaskManager-class.html0000644000076600000240000002321111501734226032370 0ustar hinsenstaff00000000000000 Scientific.Threading.TaskManager.TaskManager
Package Scientific :: Package Threading :: Module TaskManager :: Class TaskManager
[frames] | no frames]

Class TaskManager

Parallel task manager for shared-memory multiprocessor machines

This class provides a rather simple way to profit from shared-memory multiprocessor machines by running several tasks in parallel. The calling program decides how many execution threads should run at any given time, and then feeds compute tasks to the task manager, who runs them as soon as possible without exceeding the maximum number of threads.

The major limitation of this approach lies in Python's Global Interpreter Lock. This effectively means that no more than one Python thread can run at the same time. Consequently, parallelization can only be achieved if the tasks to be parallelized spend significant time in C extension modules that release the Global Interpreter Lock.

Instance Methods
 
__init__(self, nthreads)
 
runTask(self, function, args)
Run a task as soon as processing capacity becomes available
 
terminate(self)
Wait until all tasks have finished
Method Details

__init__(self, nthreads)
(Constructor)

 
Parameters:
  • nthreads (int) - the maximum number of compute threads that should run in parallel. Note: This does not include the main thread which generated and feeds the task manager!

runTask(self, function, args)

 

Run a task as soon as processing capacity becomes available

Parameters:
  • function (callable) - the function that will be executed as the body of the task
  • args (tuple) - the arguments that will be passed to function when it is called. An additional argument will be added at the end: a lock object that the task can use to get temporarily exclusive access to data shared with other tasks.

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets-module.html0000644000076600000240000001545211501734226026170 0ustar hinsenstaff00000000000000 Scientific.TkWidgets
Package Scientific :: Package TkWidgets
[frames] | no frames]

Package TkWidgets

Submodules

Classes
  ButtonBar
Horizontal array of buttons
  FilenameEntry
Filename entry widget
  FloatEntry
Entry field for float numbers
  IntEntry
Entry field for integer numbers
  ModalDialog
  StatusBar
Status bar
ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.ButtonBar-class.html0000644000076600000240000003431311501734226027704 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.ButtonBar
Package Scientific :: Package TkWidgets :: Class ButtonBar
[frames] | no frames]

Class ButtonBar

  Tkinter.Misc --+            
                 |            
Tkinter.BaseWidget --+        
                     |        
      Tkinter.Pack --+        
                     |        
     Tkinter.Place --+        
                     |        
      Tkinter.Grid --+        
                     |        
        Tkinter.Widget --+    
                         |    
             Tkinter.Frame --+
                             |
                            ButtonBar

Horizontal array of buttons

Nested Classes

Inherited from Tkinter.Misc: getdouble, getint

Instance Methods
 
__init__(self, master, left_button_list, right_button_list)
Construct a frame widget with the parent MASTER.

Inherited from Tkinter.BaseWidget: destroy

Inherited from Tkinter.Misc: __getitem__, __setitem__, __str__, after, after_cancel, after_idle, bbox, bell, bind, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, clipboard_get, colormodel, columnconfigure, config, configure, deletecommand, event_add, event_delete, event_generate, event_info, focus, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_location, grid_propagate, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, keys, lift, lower, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_propagate, pack_slaves, place_slaves, propagate, quit, register, rowconfigure, selection_clear, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, size, slaves, tk_bisque, tk_focusFollowsMouse, tk_focusNext, tk_focusPrev, tk_menuBar, tk_setPalette, tk_strictMotif, tkraise, unbind, unbind_all, unbind_class, update, update_idletasks, wait_variable, wait_visibility, wait_window, waitvar, winfo_atom, winfo_atomname, winfo_cells, winfo_children, winfo_class, winfo_colormapfull, winfo_containing, winfo_depth, winfo_exists, winfo_fpixels, winfo_geometry, winfo_height, winfo_id, winfo_interps, winfo_ismapped, winfo_manager, winfo_name, winfo_parent, winfo_pathname, winfo_pixels, winfo_pointerx, winfo_pointerxy, winfo_pointery, winfo_reqheight, winfo_reqwidth, winfo_rgb, winfo_rootx, winfo_rooty, winfo_screen, winfo_screencells, winfo_screendepth, winfo_screenheight, winfo_screenmmheight, winfo_screenmmwidth, winfo_screenvisual, winfo_screenwidth, winfo_server, winfo_toplevel, winfo_viewable, winfo_visual, winfo_visualid, winfo_visualsavailable, winfo_vrootheight, winfo_vrootwidth, winfo_vrootx, winfo_vrooty, winfo_width, winfo_x, winfo_y

Inherited from Tkinter.Pack: forget, info, pack, pack_configure, pack_forget, pack_info

Inherited from Tkinter.Place: place, place_configure, place_forget, place_info

Inherited from Tkinter.Grid: grid, grid_configure, grid_forget, grid_info, grid_remove, location

Class Variables

Inherited from Tkinter.Misc: _noarg_

Method Details

__init__(self, master, left_button_list, right_button_list)
(Constructor)

 

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.

Parameters:
  • master - the parent widget
  • left_button_list - a list of (text, action) tuples specifying the buttons on the left-hand side of the button bar
  • right_button_list - a list of (text, action) tuples specifying the buttons on the right-hand side of the button bar
Overrides: Tkinter.BaseWidget.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.FilenameEntry-class.html0000644000076600000240000004171111501734226030546 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.FilenameEntry
Package Scientific :: Package TkWidgets :: Class FilenameEntry
[frames] | no frames]

Class FilenameEntry

  Tkinter.Misc --+            
                 |            
Tkinter.BaseWidget --+        
                     |        
      Tkinter.Pack --+        
                     |        
     Tkinter.Place --+        
                     |        
      Tkinter.Grid --+        
                     |        
        Tkinter.Widget --+    
                         |    
             Tkinter.Frame --+
                             |
                            FilenameEntry

Filename entry widget

A FilenameEntry widget consists of three parts: an identifying label, a text entry field for the filename, and a button labelled 'browse' which call a file selection dialog box for picking a file name.

Nested Classes

Inherited from Tkinter.Misc: getdouble, getint

Instance Methods
 
__init__(self, master, text, pattern='*', must_exist=True, **attr)
Construct a frame widget with the parent MASTER.
 
browse(self)
str
get(self)
Returns: the current filename

Inherited from Tkinter.BaseWidget: destroy

Inherited from Tkinter.Misc: __getitem__, __setitem__, __str__, after, after_cancel, after_idle, bbox, bell, bind, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, clipboard_get, colormodel, columnconfigure, config, configure, deletecommand, event_add, event_delete, event_generate, event_info, focus, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_location, grid_propagate, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, keys, lift, lower, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_propagate, pack_slaves, place_slaves, propagate, quit, register, rowconfigure, selection_clear, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, size, slaves, tk_bisque, tk_focusFollowsMouse, tk_focusNext, tk_focusPrev, tk_menuBar, tk_setPalette, tk_strictMotif, tkraise, unbind, unbind_all, unbind_class, update, update_idletasks, wait_variable, wait_visibility, wait_window, waitvar, winfo_atom, winfo_atomname, winfo_cells, winfo_children, winfo_class, winfo_colormapfull, winfo_containing, winfo_depth, winfo_exists, winfo_fpixels, winfo_geometry, winfo_height, winfo_id, winfo_interps, winfo_ismapped, winfo_manager, winfo_name, winfo_parent, winfo_pathname, winfo_pixels, winfo_pointerx, winfo_pointerxy, winfo_pointery, winfo_reqheight, winfo_reqwidth, winfo_rgb, winfo_rootx, winfo_rooty, winfo_screen, winfo_screencells, winfo_screendepth, winfo_screenheight, winfo_screenmmheight, winfo_screenmmwidth, winfo_screenvisual, winfo_screenwidth, winfo_server, winfo_toplevel, winfo_viewable, winfo_visual, winfo_visualid, winfo_visualsavailable, winfo_vrootheight, winfo_vrootwidth, winfo_vrootx, winfo_vrooty, winfo_width, winfo_x, winfo_y

Inherited from Tkinter.Pack: forget, info, pack, pack_configure, pack_forget, pack_info

Inherited from Tkinter.Place: place, place_configure, place_forget, place_info

Inherited from Tkinter.Grid: grid, grid_configure, grid_forget, grid_info, grid_remove, location

Class Variables

Inherited from Tkinter.Misc: _noarg_

Method Details

__init__(self, master, text, pattern='*', must_exist=True, **attr)
(Constructor)

 

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.

Parameters:
  • master - the parent widget
  • text (str) - the label in front of the filename box
  • pattern (str) - the filename matching pattern that determines the file list in the file selection dialog
  • must_exist (bool) - if True, allow only names of existing files
Overrides: Tkinter.BaseWidget.__init__

get(self)

 
Returns: str
the current filename
Raises:
  • ValueError - if must_exist is True and the name does not refer to an existing file

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.FloatEntry-class.html0000644000076600000240000005270311501734226030076 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.FloatEntry
Package Scientific :: Package TkWidgets :: Class FloatEntry
[frames] | no frames]

Class FloatEntry

  Tkinter.Misc --+            
                 |            
Tkinter.BaseWidget --+        
                     |        
      Tkinter.Pack --+        
                     |        
     Tkinter.Place --+        
                     |        
      Tkinter.Grid --+        
                     |        
        Tkinter.Widget --+    
                         |    
             Tkinter.Frame --+
                             |
                            FloatEntry
Known Subclasses:

Entry field for float numbers

A FloatEntry widget consists of a label followed by a text entry field.

Nested Classes

Inherited from Tkinter.Misc: getdouble, getint

Instance Methods
 
__init__(self, master, text, init=None, lower=None, upper=None, name=None, **attr)
Construct a frame widget with the parent MASTER.
 
bind(self, sequence=None, func=None, add=None)
Bind to this widget at event SEQUENCE a call to function FUNC.
float
get(self)
Returns: the current value displayed in the field
 
set(self, value)
Set the value displayed in the field

Inherited from Tkinter.BaseWidget: destroy

Inherited from Tkinter.Misc: __getitem__, __setitem__, __str__, after, after_cancel, after_idle, bbox, bell, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, clipboard_get, colormodel, columnconfigure, config, configure, deletecommand, event_add, event_delete, event_generate, event_info, focus, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_location, grid_propagate, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, keys, lift, lower, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_propagate, pack_slaves, place_slaves, propagate, quit, register, rowconfigure, selection_clear, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, size, slaves, tk_bisque, tk_focusFollowsMouse, tk_focusNext, tk_focusPrev, tk_menuBar, tk_setPalette, tk_strictMotif, tkraise, unbind, unbind_all, unbind_class, update, update_idletasks, wait_variable, wait_visibility, wait_window, waitvar, winfo_atom, winfo_atomname, winfo_cells, winfo_children, winfo_class, winfo_colormapfull, winfo_containing, winfo_depth, winfo_exists, winfo_fpixels, winfo_geometry, winfo_height, winfo_id, winfo_interps, winfo_ismapped, winfo_manager, winfo_name, winfo_parent, winfo_pathname, winfo_pixels, winfo_pointerx, winfo_pointerxy, winfo_pointery, winfo_reqheight, winfo_reqwidth, winfo_rgb, winfo_rootx, winfo_rooty, winfo_screen, winfo_screencells, winfo_screendepth, winfo_screenheight, winfo_screenmmheight, winfo_screenmmwidth, winfo_screenvisual, winfo_screenwidth, winfo_server, winfo_toplevel, winfo_viewable, winfo_visual, winfo_visualid, winfo_visualsavailable, winfo_vrootheight, winfo_vrootwidth, winfo_vrootx, winfo_vrooty, winfo_width, winfo_x, winfo_y

Inherited from Tkinter.Pack: forget, info, pack, pack_configure, pack_forget, pack_info

Inherited from Tkinter.Place: place, place_configure, place_forget, place_info

Inherited from Tkinter.Grid: grid, grid_configure, grid_forget, grid_info, grid_remove, location

Class Variables

Inherited from Tkinter.Misc: _noarg_

Method Details

__init__(self, master, text, init=None, lower=None, upper=None, name=None, **attr)
(Constructor)

 

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.

Parameters:
  • master - the parent widget
  • text (str) - the label in front of the entry field
  • init (number) - an optional initial value (default: blank field)
  • upper (number) - an optional upper limit for the value
  • lower (number) - an optional lower limit for the value
Overrides: Tkinter.BaseWidget.__init__

bind(self, sequence=None, func=None, add=None)

 

Bind to this widget at event SEQUENCE a call to function FUNC.

SEQUENCE is a string of concatenated event patterns. An event pattern is of the form <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4, Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3, B3, Alt, Button4, B4, Double, Button5, B5 Triple, Mod1, M1. TYPE is one of Activate, Enter, Map, ButtonPress, Button, Expose, Motion, ButtonRelease FocusIn, MouseWheel, Circulate, FocusOut, Property, Colormap, Gravity Reparent, Configure, KeyPress, Key, Unmap, Deactivate, KeyRelease Visibility, Destroy, Leave and DETAIL is the button number for ButtonPress, ButtonRelease and DETAIL is the Keysym for KeyPress and KeyRelease. Examples are <Control-Button-1> for pressing Control and mouse button 1 or <Alt-A> for pressing A and the Alt key (KeyPress can be omitted). An event pattern can also be a virtual event of the form <<AString>> where AString can be arbitrary. This event can be generated by event_generate. If events are concatenated they must appear shortly after each other.

FUNC will be called if the event sequence occurs with an instance of Event as argument. If the return value of FUNC is "break" no further bound function is invoked.

An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function.

Bind will return an identifier to allow deletion of the bound function with unbind without memory leak.

If FUNC or SEQUENCE is omitted the bound function or list of bound events are returned.

Overrides: Tkinter.Misc.bind
(inherited documentation)

get(self)

 
Returns: float
the current value displayed in the field
Raises:
  • ValueError - if the current value is not a valid number or is not within the specified limits

set(self, value)

 

Set the value displayed in the field

Parameters:
  • value (float) - the new value

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.IntEntry-class.html0000644000076600000240000003407511501734226027565 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.IntEntry
Package Scientific :: Package TkWidgets :: Class IntEntry
[frames] | no frames]

Class IntEntry

  Tkinter.Misc --+                
                 |                
Tkinter.BaseWidget --+            
                     |            
      Tkinter.Pack --+            
                     |            
     Tkinter.Place --+            
                     |            
      Tkinter.Grid --+            
                     |            
        Tkinter.Widget --+        
                         |        
             Tkinter.Frame --+    
                             |    
                    FloatEntry --+
                                 |
                                IntEntry

Entry field for integer numbers

A IntEntry widget consists of a label followed by a text entry field.

Nested Classes

Inherited from Tkinter.Misc: getdouble, getint

Instance Methods
int
get(self)
Returns: the current value displayed in the field

Inherited from FloatEntry: __init__, bind, set

Inherited from Tkinter.BaseWidget: destroy

Inherited from Tkinter.Misc: __getitem__, __setitem__, __str__, after, after_cancel, after_idle, bbox, bell, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, clipboard_get, colormodel, columnconfigure, config, configure, deletecommand, event_add, event_delete, event_generate, event_info, focus, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_location, grid_propagate, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, keys, lift, lower, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_propagate, pack_slaves, place_slaves, propagate, quit, register, rowconfigure, selection_clear, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, size, slaves, tk_bisque, tk_focusFollowsMouse, tk_focusNext, tk_focusPrev, tk_menuBar, tk_setPalette, tk_strictMotif, tkraise, unbind, unbind_all, unbind_class, update, update_idletasks, wait_variable, wait_visibility, wait_window, waitvar, winfo_atom, winfo_atomname, winfo_cells, winfo_children, winfo_class, winfo_colormapfull, winfo_containing, winfo_depth, winfo_exists, winfo_fpixels, winfo_geometry, winfo_height, winfo_id, winfo_interps, winfo_ismapped, winfo_manager, winfo_name, winfo_parent, winfo_pathname, winfo_pixels, winfo_pointerx, winfo_pointerxy, winfo_pointery, winfo_reqheight, winfo_reqwidth, winfo_rgb, winfo_rootx, winfo_rooty, winfo_screen, winfo_screencells, winfo_screendepth, winfo_screenheight, winfo_screenmmheight, winfo_screenmmwidth, winfo_screenvisual, winfo_screenwidth, winfo_server, winfo_toplevel, winfo_viewable, winfo_visual, winfo_visualid, winfo_visualsavailable, winfo_vrootheight, winfo_vrootwidth, winfo_vrootx, winfo_vrooty, winfo_width, winfo_x, winfo_y

Inherited from Tkinter.Pack: forget, info, pack, pack_configure, pack_forget, pack_info

Inherited from Tkinter.Place: place, place_configure, place_forget, place_info

Inherited from Tkinter.Grid: grid, grid_configure, grid_forget, grid_info, grid_remove, location

Class Variables

Inherited from Tkinter.Misc: _noarg_

Method Details

get(self)

 
Returns: int
the current value displayed in the field
Raises:
  • ValueError - if the current value is not a valid number or is not within the specified limits
Overrides: FloatEntry.get

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.ModalDialog-class.html0000644000076600000240000004352111501734226030161 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.ModalDialog
Package Scientific :: Package TkWidgets :: Class ModalDialog
[frames] | no frames]

Class ModalDialog

  Tkinter.Misc --+        
                 |        
Tkinter.BaseWidget --+    
                     |    
        Tkinter.Wm --+    
                     |    
      Tkinter.Toplevel --+
                         |
                        ModalDialog

Nested Classes

Inherited from Tkinter.Misc: getdouble, getint

Instance Methods
 
__init__(self, parent, title=None)
Construct a toplevel widget with the parent MASTER.
 
apply(self)
 
body(self, master)
 
buttonbox(self)
 
cancel(self, event=None)
 
ok(self, event=None)
 
validate(self)

Inherited from Tkinter.BaseWidget: destroy

Inherited from Tkinter.Misc: __getitem__, __setitem__, __str__, after, after_cancel, after_idle, bbox, bell, bind, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, clipboard_get, colormodel, columnconfigure, config, configure, deletecommand, event_add, event_delete, event_generate, event_info, focus, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_location, grid_propagate, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, keys, lift, lower, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_propagate, pack_slaves, place_slaves, propagate, quit, register, rowconfigure, selection_clear, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, size, slaves, tk_bisque, tk_focusFollowsMouse, tk_focusNext, tk_focusPrev, tk_menuBar, tk_setPalette, tk_strictMotif, tkraise, unbind, unbind_all, unbind_class, update, update_idletasks, wait_variable, wait_visibility, wait_window, waitvar, winfo_atom, winfo_atomname, winfo_cells, winfo_children, winfo_class, winfo_colormapfull, winfo_containing, winfo_depth, winfo_exists, winfo_fpixels, winfo_geometry, winfo_height, winfo_id, winfo_interps, winfo_ismapped, winfo_manager, winfo_name, winfo_parent, winfo_pathname, winfo_pixels, winfo_pointerx, winfo_pointerxy, winfo_pointery, winfo_reqheight, winfo_reqwidth, winfo_rgb, winfo_rootx, winfo_rooty, winfo_screen, winfo_screencells, winfo_screendepth, winfo_screenheight, winfo_screenmmheight, winfo_screenmmwidth, winfo_screenvisual, winfo_screenwidth, winfo_server, winfo_toplevel, winfo_viewable, winfo_visual, winfo_visualid, winfo_visualsavailable, winfo_vrootheight, winfo_vrootwidth, winfo_vrootx, winfo_vrooty, winfo_width, winfo_x, winfo_y

Inherited from Tkinter.Wm: aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, frame, geometry, grid, group, iconbitmap, iconify, iconmask, iconname, iconposition, iconwindow, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, state, title, transient, withdraw, wm_aspect, wm_attributes, wm_client, wm_colormapwindows, wm_command, wm_deiconify, wm_focusmodel, wm_frame, wm_geometry, wm_grid, wm_group, wm_iconbitmap, wm_iconify, wm_iconmask, wm_iconname, wm_iconposition, wm_iconwindow, wm_maxsize, wm_minsize, wm_overrideredirect, wm_positionfrom, wm_protocol, wm_resizable, wm_sizefrom, wm_state, wm_title, wm_transient, wm_withdraw

Class Variables

Inherited from Tkinter.Misc: _noarg_

Method Details

__init__(self, parent, title=None)
(Constructor)

 

Construct a toplevel widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, menu, relief, screen, takefocus, use, visual, width.

Overrides: Tkinter.BaseWidget.__init__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.StatusBar-class.html0000644000076600000240000003756311501734226027726 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.StatusBar
Package Scientific :: Package TkWidgets :: Class StatusBar
[frames] | no frames]

Class StatusBar

  Tkinter.Misc --+            
                 |            
Tkinter.BaseWidget --+        
                     |        
      Tkinter.Pack --+        
                     |        
     Tkinter.Place --+        
                     |        
      Tkinter.Grid --+        
                     |        
        Tkinter.Widget --+    
                         |    
             Tkinter.Frame --+
                             |
                            StatusBar

Status bar

A status bar can be used to inform the user about the status of an ongoing calculation. A message can be displayed with set() and removed with clear(). In both cases, the StatusBar object makes sure that the change takes place immediately. While a message is being displayed, the cursor form is changed to a watch.

Nested Classes

Inherited from Tkinter.Misc: getdouble, getint

Instance Methods
 
__init__(self, master)
Construct a frame widget with the parent MASTER.
 
clear(self)
Clear any message displayed in the status bar
 
set(self, text)
Set a message to be displayed in the status bar

Inherited from Tkinter.BaseWidget: destroy

Inherited from Tkinter.Misc: __getitem__, __setitem__, __str__, after, after_cancel, after_idle, bbox, bell, bind, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, clipboard_get, colormodel, columnconfigure, config, configure, deletecommand, event_add, event_delete, event_generate, event_info, focus, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_location, grid_propagate, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, keys, lift, lower, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_propagate, pack_slaves, place_slaves, propagate, quit, register, rowconfigure, selection_clear, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, size, slaves, tk_bisque, tk_focusFollowsMouse, tk_focusNext, tk_focusPrev, tk_menuBar, tk_setPalette, tk_strictMotif, tkraise, unbind, unbind_all, unbind_class, update, update_idletasks, wait_variable, wait_visibility, wait_window, waitvar, winfo_atom, winfo_atomname, winfo_cells, winfo_children, winfo_class, winfo_colormapfull, winfo_containing, winfo_depth, winfo_exists, winfo_fpixels, winfo_geometry, winfo_height, winfo_id, winfo_interps, winfo_ismapped, winfo_manager, winfo_name, winfo_parent, winfo_pathname, winfo_pixels, winfo_pointerx, winfo_pointerxy, winfo_pointery, winfo_reqheight, winfo_reqwidth, winfo_rgb, winfo_rootx, winfo_rooty, winfo_screen, winfo_screencells, winfo_screendepth, winfo_screenheight, winfo_screenmmheight, winfo_screenmmwidth, winfo_screenvisual, winfo_screenwidth, winfo_server, winfo_toplevel, winfo_viewable, winfo_visual, winfo_visualid, winfo_visualsavailable, winfo_vrootheight, winfo_vrootwidth, winfo_vrootx, winfo_vrooty, winfo_width, winfo_x, winfo_y

Inherited from Tkinter.Pack: forget, info, pack, pack_configure, pack_forget, pack_info

Inherited from Tkinter.Place: place, place_configure, place_forget, place_info

Inherited from Tkinter.Grid: grid, grid_configure, grid_forget, grid_info, grid_remove, location

Class Variables

Inherited from Tkinter.Misc: _noarg_

Method Details

__init__(self, master)
(Constructor)

 

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.

Parameters:
  • master - the parent widget
Overrides: Tkinter.BaseWidget.__init__

set(self, text)

 

Set a message to be displayed in the status bar

Parameters:
  • text - the text of the message

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkPlotCanvas-module.html0000644000076600000240000001537511501734226030544 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkPlotCanvas
Package Scientific :: Package TkWidgets :: Module TkPlotCanvas
[frames] | no frames]

Module TkPlotCanvas

Plot widget for Tk user interfaces

A plot widget acts like a canvas for special graphics objects that represent curves shown by lines or markers.

Note that this module is not meant to replace a full-featured plot program. It was designed to permit the simple integration of plots into Tk-based user interfaces.

Classes
  HorizontalLine
A horizontal line
  PlotCanvas
Tk plot widget
  PlotGraphics
Compound graphics object
  PolyLine
Multiple connected lines
  PolyMarker
Series of markers
  PolyPoints
  VerticalLine
A vertical line
ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkPlotCanvas.HorizontalLine-class.html0000644000076600000240000002506011501734226033314 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkPlotCanvas.HorizontalLine
Package Scientific :: Package TkWidgets :: Module TkPlotCanvas :: Class HorizontalLine
[frames] | no frames]

Class HorizontalLine

PolyPoints --+    
             |    
      PolyLine --+
                 |
                HorizontalLine

A horizontal line

Instance Methods
 
__init__(self, ypos, **attr)
 
draw(self, canvas, bbox)
 
writeToFile(self, file, separator)

Inherited from PolyPoints: boundingBox, scaleAndShift

Method Details

__init__(self, ypos, **attr)
(Constructor)

 
Parameters:
  • ypos (float) - the y coordinate of the line
  • attr - line attributes
  • width - the line width (default: 1)
  • color - a string whose value is one of the color names defined in Tk (default: "black")
  • stipple - a string whose value is the name of a bitmap defined in Tk, or None for no bitmap (default: None)
Overrides: PolyPoints.__init__

draw(self, canvas, bbox)

 
Overrides: PolyLine.draw

writeToFile(self, file, separator)

 
Overrides: PolyPoints.writeToFile

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkPlotCanvas.PlotCanvas-class.html0000644000076600000240000006175711501734226032442 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkPlotCanvas.PlotCanvas
Package Scientific :: Package TkWidgets :: Module TkPlotCanvas :: Class PlotCanvas
[frames] | no frames]

Class PlotCanvas

  Tkinter.Misc --+            
                 |            
Tkinter.BaseWidget --+        
                     |        
      Tkinter.Pack --+        
                     |        
     Tkinter.Place --+        
                     |        
      Tkinter.Grid --+        
                     |        
        Tkinter.Widget --+    
                         |    
             Tkinter.Frame --+
                             |
                            PlotCanvas

Tk plot widget

PlotCanvas objects support all operations of Tk widgets.

Nested Classes

Inherited from Tkinter.Misc: getdouble, getint

Instance Methods
 
__init__(self, master, width, height, background='white', font='-*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*', **attr)
Construct a frame widget with the parent MASTER.
 
bind(self, *args)
Bind to this widget at event SEQUENCE a call to function FUNC.
 
clear(self)
Clear the canvas
 
draw(self, graphics, xaxis=None, yaxis=None)
Draw something on the canvas
 
reconfigure(self, event)
 
redraw(self)
Redraw the most recent canvas contents
 
select(self, range)
Highlight a range on the x-axis

Inherited from Tkinter.BaseWidget: destroy

Inherited from Tkinter.Misc: __getitem__, __setitem__, __str__, after, after_cancel, after_idle, bbox, bell, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, clipboard_get, colormodel, columnconfigure, config, configure, deletecommand, event_add, event_delete, event_generate, event_info, focus, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_location, grid_propagate, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, keys, lift, lower, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_propagate, pack_slaves, place_slaves, propagate, quit, register, rowconfigure, selection_clear, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, size, slaves, tk_bisque, tk_focusFollowsMouse, tk_focusNext, tk_focusPrev, tk_menuBar, tk_setPalette, tk_strictMotif, tkraise, unbind, unbind_all, unbind_class, update, update_idletasks, wait_variable, wait_visibility, wait_window, waitvar, winfo_atom, winfo_atomname, winfo_cells, winfo_children, winfo_class, winfo_colormapfull, winfo_containing, winfo_depth, winfo_exists, winfo_fpixels, winfo_geometry, winfo_height, winfo_id, winfo_interps, winfo_ismapped, winfo_manager, winfo_name, winfo_parent, winfo_pathname, winfo_pixels, winfo_pointerx, winfo_pointerxy, winfo_pointery, winfo_reqheight, winfo_reqwidth, winfo_rgb, winfo_rootx, winfo_rooty, winfo_screen, winfo_screencells, winfo_screendepth, winfo_screenheight, winfo_screenmmheight, winfo_screenmmwidth, winfo_screenvisual, winfo_screenwidth, winfo_server, winfo_toplevel, winfo_viewable, winfo_visual, winfo_visualid, winfo_visualsavailable, winfo_vrootheight, winfo_vrootwidth, winfo_vrootx, winfo_vrooty, winfo_width, winfo_x, winfo_y

Inherited from Tkinter.Pack: forget, info, pack, pack_configure, pack_forget, pack_info

Inherited from Tkinter.Place: place, place_configure, place_forget, place_info

Inherited from Tkinter.Grid: grid, grid_configure, grid_forget, grid_info, grid_remove, location

Class Variables

Inherited from Tkinter.Misc: _noarg_

Method Details

__init__(self, master, width, height, background='white', font='-*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*', **attr)
(Constructor)

 

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.

Parameters:
  • master - the parent widget
  • width (int) - the initial width of the canvas
  • height (int) - the initial height of the canvas
  • background (str) - the background color
  • font (str) - the font used for the axis labels
  • attr - widget attributes
  • zoom (bool) - a flag that indicates whether interactive zooming (using the left mouse button) is enabled; the default is False (no zoom)
  • select - enables the user to select a range along the x axis by dragging the mouse (with the left button pressed) in the area under the x axis. If select is 0, no selection is possible. Otherwise the value of select must be a callable object that is called whenever the selection changes, with a single argument that can be None (no selection) or a tuple containing two x values.
Overrides: Tkinter.BaseWidget.__init__

bind(self, *args)

 

Bind to this widget at event SEQUENCE a call to function FUNC.

SEQUENCE is a string of concatenated event patterns. An event pattern is of the form <MODIFIER-MODIFIER-TYPE-DETAIL> where MODIFIER is one of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4, Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3, B3, Alt, Button4, B4, Double, Button5, B5 Triple, Mod1, M1. TYPE is one of Activate, Enter, Map, ButtonPress, Button, Expose, Motion, ButtonRelease FocusIn, MouseWheel, Circulate, FocusOut, Property, Colormap, Gravity Reparent, Configure, KeyPress, Key, Unmap, Deactivate, KeyRelease Visibility, Destroy, Leave and DETAIL is the button number for ButtonPress, ButtonRelease and DETAIL is the Keysym for KeyPress and KeyRelease. Examples are <Control-Button-1> for pressing Control and mouse button 1 or <Alt-A> for pressing A and the Alt key (KeyPress can be omitted). An event pattern can also be a virtual event of the form <<AString>> where AString can be arbitrary. This event can be generated by event_generate. If events are concatenated they must appear shortly after each other.

FUNC will be called if the event sequence occurs with an instance of Event as argument. If the return value of FUNC is "break" no further bound function is invoked.

An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will replace the previous function.

Bind will return an identifier to allow deletion of the bound function with unbind without memory leak.

If FUNC or SEQUENCE is omitted the bound function or list of bound events are returned.

Overrides: Tkinter.Misc.bind
(inherited documentation)

draw(self, graphics, xaxis=None, yaxis=None)

 

Draw something on the canvas

Parameters:
  • graphics - the graphics object (PolyLine, PolyMarker, or PlotGraphics) to be drawn
  • xaxis - None (no x-axis), "automatic" (automatic scaling), or a pair (x1, x2) defining the range of the x-axis
  • yaxis - None (no y-axis), "automatic" (automatic scaling), or a pair (y1, y2) defining the range of the y-axis

select(self, range)

 

Highlight a range on the x-axis

Parameters:
  • range - the range on the x-axis to be highlighted. It can be None (no selection) or a sequence of two values on the x-axis.

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkPlotCanvas.PlotGraphics-class.html0000644000076600000240000001732111501734226032753 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkPlotCanvas.PlotGraphics
Package Scientific :: Package TkWidgets :: Module TkPlotCanvas :: Class PlotGraphics
[frames] | no frames]

Class PlotGraphics

Compound graphics object

Instance Methods
 
__getitem__(self, item)
 
__init__(self, objects)
 
__len__(self)
Method Details

__init__(self, objects)
(Constructor)

 
Parameters:

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkPlotCanvas.PolyLine-class.html0000644000076600000240000002005211501734226032102 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkPlotCanvas.PolyLine
Package Scientific :: Package TkWidgets :: Module TkPlotCanvas :: Class PolyLine
[frames] | no frames]

Class PolyLine

PolyPoints --+
             |
            PolyLine
Known Subclasses:

Multiple connected lines

Instance Methods
 
__init__(self, points, **attr)

Inherited from PolyPoints: boundingBox, scaleAndShift, writeToFile

Method Details

__init__(self, points, **attr)
(Constructor)

 
Parameters:
  • points - any sequence of (x, y) number pairs
  • attr - line attributes
  • width - the line width (default: 1)
  • color - a string whose value is one of the color names defined in Tk (default: "black")
  • stipple - a string whose value is the name of a bitmap defined in Tk, or None for no bitmap (default: None)
Overrides: PolyPoints.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkPlotCanvas.PolyMarker-class.html0000644000076600000240000002144411501734226032442 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkPlotCanvas.PolyMarker
Package Scientific :: Package TkWidgets :: Module TkPlotCanvas :: Class PolyMarker
[frames] | no frames]

Class PolyMarker

PolyPoints --+
             |
            PolyMarker

Series of markers

Instance Methods
 
__init__(self, points, **attr)
 
draw(self, canvas, bbox)

Inherited from PolyPoints: boundingBox, scaleAndShift, writeToFile

Method Details

__init__(self, points, **attr)
(Constructor)

 
Parameters:
  • points - any sequence of (x, y) number pairs
  • attr - marker attributes
  • width - the line width for drawing the marker (default: 1)
  • color - a string whose value is one of the color names defined in Tk, defines the color of the line forming the marker (default: "black")
  • fillcolor - a string whose value is one of the color names defined in Tk, defines the color of the interior of the marker (default: "black")
  • marker - one of 'circle' (default), 'dot', 'square', 'triangle', 'triangle_down', 'cross', 'plus'
Overrides: PolyPoints.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkPlotCanvas.PolyPoints-class.html0000644000076600000240000001635311501734226032500 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkPlotCanvas.PolyPoints
Package Scientific :: Package TkWidgets :: Module TkPlotCanvas :: Class PolyPoints
[frames] | no frames]

Class PolyPoints

Known Subclasses:

Instance Methods
 
__init__(self, points, attr)
 
boundingBox(self)
 
scaleAndShift(self, scale=1, shift=0)
 
writeToFile(self, file, separator)
ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkPlotCanvas.VerticalLine-class.html0000644000076600000240000002503611501734226032737 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkPlotCanvas.VerticalLine
Package Scientific :: Package TkWidgets :: Module TkPlotCanvas :: Class VerticalLine
[frames] | no frames]

Class VerticalLine

PolyPoints --+    
             |    
      PolyLine --+
                 |
                VerticalLine

A vertical line

Instance Methods
 
__init__(self, xpos, **attr)
 
draw(self, canvas, bbox)
 
writeToFile(self, file, separator)

Inherited from PolyPoints: boundingBox, scaleAndShift

Method Details

__init__(self, xpos, **attr)
(Constructor)

 
Parameters:
  • xpos (float) - the x coordinate of the line
  • attr - line attributes
  • width - the line width (default: 1)
  • color - a string whose value is one of the color names defined in Tk (default: "black")
  • stipple - a string whose value is the name of a bitmap defined in Tk, or None for no bitmap (default: None)
Overrides: PolyPoints.__init__

draw(self, canvas, bbox)

 
Overrides: PolyLine.draw

writeToFile(self, file, separator)

 
Overrides: PolyPoints.writeToFile

ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkVisualizationCanvas-module.html0000644000076600000240000001346711501734226032467 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkVisualizationCanvas
Package Scientific :: Package TkWidgets :: Module TkVisualizationCanvas
[frames] | no frames]

Module TkVisualizationCanvas

3D wireframe canvas widget for Tk

This module provides a special widget for Tk user interfaces which permits the display of 3D wireframe structures with interactive manipulation.

Note that this widget can become sluggish if two many lines are to be displayed. An OpenGL widget should be used for serious visualization needs. The advantage of this module is that it requires no special graphics libraries in addition to Tk.

Classes
  PolyLine3D
Multiple connected lines
  VisualizationCanvas
Tk visualization widget
  VisualizationGraphics
Compound graphics object
././@LongLink0000000000000000000000000000014600000000000011216 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D-class.htm0000644000076600000240000001732511501734226034051 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D
Package Scientific :: Package TkWidgets :: Module TkVisualizationCanvas :: Class PolyLine3D
[frames] | no frames]

Class PolyLine3D

PolyPoints3D --+
               |
              PolyLine3D

Multiple connected lines

Instance Methods
 
__init__(self, points, **attr)
 
lines(self)

Inherited from PolyPoints3D: boundingBox, boundingBoxPlane, project, scaleAndShift

Method Details

__init__(self, points, **attr)
(Constructor)

 
Parameters:
  • points - any sequence of (x, y, z) coordinate triples
  • attr - line attributes
  • width (int) - line width (default: 1)
  • color (str) - a Tk color name (default: "black")
Overrides: PolyPoints3D.__init__

././@LongLink0000000000000000000000000000015700000000000011220 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas-0000644000076600000240000005705211501734226034310 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas
Package Scientific :: Package TkWidgets :: Module TkVisualizationCanvas :: Class VisualizationCanvas
[frames] | no frames]

Class VisualizationCanvas

  Tkinter.Misc --+            
                 |            
Tkinter.BaseWidget --+        
                     |        
      Tkinter.Pack --+        
                     |        
     Tkinter.Place --+        
                     |        
      Tkinter.Grid --+        
                     |        
        Tkinter.Widget --+    
                         |    
             Tkinter.Frame --+
                             |
                            VisualizationCanvas

Tk visualization widget

VisualizationCanvas objects support all operations of Tk widgets.

Interactive manipulation of the display is possible with click-and-drag operations. The left mouse button rotates the objects, the middle button translates it, and the right button scales it up or down.

Nested Classes

Inherited from Tkinter.Misc: getdouble, getint

Instance Methods
 
__init__(self, master, width, height, background='white', **attr)
Construct a frame widget with the parent MASTER.
 
clear(self, keepscale=0)
Clear the canvas
 
clickhandler1(self, event)
 
clickhandler2(self, event)
 
clickhandler3(self, event)
 
copyViewpointFrom(self, other)
 
draw(self, graphics)
Draw something on the canvas
 
reconfigure(self, event)
 
redraw(self)
 
releasehandler1(self, event)
 
releasehandler2(self, event)
 
releasehandler3(self, event)
 
setViewpoint(self, axis, plane, scale=None, translate=None)

Inherited from Tkinter.BaseWidget: destroy

Inherited from Tkinter.Misc: __getitem__, __setitem__, __str__, after, after_cancel, after_idle, bbox, bell, bind, bind_all, bind_class, bindtags, cget, clipboard_append, clipboard_clear, clipboard_get, colormodel, columnconfigure, config, configure, deletecommand, event_add, event_delete, event_generate, event_info, focus, focus_displayof, focus_force, focus_get, focus_lastfor, focus_set, getboolean, getvar, grab_current, grab_release, grab_set, grab_set_global, grab_status, grid_bbox, grid_columnconfigure, grid_location, grid_propagate, grid_rowconfigure, grid_size, grid_slaves, image_names, image_types, keys, lift, lower, mainloop, nametowidget, option_add, option_clear, option_get, option_readfile, pack_propagate, pack_slaves, place_slaves, propagate, quit, register, rowconfigure, selection_clear, selection_get, selection_handle, selection_own, selection_own_get, send, setvar, size, slaves, tk_bisque, tk_focusFollowsMouse, tk_focusNext, tk_focusPrev, tk_menuBar, tk_setPalette, tk_strictMotif, tkraise, unbind, unbind_all, unbind_class, update, update_idletasks, wait_variable, wait_visibility, wait_window, waitvar, winfo_atom, winfo_atomname, winfo_cells, winfo_children, winfo_class, winfo_colormapfull, winfo_containing, winfo_depth, winfo_exists, winfo_fpixels, winfo_geometry, winfo_height, winfo_id, winfo_interps, winfo_ismapped, winfo_manager, winfo_name, winfo_parent, winfo_pathname, winfo_pixels, winfo_pointerx, winfo_pointerxy, winfo_pointery, winfo_reqheight, winfo_reqwidth, winfo_rgb, winfo_rootx, winfo_rooty, winfo_screen, winfo_screencells, winfo_screendepth, winfo_screenheight, winfo_screenmmheight, winfo_screenmmwidth, winfo_screenvisual, winfo_screenwidth, winfo_server, winfo_toplevel, winfo_viewable, winfo_visual, winfo_visualid, winfo_visualsavailable, winfo_vrootheight, winfo_vrootwidth, winfo_vrootx, winfo_vrooty, winfo_width, winfo_x, winfo_y

Inherited from Tkinter.Pack: forget, info, pack, pack_configure, pack_forget, pack_info

Inherited from Tkinter.Place: place, place_configure, place_forget, place_info

Inherited from Tkinter.Grid: grid, grid_configure, grid_forget, grid_info, grid_remove, location

Class Variables

Inherited from Tkinter.Misc: _noarg_

Method Details

__init__(self, master, width, height, background='white', **attr)
(Constructor)

 

Construct a frame widget with the parent MASTER.

Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, highlightcolor, highlightthickness, relief, takefocus, visual, width.

Parameters:
  • master - the parent widget
  • width (int) - the initial width of the canvas
  • height (int) - the initial height of the canvas
  • background (str) - the background color
  • attr - widget attributes
Overrides: Tkinter.BaseWidget.__init__

draw(self, graphics)

 

Draw something on the canvas

Parameters:

././@LongLink0000000000000000000000000000016100000000000011213 Lustar 00000000000000ScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphics-class.htmlScientificPython-2.9.4/Doc/Reference/Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphic0000644000076600000240000001731011501734226034366 0ustar hinsenstaff00000000000000 Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphics
Package Scientific :: Package TkWidgets :: Module TkVisualizationCanvas :: Class VisualizationGraphics
[frames] | no frames]

Class VisualizationGraphics

Compound graphics object

Instance Methods
 
__getitem__(self, item)
 
__init__(self, objects)
 
__len__(self)
Method Details

__init__(self, objects)
(Constructor)

 
Parameters:

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization-module.html0000644000076600000240000001473111501734226027123 0ustar hinsenstaff00000000000000 Scientific.Visualization
Package Scientific :: Package Visualization
[frames] | no frames]

Package Visualization

Scientific visualization

The modules in this subpackage provide visualization of 3D objects using different backends (VRML, VMD, VPython), but with an almost identical interface. It is thus possible to write generic 3D graphics code in which the backend can be changed by modifying a single line of code.

The intended application of these modules is scientific visualization. Many sophisticated 3D objects are therefore absent, as are complex surface definitions such as textures.

Submodules

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.Color-module.html0000644000076600000240000002020411501734226030170 0ustar hinsenstaff00000000000000 Scientific.Visualization.Color
Package Scientific :: Package Visualization :: Module Color
[frames] | no frames]

Module Color

Color definitions for use in the modules VRML, VRML2, VMD, and PyMOL.

Classes
  Color
RGB Color specification
  ColorScale
Mapping from a number interval to a color range
  SymmetricColorScale
Mapping of a symmetric number interval to a color range
Functions
Color
ColorByName(name)
Returns: the color associated with name
Function Details

ColorByName(name)

 
Parameters:
  • name (str) - one of the predefined color names: black, white, grey, red, green, blue, yellow, magenta, cyan, orange, violet, olive, and brown. Any color can be prefixed by "light " or "dark " to yield a variant. The prefix must be separated from the color name by white space, e.g. "light green".
Returns: Color
the color associated with name
Raises:
  • KeyError - if the color name is not defined

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.Color.Color-class.html0000644000076600000240000002432711501734226031077 0ustar hinsenstaff00000000000000 Scientific.Visualization.Color.Color
Package Scientific :: Package Visualization :: Module Color :: Class Color
[frames] | no frames]

Class Color

RGB Color specification

Color objects can be added and multiplied with scalars.

Instance Methods
 
__add__(self, other)
 
__cmp__(self, other)
 
__hash__(self)
 
__init__(self, rgb)
 
__mul__(self, scale)
 
__repr__(self)
 
__rmul__(self, scale)
 
__str__(self)
Method Details

__init__(self, rgb)
(Constructor)

 
Parameters:
  • rgb (int or float) - a sequence of three numbers between zero and one, specifying the intensities of red, green, and blue.

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.Color.ColorScale-class.html0000644000076600000240000002044411501734226032043 0ustar hinsenstaff00000000000000 Scientific.Visualization.Color.ColorScale
Package Scientific :: Package Visualization :: Module Color :: Class ColorScale
[frames] | no frames]

Class ColorScale

Mapping from a number interval to a color range

The color scale is blue - green - yellow - orange - red.

Instance Methods
Color
__call__(self, value)
Returns: the color corresponding to value
 
__init__(self, range)
Method Details

__call__(self, value)
(Call operator)

 
Parameters:
  • value (float) - the value within the range for which the color is requested. If the value is outside of the specified range, the edge of the range is used instead.
Returns: Color
the color corresponding to value

__init__(self, range)
(Constructor)

 
Parameters:
  • range (float or tuple) - a tuple of two numbers (the center of the interval and its width), or a single number specifying the width for a default center of zero

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.Color.SymmetricColorScale-class.html0000644000076600000240000002101211501734226033730 0ustar hinsenstaff00000000000000 Scientific.Visualization.Color.SymmetricColorScale
Package Scientific :: Package Visualization :: Module Color :: Class SymmetricColorScale
[frames] | no frames]

Class SymmetricColorScale

Mapping of a symmetric number interval to a color range

The colors are red for negative numbers and green for positive numbers, with a color intensity proportional to the absolute value of the argument. Zero is mapped to white.

Instance Methods
Color
__call__(self, value)
Returns: the color corresponding to value
 
__init__(self, max, n=20)
Method Details

__call__(self, value)
(Call operator)

 
Parameters:
  • value (float) - the value within the range for which the color is requested. If the value is outside of the specified range, the edge of the range is used instead.
Returns: Color
the color corresponding to value

__init__(self, max, n=20)
(Constructor)

 
Parameters:
  • max (float) - a positive number defining the range, which is from -max to +max.

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL-module.html0000644000076600000240000003261411501734226030062 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL
Package Scientific :: Package Visualization :: Module PyMOL
[frames] | no frames]

Module PyMOL

Definitions of simple 3D graphics objects and scenes containing them, in a form that can be fed to the molecular visualization program PyMOL

Scripts that use this module, directly or indirectly, must be run from inside PyMOL, otherwise they will terminate with an error message.

This module is almost compatible with the modules VRML and VRML2, which provide visualization by VRML browsers. There are no Polygon objects, and the only material attribute supported is diffuse_color.

Example:

 >>> from Scientific.Visualization.PyMOL import *
 >>> scene = Scene([])
 >>> scale = ColorScale(10.)
 >>> for x in range(11):
 >>>     color = scale(x)
 >>>     scene.addObject(Cube(Vector(x, 0., 0.), 0.2,
 >>>                          material=Material(diffuse_color = color)))
 >>> scene.view()
Classes
  Arrow
Arrow
  Cone
Cone
  Cube
Cube
  Cylinder
Cylinder
  Group
Base class for composite objects
  Line
Line
  Material
Material specification for graphics objects
  Molecules
Molecules from a PDB file
  PyMOLObject
Graphics object for PyMOL
  Scene
PyMOL scene
  ShapeObject
Graphics objects representing geometrical shapes
  Sphere
Sphere
Functions
Material
DiffuseMaterial(color)
Returns: a material with the 'diffuse color' attribute set to color
Material
EmissiveMaterial(color)
Returns: a material with the 'diffuse color' attribute set to color
 
isGroup(x)
Function Details

DiffuseMaterial(color)

 
Parameters:
  • color (Color or str) - a color object or a predefined color name
Returns: Material
a material with the 'diffuse color' attribute set to color

EmissiveMaterial(color)

 
Parameters:
  • color (Color or str) - a color object or a predefined color name
Returns: Material
a material with the 'diffuse color' attribute set to color

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.Arrow-class.html0000644000076600000240000002132311501734226030766 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.Arrow
Package Scientific :: Package Visualization :: Module PyMOL :: Class Arrow
[frames] | no frames]

Class Arrow

Group --+
        |
       Arrow

Arrow

An arrow consists of a cylinder and a cone.

Instance Methods
 
__init__(self, point1, point2, radius, **attr)

Inherited from Group: __add__, __coerce__, __getitem__, __len__, getPymolObjects

Class Variables

Inherited from Group: is_group

Method Details

__init__(self, point1, point2, radius, **attr)
(Constructor)

 
Parameters:
Overrides: Group.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.Cone-class.html0000644000076600000240000002420611501734226030563 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.Cone
Package Scientific :: Package Visualization :: Module PyMOL :: Class Cone
[frames] | no frames]

Class Cone

PyMOLObject --+    
              |    
    ShapeObject --+
                  |
                 Cone

Cone

Instance Methods
 
__init__(self, point1, point2, radius, face=True, **attr)
 
cgoObjects(self, material)

Inherited from ShapeObject: __add__, getPymolObjects, use

Inherited from PyMOLObject: __copy__, __getitem__, __setitem__, writeToFile

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, radius, face=True, **attr)
(Constructor)

 
Parameters:
  • point1 (Scientific.Geometry.Vector) - the tip of the cone
  • point2 (Scientific.Geometry.Vector) - end point of the cone axis
  • radius (positive number) - the radius at the base
  • face (bool) - a boolean flag, specifying if the circular bottom is visible
  • attr - graphics attributes as keyword parameters
Overrides: PyMOLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.Cube-class.html0000644000076600000240000002313211501734226030552 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.Cube
Package Scientific :: Package Visualization :: Module PyMOL :: Class Cube
[frames] | no frames]

Class Cube

PyMOLObject --+    
              |    
    ShapeObject --+
                  |
                 Cube

Cube

The edges of a cube are always parallel to the coordinate axes.

Instance Methods
 
__init__(self, center, edge, **attr)
 
cgoObjects(self, material)

Inherited from ShapeObject: __add__, getPymolObjects, use

Inherited from PyMOLObject: __copy__, __getitem__, __setitem__, writeToFile

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, center, edge, **attr)
(Constructor)

 
Parameters:
  • center (Scientific.Geometry.Vector) - the center of the sphere
  • edge (positive number) - the length of an edge
  • attr - graphics attributes as keyword parameters
Overrides: PyMOLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.Cylinder-class.html0000644000076600000240000002513211501734226031447 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.Cylinder
Package Scientific :: Package Visualization :: Module PyMOL :: Class Cylinder
[frames] | no frames]

Class Cylinder

PyMOLObject --+    
              |    
    ShapeObject --+
                  |
                 Cylinder

Cylinder

Instance Methods
 
__init__(self, point1, point2, radius, faces=(True, True, True), **attr)
 
cgoObjects(self, material)

Inherited from ShapeObject: __add__, getPymolObjects, use

Inherited from PyMOLObject: __copy__, __getitem__, __setitem__, writeToFile

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, radius, faces=(True, True, True), **attr)
(Constructor)

 
Parameters:
  • point1 (Scientific.Geometry.Vector) - first end point of the cylinder axis
  • point2 (Scientific.Geometry.Vector) - second end point of the cylinder axis
  • radius (positive number) - the cylinder radius
  • faces - a sequence of three boolean flags, corresponding to the cylinder hull and the two circular end pieces, specifying for each of these parts whether it is visible or not
  • attr - graphics attributes as keyword parameters
Overrides: PyMOLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.Group-class.html0000644000076600000240000002126311501734226030773 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.Group
Package Scientific :: Package Visualization :: Module PyMOL :: Class Group
[frames] | no frames]

Class Group

Known Subclasses:

Base class for composite objects

Instance Methods
 
__add__(self, other)
 
__coerce__(self, other)
 
__getitem__(self, item)
 
__init__(self, objects, **attr)
 
__len__(self)
 
getPymolObjects(self)
Class Variables
  is_group = 1
ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.Line-class.html0000644000076600000240000002314011501734226030562 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.Line
Package Scientific :: Package Visualization :: Module PyMOL :: Class Line
[frames] | no frames]

Class Line

PyMOLObject --+    
              |    
    ShapeObject --+
                  |
                 Line

Line

Instance Methods
 
__init__(self, point1, point2, **attr)
 
cgoObjects(self, material)

Inherited from ShapeObject: __add__, getPymolObjects, use

Inherited from PyMOLObject: __copy__, __getitem__, __setitem__, writeToFile

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, **attr)
(Constructor)

 
Parameters:
Overrides: PyMOLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.Material-class.html0000644000076600000240000002770711501734226031446 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.Material
Package Scientific :: Package Visualization :: Module PyMOL :: Class Material
[frames] | no frames]

Class Material

PyMOLObject --+
              |
             Material

Material specification for graphics objects

A material defines the color and surface properties of an object.

For compatibility with the module Scientific.Visualization.VRML, many material attributes are accepted but not used in any way.

Instance Methods
 
__init__(self, **attr)
 
getRGB(self)

Inherited from PyMOLObject: __copy__, __getitem__, __setitem__, getPymolObjects, writeToFile

Class Variables
  attribute_names = ['comment', 'ambient_color', 'diffuse_color'...
Method Details

__init__(self, **attr)
(Constructor)

 
Parameters:
  • attr - material attributes as keyword arguments
  • diffuse_color (Color) - the color of a diffusely reflecting surface
  • emissive_color - not used
  • ambient_color - not used
  • specular_color - not used
  • shininess - not used
  • transparency - not used
Overrides: PyMOLObject.__init__

Class Variable Details

attribute_names

Value:
['comment',
 'ambient_color',
 'diffuse_color',
 'specular_color',
 'emissive_color',
 'shininess',
 'transparency']

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.Molecules-class.html0000644000076600000240000002303311501734226031624 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.Molecules
Package Scientific :: Package Visualization :: Module PyMOL :: Class Molecules
[frames] | no frames]

Class Molecules

PyMOLObject --+
              |
             Molecules

Molecules from a PDB file

Instance Methods
 
__init__(self, filename, **attr)
 
getPymolObjects(self)
Returns: a list of pymol.cgo objects

Inherited from PyMOLObject: __copy__, __getitem__, __setitem__, writeToFile

Class Variables

Inherited from PyMOLObject: attribute_names

Method Details

__init__(self, filename, **attr)
(Constructor)

 
Parameters:
  • filename (str) - the name of a PDB file
  • attr - keyword attributes
Overrides: PyMOLObject.__init__

getPymolObjects(self)

 
Returns:
a list of pymol.cgo objects
Overrides: PyMOLObject.getPymolObjects
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.PyMOLObject-class.html0000644000076600000240000003236311501734226031771 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.PyMOLObject
Package Scientific :: Package Visualization :: Module PyMOL :: Class PyMOLObject
[frames] | no frames]

Class PyMOLObject

Known Subclasses:

Graphics object for PyMOL

This is an abstract base class. Use one of the subclasses to generate graphics.

Instance Methods
 
__copy__(self)
 
__getitem__(self, attr)
Returns: the value of the attribute, or None if the attribute is undefined
 
__init__(self, attr)
 
__setitem__(self, attr, value)
 
getPymolObjects(self)
Returns: a list of pymol.cgo objects
 
writeToFile(self, file)
Class Variables
  attribute_names = ['comment']
Method Details

__getitem__(self, attr)
(Indexing operator)

 
Parameters:
  • attr (str) - the name of a graphics attribute
Returns:
the value of the attribute, or None if the attribute is undefined

__init__(self, attr)
(Constructor)

 
Parameters:
  • attr - graphics attributes specified by keywords
  • material (Material) - color and surface properties

__setitem__(self, attr, value)
(Index assignment operator)

 
Parameters:
  • attr (str) - the name of a graphics attribute
  • value - a new value for the attribute

getPymolObjects(self)

 
Returns:
a list of pymol.cgo objects

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.Scene-class.html0000644000076600000240000003463311501734226030741 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.Scene
Package Scientific :: Package Visualization :: Module PyMOL :: Class Scene
[frames] | no frames]

Class Scene

PyMOL scene

A PyMOL scene is a collection of graphics objects that can be loaded into PyMOL.

Instance Methods
PyMOLObject
__getitem__(self, item)
Returns: the graphics object at the index position
 
__init__(self, objects=None, **options)
int
__len__(self)
Returns: the number of graphics objects in the scene
 
addObject(self, object)
 
view(self, name='external graphics')
Load the scene into PyMOL
 
writeToFile(self, filename, delete=0)
File I/O is not supported for PyMOL
Method Details

__getitem__(self, item)
(Indexing operator)

 
Parameters:
  • item (int) - an index
Returns: PyMOLObject
the graphics object at the index position

__init__(self, objects=None, **options)
(Constructor)

 
Parameters:
  • objects (list or NoneType) - a list of graphics objects, or None for an empty scene
  • options - options as keyword arguments. This is provided for compatibility only, no options have any effect for PyMOL graphics.

__len__(self)
(Length operator)

 
Returns: int
the number of graphics objects in the scene

addObject(self, object)

 
Parameters:
  • object (PyMOLObject) - a graphics object to be added to the scene

view(self, name='external graphics')

 

Load the scene into PyMOL

Parameters:
  • name - the name of the PyMOL object corresponding to the scene

writeToFile(self, filename, delete=0)

 

File I/O is not supported for PyMOL

Raises:
  • ValueError - always

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.ShapeObject-class.html0000644000076600000240000002372611501734226032074 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.ShapeObject
Package Scientific :: Package Visualization :: Module PyMOL :: Class ShapeObject
[frames] | no frames]

Class ShapeObject

PyMOLObject --+
              |
             ShapeObject
Known Subclasses:

Graphics objects representing geometrical shapes

This is an abstract base class. Use one of the subclasses to generate graphics.

Instance Methods
 
__add__(self, other)
 
getPymolObjects(self)
Returns: a list of pymol.cgo objects
 
use(self, file)

Inherited from PyMOLObject: __copy__, __getitem__, __init__, __setitem__, writeToFile

Class Variables
  attribute_names = ['comment', 'material']
Method Details

getPymolObjects(self)

 
Returns:
a list of pymol.cgo objects
Overrides: PyMOLObject.getPymolObjects
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.PyMOL.Sphere-class.html0000644000076600000240000002304111501734226031121 0ustar hinsenstaff00000000000000 Scientific.Visualization.PyMOL.Sphere
Package Scientific :: Package Visualization :: Module PyMOL :: Class Sphere
[frames] | no frames]

Class Sphere

PyMOLObject --+    
              |    
    ShapeObject --+
                  |
                 Sphere

Sphere

Instance Methods
 
__init__(self, center, radius, **attr)
 
cgoObjects(self, material)

Inherited from ShapeObject: __add__, getPymolObjects, use

Inherited from PyMOLObject: __copy__, __getitem__, __setitem__, writeToFile

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, center, radius, **attr)
(Constructor)

 
Parameters:
  • center (Scientific.Geometry.Vector) - the center of the sphere
  • radius (positive number) - the sphere radius
  • attr - graphics attributes as keyword parameters
Overrides: PyMOLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD-module.html0000644000076600000240000003570411501734226027553 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD
Package Scientific :: Package Visualization :: Module VMD
[frames] | no frames]

Module VMD

Definitions of simple 3D graphics objects and scenes containing them, in a form that can be fed to the molecular visualization program VMD

Scenes can either be written as VMD script files, or visualized directly by running VMD.

This module is almost compatible with the modules VRML and VRML2, which provide visualization by VRML browsers. There is no Polygon class, and the only material attribute supported is diffuse_color. Note also that loading a scene with many cubes into VMD is very slow, because each cube is represented by 12 individual triangles.

Example:

 >>> from VMD import *    
 >>> scene = Scene([])
 >>> scale = ColorScale(10.)
 >>> for x in range(11):
 >>>     color = scale(x)
 >>>     scene.addObject(Cube(Vector(x, 0., 0.), 0.2,
 >>>                          material=Material(diffuse_color = color)))
 >>> scene.view()
Classes
  Arrow
Arrow
  Cone
Cone
  Cube
Cube
  Cylinder
Cylinder
  Group
Base class for composite objects
  Line
Line
  Material
Material specification for graphics objects
  Molecules
Molecules from a PDB file
  Scene
VMD scene
  SceneFile
  ShapeObject
Graphics objects representing geometrical shapes
  Sphere
Sphere
  VMDObject
Graphics object for VMD
Functions
Material
DiffuseMaterial(color)
Returns: a material with the 'diffuse color' attribute set to color
Material
EmissiveMaterial(color)
Returns: a material with the 'diffuse color' attribute set to color
 
isGroup(x)
Variables
  ex = Vector(1.000000,0.000000,0.000000)
  ey = Vector(0.000000,1.000000,0.000000)
  ez = Vector(0.000000,0.000000,1.000000)
Function Details

DiffuseMaterial(color)

 
Parameters:
  • color (Color or str) - a color object or a predefined color name
Returns: Material
a material with the 'diffuse color' attribute set to color

EmissiveMaterial(color)

 
Parameters:
  • color (Color or str) - a color object or a predefined color name
Returns: Material
a material with the 'diffuse color' attribute set to color

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.Arrow-class.html0000644000076600000240000002125511501734226030460 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.Arrow
Package Scientific :: Package Visualization :: Module VMD :: Class Arrow
[frames] | no frames]

Class Arrow

Group --+
        |
       Arrow

Arrow

An arrow consists of a cylinder and a cone.

Instance Methods
 
__init__(self, point1, point2, radius, **attr)

Inherited from Group: __add__, __coerce__, __getitem__, __len__, writeToFile

Class Variables

Inherited from Group: is_group

Method Details

__init__(self, point1, point2, radius, **attr)
(Constructor)

 
Parameters:
Overrides: Group.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.Cone-class.html0000644000076600000240000002372611501734226030257 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.Cone
Package Scientific :: Package Visualization :: Module VMD :: Class Cone
[frames] | no frames]

Class Cone

VMDObject --+    
            |    
  ShapeObject --+
                |
               Cone

Cone

Instance Methods
 
__init__(self, point1, point2, radius, face=1, **attr)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VMDObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, radius, face=1, **attr)
(Constructor)

 
Parameters:
  • point1 (Scientific.Geometry.Vector) - the tip of the cone
  • point2 (Scientific.Geometry.Vector) - end point of the cone axis
  • radius (positive number) - the radius at the base
  • face (bool) - a boolean flag, specifying if the circular bottom is visible
  • attr - graphics attributes as keyword parameters
Overrides: VMDObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.Cube-class.html0000644000076600000240000002266011501734226030245 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.Cube
Package Scientific :: Package Visualization :: Module VMD :: Class Cube
[frames] | no frames]

Class Cube

VMDObject --+    
            |    
  ShapeObject --+
                |
               Cube

Cube

The edges of a cube are always parallel to the coordinate axes.

Instance Methods
 
__init__(self, center, edge, **attr)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VMDObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, center, edge, **attr)
(Constructor)

 
Parameters:
  • center (Scientific.Geometry.Vector) - the center of the sphere
  • edge (positive number) - the length of an edge
  • attr - graphics attributes as keyword parameters
Overrides: VMDObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.Cylinder-class.html0000644000076600000240000002463611501734226031145 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.Cylinder
Package Scientific :: Package Visualization :: Module VMD :: Class Cylinder
[frames] | no frames]

Class Cylinder

VMDObject --+    
            |    
  ShapeObject --+
                |
               Cylinder

Cylinder

Instance Methods
 
__init__(self, point1, point2, radius, faces=(1, 1, 1), **attr)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VMDObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, radius, faces=(1, 1, 1), **attr)
(Constructor)

 
Parameters:
  • point1 (Scientific.Geometry.Vector) - first end point of the cylinder axis
  • point2 (Scientific.Geometry.Vector) - second end point of the cylinder axis
  • radius (positive number) - the cylinder radius
  • faces - a sequence of three boolean flags, corresponding to the cylinder hull and the two circular end pieces, specifying for each of these parts whether it is visible or not
  • attr - graphics attributes as keyword parameters
Overrides: VMDObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.Group-class.html0000644000076600000240000002132411501734226030457 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.Group
Package Scientific :: Package Visualization :: Module VMD :: Class Group
[frames] | no frames]

Class Group

Known Subclasses:

Base class for composite objects

Instance Methods
 
__add__(self, other)
 
__coerce__(self, other)
 
__getitem__(self, item)
 
__init__(self, objects, **attr)
 
__len__(self)
 
writeToFile(self, file)
Class Variables
  is_group = 1
ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.Line-class.html0000644000076600000240000002266611501734226030264 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.Line
Package Scientific :: Package Visualization :: Module VMD :: Class Line
[frames] | no frames]

Class Line

VMDObject --+    
            |    
  ShapeObject --+
                |
               Line

Line

Instance Methods
 
__init__(self, point1, point2, **attr)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VMDObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, **attr)
(Constructor)

 
Parameters:
Overrides: VMDObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.Material-class.html0000644000076600000240000003067411501734226031131 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.Material
Package Scientific :: Package Visualization :: Module VMD :: Class Material
[frames] | no frames]

Class Material

VMDObject --+
            |
           Material

Material specification for graphics objects

A material defines the color and surface properties of an object.

For compatibility with the module Scientific.Visualization.VRML, many material attributes are accepted but not used in any way.

Instance Methods
 
__init__(self, **attr)
 
writeToFile(self, file)

Inherited from VMDObject: __copy__, __getitem__, __setitem__

Class Variables
  attribute_names = ['comment', 'ambient_color', 'diffuse_color'...
Method Details

__init__(self, **attr)
(Constructor)

 
Parameters:
  • attr - material attributes as keyword arguments
  • diffuse_color (Color) - the color of a diffusely reflecting surface
  • emissive_color - not used
  • ambient_color - not used
  • specular_color - not used
  • shininess - not used
  • transparency - not used
Overrides: VMDObject.__init__

writeToFile(self, file)

 
Overrides: VMDObject.writeToFile

Class Variable Details

attribute_names

Value:
['comment',
 'ambient_color',
 'diffuse_color',
 'specular_color',
 'emissive_color',
 'shininess',
 'transparency']

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.Molecules-class.html0000644000076600000240000002240111501734226031310 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.Molecules
Package Scientific :: Package Visualization :: Module VMD :: Class Molecules
[frames] | no frames]

Class Molecules

VMDObject --+
            |
           Molecules

Molecules from a PDB file

Instance Methods
 
__init__(self, object, **attr)
 
writeToFile(self, file)

Inherited from VMDObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from VMDObject: attribute_names

Method Details

__init__(self, object, **attr)
(Constructor)

 
Parameters:
  • object (str or MMTK.ChemicalObject) - the name of a PDB file or an MMTK object
  • attr - keyword attributes
Overrides: VMDObject.__init__

writeToFile(self, file)

 
Overrides: VMDObject.writeToFile

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.Scene-class.html0000644000076600000240000003463411501734226030430 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.Scene
Package Scientific :: Package Visualization :: Module VMD :: Class Scene
[frames] | no frames]

Class Scene

VMD scene

A VMD scene is a collection of graphics objects that can be loaded into VMD.

Instance Methods
VMDObject
__getitem__(self, item)
Returns: the graphics object at the index position
 
__init__(self, objects=None, **options)
int
__len__(self)
Returns: the number of graphics objects in the scene
 
addObject(self, object)
 
view(self, *args)
Start VMD and load the scene
 
writeToFile(self, filename, delete=False)
Write the scene to a VMD script file
Method Details

__getitem__(self, item)
(Indexing operator)

 
Parameters:
  • item (int) - an index
Returns: VMDObject
the graphics object at the index position

__init__(self, objects=None, **options)
(Constructor)

 
Parameters:
  • objects (list or NoneType) - a list of graphics objects, or None for an empty scene
  • options - options as keyword arguments
  • scale (positive number) - a scale factor applied to all coordinates of geometrical objects except for molecule objects, which cannot be scaled

__len__(self)
(Length operator)

 
Returns: int
the number of graphics objects in the scene

addObject(self, object)

 
Parameters:
  • object (VMDObject) - a graphics object to be added to the scene

view(self, *args)

 

Start VMD and load the scene

Parameters:
  • args - not used, for compatibility with VRML modules only

writeToFile(self, filename, delete=False)

 

Write the scene to a VMD script file

Parameters:
  • filename (str) - the name of the script
  • delete (bool) - flag that indicates whether the script should delete itself as its last action; used for temporary files

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.SceneFile-class.html0000644000076600000240000002024711501734226031223 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.SceneFile
Package Scientific :: Package Visualization :: Module VMD :: Class SceneFile
[frames] | no frames]

Class SceneFile

Instance Methods
 
__del__(self)
 
__init__(self, filename, mode='r', scale=1.0, delete=False)
 
close(self)
 
write(self, object)
 
writeString(self, data)
 
writeVector(self, v)
ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.ShapeObject-class.html0000644000076600000240000002650411501734226031557 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.ShapeObject
Package Scientific :: Package Visualization :: Module VMD :: Class ShapeObject
[frames] | no frames]

Class ShapeObject

VMDObject --+
            |
           ShapeObject
Known Subclasses:

Graphics objects representing geometrical shapes

This is an abstract base class. Use one of the subclasses to generate graphics.

Instance Methods
 
__add__(self, other)
 
__init__(self, attr)
 
use(self, file)
 
writeToFile(self, file)

Inherited from VMDObject: __copy__, __getitem__, __setitem__

Class Variables
  attribute_names = ['comment', 'material']
Method Details

__init__(self, attr)
(Constructor)

 
Parameters:
  • attr - graphics attributes specified by keywords
  • material - color and surface properties
  • comment - a comment that is written to the script file
Overrides: VMDObject.__init__
(inherited documentation)

writeToFile(self, file)

 
Overrides: VMDObject.writeToFile

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.Sphere-class.html0000644000076600000240000002256711501734226030623 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.Sphere
Package Scientific :: Package Visualization :: Module VMD :: Class Sphere
[frames] | no frames]

Class Sphere

VMDObject --+    
            |    
  ShapeObject --+
                |
               Sphere

Sphere

Instance Methods
 
__init__(self, center, radius, **attr)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VMDObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, center, radius, **attr)
(Constructor)

 
Parameters:
  • center (Scientific.Geometry.Vector) - the center of the sphere
  • radius (positive number) - the sphere radius
  • attr - graphics attributes as keyword parameters
Overrides: VMDObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VMD.VMDObject-class.html0000644000076600000240000003016511501734226031143 0ustar hinsenstaff00000000000000 Scientific.Visualization.VMD.VMDObject
Package Scientific :: Package Visualization :: Module VMD :: Class VMDObject
[frames] | no frames]

Class VMDObject

Known Subclasses:

Graphics object for VMD

This is an abstract base class. Use one of the subclasses to generate graphics.

Instance Methods
 
__copy__(self)
 
__getitem__(self, attr)
Returns: the value of the attribute, or None if the attribute is undefined
 
__init__(self, attr)
 
__setitem__(self, attr, value)
 
writeToFile(self, file)
Class Variables
  attribute_names = ['comment']
Method Details

__getitem__(self, attr)
(Indexing operator)

 
Parameters:
  • attr (str) - the name of a graphics attribute
Returns:
the value of the attribute, or None if the attribute is undefined

__init__(self, attr)
(Constructor)

 
Parameters:
  • attr - graphics attributes specified by keywords
  • material (Material) - color and surface properties
  • comment (str) - a comment that is written to the script file

__setitem__(self, attr, value)
(Index assignment operator)

 
Parameters:
  • attr (str) - the name of a graphics attribute
  • value - a new value for the attribute

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython-module.html0000644000076600000240000003164411501734226030533 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython
Package Scientific :: Package Visualization :: Module VPython
[frames] | no frames]

Module VPython

Definitions of simple 3D graphics objects and scenes containing them, to be rendered using VPython

Classes
  Arrow
Arrow
  Cone
Cone
  Cube
Cube
  Cylinder
Cylinder
  GraphicsObject
Graphics object for VPython
  Group
Base class for composite objects
  Line
Line
  Material
Material specification for graphics objects
  PolyLines
Multiple connected lines
  Polygons
Polygons
  Scene
VPython scene
  ShapeObject
Graphics objects representing geometrical shapes
  Sphere
Sphere
Functions
Material
DiffuseMaterial(color)
Returns: a material with the 'diffuse color' attribute set to color
Material
EmissiveMaterial(color)
Returns: a material with the 'emissive color' attribute set to color
 
isGroup(x)
Function Details

DiffuseMaterial(color)

 
Parameters:
  • color (Color or str) - a color object or a predefined color name
Returns: Material
a material with the 'diffuse color' attribute set to color

EmissiveMaterial(color)

 
Parameters:
  • color (Color or str) - a color object or a predefined color name
Returns: Material
a material with the 'emissive color' attribute set to color

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.Arrow-class.html0000644000076600000240000002324411501734226031441 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.Arrow
Package Scientific :: Package Visualization :: Module VPython :: Class Arrow
[frames] | no frames]

Class Arrow

GraphicsObject --+    
                 |    
       ShapeObject --+
                     |
                    Arrow

Arrow

Instance Methods
 
__init__(self, point1, point2, radius, **attr)
 
show(self, window)

Inherited from ShapeObject: __add__, display

Inherited from GraphicsObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, radius, **attr)
(Constructor)

 
Parameters:
Overrides: GraphicsObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.Cone-class.html0000644000076600000240000002464311501734226031237 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.Cone
Package Scientific :: Package Visualization :: Module VPython :: Class Cone
[frames] | no frames]

Class Cone

GraphicsObject --+    
                 |    
       ShapeObject --+
                     |
                    Cone

Cone

Instance Methods
 
__init__(self, point1, point2, radius, face=1, **attr)
 
show(self, window)

Inherited from ShapeObject: __add__, display

Inherited from GraphicsObject: __copy__, __getitem__, __setitem__

Class Variables
  attribute_names = ['comment', 'material', 'face']
Method Details

__init__(self, point1, point2, radius, face=1, **attr)
(Constructor)

 
Parameters:
  • point1 (Scientific.Geometry.Vector) - the tip of the cone
  • point2 (Scientific.Geometry.Vector) - end point of the cone axis
  • radius (positive number) - the radius at the base
  • face (bool) - a boolean flag, specifying if the circular bottom is visible
  • attr - graphics attributes as keyword parameters
Overrides: GraphicsObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.Cube-class.html0000644000076600000240000002266511501734227031234 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.Cube
Package Scientific :: Package Visualization :: Module VPython :: Class Cube
[frames] | no frames]

Class Cube

GraphicsObject --+    
                 |    
       ShapeObject --+
                     |
                    Cube

Cube

The edges of a cube are always parallel to the coordinate axes.

Instance Methods
 
__init__(self, center, edge, **attr)
 
show(self, window)

Inherited from ShapeObject: __add__, display

Inherited from GraphicsObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, center, edge, **attr)
(Constructor)

 
Parameters:
  • center (Scientific.Geometry.Vector) - the center of the sphere
  • edge (positive number) - the length of an edge
  • attr - graphics attributes as keyword parameters
Overrides: GraphicsObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.Cylinder-class.html0000644000076600000240000002423111501734226032115 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.Cylinder
Package Scientific :: Package Visualization :: Module VPython :: Class Cylinder
[frames] | no frames]

Class Cylinder

GraphicsObject --+    
                 |    
       ShapeObject --+
                     |
                    Cylinder

Cylinder

Instance Methods
 
__init__(self, point1, point2, radius, **attr)
 
show(self, window)

Inherited from ShapeObject: __add__, display

Inherited from GraphicsObject: __copy__, __getitem__, __setitem__

Class Variables
  attribute_names = ['comment', 'material', 'faces']
Method Details

__init__(self, point1, point2, radius, **attr)
(Constructor)

 
Parameters:
Overrides: GraphicsObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.GraphicsObject-class.html0000644000076600000240000002663411501734227033245 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.GraphicsObject
Package Scientific :: Package Visualization :: Module VPython :: Class GraphicsObject
[frames] | no frames]

Class GraphicsObject

Known Subclasses:

Graphics object for VPython

This is an abstract base class. Use one of the subclasses to generate graphics.

Instance Methods
 
__copy__(self)
 
__getitem__(self, attr)
Returns: the value of the attribute, or None if the attribute is undefined
 
__init__(self, attr)
 
__setitem__(self, attr, value)
Class Variables
  attribute_names = ['comment']
Method Details

__getitem__(self, attr)
(Indexing operator)

 
Parameters:
  • attr (str) - the name of a graphics attribute
Returns:
the value of the attribute, or None if the attribute is undefined

__init__(self, attr)
(Constructor)

 
Parameters:
  • attr - graphics attributes specified by keywords
  • material (Material) - color and surface properties

__setitem__(self, attr, value)
(Index assignment operator)

 
Parameters:
  • attr (str) - the name of a graphics attribute
  • value - a new value for the attribute

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.Group-class.html0000644000076600000240000002105611501734227031443 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.Group
Package Scientific :: Package Visualization :: Module VPython :: Class Group
[frames] | no frames]

Class Group

Base class for composite objects

Instance Methods
 
__add__(self, other)
 
__coerce__(self, other)
 
__getitem__(self, item)
 
__init__(self, objects, **attr)
 
__len__(self)
 
show(self, window)
Class Variables
  is_group = 1
ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.Line-class.html0000644000076600000240000002241211501734227031233 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.Line
Package Scientific :: Package Visualization :: Module VPython :: Class Line
[frames] | no frames]

Class Line

GraphicsObject --+        
                 |        
       ShapeObject --+    
                     |    
             PolyLines --+
                         |
                        Line

Line

Instance Methods
 
__init__(self, point1, point2, **attr)

Inherited from PolyLines: show

Inherited from ShapeObject: __add__, display

Inherited from GraphicsObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, **attr)
(Constructor)

 
Parameters:
Overrides: GraphicsObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.Material-class.html0000644000076600000240000002551511501734226032110 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.Material
Package Scientific :: Package Visualization :: Module VPython :: Class Material
[frames] | no frames]

Class Material

GraphicsObject --+
                 |
                Material

Material specification for graphics objects

A material defines the color and surface properties of an object.

Instance Methods
 
__init__(self, **attr)

Inherited from GraphicsObject: __copy__, __getitem__, __setitem__

Class Variables
  attribute_names = ['comment', 'ambient_color', 'diffuse_color'...
Method Details

__init__(self, **attr)
(Constructor)

 
Parameters:
  • attr - material attributes as keyword arguments
  • diffuse_color (Color) - the color of a diffusely reflecting surface
  • emissive_color (Color) - the color of emitted light
Overrides: GraphicsObject.__init__

Class Variable Details

attribute_names

Value:
['comment',
 'ambient_color',
 'diffuse_color',
 'specular_color',
 'emissive_color',
 'shininess',
 'transparency']

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.Polygons-class.html0000644000076600000240000002305011501734227032155 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.Polygons
Package Scientific :: Package Visualization :: Module VPython :: Class Polygons
[frames] | no frames]

Class Polygons

GraphicsObject --+    
                 |    
       ShapeObject --+
                     |
                    Polygons

Polygons

Instance Methods
 
__init__(self, points, index_lists, **attr)
 
show(self, window)

Inherited from ShapeObject: __add__, display

Inherited from GraphicsObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, points, index_lists, **attr)
(Constructor)

 
Parameters:
  • points (sequence of Scientific.Geometry.Vector) - a sequence of points
  • index_lists (sequence of list) - a sequence of index lists, one for each polygon. The index list for a polygon defines which points are vertices of the polygon.
  • attr - graphics attributes as keyword parameters
Overrides: GraphicsObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.PolyLines-class.html0000644000076600000240000002263211501734226032265 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.PolyLines
Package Scientific :: Package Visualization :: Module VPython :: Class PolyLines
[frames] | no frames]

Class PolyLines

GraphicsObject --+    
                 |    
       ShapeObject --+
                     |
                    PolyLines
Known Subclasses:

Multiple connected lines

Instance Methods
 
__init__(self, points, **attr)
 
show(self, window)

Inherited from ShapeObject: __add__, display

Inherited from GraphicsObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, points, **attr)
(Constructor)

 
Parameters:
  • points (sequence of Scientific.Geometry.Vector) - a sequence of points to be connected by lines
  • attr - graphics attributes as keyword parameters
Overrides: GraphicsObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.Scene-class.html0000644000076600000240000003047511501734226031410 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.Scene
Package Scientific :: Package Visualization :: Module VPython :: Class Scene
[frames] | no frames]

Class Scene

VPython scene

A VPython scene is a collection of graphics objects that can be shown in a VPython window. When the "view" method is called, a new window is created and the graphics objects are displayed in it.

Instance Methods
GraphicsObject
__getitem__(self, item)
Returns: the graphics object at the index position
 
__init__(self, objects=None, **options)
int
__len__(self)
Returns: the number of graphics objects in the scene
 
addObject(self, object)
 
view(self)
Open a VPython window for the scene
Method Details

__getitem__(self, item)
(Indexing operator)

 
Parameters:
  • item (int) - an index
Returns: GraphicsObject
the graphics object at the index position

__init__(self, objects=None, **options)
(Constructor)

 
Parameters:
  • objects (list or NoneType) - a list of graphics objects, or None for an empty scene
  • options - options as keyword arguments
  • title (str) - the window title (default: "VPython scene")
  • width (int) - the window width in pixels (default: 300)
  • height (int) - the window height in pixels (default: 300)
  • background (str) - the background color (default: "black")

__len__(self)
(Length operator)

 
Returns: int
the number of graphics objects in the scene

addObject(self, object)

 
Parameters:
  • object (GraphicsObject) - a graphics object to be added to the scene

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.ShapeObject-class.html0000644000076600000240000002045011501734226032532 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.ShapeObject
Package Scientific :: Package Visualization :: Module VPython :: Class ShapeObject
[frames] | no frames]

Class ShapeObject

GraphicsObject --+
                 |
                ShapeObject
Known Subclasses:

Graphics objects representing geometrical shapes

This is an abstract base class. Use one of the subclasses to generate graphics.

Instance Methods
 
__add__(self, other)
 
display(self, window)

Inherited from GraphicsObject: __copy__, __getitem__, __init__, __setitem__

Class Variables
  attribute_names = ['comment', 'material']
ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VPython.Sphere-class.html0000644000076600000240000002257411501734226031602 0ustar hinsenstaff00000000000000 Scientific.Visualization.VPython.Sphere
Package Scientific :: Package Visualization :: Module VPython :: Class Sphere
[frames] | no frames]

Class Sphere

GraphicsObject --+    
                 |    
       ShapeObject --+
                     |
                    Sphere

Sphere

Instance Methods
 
__init__(self, center, radius, **attr)
 
show(self, window)

Inherited from ShapeObject: __add__, display

Inherited from GraphicsObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, center, radius, **attr)
(Constructor)

 
Parameters:
  • center (Scientific.Geometry.Vector) - the center of the sphere
  • radius (positive number) - the sphere radius
  • attr - graphics attributes as keyword parameters
Overrides: GraphicsObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML-module.html0000644000076600000240000003736011501734226027705 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML
Package Scientific :: Package Visualization :: Module VRML
[frames] | no frames]

Module VRML

Definitions of simple 3D graphics objects and VRML scenes containing them

The objects are appropriate for data visualization, not for virtual reality modelling. Scenes can be written to VRML files or visualized immediately using a VRML browser, whose name is taken from the environment variable VRMLVIEWER (under Unix).

This module used the original VRML definition, version 1.0. For the newer VRML 2 or VRML97, use the module VRML2, which uses exactly the same interface.

Example:

 >>> from Scientific.Visualization.VRML import *    
 >>> scene = Scene([])
 >>> scale = ColorScale(10.)
 >>> for x in range(11):
 >>>     color = scale(x)
 >>>     scene.addObject(Cube(Vector(x, 0., 0.), 0.2,
 >>>                          material=Material(diffuse_color = color)))
 >>> scene.view()
Classes
  Arrow
Arrow
  Cone
Cone
  Cube
Cube
  Cylinder
Cylinder
  Group
Base class for composite objects
  Line
Line
  LinearOrientedObject
  Material
Material specification for graphics objects
  PolyLines
Multiple connected lines
  Polygons
Polygons
  Scene
VRML scene
  SceneFile
  ShapeObject
Graphics objects representing geometrical shapes
  Sphere
Sphere
  VRMLFile
  VRMLObject
Graphics object for VRML
Functions
Material
DiffuseMaterial(color)
Returns: a material with the 'diffuse color' attribute set to color
Material
EmissiveMaterial(color)
Returns: a material with the 'emissive color' attribute set to color
 
isGroup(x)
Variables
  ex = Vector(1.000000,0.000000,0.000000)
  ey = Vector(0.000000,1.000000,0.000000)
  ez = Vector(0.000000,0.000000,1.000000)
Function Details

DiffuseMaterial(color)

 
Parameters:
  • color (Color or str) - a color object or a predefined color name
Returns: Material
a material with the 'diffuse color' attribute set to color

EmissiveMaterial(color)

 
Parameters:
  • color (Color or str) - a color object or a predefined color name
Returns: Material
a material with the 'emissive color' attribute set to color

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.Arrow-class.html0000644000076600000240000002127411501734226030613 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.Arrow
Package Scientific :: Package Visualization :: Module VRML :: Class Arrow
[frames] | no frames]

Class Arrow

Group --+
        |
       Arrow

Arrow

An arrow consists of a cylinder and a cone.

Instance Methods
 
__init__(self, point1, point2, radius, **attr)

Inherited from Group: __add__, __coerce__, __getitem__, __len__, writeToFile

Class Variables

Inherited from Group: is_group

Method Details

__init__(self, point1, point2, radius, **attr)
(Constructor)

 
Parameters:
Overrides: Group.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.Cone-class.html0000644000076600000240000002525111501734226030404 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.Cone
Package Scientific :: Package Visualization :: Module VRML :: Class Cone
[frames] | no frames]

Class Cone

  VRMLObject --+        
               |        
     ShapeObject --+    
                   |    
LinearOrientedObject --+
                       |
                      Cone

Cone

Instance Methods
 
__init__(self, point1, point2, radius, face=True, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, radius, face=True, **attr)
(Constructor)

 
Parameters:
  • point1 (Scientific.Geometry.Vector) - the tip of the cone
  • point2 (Scientific.Geometry.Vector) - end point of the cone axis
  • radius (positive number) - the radius at the base
  • face (bool) - a boolean flag, specifying if the circular bottom is visible
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.Cube-class.html0000644000076600000240000002374111501734226030400 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.Cube
Package Scientific :: Package Visualization :: Module VRML :: Class Cube
[frames] | no frames]

Class Cube

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                Cube

Cube

The edges of a cube are always parallel to the coordinate axes.

Instance Methods
 
__init__(self, center, edge, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, center, edge, **attr)
(Constructor)

 
Parameters:
  • center (Scientific.Geometry.Vector) - the center of the sphere
  • edge (positive number) - the length of an edge
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.Cylinder-class.html0000644000076600000240000002617511501734227031300 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.Cylinder
Package Scientific :: Package Visualization :: Module VRML :: Class Cylinder
[frames] | no frames]

Class Cylinder

  VRMLObject --+        
               |        
     ShapeObject --+    
                   |    
LinearOrientedObject --+
                       |
                      Cylinder

Cylinder

Instance Methods
 
__init__(self, point1, point2, radius, faces=(True, True, True), **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, radius, faces=(True, True, True), **attr)
(Constructor)

 
Parameters:
  • point1 (Scientific.Geometry.Vector) - first end point of the cylinder axis
  • point2 (Scientific.Geometry.Vector) - second end point of the cylinder axis
  • radius (positive number) - the cylinder radius
  • faces - a sequence of three boolean flags, corresponding to the cylinder hull and the two circular end pieces, specifying for each of these parts whether it is visible or not
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.Group-class.html0000644000076600000240000002133111501734226030607 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.Group
Package Scientific :: Package Visualization :: Module VRML :: Class Group
[frames] | no frames]

Class Group

Known Subclasses:

Base class for composite objects

Instance Methods
 
__add__(self, other)
 
__coerce__(self, other)
 
__getitem__(self, item)
 
__init__(self, objects, **attr)
 
__len__(self)
 
writeToFile(self, file)
Class Variables
  is_group = 1
ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.Line-class.html0000644000076600000240000002374711501734227030420 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.Line
Package Scientific :: Package Visualization :: Module VRML :: Class Line
[frames] | no frames]

Class Line

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                Line

Line

Instance Methods
 
__init__(self, point1, point2, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, **attr)
(Constructor)

 
Parameters:
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.LinearOrientedObject-class.html0000644000076600000240000002263711501734226033560 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.LinearOrientedObject
Package Scientific :: Package Visualization :: Module VRML :: Class LinearOrientedObject
[frames] | no frames]

Class LinearOrientedObject

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                LinearOrientedObject
Known Subclasses:

Instance Methods
 
__init__(self, attr, point1, point2)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, attr, point1, point2)
(Constructor)

 
Parameters:
  • attr - graphics attributes specified by keywords
  • material - color and surface properties
  • comment - a comment that is written to the script file
  • reuse - a flag defaulting to False. If set to True, the object may share its VRML definition with other objects. This reduces the size of the VRML file, but can yield surprising side effects in some cases.
Overrides: VRMLObject.__init__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.Material-class.html0000644000076600000240000004055011501734227031256 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.Material
Package Scientific :: Package Visualization :: Module VRML :: Class Material
[frames] | no frames]

Class Material

VRMLObject --+
             |
            Material

Material specification for graphics objects

A material defines the color and surface properties of an object.

Instance Methods
 
__init__(self, **attr)
 
use(self, file)
 
writeToFile(self, file)

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables
  attribute_conversion = {'ambient_color': 'ambientColor', 'diff...
  attribute_names = ['comment', 'ambient_color', 'diffuse_color'...
Method Details

__init__(self, **attr)
(Constructor)

 
Parameters:
  • attr - material attributes as keyword arguments
  • diffuse_color (Color) - the color of a diffusely reflecting surface
  • emissive_color (Color) - the color of emitted light
  • ambient_color (Color)
  • specular_color (Color)
  • shininess (float)
  • transparency (float)
Overrides: VRMLObject.__init__

writeToFile(self, file)

 
Overrides: VRMLObject.writeToFile

Class Variable Details

attribute_conversion

Value:
{'ambient_color': 'ambientColor',
 'diffuse_color': 'diffuseColor',
 'emissive_color': 'emissiveColor',
 'shininess': 'shininess',
 'specular_color': 'specularColor',
 'transparency': 'transparency'}

attribute_names

Value:
['comment',
 'ambient_color',
 'diffuse_color',
 'specular_color',
 'emissive_color',
 'shininess',
 'transparency']

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.Polygons-class.html0000644000076600000240000002412411501734226031330 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.Polygons
Package Scientific :: Package Visualization :: Module VRML :: Class Polygons
[frames] | no frames]

Class Polygons

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                Polygons

Polygons

Instance Methods
 
__init__(self, points, index_lists, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, points, index_lists, **attr)
(Constructor)

 
Parameters:
  • points (sequence of Scientific.Geometry.Vector) - a sequence of points
  • index_lists (sequence of list) - a sequence of index lists, one for each polygon. The index list for a polygon defines which points are vertices of the polygon.
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.PolyLines-class.html0000644000076600000240000002344111501734227031436 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.PolyLines
Package Scientific :: Package Visualization :: Module VRML :: Class PolyLines
[frames] | no frames]

Class PolyLines

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                PolyLines

Multiple connected lines

Instance Methods
 
__init__(self, points, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, points, **attr)
(Constructor)

 
Parameters:
  • points (sequence of Scientific.Geometry.Vector) - a sequence of points to be connected by lines
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.Scene-class.html0000644000076600000240000003715111501734227030560 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.Scene
Package Scientific :: Package Visualization :: Module VRML :: Class Scene
[frames] | no frames]

Class Scene

VRML scene

A VRML scene is a collection of graphics objects that can be written to a VRML file or fed directly to a VRML browser.

Instance Methods
VRMLObject
__getitem__(self, item)
Returns: the graphics object at the index position
 
__init__(self, objects=None, cameras=None, **options)
int
__len__(self)
Returns: the number of graphics objects in the scene
 
addCamera(self, camera)
Add a camera to the list of cameras
 
addObject(self, object)
 
view(self, *args)
Start a VRML browser and load the scene
 
writeToFile(self, filename)
Write the scene to a VRML file
Method Details

__getitem__(self, item)
(Indexing operator)

 
Parameters:
  • item (int) - an index
Returns: VRMLObject
the graphics object at the index position

__init__(self, objects=None, cameras=None, **options)
(Constructor)

 
Parameters:
  • objects (list or NoneType) - a list of graphics objects, or None for an empty scene
  • cameras - a list of cameras, or None for no cameras (not yet implemented)
  • options - options as keyword arguments (none defined)

__len__(self)
(Length operator)

 
Returns: int
the number of graphics objects in the scene

addCamera(self, camera)

 

Add a camera to the list of cameras

Parameters:
  • camera - the camera to be adde

addObject(self, object)

 
Parameters:
  • object (VRMLObject) - a graphics object to be added to the scene

view(self, *args)

 

Start a VRML browser and load the scene

Parameters:
  • args - not used, for compatibility only

writeToFile(self, filename)

 

Write the scene to a VRML file

Parameters:
  • filename (str) - the name of the script

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.SceneFile-class.html0000644000076600000240000001766411501734226031366 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.SceneFile
Package Scientific :: Package Visualization :: Module VRML :: Class SceneFile
[frames] | no frames]

Class SceneFile

Instance Methods
 
__del__(self)
 
__init__(self, filename, mode='r')
 
close(self)
 
uniqueName(self)
 
write(self, object)
 
writeString(self, data)
ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.ShapeObject-class.html0000644000076600000240000003040411501734226031703 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.ShapeObject
Package Scientific :: Package Visualization :: Module VRML :: Class ShapeObject
[frames] | no frames]

Class ShapeObject

VRMLObject --+
             |
            ShapeObject
Known Subclasses:

Graphics objects representing geometrical shapes

This is an abstract base class. Use one of the subclasses to generate graphics.

Instance Methods
 
__add__(self, other)
 
__init__(self, attr, rotation, translation, reference_point)
 
use(self, file)
 
writeToFile(self, file)

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables
  attribute_names = ['comment', 'material', 'reuse']
Method Details

__init__(self, attr, rotation, translation, reference_point)
(Constructor)

 
Parameters:
  • attr - graphics attributes specified by keywords
  • material - color and surface properties
  • comment - a comment that is written to the script file
  • reuse - a flag defaulting to False. If set to True, the object may share its VRML definition with other objects. This reduces the size of the VRML file, but can yield surprising side effects in some cases.
Overrides: VRMLObject.__init__
(inherited documentation)

writeToFile(self, file)

 
Overrides: VRMLObject.writeToFile

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.Sphere-class.html0000644000076600000240000002365011501734226030747 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.Sphere
Package Scientific :: Package Visualization :: Module VRML :: Class Sphere
[frames] | no frames]

Class Sphere

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                Sphere

Sphere

Instance Methods
 
__init__(self, center, radius, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, center, radius, **attr)
(Constructor)

 
Parameters:
  • center (Scientific.Geometry.Vector) - the center of the sphere
  • radius (positive number) - the sphere radius
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML.VRMLObject-class.html0000644000076600000240000003061511501734227031430 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML.VRMLObject
Package Scientific :: Package Visualization :: Module VRML :: Class VRMLObject
[frames] | no frames]

Class VRMLObject

Known Subclasses:

Graphics object for VRML

This is an abstract base class. Use one of the subclasses to generate graphics.

Instance Methods
 
__copy__(self)
 
__getitem__(self, attr)
Returns: the value of the attribute, or None if the attribute is undefined
 
__init__(self, attr)
 
__setitem__(self, attr, value)
 
writeToFile(self, file)
Class Variables
  attribute_names = ['comment']
Method Details

__getitem__(self, attr)
(Indexing operator)

 
Parameters:
  • attr (str) - the name of a graphics attribute
Returns:
the value of the attribute, or None if the attribute is undefined

__init__(self, attr)
(Constructor)

 
Parameters:
  • attr - graphics attributes specified by keywords
  • material (Material) - color and surface properties
  • comment (str) - a comment that is written to the script file
  • reuse (bool) - a flag defaulting to False. If set to True, the object may share its VRML definition with other objects. This reduces the size of the VRML file, but can yield surprising side effects in some cases.

__setitem__(self, attr, value)
(Index assignment operator)

 
Parameters:
  • attr (str) - the name of a graphics attribute
  • value - a new value for the attribute

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2-module.html0000644000076600000240000004056211501734226027765 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2
Package Scientific :: Package Visualization :: Module VRML2
[frames] | no frames]

Module VRML2

Definitions of simple 3D graphics objects and VRML scenes containing them

The objects are appropriate for data visualization, not for virtual reality modelling. Scenes can be written to VRML files or visualized immediately using a VRML browser, whose name is taken from the environment variable VRML2VIEWER (under Unix).

This module uses the VRML 2.0 definition, also known as VRML97. For the original VRML 1, use the module VRML, which uses exactly the same interface.

Example:

 >>> from Scientific.Visualization.VRML import *    
 >>> scene = Scene([])
 >>> scale = ColorScale(10.)
 >>> for x in range(11):
 >>>     color = scale(x)
 >>>     scene.addObject(Cube(Vector(x, 0., 0.), 0.2,
 >>>                          material=Material(diffuse_color = color)))
 >>> scene.view()
Classes
  Arrow
Arrow
  Camera
Camera/viewpoint for a scene
  Cone
Cone
  Cube
Cube
  Cylinder
Cylinder
  Group
Base class for composite objects
  Line
Line
  LinearOrientedObject
  Material
Material specification for graphics objects
  NavigationInfo
Navigation information
  PolyLines
Multiple connected lines
  Polygons
Polygons
  Scene
VRML scene
  SceneFile
  ShapeObject
Graphics objects representing geometrical shapes
  Sphere
Sphere
  VRMLFile
  VRMLObject
Graphics object for VRML
Functions
Material
DiffuseMaterial(color)
Returns: a material with the 'diffuse color' attribute set to color
Material
EmissiveMaterial(color)
Returns: a material with the 'emissive color' attribute set to color
 
isGroup(x)
Variables
  ex = Vector(1.000000,0.000000,0.000000)
  ey = Vector(0.000000,1.000000,0.000000)
  ez = Vector(0.000000,0.000000,1.000000)
Function Details

DiffuseMaterial(color)

 
Parameters:
  • color (Color or str) - a color object or a predefined color name
Returns: Material
a material with the 'diffuse color' attribute set to color

EmissiveMaterial(color)

 
Parameters:
  • color (Color or str) - a color object or a predefined color name
Returns: Material
a material with the 'emissive color' attribute set to color

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.Arrow-class.html0000644000076600000240000002131311501734226030667 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.Arrow
Package Scientific :: Package Visualization :: Module VRML2 :: Class Arrow
[frames] | no frames]

Class Arrow

Group --+
        |
       Arrow

Arrow

An arrow consists of a cylinder and a cone.

Instance Methods
 
__init__(self, point1, point2, radius, **attr)

Inherited from Group: __add__, __coerce__, __getitem__, __len__, writeToFile

Class Variables

Inherited from Group: is_group

Method Details

__init__(self, point1, point2, radius, **attr)
(Constructor)

 
Parameters:
Overrides: Group.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.Camera-class.html0000644000076600000240000002006011501734226030763 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.Camera
Package Scientific :: Package Visualization :: Module VRML2 :: Class Camera
[frames] | no frames]

Class Camera

Camera/viewpoint for a scene

Instance Methods
 
__init__(self, position=None, orientation=None, description=None, field_of_view=None)
 
writeToFile(self, file)
Method Details

__init__(self, position=None, orientation=None, description=None, field_of_view=None)
(Constructor)

 
Parameters:
  • position (Scientific.Geometry.Vector) - the location of the camera
  • orientation - an (axis, angle) tuple in which the axis is a vector and the angle a number in radians; axis and angle specify a rotation with respect to the standard orientation along the negative z axis
  • description (str) - a label for the viewpoint
  • field_of_view (positive number) - the field of view

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.Cone-class.html0000644000076600000240000002527411501734226030473 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.Cone
Package Scientific :: Package Visualization :: Module VRML2 :: Class Cone
[frames] | no frames]

Class Cone

  VRMLObject --+        
               |        
     ShapeObject --+    
                   |    
LinearOrientedObject --+
                       |
                      Cone

Cone

Instance Methods
 
__init__(self, point1, point2, radius, face=True, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, radius, face=True, **attr)
(Constructor)

 
Parameters:
  • point1 (Scientific.Geometry.Vector) - the tip of the cone
  • point2 (Scientific.Geometry.Vector) - end point of the cone axis
  • radius (positive number) - the radius at the base
  • face (bool) - a boolean flag, specifying if the circular bottom is visible
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.Cube-class.html0000644000076600000240000002376311501734226030466 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.Cube
Package Scientific :: Package Visualization :: Module VRML2 :: Class Cube
[frames] | no frames]

Class Cube

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                Cube

Cube

The edges of a cube are always parallel to the coordinate axes.

Instance Methods
 
__init__(self, center, edge, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, center, edge, **attr)
(Constructor)

 
Parameters:
  • center (Scientific.Geometry.Vector) - the center of the sphere
  • edge (positive number) - the length of an edge
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.Cylinder-class.html0000644000076600000240000002622011501734226031350 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.Cylinder
Package Scientific :: Package Visualization :: Module VRML2 :: Class Cylinder
[frames] | no frames]

Class Cylinder

  VRMLObject --+        
               |        
     ShapeObject --+    
                   |    
LinearOrientedObject --+
                       |
                      Cylinder

Cylinder

Instance Methods
 
__init__(self, point1, point2, radius, faces=(True, True, True), **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, radius, faces=(True, True, True), **attr)
(Constructor)

 
Parameters:
  • point1 (Scientific.Geometry.Vector) - first end point of the cylinder axis
  • point2 (Scientific.Geometry.Vector) - second end point of the cylinder axis
  • radius (positive number) - the cylinder radius
  • faces - a sequence of three boolean flags, corresponding to the cylinder hull and the two circular end pieces, specifying for each of these parts whether it is visible or not
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.Group-class.html0000644000076600000240000002133611501734227030677 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.Group
Package Scientific :: Package Visualization :: Module VRML2 :: Class Group
[frames] | no frames]

Class Group

Known Subclasses:

Base class for composite objects

Instance Methods
 
__add__(self, other)
 
__coerce__(self, other)
 
__getitem__(self, item)
 
__init__(self, objects, **attr)
 
__len__(self)
 
writeToFile(self, file)
Class Variables
  is_group = 1
ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.Line-class.html0000644000076600000240000002377111501734226030476 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.Line
Package Scientific :: Package Visualization :: Module VRML2 :: Class Line
[frames] | no frames]

Class Line

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                Line

Line

Instance Methods
 
__init__(self, point1, point2, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, point1, point2, **attr)
(Constructor)

 
Parameters:
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.LinearOrientedObject-class.html0000644000076600000240000002266311501734227033642 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.LinearOrientedObject
Package Scientific :: Package Visualization :: Module VRML2 :: Class LinearOrientedObject
[frames] | no frames]

Class LinearOrientedObject

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                LinearOrientedObject
Known Subclasses:

Instance Methods
 
__init__(self, attr, point1, point2)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, attr, point1, point2)
(Constructor)

 
Parameters:
  • attr - graphics attributes specified by keywords
  • material - color and surface properties
  • comment - a comment that is written to the script file
  • reuse - a flag defaulting to False. If set to True, the object may share its VRML definition with other objects. This reduces the size of the VRML file, but can yield surprising side effects in some cases.
Overrides: VRMLObject.__init__
(inherited documentation)

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.Material-class.html0000644000076600000240000004056711501734226031347 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.Material
Package Scientific :: Package Visualization :: Module VRML2 :: Class Material
[frames] | no frames]

Class Material

VRMLObject --+
             |
            Material

Material specification for graphics objects

A material defines the color and surface properties of an object.

Instance Methods
 
__init__(self, **attr)
 
use(self, file)
 
writeToFile(self, file)

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables
  attribute_conversion = {'ambient_color': 'ambientColor', 'diff...
  attribute_names = ['comment', 'ambient_color', 'diffuse_color'...
Method Details

__init__(self, **attr)
(Constructor)

 
Parameters:
  • attr - material attributes as keyword arguments
  • diffuse_color (Color) - the color of a diffusely reflecting surface
  • emissive_color (Color) - the color of emitted light
  • ambient_color (Color)
  • specular_color (Color)
  • shininess (float)
  • transparency (float)
Overrides: VRMLObject.__init__

writeToFile(self, file)

 
Overrides: VRMLObject.writeToFile

Class Variable Details

attribute_conversion

Value:
{'ambient_color': 'ambientColor',
 'diffuse_color': 'diffuseColor',
 'emissive_color': 'emissiveColor',
 'shininess': 'shininess',
 'specular_color': 'specularColor',
 'transparency': 'transparency'}

attribute_names

Value:
['comment',
 'ambient_color',
 'diffuse_color',
 'specular_color',
 'emissive_color',
 'shininess',
 'transparency']

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.NavigationInfo-class.html0000644000076600000240000001667011501734227032523 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.NavigationInfo
Package Scientific :: Package Visualization :: Module VRML2 :: Class NavigationInfo
[frames] | no frames]

Class NavigationInfo

Navigation information

Instance Methods
 
__init__(self, speed=100.0, type='EXAMINE')
 
writeToFile(self, file)
Method Details

__init__(self, speed=100.0, type='EXAMINE')
(Constructor)

 
Parameters:
  • speed (number) - walking speed in length units per second
  • type - one of 'WALK', 'EXAMINE', 'FLY', 'NONE', 'ANY'

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.Polygons-class.html0000644000076600000240000002414611501734227031417 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.Polygons
Package Scientific :: Package Visualization :: Module VRML2 :: Class Polygons
[frames] | no frames]

Class Polygons

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                Polygons

Polygons

Instance Methods
 
__init__(self, points, index_lists, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, points, index_lists, **attr)
(Constructor)

 
Parameters:
  • points (sequence of Scientific.Geometry.Vector) - a sequence of points
  • index_lists (sequence of list) - a sequence of index lists, one for each polygon. The index list for a polygon defines which points are vertices of the polygon.
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.PolyLines-class.html0000644000076600000240000002346311501734227031524 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.PolyLines
Package Scientific :: Package Visualization :: Module VRML2 :: Class PolyLines
[frames] | no frames]

Class PolyLines

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                PolyLines

Multiple connected lines

Instance Methods
 
__init__(self, points, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, points, **attr)
(Constructor)

 
Parameters:
  • points (sequence of Scientific.Geometry.Vector) - a sequence of points to be connected by lines
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.Scene-class.html0000644000076600000240000003711711501734226030643 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.Scene
Package Scientific :: Package Visualization :: Module VRML2 :: Class Scene
[frames] | no frames]

Class Scene

VRML scene

A VRML scene is a collection of graphics objects that can be written to a VRML file or fed directly to a VRML browser.

Instance Methods
VRMLObject
__getitem__(self, item)
Returns: the graphics object at the index position
 
__init__(self, objects=None, cameras=None, **options)
int
__len__(self)
Returns: the number of graphics objects in the scene
 
addCamera(self, camera)
Add a camera to the list of cameras
 
addObject(self, object)
 
view(self, *args)
Start a VRML browser and load the scene
 
writeToFile(self, filename)
Write the scene to a VRML file
Method Details

__getitem__(self, item)
(Indexing operator)

 
Parameters:
  • item (int) - an index
Returns: VRMLObject
the graphics object at the index position

__init__(self, objects=None, cameras=None, **options)
(Constructor)

 
Parameters:
  • objects (list or NoneType) - a list of graphics objects, or None for an empty scene
  • cameras - a list of cameras, or None for no cameras
  • options - options as keyword arguments (none defined)

__len__(self)
(Length operator)

 
Returns: int
the number of graphics objects in the scene

addCamera(self, camera)

 

Add a camera to the list of cameras

Parameters:
  • camera - the camera to be adde

addObject(self, object)

 
Parameters:
  • object (VRMLObject) - a graphics object to be added to the scene

view(self, *args)

 

Start a VRML browser and load the scene

Parameters:
  • args - not used, for compatibility only

writeToFile(self, filename)

 

Write the scene to a VRML file

Parameters:
  • filename (str) - the name of the script

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.SceneFile-class.html0000644000076600000240000001767011501734227031446 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.SceneFile
Package Scientific :: Package Visualization :: Module VRML2 :: Class SceneFile
[frames] | no frames]

Class SceneFile

Instance Methods
 
__del__(self)
 
__init__(self, filename, mode='r')
 
close(self)
 
uniqueName(self)
 
write(self, object)
 
writeString(self, data)
ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.ShapeObject-class.html0000644000076600000240000003042711501734226031772 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.ShapeObject
Package Scientific :: Package Visualization :: Module VRML2 :: Class ShapeObject
[frames] | no frames]

Class ShapeObject

VRMLObject --+
             |
            ShapeObject
Known Subclasses:

Graphics objects representing geometrical shapes

This is an abstract base class. Use one of the subclasses to generate graphics.

Instance Methods
 
__add__(self, other)
 
__init__(self, attr, rotation, translation, reference_point)
 
use(self, file)
 
writeToFile(self, file)

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables
  attribute_names = ['comment', 'material', 'reuse']
Method Details

__init__(self, attr, rotation, translation, reference_point)
(Constructor)

 
Parameters:
  • attr - graphics attributes specified by keywords
  • material - color and surface properties
  • comment - a comment that is written to the script file
  • reuse - a flag defaulting to False. If set to True, the object may share its VRML definition with other objects. This reduces the size of the VRML file, but can yield surprising side effects in some cases.
Overrides: VRMLObject.__init__
(inherited documentation)

writeToFile(self, file)

 
Overrides: VRMLObject.writeToFile

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.Sphere-class.html0000644000076600000240000002367211501734226031035 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.Sphere
Package Scientific :: Package Visualization :: Module VRML2 :: Class Sphere
[frames] | no frames]

Class Sphere

VRMLObject --+    
             |    
   ShapeObject --+
                 |
                Sphere

Sphere

Instance Methods
 
__init__(self, center, radius, **attr)
 
memoKey(self)
 
writeSpecification(self, file)

Inherited from ShapeObject: __add__, use, writeToFile

Inherited from VRMLObject: __copy__, __getitem__, __setitem__

Class Variables

Inherited from ShapeObject: attribute_names

Method Details

__init__(self, center, radius, **attr)
(Constructor)

 
Parameters:
  • center (Scientific.Geometry.Vector) - the center of the sphere
  • radius (positive number) - the sphere radius
  • attr - graphics attributes as keyword parameters
Overrides: VRMLObject.__init__

ScientificPython-2.9.4/Doc/Reference/Scientific.Visualization.VRML2.VRMLObject-class.html0000644000076600000240000003062711501734226031514 0ustar hinsenstaff00000000000000 Scientific.Visualization.VRML2.VRMLObject
Package Scientific :: Package Visualization :: Module VRML2 :: Class VRMLObject
[frames] | no frames]

Class VRMLObject

Known Subclasses:

Graphics object for VRML

This is an abstract base class. Use one of the subclasses to generate graphics.

Instance Methods
 
__copy__(self)
 
__getitem__(self, attr)
Returns: the value of the attribute, or None if the attribute is undefined
 
__init__(self, attr)
 
__setitem__(self, attr, value)
 
writeToFile(self, file)
Class Variables
  attribute_names = ['comment']
Method Details

__getitem__(self, attr)
(Indexing operator)

 
Parameters:
  • attr (str) - the name of a graphics attribute
Returns:
the value of the attribute, or None if the attribute is undefined

__init__(self, attr)
(Constructor)

 
Parameters:
  • attr - graphics attributes specified by keywords
  • material (Material) - color and surface properties
  • comment (str) - a comment that is written to the script file
  • reuse (bool) - a flag defaulting to False. If set to True, the object may share its VRML definition with other objects. This reduces the size of the VRML file, but can yield surprising side effects in some cases.

__setitem__(self, attr, value)
(Index assignment operator)

 
Parameters:
  • attr (str) - the name of a graphics attribute
  • value - a new value for the attribute

ScientificPython-2.9.4/Doc/Reference/term-index.html0000644000076600000240000003460211501734226022773 0ustar hinsenstaff00000000000000 Term Definition Index
 
[frames] | no frames]
[ Identifiers | Term Definitions ]

Term Definition Index

[ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ ]

A

D

F

G

I

L

M

N

P

R

T

Z



ScientificPython-2.9.4/Doc/Reference/toc-everything.html0000644000076600000240000016311511501734226023670 0ustar hinsenstaff00000000000000 Everything

Everything


All Classes

Scientific.BSP.Console.BSPSyncError
Scientific.BSP.Console.OKToken
Scientific.BSP.Console.OutputStream
Scientific.BSP.Console.ParallelConsole
Scientific.BSP.Console.ParallelInterpreter
Scientific.BSP.ParAccumulator
Scientific.BSP.ParBase
Scientific.BSP.ParClass
Scientific.BSP.ParConstant
Scientific.BSP.ParData
Scientific.BSP.ParFunction
Scientific.BSP.ParIndex
Scientific.BSP.ParIndexIterator
Scientific.BSP.ParIterator
Scientific.BSP.ParMessages
Scientific.BSP.ParRootFunction
Scientific.BSP.ParRootSequence
Scientific.BSP.ParSequence
Scientific.BSP.ParTuple
Scientific.BSP.ParValue
Scientific.Clustering.AffinityPropagation.DataSet
Scientific.DictWithDefault.DictWithDefault
Scientific.DistributedComputing.MasterSlave.GlobalStateValue
Scientific.DistributedComputing.MasterSlave.MasterProcess
Scientific.DistributedComputing.MasterSlave.SlaveProcess
Scientific.DistributedComputing.TaskManager.Task
Scientific.DistributedComputing.TaskManager.TaskManager
Scientific.DistributedComputing.TaskManager.TaskManagerTermination
Scientific.DistributedComputing.TaskManager.TaskQueue
Scientific.DistributedComputing.TaskManager.TaskRaisedException
Scientific.DistributedComputing.TaskManager.Watchdog
Scientific.Functions.Derivatives.DerivVar
Scientific.Functions.FirstDerivatives.DerivVar
Scientific.Functions.Interpolation.InterpolatingFunction
Scientific.Functions.Interpolation.NetCDFInterpolatingFunction
Scientific.Functions.Polynomial.Polynomial
Scientific.Functions.Rational.RationalFunction
Scientific.Geometry.Objects3D.BravaisLattice
Scientific.Geometry.Objects3D.Circle
Scientific.Geometry.Objects3D.Cone
Scientific.Geometry.Objects3D.GeometricalObject3D
Scientific.Geometry.Objects3D.Lattice
Scientific.Geometry.Objects3D.Line
Scientific.Geometry.Objects3D.Plane
Scientific.Geometry.Objects3D.RhombicLattice
Scientific.Geometry.Objects3D.SCLattice
Scientific.Geometry.Objects3D.Sphere
Scientific.Geometry.Quaternion.Quaternion
Scientific.Geometry.Tensor
Scientific.Geometry.TensorAnalysis.ScalarField
Scientific.Geometry.TensorAnalysis.TensorField
Scientific.Geometry.TensorAnalysis.VectorField
Scientific.Geometry.Transformation.Inversion
Scientific.Geometry.Transformation.LinearTransformation
Scientific.Geometry.Transformation.RigidBodyTransformation
Scientific.Geometry.Transformation.Rotation
Scientific.Geometry.Transformation.RotationTranslation
Scientific.Geometry.Transformation.Scaling
Scientific.Geometry.Transformation.Shear
Scientific.Geometry.Transformation.Transformation
Scientific.Geometry.Transformation.Translation
Scientific.Geometry.Vector
Scientific.IO.FortranFormat.FortranFormat
Scientific.IO.FortranFormat.FortranLine
Scientific.IO.NetCDF.NetCDFFile
Scientific.IO.NetCDF.NetCDFVariable
Scientific.IO.PDB.AminoAcidResidue
Scientific.IO.PDB.Atom
Scientific.IO.PDB.Chain
Scientific.IO.PDB.Group
Scientific.IO.PDB.HetAtom
Scientific.IO.PDB.Molecule
Scientific.IO.PDB.NucleotideChain
Scientific.IO.PDB.NucleotideResidue
Scientific.IO.PDB.PDBFile
Scientific.IO.PDB.PeptideChain
Scientific.IO.PDB.Residue
Scientific.IO.PDB.ResidueNumber
Scientific.IO.PDB.Structure
Scientific.IO.PDBSpaceGroups.SpaceGroup
Scientific.IO.TextFile.TextFile
Scientific.IterationCountExceededError
Scientific.MPI.IO.LogFile
Scientific.MPI.MPICommunicator
Scientific.MPI.MPIOperationObject
Scientific.MPI.MPIRequest
Scientific.MPI.band
Scientific.MPI.bor
Scientific.MPI.bxor
Scientific.MPI.land
Scientific.MPI.lor
Scientific.MPI.lxor
Scientific.MPI.max
Scientific.MPI.maxloc
Scientific.MPI.min
Scientific.MPI.minloc
Scientific.MPI.prod
Scientific.MPI.replace
Scientific.MPI.sum
Scientific.NumberDict.NumberDict
Scientific.Physics.PhysicalQuantities.PhysicalQuantity
Scientific.Physics.PhysicalQuantities.PhysicalUnit
Scientific.Physics.Potential.PotentialWithGradients
Scientific.Physics.Potential.PotentialWithGradientsAndForceConstants
Scientific.QtWidgets.QtPlotCanvas.HorizontalLine
Scientific.QtWidgets.QtPlotCanvas.PlotCanvas
Scientific.QtWidgets.QtPlotCanvas.PlotGraphics
Scientific.QtWidgets.QtPlotCanvas.PolyLine
Scientific.QtWidgets.QtPlotCanvas.PolyMarker
Scientific.QtWidgets.QtPlotCanvas.PolyPoints
Scientific.QtWidgets.QtPlotCanvas.VerticalLine
Scientific.QtWidgets.QtVisualizationCanvas.PolyLine3D
Scientific.QtWidgets.QtVisualizationCanvas.VisualizationCanvas
Scientific.QtWidgets.QtVisualizationCanvas.VisualizationGraphics
Scientific.Signals.Models.AutoRegressiveModel
Scientific.Signals.Models.AveragedAutoRegressiveModel
Scientific.Statistics.Histogram.Histogram
Scientific.Statistics.Histogram.WeightedHistogram
Scientific.Threading.TaskManager.TaskManager
Scientific.TkWidgets.ButtonBar
Scientific.TkWidgets.FilenameEntry
Scientific.TkWidgets.FloatEntry
Scientific.TkWidgets.IntEntry
Scientific.TkWidgets.ModalDialog
Scientific.TkWidgets.StatusBar
Scientific.TkWidgets.TkPlotCanvas.HorizontalLine
Scientific.TkWidgets.TkPlotCanvas.PlotCanvas
Scientific.TkWidgets.TkPlotCanvas.PlotGraphics
Scientific.TkWidgets.TkPlotCanvas.PolyLine
Scientific.TkWidgets.TkPlotCanvas.PolyMarker
Scientific.TkWidgets.TkPlotCanvas.PolyPoints
Scientific.TkWidgets.TkPlotCanvas.VerticalLine
Scientific.TkWidgets.TkVisualizationCanvas.PolyLine3D
Scientific.TkWidgets.TkVisualizationCanvas.VisualizationCanvas
Scientific.TkWidgets.TkVisualizationCanvas.VisualizationGraphics
Scientific.Visualization.Color.Color
Scientific.Visualization.Color.ColorScale
Scientific.Visualization.Color.SymmetricColorScale
Scientific.Visualization.PyMOL.Arrow
Scientific.Visualization.PyMOL.Cone
Scientific.Visualization.PyMOL.Cube
Scientific.Visualization.PyMOL.Cylinder
Scientific.Visualization.PyMOL.Group
Scientific.Visualization.PyMOL.Line
Scientific.Visualization.PyMOL.Material
Scientific.Visualization.PyMOL.Molecules
Scientific.Visualization.PyMOL.PyMOLObject
Scientific.Visualization.PyMOL.Scene
Scientific.Visualization.PyMOL.ShapeObject
Scientific.Visualization.PyMOL.Sphere
Scientific.Visualization.VMD.Arrow
Scientific.Visualization.VMD.Cone
Scientific.Visualization.VMD.Cube
Scientific.Visualization.VMD.Cylinder
Scientific.Visualization.VMD.Group
Scientific.Visualization.VMD.Line
Scientific.Visualization.VMD.Material
Scientific.Visualization.VMD.Molecules
Scientific.Visualization.VMD.Scene
Scientific.Visualization.VMD.SceneFile
Scientific.Visualization.VMD.ShapeObject
Scientific.Visualization.VMD.Sphere
Scientific.Visualization.VMD.VMDObject
Scientific.Visualization.VPython.Arrow
Scientific.Visualization.VPython.Cone
Scientific.Visualization.VPython.Cube
Scientific.Visualization.VPython.Cylinder
Scientific.Visualization.VPython.GraphicsObject
Scientific.Visualization.VPython.Group
Scientific.Visualization.VPython.Line
Scientific.Visualization.VPython.Material
Scientific.Visualization.VPython.PolyLines
Scientific.Visualization.VPython.Polygons
Scientific.Visualization.VPython.Scene
Scientific.Visualization.VPython.ShapeObject
Scientific.Visualization.VPython.Sphere
Scientific.Visualization.VRML.Arrow
Scientific.Visualization.VRML.Cone
Scientific.Visualization.VRML.Cube
Scientific.Visualization.VRML.Cylinder
Scientific.Visualization.VRML.Group
Scientific.Visualization.VRML.Line
Scientific.Visualization.VRML.LinearOrientedObject
Scientific.Visualization.VRML.Material
Scientific.Visualization.VRML.PolyLines
Scientific.Visualization.VRML.Polygons
Scientific.Visualization.VRML.Scene
Scientific.Visualization.VRML.SceneFile
Scientific.Visualization.VRML.ShapeObject
Scientific.Visualization.VRML.Sphere
Scientific.Visualization.VRML.VRMLObject
Scientific.Visualization.VRML2.Arrow
Scientific.Visualization.VRML2.Camera
Scientific.Visualization.VRML2.Cone
Scientific.Visualization.VRML2.Cube
Scientific.Visualization.VRML2.Cylinder
Scientific.Visualization.VRML2.Group
Scientific.Visualization.VRML2.Line
Scientific.Visualization.VRML2.LinearOrientedObject
Scientific.Visualization.VRML2.Material
Scientific.Visualization.VRML2.NavigationInfo
Scientific.Visualization.VRML2.PolyLines
Scientific.Visualization.VRML2.Polygons
Scientific.Visualization.VRML2.Scene
Scientific.Visualization.VRML2.SceneFile
Scientific.Visualization.VRML2.ShapeObject
Scientific.Visualization.VRML2.Sphere
Scientific.Visualization.VRML2.VRMLObject
float
int
qt.QPaintDevice.PDevCmd
qt.QWidget.BackgroundOrigin
qt.QWidget.FocusPolicy
qt.Qt.AlignmentFlags
qt.Qt.AnchorAttribute
qt.Qt.ArrowType
qt.Qt.BGMode
qt.Qt.BackgroundMode
qt.Qt.BrushStyle
qt.Qt.ButtonState
qt.Qt.Corner
qt.Qt.CursorShape
qt.Qt.DateFormat
qt.Qt.Dock
qt.Qt.GUIStyle
qt.Qt.ImageConversionFlags
qt.Qt.Key
qt.Qt.MacintoshVersion
qt.Qt.Modifier
qt.Qt.Orientation
qt.Qt.PenCapStyle
qt.Qt.PenJoinStyle
qt.Qt.PenStyle
qt.Qt.RasterOp
qt.Qt.SequenceMatch
qt.Qt.SortOrder
qt.Qt.StringComparisonMode
qt.Qt.TextFlags
qt.Qt.TextFormat
qt.Qt.TimeSpec
qt.Qt.UIEffect
qt.Qt.WidgetFlags
qt.Qt.WidgetState
qt.Qt.WindowState
qt.Qt.WindowsVersion

All Functions

Scientific.BSP.Console.console
Scientific.BSP.Console.interpreter
Scientific.BSP.Console.isOK
Scientific.BSP.Console.syncCheck
Scientific.BSP.Console.synchronize
Scientific.BSP.Console.typePar
Scientific.DistributedComputing.MasterSlave.getMachineInfo
Scientific.DistributedComputing.MasterSlave.initializeMasterProcess
Scientific.DistributedComputing.MasterSlave.runJob
Scientific.DistributedComputing.MasterSlave.startSlaveProcess
Scientific.Functions.Derivatives.DerivVector
Scientific.Functions.Derivatives.isDerivVar
Scientific.Functions.FindRoot.newtonRaphson
Scientific.Functions.FirstDerivatives.DerivVector
Scientific.Functions.FirstDerivatives.isDerivVar
Scientific.Functions.LeastSquares.leastSquaresFit
Scientific.Functions.LeastSquares.polynomialLeastSquaresFit
Scientific.Functions.Romberg.romberg
Scientific.Functions.Romberg.trapezoid
Scientific.Geometry.Objects3D.rotateDirection
Scientific.Geometry.Objects3D.rotatePoint
Scientific.Geometry.Quaternion.isQuaternion
Scientific.Geometry.Transformation.angleFromSineAndCosine
Scientific.Geometry.Transformation.mod_angle
Scientific.IO.ArrayIO.readArray
Scientific.IO.ArrayIO.readFloatArray
Scientific.IO.ArrayIO.readIntegerArray
Scientific.IO.ArrayIO.writeArray
Scientific.IO.ArrayIO.writeDataSets
Scientific.IO.PDB.defineAminoAcidResidue
Scientific.IO.PDB.defineNucleicAcidResidue
Scientific.IO.PDBSpaceGroups.getSpaceGroupTransformations
Scientific.Physics.PhysicalQuantities.description
Scientific.Physics.PhysicalQuantities.isPhysicalQuantity
Scientific.Physics.PhysicalQuantities.isPhysicalUnit
Scientific.Physics.Potential.DerivVectors
Scientific.Physics.Potential.EnergyGradients
Scientific.Physics.Potential.EnergyGradientsForceConstants
Scientific.Statistics.correlation
Scientific.Statistics.kurtosis
Scientific.Statistics.mean
Scientific.Statistics.median
Scientific.Statistics.mode
Scientific.Statistics.moment
Scientific.Statistics.normalizedMoment
Scientific.Statistics.skewness
Scientific.Statistics.standardDeviation
Scientific.Statistics.variance
Scientific.Statistics.weightedMean
Scientific.Visualization.Color.ColorByName
Scientific.Visualization.PyMOL.DiffuseMaterial
Scientific.Visualization.PyMOL.isGroup
Scientific.Visualization.VMD.DiffuseMaterial
Scientific.Visualization.VMD.isGroup
Scientific.Visualization.VPython.DiffuseMaterial
Scientific.Visualization.VPython.EmissiveMaterial
Scientific.Visualization.VPython.isGroup
Scientific.Visualization.VRML.DiffuseMaterial
Scientific.Visualization.VRML.EmissiveMaterial
Scientific.Visualization.VRML.isGroup
Scientific.Visualization.VRML2.DiffuseMaterial
Scientific.Visualization.VRML2.EmissiveMaterial
Scientific.Visualization.VRML2.isGroup

All Variables

Scientific.BSP.Console.numberOfProcessors
Scientific.BSP.Console.ok
Scientific.BSP.Console.processorID
Scientific.BSP.IO.ParInvalid
Scientific.BSP.IO.ParNetCDFFile
Scientific.BSP.IO.ParNetCDFVariable
Scientific.BSP.ParInvalid
Scientific.BSP.name
Scientific.BSP.numberOfProcessors
Scientific.BSP.processorID
Scientific.DistributedComputing.MasterSlave.debug
Scientific.DistributedComputing.TaskManager.debug
Scientific.FFT.package
Scientific.Functions.Interpolation.index_expression
Scientific.Geometry.TensorAnalysis.index_expression
Scientific.Geometry.delta
Scientific.Geometry.epsilon
Scientific.Geometry.ex
Scientific.Geometry.ey
Scientific.Geometry.ez
Scientific.Geometry.nullVector
Scientific.IO.PDB.amino_acids
Scientific.IO.PDB.nucleic_acids
Scientific.IO.PDBSpaceGroups.sg
Scientific.MPI.world
Scientific.NRNG.default_distribution
Scientific.NRNG.package
Scientific.NRNG.standard_generator
Scientific.Physics.PhysicalQuantities.prefix
Scientific.Physics.PhysicalQuantities.unit
Scientific.Physics.PhysicalQuantities.value
Scientific.QtWidgets.QtPlotCanvas.IO_AbortError
Scientific.QtWidgets.QtPlotCanvas.IO_Append
Scientific.QtWidgets.QtPlotCanvas.IO_Async
Scientific.QtWidgets.QtPlotCanvas.IO_Combined
Scientific.QtWidgets.QtPlotCanvas.IO_ConnectError
Scientific.QtWidgets.QtPlotCanvas.IO_Direct
Scientific.QtWidgets.QtPlotCanvas.IO_FatalError
Scientific.QtWidgets.QtPlotCanvas.IO_ModeMask
Scientific.QtWidgets.QtPlotCanvas.IO_Ok
Scientific.QtWidgets.QtPlotCanvas.IO_Open
Scientific.QtWidgets.QtPlotCanvas.IO_OpenError
Scientific.QtWidgets.QtPlotCanvas.IO_Raw
Scientific.QtWidgets.QtPlotCanvas.IO_ReadError
Scientific.QtWidgets.QtPlotCanvas.IO_ReadOnly
Scientific.QtWidgets.QtPlotCanvas.IO_ReadWrite
Scientific.QtWidgets.QtPlotCanvas.IO_ResourceError
Scientific.QtWidgets.QtPlotCanvas.IO_Sequential
Scientific.QtWidgets.QtPlotCanvas.IO_StateMask
Scientific.QtWidgets.QtPlotCanvas.IO_TimeOutError
Scientific.QtWidgets.QtPlotCanvas.IO_Translate
Scientific.QtWidgets.QtPlotCanvas.IO_Truncate
Scientific.QtWidgets.QtPlotCanvas.IO_TypeMask
Scientific.QtWidgets.QtPlotCanvas.IO_UnspecifiedError
Scientific.QtWidgets.QtPlotCanvas.IO_WriteError
Scientific.QtWidgets.QtPlotCanvas.IO_WriteOnly
Scientific.QtWidgets.QtPlotCanvas.PYQT_VERSION
Scientific.QtWidgets.QtPlotCanvas.PYQT_VERSION_STR
Scientific.QtWidgets.QtPlotCanvas.QCOORD_MAX
Scientific.QtWidgets.QtPlotCanvas.QCOORD_MIN
Scientific.QtWidgets.QtPlotCanvas.QT_VERSION
Scientific.QtWidgets.QtPlotCanvas.QT_VERSION_STR
Scientific.QtWidgets.QtPlotCanvas.QtDebugMsg
Scientific.QtWidgets.QtPlotCanvas.QtFatalMsg
Scientific.QtWidgets.QtPlotCanvas.QtWarningMsg
Scientific.QtWidgets.QtPlotCanvas.colors_by_name
Scientific.QtWidgets.QtPlotCanvas.qApp
Scientific.QtWidgets.QtVisualizationCanvas.IO_AbortError
Scientific.QtWidgets.QtVisualizationCanvas.IO_Append
Scientific.QtWidgets.QtVisualizationCanvas.IO_Async
Scientific.QtWidgets.QtVisualizationCanvas.IO_Combined
Scientific.QtWidgets.QtVisualizationCanvas.IO_ConnectError
Scientific.QtWidgets.QtVisualizationCanvas.IO_Direct
Scientific.QtWidgets.QtVisualizationCanvas.IO_FatalError
Scientific.QtWidgets.QtVisualizationCanvas.IO_ModeMask
Scientific.QtWidgets.QtVisualizationCanvas.IO_Ok
Scientific.QtWidgets.QtVisualizationCanvas.IO_Open
Scientific.QtWidgets.QtVisualizationCanvas.IO_OpenError
Scientific.QtWidgets.QtVisualizationCanvas.IO_Raw
Scientific.QtWidgets.QtVisualizationCanvas.IO_ReadError
Scientific.QtWidgets.QtVisualizationCanvas.IO_ReadOnly
Scientific.QtWidgets.QtVisualizationCanvas.IO_ReadWrite
Scientific.QtWidgets.QtVisualizationCanvas.IO_ResourceError
Scientific.QtWidgets.QtVisualizationCanvas.IO_Sequential
Scientific.QtWidgets.QtVisualizationCanvas.IO_StateMask
Scientific.QtWidgets.QtVisualizationCanvas.IO_TimeOutError
Scientific.QtWidgets.QtVisualizationCanvas.IO_Translate
Scientific.QtWidgets.QtVisualizationCanvas.IO_Truncate
Scientific.QtWidgets.QtVisualizationCanvas.IO_TypeMask
Scientific.QtWidgets.QtVisualizationCanvas.IO_UnspecifiedError
Scientific.QtWidgets.QtVisualizationCanvas.IO_WriteError
Scientific.QtWidgets.QtVisualizationCanvas.IO_WriteOnly
Scientific.QtWidgets.QtVisualizationCanvas.PYQT_VERSION
Scientific.QtWidgets.QtVisualizationCanvas.PYQT_VERSION_STR
Scientific.QtWidgets.QtVisualizationCanvas.QCOORD_MAX
Scientific.QtWidgets.QtVisualizationCanvas.QCOORD_MIN
Scientific.QtWidgets.QtVisualizationCanvas.QT_VERSION
Scientific.QtWidgets.QtVisualizationCanvas.QT_VERSION_STR
Scientific.QtWidgets.QtVisualizationCanvas.QtDebugMsg
Scientific.QtWidgets.QtVisualizationCanvas.QtFatalMsg
Scientific.QtWidgets.QtVisualizationCanvas.QtWarningMsg
Scientific.QtWidgets.QtVisualizationCanvas.colors_by_name
Scientific.QtWidgets.QtVisualizationCanvas.qApp
Scientific.Visualization.VMD.ex
Scientific.Visualization.VMD.ey
Scientific.Visualization.VMD.ez
Scientific.Visualization.VRML.ex
Scientific.Visualization.VRML.ey
Scientific.Visualization.VRML.ez
Scientific.Visualization.VRML2.ex
Scientific.Visualization.VRML2.ey
Scientific.Visualization.VRML2.ez
Scientific.indexing.index_expression

ScientificPython-2.9.4/Doc/Reference/toc-Scientific-module.html0000644000076600000240000000174311501734227025046 0ustar hinsenstaff00000000000000 Scientific

Module Scientific


Classes

IterationCountExceededError

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.BSP-module.html0000644000076600000240000000527011501734227025470 0ustar hinsenstaff00000000000000 BSP

Module BSP


Classes

ParAccumulator
ParBase
ParClass
ParConstant
ParData
ParFunction
ParIndex
ParIndexIterator
ParIterator
ParMessages
ParRootFunction
ParRootSequence
ParSequence
ParTuple
ParValue

Variables

ParInvalid
name
numberOfProcessors
processorID

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.BSP.Console-module.html0000644000076600000240000000454411501734226027073 0ustar hinsenstaff00000000000000 Console

Module Console


Classes

BSPSyncError
OKToken
OutputStream
ParallelConsole
ParallelInterpreter

Functions

console
interpreter
isOK
syncCheck
synchronize
typePar

Variables

numberOfProcessors
ok
processorID

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.BSP.IO-module.html0000644000076600000240000000222711501734226025774 0ustar hinsenstaff00000000000000 IO

Module IO


Variables

ParInvalid
ParNetCDFFile
ParNetCDFVariable

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Clustering-module.html0000644000076600000240000000150611501734226027160 0ustar hinsenstaff00000000000000 Clustering

Module Clustering



ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Clustering.AffinityPropagation-module.html0000644000076600000240000000175411501734226033141 0ustar hinsenstaff00000000000000 AffinityPropagation

Module AffinityPropagation


Classes

DataSet

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.DictWithDefault-module.html0000644000076600000240000000174511501734226030072 0ustar hinsenstaff00000000000000 DictWithDefault

Module DictWithDefault


Classes

DictWithDefault

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.DistributedComputing-module.html0000644000076600000240000000153211501734226031210 0ustar hinsenstaff00000000000000 DistributedComputing

Module DistributedComputing



ScientificPython-2.9.4/Doc/Reference/toc-Scientific.DistributedComputing.MasterSlave-module.html0000644000076600000240000000371211501734227033440 0ustar hinsenstaff00000000000000 MasterSlave

Module MasterSlave


Classes

GlobalStateValue
MasterProcess
SlaveProcess

Functions

getMachineInfo
initializeMasterProcess
runJob
startSlaveProcess

Variables

debug

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.DistributedComputing.TaskManager-module.html0000644000076600000240000000340411501734227033405 0ustar hinsenstaff00000000000000 TaskManager

Module TaskManager


Classes

Task
TaskManager
TaskManagerTermination
TaskQueue
TaskRaisedException
Watchdog

Variables

debug

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.FFT-module.html0000644000076600000240000000166411501734227025466 0ustar hinsenstaff00000000000000 FFT

Module FFT


Variables

package

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Functions-module.html0000644000076600000240000000150411501734227027010 0ustar hinsenstaff00000000000000 Functions

Module Functions



ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Functions.Derivatives-module.html0000644000076600000240000000233611501734227031300 0ustar hinsenstaff00000000000000 Derivatives

Module Derivatives


Classes

DerivVar

Functions

DerivVector
isDerivVar

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Functions.FindRoot-module.html0000644000076600000240000000173111501734227030535 0ustar hinsenstaff00000000000000 FindRoot

Module FindRoot


Functions

newtonRaphson

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Functions.FirstDerivatives-module.html0000644000076600000240000000236711501734227032314 0ustar hinsenstaff00000000000000 FirstDerivatives

Module FirstDerivatives


Classes

DerivVar

Functions

DerivVector
isDerivVar

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Functions.Interpolation-module.html0000644000076600000240000000245511501734227031644 0ustar hinsenstaff00000000000000 Interpolation

Module Interpolation


Classes

InterpolatingFunction
NetCDFInterpolatingFunction

Variables

index_expression

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Functions.LeastSquares-module.html0000644000076600000240000000217311501734227031426 0ustar hinsenstaff00000000000000 LeastSquares

Module LeastSquares


Functions

leastSquaresFit
polynomialLeastSquaresFit

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Functions.Polynomial-module.html0000644000076600000240000000172611501734227031140 0ustar hinsenstaff00000000000000 Polynomial

Module Polynomial


Classes

Polynomial

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Functions.Rational-module.html0000644000076600000240000000173411501734227030565 0ustar hinsenstaff00000000000000 Rational

Module Rational


Classes

RationalFunction

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Functions.Romberg-module.html0000644000076600000240000000206711501734227030411 0ustar hinsenstaff00000000000000 Romberg

Module Romberg


Functions

romberg
trapezoid

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Geometry-module.html0000644000076600000240000000314011501734227026631 0ustar hinsenstaff00000000000000 Geometry

Module Geometry


Classes

Tensor
Vector

Variables

delta
epsilon
ex
ey
ez
nullVector

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Geometry.Objects3D-module.html0000644000076600000240000000425611501734227030421 0ustar hinsenstaff00000000000000 Objects3D

Module Objects3D


Classes

BravaisLattice
Circle
Cone
GeometricalObject3D
Lattice
Line
Plane
RhombicLattice
SCLattice
Sphere

Functions

rotateDirection
rotatePoint

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Geometry.Quaternion-module.html0000644000076600000240000000215311501734227030760 0ustar hinsenstaff00000000000000 Quaternion

Module Quaternion


Classes

Quaternion

Functions

isQuaternion

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Geometry.TensorAnalysis-module.html0000644000076600000240000000256111501734227031614 0ustar hinsenstaff00000000000000 TensorAnalysis

Module TensorAnalysis


Classes

ScalarField
TensorField
VectorField

Variables

index_expression

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Geometry.Transformation-module.html0000644000076600000240000000432611501734227031645 0ustar hinsenstaff00000000000000 Transformation

Module Transformation


Classes

Inversion
LinearTransformation
RigidBodyTransformation
Rotation
RotationTranslation
Scaling
Shear
Transformation
Translation

Functions

angleFromSineAndCosine
mod_angle

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.indexing-module.html0000644000076600000240000000172511501734227026652 0ustar hinsenstaff00000000000000 indexing

Module indexing


Variables

index_expression

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.IO-module.html0000644000076600000240000000146611501734227025356 0ustar hinsenstaff00000000000000 IO

Module IO



ScientificPython-2.9.4/Doc/Reference/toc-Scientific.IO.ArrayIO-module.html0000644000076600000240000000260111501734227026653 0ustar hinsenstaff00000000000000 ArrayIO

Module ArrayIO


Functions

readArray
readFloatArray
readIntegerArray
writeArray
writeDataSets

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.IO.FortranFormat-module.html0000644000076600000240000000211511501734227030131 0ustar hinsenstaff00000000000000 FortranFormat

Module FortranFormat


Classes

FortranFormat
FortranLine

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.IO.NetCDF-module.html0000644000076600000240000000206111501734227026410 0ustar hinsenstaff00000000000000 NetCDF

Module NetCDF


Classes

NetCDFFile
NetCDFVariable

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.IO.PDB-module.html0000644000076600000240000000514211501734227025755 0ustar hinsenstaff00000000000000 PDB

Module PDB


Classes

AminoAcidResidue
Atom
Chain
Group
HetAtom
Molecule
NucleotideChain
NucleotideResidue
PDBFile
PeptideChain
Residue
ResidueNumber
Structure

Functions

defineAminoAcidResidue
defineNucleicAcidResidue

Variables

amino_acids
nucleic_acids

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.IO.PDBSpaceGroups-module.html0000644000076600000240000000241711501734227030133 0ustar hinsenstaff00000000000000 PDBSpaceGroups

Module PDBSpaceGroups


Classes

SpaceGroup

Functions

getSpaceGroupTransformations

Variables

sg

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.IO.TextFile-module.html0000644000076600000240000000170511501734227027075 0ustar hinsenstaff00000000000000 TextFile

Module TextFile


Classes

TextFile

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.MPI-module.html0000644000076600000240000000452111501734227025467 0ustar hinsenstaff00000000000000 MPI

Module MPI


Classes

MPICommunicator
MPIOperationObject
MPIRequest
band
bor
bxor
land
lor
lxor
max
maxloc
min
minloc
prod
replace
sum

Variables

world

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.MPI.IO-module.html0000644000076600000240000000166211501734227026000 0ustar hinsenstaff00000000000000 IO

Module IO


Classes

LogFile

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.NRNG-module.html0000644000076600000240000000223711501734227025610 0ustar hinsenstaff00000000000000 NRNG

Module NRNG


Variables

default_distribution
package
standard_generator

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.NumberDict-module.html0000644000076600000240000000171411501734227027077 0ustar hinsenstaff00000000000000 NumberDict

Module NumberDict


Classes

NumberDict

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Physics-module.html0000644000076600000240000000150011501734227026456 0ustar hinsenstaff00000000000000 Physics

Module Physics



ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Physics.PhysicalQuantities-module.html0000644000076600000240000000360111501734227032304 0ustar hinsenstaff00000000000000 PhysicalQuantities

Module PhysicalQuantities


Classes

PhysicalQuantity
PhysicalUnit

Functions

description
isPhysicalQuantity
isPhysicalUnit

Variables

prefix
unit
value

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Physics.Potential-module.html0000644000076600000240000000306311501734227030422 0ustar hinsenstaff00000000000000 Potential

Module Potential


Classes

PotentialWithGradients
PotentialWithGradientsAndForceConstants

Functions

DerivVectors
EnergyGradients
EnergyGradientsForceConstants

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.QtWidgets-module.html0000644000076600000240000000150411501734227026753 0ustar hinsenstaff00000000000000 QtWidgets

Module QtWidgets



ScientificPython-2.9.4/Doc/Reference/toc-Scientific.QtWidgets.QtPlotCanvas-module.html0000644000076600000240000001355711501734227031344 0ustar hinsenstaff00000000000000 QtPlotCanvas

Module QtPlotCanvas


Classes

HorizontalLine
PlotCanvas
PlotGraphics
PolyLine
PolyMarker
PolyPoints
VerticalLine

Variables

IO_AbortError
IO_Append
IO_Async
IO_Combined
IO_ConnectError
IO_Direct
IO_FatalError
IO_ModeMask
IO_Ok
IO_Open
IO_OpenError
IO_Raw
IO_ReadError
IO_ReadOnly
IO_ReadWrite
IO_ResourceError
IO_Sequential
IO_StateMask
IO_TimeOutError
IO_Translate
IO_Truncate
IO_TypeMask
IO_UnspecifiedError
IO_WriteError
IO_WriteOnly
PYQT_VERSION
PYQT_VERSION_STR
QCOORD_MAX
QCOORD_MIN
QT_VERSION
QT_VERSION_STR
QtDebugMsg
QtFatalMsg
QtWarningMsg
colors_by_name
qApp

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.QtWidgets.QtVisualizationCanvas-module.html0000644000076600000240000001346011501734227033260 0ustar hinsenstaff00000000000000 QtVisualizationCanvas

Module QtVisualizationCanvas


Classes

PolyLine3D
VisualizationCanvas
VisualizationGraphics

Variables

IO_AbortError
IO_Append
IO_Async
IO_Combined
IO_ConnectError
IO_Direct
IO_FatalError
IO_ModeMask
IO_Ok
IO_Open
IO_OpenError
IO_Raw
IO_ReadError
IO_ReadOnly
IO_ReadWrite
IO_ResourceError
IO_Sequential
IO_StateMask
IO_TimeOutError
IO_Translate
IO_Truncate
IO_TypeMask
IO_UnspecifiedError
IO_WriteError
IO_WriteOnly
PYQT_VERSION
PYQT_VERSION_STR
QCOORD_MAX
QCOORD_MIN
QT_VERSION
QT_VERSION_STR
QtDebugMsg
QtFatalMsg
QtWarningMsg
colors_by_name
qApp

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Signals-module.html0000644000076600000240000000150011501734227026434 0ustar hinsenstaff00000000000000 Signals

Module Signals



ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Signals.Models-module.html0000644000076600000240000000214711501734227027666 0ustar hinsenstaff00000000000000 Models

Module Models


Classes

AutoRegressiveModel
AveragedAutoRegressiveModel

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Statistics-module.html0000644000076600000240000000405511501734227027176 0ustar hinsenstaff00000000000000 Statistics

Module Statistics


Functions

average
correlation
kurtosis
mean
median
mode
moment
normalizedMoment
skewness
standardDeviation
variance
weightedMean

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Statistics.Histogram-module.html0000644000076600000240000000212111501734227031122 0ustar hinsenstaff00000000000000 Histogram

Module Histogram


Classes

Histogram
WeightedHistogram

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Threading-module.html0000644000076600000240000000150411501734227026745 0ustar hinsenstaff00000000000000 Threading

Module Threading



ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Threading.TaskManager-module.html0000644000076600000240000000173311501734227031145 0ustar hinsenstaff00000000000000 TaskManager

Module TaskManager


Classes

TaskManager

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.TkWidgets-module.html0000644000076600000240000000270711501734227026753 0ustar hinsenstaff00000000000000 TkWidgets

Module TkWidgets


Classes

ButtonBar
FilenameEntry
FloatEntry
IntEntry
ModalDialog
StatusBar

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.TkWidgets.TkPlotCanvas-module.html0000644000076600000240000000323211501734227031315 0ustar hinsenstaff00000000000000 TkPlotCanvas

Module TkPlotCanvas


Classes

HorizontalLine
PlotCanvas
PlotGraphics
PolyLine
PolyMarker
PolyPoints
VerticalLine

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.TkWidgets.TkVisualizationCanvas-module.html0000644000076600000240000000242711501734227033245 0ustar hinsenstaff00000000000000 TkVisualizationCanvas

Module TkVisualizationCanvas


Classes

PolyLine3D
VisualizationCanvas
VisualizationGraphics

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Visualization-module.html0000644000076600000240000000151411501734227027702 0ustar hinsenstaff00000000000000 Visualization

Module Visualization



ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Visualization.Color-module.html0000644000076600000240000000250711501734227030762 0ustar hinsenstaff00000000000000 Color

Module Color


Classes

Color
ColorScale
SymmetricColorScale

Functions

ColorByName

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Visualization.PyMOL-module.html0000644000076600000240000000471711501734227030651 0ustar hinsenstaff00000000000000 PyMOL

Module PyMOL


Classes

Arrow
Cone
Cube
Cylinder
Group
Line
Material
Molecules
PyMOLObject
Scene
ShapeObject
Sphere

Functions

DiffuseMaterial
EmissiveMaterial
isGroup

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Visualization.VMD-module.html0000644000076600000240000000552311501734227030333 0ustar hinsenstaff00000000000000 VMD

Module VMD


Classes

Arrow
Cone
Cube
Cylinder
Group
Line
Material
Molecules
Scene
SceneFile
ShapeObject
Sphere
VMDObject

Functions

DiffuseMaterial
EmissiveMaterial
isGroup

Variables

ex
ey
ez

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Visualization.VPython-module.html0000644000076600000240000000514511501734227031314 0ustar hinsenstaff00000000000000 VPython

Module VPython


Classes

Arrow
Cone
Cube
Cylinder
GraphicsObject
Group
Line
Material
PolyLines
Polygons
Scene
ShapeObject
Sphere

Functions

DiffuseMaterial
EmissiveMaterial
isGroup

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Visualization.VRML-module.html0000644000076600000240000000630411501734227030463 0ustar hinsenstaff00000000000000 VRML

Module VRML


Classes

Arrow
Cone
Cube
Cylinder
Group
Line
LinearOrientedObject
Material
PolyLines
Polygons
Scene
SceneFile
ShapeObject
Sphere
VRMLFile
VRMLObject

Functions

DiffuseMaterial
EmissiveMaterial
isGroup

Variables

ex
ey
ez

ScientificPython-2.9.4/Doc/Reference/toc-Scientific.Visualization.VRML2-module.html0000644000076600000240000000667411501734227030557 0ustar hinsenstaff00000000000000 VRML2

Module VRML2


Classes

Arrow
Camera
Cone
Cube
Cylinder
Group
Line
LinearOrientedObject
Material
NavigationInfo
PolyLines
Polygons
Scene
SceneFile
ShapeObject
Sphere
VRMLFile
VRMLObject

Functions

DiffuseMaterial
EmissiveMaterial
isGroup

Variables

ex
ey
ez

ScientificPython-2.9.4/Doc/Reference/toc.html0000644000076600000240000003454011501734227021506 0ustar hinsenstaff00000000000000 Table of Contents

Table of Contents


Everything

Modules

Scientific
Scientific.BSP
Scientific.BSP.Console
Scientific.BSP.IO
Scientific.Clustering
Scientific.Clustering.AffinityPropagation
Scientific.DictWithDefault
Scientific.DistributedComputing
Scientific.DistributedComputing.MasterSlave
Scientific.DistributedComputing.TaskManager
Scientific.FFT
Scientific.Functions
Scientific.Functions.Derivatives
Scientific.Functions.FindRoot
Scientific.Functions.FirstDerivatives
Scientific.Functions.Interpolation
Scientific.Functions.LeastSquares
Scientific.Functions.Polynomial
Scientific.Functions.Rational
Scientific.Functions.Romberg
Scientific.Geometry
Scientific.Geometry.Objects3D
Scientific.Geometry.Quaternion
Scientific.Geometry.TensorAnalysis
Scientific.Geometry.Transformation
Scientific.IO
Scientific.IO.ArrayIO
Scientific.IO.FortranFormat
Scientific.IO.NetCDF
Scientific.IO.PDB
Scientific.IO.PDBSpaceGroups
Scientific.IO.TextFile
Scientific.MPI
Scientific.MPI.IO
Scientific.NRNG
Scientific.NumberDict
Scientific.Physics
Scientific.Physics.PhysicalQuantities
Scientific.Physics.Potential
Scientific.QtWidgets
Scientific.QtWidgets.QtPlotCanvas
Scientific.QtWidgets.QtVisualizationCanvas
Scientific.Signals
Scientific.Signals.Models
Scientific.Statistics
Scientific.Statistics.Histogram
Scientific.Threading
Scientific.Threading.TaskManager
Scientific.TkWidgets
Scientific.TkWidgets.TkPlotCanvas
Scientific.TkWidgets.TkVisualizationCanvas
Scientific.Visualization
Scientific.Visualization.Color
Scientific.Visualization.PyMOL
Scientific.Visualization.VMD
Scientific.Visualization.VPython
Scientific.Visualization.VRML
Scientific.Visualization.VRML2
Scientific.indexing

ScientificPython-2.9.4/Examples/0000755000076600000240000000000012270505005017172 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Examples/BSP/0000755000076600000240000000000012270505005017616 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Examples/BSP/example1.py0000644000076600000240000000125311501734223021707 0ustar hinsenstaff00000000000000from Scientific.BSP import ParSequence, ParFunction, ParRootFunction import operator # The local computation function. def square(numbers): return [x*x for x in numbers] # The global computation function. global_square = ParFunction(square) # The local output function def output(result): print result # The global output function - active on processor 0 only. global_output = ParRootFunction(output) # A list of numbers distributed over the processors. items = ParSequence(range(100)) # Computation. results = global_square(items) # Collect results on processor 0. all_results = results.reduce(operator.add, []) # Output from processor 0. global_output(all_results) ScientificPython-2.9.4/Examples/BSP/example1_array.py0000644000076600000240000000133711501734223023110 0ustar hinsenstaff00000000000000from Scientific.BSP import ParSequence, ParFunction, ParRootFunction import Numeric; N = Numeric import operator # The local computation function. def square(numbers): return numbers**2 # The global computation function. global_square = ParFunction(square) # The local output function def output(result): print result # The global output function - active on processor 0 only. global_output = ParRootFunction(output) # A list of numbers distributed over the processors. items = ParSequence(N.arange(100)) # Computation. results = global_square(items) # Collect results on processor 0. all_results = results.reduce(lambda a, b: N.concatenate((a, b)), N.zeros((0,))) # Output from processor 0. global_output(all_results) ScientificPython-2.9.4/Examples/BSP/example2.py0000644000076600000240000000223611501734223021712 0ustar hinsenstaff00000000000000from Scientific.BSP import ParData, ParSequence, ParAccumulator, \ ParFunction, ParRootFunction, numberOfProcessors import operator # Local and global computation functions. def makepairs(sequence1, sequence2): pairs = [] for item1 in sequence1: for item2 in sequence2: pairs.append((item1, item2)) return pairs global_makepairs = ParFunction(makepairs) # Local and global output functions. def output(result): print result global_output = ParRootFunction(output) # A list of data items (here letters) distributed over the processors. my_items = ParSequence('abcdef') # The number of the neighbour to the right (circular). neighbour_pid = ParData(lambda pid, nprocs: [(pid+1)%nprocs]) # Loop to construct all pairs. pairs = ParAccumulator(operator.add, []) pairs.addValue(global_makepairs(my_items, my_items)) other_items = my_items for i in range(numberOfProcessors-1): other_items = other_items.put(neighbour_pid)[0] pairs.addValue(global_makepairs(my_items, other_items)) # Collect results on processor 0. all_pairs = pairs.calculateTotal() # Output results from processor 0. global_output(all_pairs) ScientificPython-2.9.4/Examples/BSP/example3.py0000644000076600000240000000236611501734223021717 0ustar hinsenstaff00000000000000from Scientific.BSP import ParFunction, ParRootFunction, ParMessages, \ ParConstant, ParIterator, ParIndexIterator, \ numberOfProcessors import operator, string # The local and global input functions. def input(): data = open('numbers').readlines() numbers = map(string.atoi, map(string.strip, data)) chunk_size = (len(numbers)+numberOfProcessors-1)/numberOfProcessors chunks = [] for i in range(numberOfProcessors): chunks.append((i, numbers[i*chunk_size:(i+1)*chunk_size])) return chunks def empty(): return [] global_input = ParRootFunction(input, empty) # The local and global computation functions. def square(x): return x*x global_square = ParFunction(square) # The local and global output functions. def output(results): file = open('results', 'a') for value in results: file.write(`value` + '\n') file.close() global_output = ParRootFunction(output) # Read input data. data = global_input() # Distribute input data. items = ParMessages(data).exchange()[0] # Computation and output loop. for item in ParIterator(items): result = global_square(item) collected_results = result.put(ParConstant([0])) global_output(collected_results) ScientificPython-2.9.4/Examples/BSP/example4.py0000644000076600000240000000443111501734223021713 0ustar hinsenstaff00000000000000from Scientific.BSP import ParClass, ParBase, numberOfProcessors import Numeric, operator class DistributedMatrix(ParBase): def __parinit__(self, pid, nprocs, matrix, distribution_mode): self.full_shape = matrix.shape self.mode = distribution_mode if distribution_mode == 'row': chunk_size = (matrix.shape[0]+numberOfProcessors-1) \ / numberOfProcessors self.submatrix = matrix[pid*chunk_size:(pid+1)*chunk_size, :] elif distribution_mode == 'column': chunk_size = (matrix.shape[1]+numberOfProcessors-1) \ / numberOfProcessors self.submatrix = matrix[:, pid*chunk_size:(pid+1)*chunk_size] else: raise ValueError, "undefined mode " + distribution_mode def __init__(self, local_submatrix, full_shape, distribution_mode): self.submatrix = local_submatrix self.full_shape = full_shape self.mode = distribution_mode def __repr__(self): return "\n" + repr(self.submatrix) def __add__(self, other): if self.full_shape == other.full_shape and self.mode == other.mode: return DistributedMatrix(self.submatrix+other.submatrix, self.full_shape, self.mode) else: raise ValueError, "incompatible matrices" def __mul__(self, other): if self.full_shape[1] != other.full_shape[0]: raise ValueError, "incompatible matrix shapes" if self.mode == 'row' or other.mode == 'column': raise ValueError, "not implemented" product = Numeric.dot(self.submatrix, other.submatrix) full_shape = product.shape chunk_size = (full_shape[0]+numberOfProcessors-1)/numberOfProcessors messages = [] for i in range(numberOfProcessors): messages.append((i, product[i*chunk_size:(i+1)*chunk_size, :])) data = self.exchangeMessages(messages) sum = reduce(operator.add, data, 0) return DistributedMatrix(sum, full_shape, 'row') gDistributedMatrix = ParClass(DistributedMatrix) m = Numeric.resize(Numeric.arange(10), (8, 8)) v = Numeric.ones((8, 1)) matrix = gDistributedMatrix(m, 'column') vector = gDistributedMatrix(v, 'row') product = matrix*vector print product ScientificPython-2.9.4/Examples/demomodule.c0000644000076600000240000000541511501734162021501 0ustar hinsenstaff00000000000000/* * Demonstration of using the netCDF module from another C module. * * Written by Konrad Hinsen * last revision: 2001-1-3 */ #include "Python.h" #include "Numeric/arrayobject.h" #include "Scientific/netcdfmodule.h" /* * Create a file with two dimensions and one variable. * * Attention: there is no error checking in this code! All return * values ought to be tested. */ static PyObject * create_file(self, args) PyObject *self; /* Not used */ PyObject *args; /* Not used either */ { /* Pointer to file object */ PyNetCDFFileObject *file; /* Dimension names for variable foo */ char *dimensions[] = {"n", "xyz", "string_length"}; /* Pointer to variable object */ PyNetCDFVariableObject *foo, *bar; /* Pointer to indices */ PyNetCDFIndex *indices; /* Open file */ file = PyNetCDFFile_Open("demo.nc", "w"); /* Add file attribute */ PyNetCDFFile_SetAttributeString(file, "title", "useless data"); /* Add history line */ PyNetCDFFile_AddHistoryLine(file, "Created some day"); /* Create two dimensions */ PyNetCDFFile_CreateDimension(file, dimensions[0], 10); PyNetCDFFile_CreateDimension(file, dimensions[1], 3); PyNetCDFFile_CreateDimension(file, dimensions[2], 100); /* Create variable */ foo = PyNetCDFFile_CreateVariable(file, "foo", 'l', dimensions, 2); /* Add variable attribute */ PyNetCDFVariable_SetAttributeString(foo, "units", "arbitrary"); /* Create index array */ indices = PyNetCDFVariable_Indices(foo); /* Write zeros everywhere */ PyNetCDFVariable_WriteArray(foo, indices, PyInt_FromLong(0)); /* Create variable */ bar = PyNetCDFFile_CreateVariable(file, "bar", 'c', dimensions+2, 1); /* Write string */ PyNetCDFVariable_WriteString(bar, (PyStringObject *)PyString_FromString("nothing important")); /* Close file */ PyNetCDFFile_Close(file); /* Return None */ Py_INCREF(Py_None); return Py_None; } /* Table of functions defined in the module */ static PyMethodDef demo_methods[] = { {"createDemoFile", create_file, 1}, {NULL, NULL} /* sentinel */ }; /* Module initialization */ void initdemo() { PyObject *module; PyObject *netcdf, *netcdf_dict; PyObject *c_api_object; /* Create the module and add the functions */ module = Py_InitModule("demo", demo_methods); /* Import the array module */ import_array(); /* Import netcdf and retrieve its C API address array */ netcdf = PyImport_ImportModule("Scientific.IO.NetCDF"); if (netcdf != NULL) { netcdf_dict = PyModule_GetDict(netcdf); c_api_object = PyDict_GetItemString(netcdf_dict, "_C_API"); if (PyCObject_Check(c_api_object)) { PyNetCDF_API = (void **)PyCObject_AsVoidPtr(c_api_object); } } /* Check for errors */ if (PyErr_Occurred()) Py_FatalError("can't initialize module demo"); } ScientificPython-2.9.4/Examples/master.py0000644000076600000240000000265411501734163021053 0ustar hinsenstaff00000000000000# Example for distributed computing using a master-slave setup. # You need Pyro (pyro.sourceforge.net) to run this example. # # 1) Type "ns" in a shell window to start the Pyro name server. # 2) Type "python master.py" in a second shell window to start # the master process. # 3) Type "task_manager slave demo" in a third shell window # to start one slave process. # # You can run as many slaves as you want (though for this trivial example, # the first slave will do all the work before you have time to start a # second one), and you can run them on any machine on the same local # network as the one that runs the master process. # # See the Pyro manual for other setups, e.g. running slaves on remote # machines connected to the Internet. # # Also see master_slave_demo.py to see how both master and slave can be # combined within a single script, which is more convenient for short # scripts. # from Scientific.DistributedComputing.MasterSlave import \ initializeMasterProcess, TaskRaisedException tasks = initializeMasterProcess("demo", slave_script="slave.py") # Do the master's work for i in range(5): # For i==0 this raises an exception task_id = tasks.requestTask("sqrt", float(i-1)) for i in range(5): try: task_id, tag, result = tasks.retrieveResult("sqrt") print result except TaskRaisedException, e: print "Task %s raised %s" % (e.task_id, str(e.exception)) print e.traceback ScientificPython-2.9.4/Examples/master_slave_demo.py0000644000076600000240000000323111501734163023241 0ustar hinsenstaff00000000000000# Example for distributed computing using a master-slave setup. # You need Pyro (pyro.sourceforge.net) to run this example. # # 1) Type "ns" in a shell window to start the Pyro name server. # 2) Type "python master_slave_demo.py" in a second shell # window to start the master process. # 3) Type "task_manager slave demo" in a third shell # window to start one slave process. # # You can run as many slaves as you want (though for this trivial example, # the first slave will do all the work before you have time to start a # second one), and you can run them on any machine on the same local # network as the one that runs the master process. # # See the Pyro manual for other setups, e.g. running slaves on remote # machines connected to the Internet. # # Also see master.py and slave.py to see how master and slave process can # be defined by separate programs. This is more convenient for multi-module # programs. # from Scientific.DistributedComputing.MasterSlave \ import MasterProcess, SlaveProcess, runJob, TaskRaisedException from Scientific import N import sys class Master(MasterProcess): def run(self): for i in range(5): # For i==0 this raises an exception task_id = self.requestTask("sqrt", float(i-1)) for i in range(5): try: task_id, tag, result = self.retrieveResult("sqrt") print result except TaskRaisedException, e: print "Task %s raised %s" % (e.task_id, str(e.exception)) print e.traceback class SquareRoot(SlaveProcess): def do_sqrt(self, x): return (x, N.sqrt(x)) runJob("demo", Master, SquareRoot) ScientificPython-2.9.4/Examples/mpi.py0000644000076600000240000000275011501734157020345 0ustar hinsenstaff00000000000000from Scientific import MPI from Scientific import N import sys communicator = MPI.world.duplicate() # Send and receive if communicator.rank == 0: data = 1.*N.arange(10) communicator.send(data, 1, 0) print "%d sent:\n%s" % (communicator.rank, str(data)) data, source, tag = communicator.receiveString(1, None) print "%d received string from %d: %s" % (communicator.rank, source, data) elif communicator.rank == 1: data, source, tag, count = \ communicator.receive(N.Float, None, None) print "%d received from %d:\n%s" \ % (communicator.rank, source, str(data)) communicator.send("Hello world", 0, 42) else: print "%d idle" % communicator.rank # Barrier print "%d waiting at barrier" % communicator.rank sys.stdout.flush() communicator.barrier() print "%d passed barrier" % communicator.rank sys.stdout.flush() # Broadcast data = N.zeros((5,), N.Float) if communicator.rank == 0: data[:] = 42. communicator.broadcast(data, 0) print "%d has:\n %s" % (communicator.rank, str(data)) sys.stdout.flush() communicator.barrier() # Reduce data_send = (communicator.rank+1) * N.arange(3) data_recv = N.zeros_st(3, data_send) communicator.reduce(data_send, data_recv, MPI.sum, 0) print "%d has:\n %s" % (communicator.rank, str(data_recv)) # Share to_share = (communicator.rank+1)*N.arange(5) all = N.zeros_st((communicator.size,)+to_share.shape, to_share) communicator.share(to_share, all) print "%d has:\n%s" % (communicator.rank, str(all)) ScientificPython-2.9.4/Examples/netcdf_demo.py0000644000076600000240000000225412270504141022016 0ustar hinsenstaff00000000000000from Scientific.N import * from Scientific.IO.NetCDF import * import time def getUserName(): try: import os, pwd, string except ImportError: return 'unknown user' pwd_entry = pwd.getpwuid(os.getuid()) name = string.strip(string.splitfields(pwd_entry[4], ',')[0]) if name == '': name = pwd_entry[0] return name # # Creating a file # file = NetCDFFile('test.nc', 'w', 'Created ' + time.ctime(time.time()) + ' by ' + getUserName()) file.title = "Just some useless junk" file.version = 42 file.createDimension('xyz', 3) file.createDimension('n', 20) file.createDimension('t', None) # unlimited dimension foo = file.createVariable('foo', Float, ('n', 'xyz')) foo[:,:] = 0. foo[0,:] = [42., 42., 42.] foo[:,1] = 1. foo.units = "arbitrary" print foo[0] print foo.dimensions bar = file.createVariable('bar', Int, ('t', 'n')) for i in range(10): bar[i] = i print bar.shape print file.dimensions print file.variables file.close() # # Reading a file # file = NetCDFFile('test.nc', 'r') print file.dimensions print file.variables foo = file.variables['foo'] foo_array = foo[:] foo_units = foo.units print foo[0] file.close() ScientificPython-2.9.4/Examples/README0000644000076600000240000000044111501734157020061 0ustar hinsenstaff00000000000000Examples for the use of the package Scientific ============================================== netcdf_demo.py shows how the netCDF interface is used from Python. demomodule.c shows how the netCDF interface is used from C extension modules. BSP/* the examples from the BSP tutorial ScientificPython-2.9.4/Examples/slave.py0000644000076600000240000000224011501734163020661 0ustar hinsenstaff00000000000000# Example for distributed computing using a master-slave setup. # You need Pyro (pyro.sourceforge.net) to run this example. # # 1) Type "ns" in a shell window to start the Pyro name server. # 2) Type "python master.py" in a second shell window to start # the master process. # 3) Type "task_manager slave demo" in a third shell window # to start one slave process. # # You can run as many slaves as you want (though for this trivial example, # the first slave will do all the work before you have time to start a # second one), and you can run them on any machine on the same local # network as the one that runs the master process. # # See the Pyro manual for other setups, e.g. running slaves on remote # machines connected to the Internet. # # Also see master_slave_demo.py to see how both master and slave can be # combined within a single script, which is more convenient for short # scripts. # from Scientific.DistributedComputing.MasterSlave import startSlaveProcess from Scientific import N # Define (or import) all the task handlers. def do_sqrt(x): return (x, N.sqrt(x)) # Start the slave process after all task handlers have been defined. startSlaveProcess() ScientificPython-2.9.4/HG_CHANGESET_ID0000644000076600000240000000010211504063766017577 0ustar hinsenstaff00000000000000# Mercurial changeset ID 7313669dde4d034570659ae6c4c3f8408bc857f8 ScientificPython-2.9.4/Include/0000755000076600000240000000000012270505005016777 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Include/Scientific/0000755000076600000240000000000012270505005021057 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Include/Scientific/arrayobject.h0000644000076600000240000000041312176746500023547 0ustar hinsenstaff00000000000000#if defined(NUMPY) #include "numpy/oldnumeric.h" #define NUMERICS_PACKAGE "NumPy" #else #if defined(NUMARRAY) #include "Numeric/arrayobject.h" #define NUMERICS_PACKAGE "Numarray" #else #include "Numeric/arrayobject.h" #define NUMERICS_PACKAGE "Numeric" #endif #endif ScientificPython-2.9.4/Include/Scientific/bspmodule.h0000644000076600000240000000163411501734224023231 0ustar hinsenstaff00000000000000/* * Include file for BSPlib interface. * * Written by Konrad Hinsen * last revision: 2001-11-20 */ #ifndef Py_BSPMODULE_H #define Py_BSPMODULE_H #ifdef __cplusplus extern "C" { #endif #include "Scientific/arrayobject.h" #include "bsp.h" /* Include the automatically generated API definitions */ #include "Scientific/PyBSP_API.h" /* Tag type and size for sending Python objects */ typedef enum {PyBSP_StringTag, PyBSP_ArrayTypeTag, PyBSP_ArrayDataTag} PyBSP_ObjectType; typedef struct {PyBSP_ObjectType type; char number; int source_pid;} PyBSP_Tag; const int PyBSP_TAGSIZE = sizeof(PyBSP_Tag); /* Message queue for receiving Python objects */ typedef struct {PyBSP_Tag *tag_ptr; void *payload_ptr; int length;} PyBSP_Message; #ifdef __cplusplus } #endif #endif /* Py_BSPMODULE_H */ ScientificPython-2.9.4/Include/Scientific/mpimodule.h0000644000076600000240000001166211501734224023234 0ustar hinsenstaff00000000000000/* * Include file for MPI interface. * * Written by Konrad Hinsen * and Jakob Schiotz * and Ciro Cattuto * last revision: 2001-3-27 */ #ifndef Py_MPIMODULE_H #define Py_MPIMODULE_H /* INSTRUCTIONS: This header file is used to create Python extension modules that use MPI (either manually or using SWIG). It exports the necessary functions from the Python executable using the standard CObject method. If possible, use the PyMPI functions defined in Scientific/PyMPI_API.h . They take a Python communicator object as their first argument. In some cases, e.g. when using source code shared between a Python module and a stand-alone executable, it is more practical to use ordinary MPI calls (MPI_Send() etc). This header files also exports many MPI_XXXX symbols from the MPI library linked into the mpipython executable. WARNING: If you use an MPI call that is not exported through this header file, you risk to either get undefined symbols in your module, or to load two copies of the MPI library. See the "troubleshooting" section below. INSTRUCTIONS FOR SINGLE FILE MODULES: If you are building an extension module in a single source file, just #include this header file, and remember to call the macro import_mpi() in the module initialization code. INSTRUCTIONS FOR MULTIPLE FILE MODULES: The PyMPI_API array of pointers must be shared and cannot therefore be declared static. In all file except one, write #define PYMPI_API_LINKAGE extern #include "Scientific/mpimodule.h" and in one file (e.g. where the module initialization is), write #define PYMPI_API_LINKAGE #include "Scientific/mpimodule.h" Again, remember to call import_mpi() in the module initialization code. Having an externally linked PyMPI_API array creates the risk of colliding symbols if you load multiple MPI-aware modules into Python. This is probably harmless, but can be avoided by changing the name of the array, e.g. by writing #define PyMPI_API PyMPI_API_MYMODULENAME before Scientific/mpimodule.h is included (this must of course be done in _all_ .c files in your extension module). TROUBLESHOOTING: This header file has to include the original mpi.h in order to get the definitions of the MPI data types (in particular MPI_Status and MPI_Request). This means that the compiler will not warn you, if you use an MPI_XXXX function that is not exported through the usual Python mechanism. Instead, you will probably get linkage problems when linking the module or when loading it into Python (or, on some platforms, two copies of the MPI library loaded into Python). The symptoms may vary from platform to platform (errors when importing the module, weird coredumps, errors from MPI, ...). To check for this problem, use nm on your module or on the .o files: nm mymodule.so | grep MPI nm *.o | grep MPI The only output from this should be PyMPI_API. If there are other MPI symbols, you should probably extend the list of functions exported through this header file. EXTENDING THE LIST OF EXPORTED MPI FUNCTIONS: Add the missing functions to the end of Src/Scientific_mpi.export, (the syntax should be obvious). Then run makeheader.py, and copy the resulting PyMPI_API.h file to Scientific/Includes/Scientific . IMPORTANT: Remember to rebuild the python executable containing Scientific.MPI (mpipython) and ALL your own modules using MPI! */ #ifdef __cplusplus extern "C" { #endif #include "Scientific/arrayobject.h" #include "mpi.h" #ifndef MPI_VERSION #define MPI_VERSION 1 #endif #ifndef MPI_SUBVERSION #define MPI_SUBVERSION 0 #endif #ifdef MS_WINDOWS #ifndef snprintf #define snprintf _snprintf #endif #endif /* MPI communicator object */ typedef struct { PyObject_HEAD MPI_Comm handle; int rank; int size; } PyMPICommunicatorObject; #define PyMPICommunicatorObject_Check(v) \ ((v)->ob_type == &PyMPICommunicator_Type) /* MPI request object */ typedef struct { PyObject_HEAD MPI_Request handle[1]; int active; /* Is it still valid, or has the request been processed? */ int operation; /* 0 = receive, 1 = send */ PyObject *buffer; /* The buffer being used */ MPI_Datatype mpi_type; /* The type of data send */ } PyMPIRequestObject; #define PyMPIRequestObject_Check(v) \ ((v)->ob_type == &PyMPIRequest_Type) #define PyMPIRequestReceive 0 #define PyMPIRequestSend 1 /* MPI operation object */ #define OP_NAME_LEN 16 typedef struct { PyObject_HEAD MPI_Op mpi_op; /* operation type */ char op_name[OP_NAME_LEN]; /* operation name */ } PyMPIOperationObject; #define PyMPIOperationObject_Check(v) \ ((v)->ob_type == &PyMPIOperation_Type) /* Include the automatically generated API definitions */ #include "Scientific/PyMPI_API.h" #ifdef __cplusplus } #endif #endif /* Py_MPIMODULE_H */ ScientificPython-2.9.4/Include/Scientific/netcdfmodule.h0000644000076600000240000003166711501734224023721 0ustar hinsenstaff00000000000000#ifndef Py_NETCDFMODULE_H #define Py_NETCDFMODULE_H #ifdef __cplusplus extern "C" { #endif /* * Include file for netCDF files and variables. * * Written by Konrad Hinsen * last revision: 2006-11-25 */ #include #if PY_VERSION_HEX < 0x02050000 #if !defined(PY_SSIZE_T_COMPATIBILITY) #define PY_SSIZE_T_COMPATIBILITY #if !defined(NUMPY) typedef int Py_ssize_t; #endif #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN typedef Py_ssize_t (*lenfunc)(PyObject *); typedef PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t); typedef PyObject *(*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t); typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *); typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); typedef Py_ssize_t (*readbufferproc)(PyObject *, Py_ssize_t, void **); typedef Py_ssize_t (*writebufferproc)(PyObject *, Py_ssize_t, void **); typedef Py_ssize_t (*segcountproc)(PyObject *, Py_ssize_t *); typedef Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, char **); #endif #endif /* NetCDFFile object */ typedef struct { PyObject_HEAD PyObject *dimensions; /* dictionary */ PyObject *variables; /* dictionary */ PyObject *attributes; /* dictionary */ PyObject *name; /* string */ PyObject *mode; /* string */ int id; char open; char define; char write; int recdim; } PyNetCDFFileObject; /* NetCDFVariable object */ typedef struct { PyObject_HEAD PyNetCDFFileObject *file; PyObject *attributes; /* dictionary */ char *name; int *dimids; size_t *dimensions; int type; /* same as array types */ int nd; int id; char unlimited; } PyNetCDFVariableObject; /* Variable index structure */ typedef struct { Py_ssize_t start; Py_ssize_t stop; Py_ssize_t stride; Py_ssize_t item; } PyNetCDFIndex; /* * C API functions */ /* Type definitions */ #define PyNetCDFFile_Type_NUM 0 #define PyNetCDFVariable_Type_NUM 1 /* Open a netCDF file (i.e. create a new file object) */ #define PyNetCDFFile_Open_RET PyNetCDFFileObject * #define PyNetCDFFile_Open_PROTO Py_PROTO((char *filename, char *mode)) #define PyNetCDFFile_Open_NUM 2 /* Close a netCDF file. Returns -1 if there was an error. */ #define PyNetCDFFile_Close_RET int #define PyNetCDFFile_Close_PROTO Py_PROTO((PyNetCDFFileObject *file)) #define PyNetCDFFile_Close_NUM 3 /* Ensure that all data is written to the disk file. Returns 0 if there was an error. */ #define PyNetCDFFile_Sync_RET int #define PyNetCDFFile_Sync_PROTO Py_PROTO((PyNetCDFFileObject *file)) #define PyNetCDFFile_Sync_NUM 4 /* Create a new dimension. Returns -1 if there was an error. */ #define PyNetCDFFile_CreateDimension_RET int #define PyNetCDFFile_CreateDimension_PROTO \ Py_PROTO((PyNetCDFFileObject *file, char *name, long size)) #define PyNetCDFFile_CreateDimension_NUM 5 /* Create a netCDF variable and return the variable object */ #define PyNetCDFFile_CreateVariable_RET PyNetCDFVariableObject * #define PyNetCDFFile_CreateVariable_PROTO \ Py_PROTO((PyNetCDFFileObject *file, char *name, int typecode, \ char **dimension_names, int ndim)) #define PyNetCDFFile_CreateVariable_NUM 6 /* Return an object referring to an existing variable */ #define PyNetCDFFile_GetVariable_RET PyNetCDFVariableObject * #define PyNetCDFFile_GetVariable_PROTO \ Py_PROTO((PyNetCDFFileObject *file, char *name)) #define PyNetCDFFile_GetVariable_NUM 7 /* Get variable rank */ #define PyNetCDFVariable_GetRank_RET int #define PyNetCDFVariable_GetRank_PROTO Py_PROTO((PyNetCDFVariableObject *var)) #define PyNetCDFVariable_GetRank_NUM 8 /* Get variable shape */ #define PyNetCDFVariable_GetShape_RET size_t * #define PyNetCDFVariable_GetShape_PROTO Py_PROTO((PyNetCDFVariableObject *var)) #define PyNetCDFVariable_GetShape_NUM 9 /* Allocate and initialize index structures for reading/writing data */ #define PyNetCDFVariable_Indices_RET PyNetCDFIndex * #define PyNetCDFVariable_Indices_PROTO Py_PROTO((PyNetCDFVariableObject *var)) #define PyNetCDFVariable_Indices_NUM 10 /* Read data and return an array object */ #define PyNetCDFVariable_ReadAsArray_RET PyArrayObject * #define PyNetCDFVariable_ReadAsArray_PROTO \ Py_PROTO((PyNetCDFVariableObject *var, PyNetCDFIndex *indices)) #define PyNetCDFVariable_ReadAsArray_NUM 11 /* Write array. Returns -1 if there was an error. */ #define PyNetCDFVariable_WriteArray_RET int #define PyNetCDFVariable_WriteArray_PROTO \ Py_PROTO((PyNetCDFVariableObject *var, PyNetCDFIndex *indices, \ PyObject *array)) #define PyNetCDFVariable_WriteArray_NUM 12 /* Get file attribute */ #define PyNetCDFFile_GetAttribute_RET PyObject * #define PyNetCDFFile_GetAttribute_PROTO \ Py_PROTO((PyNetCDFFileObject *var, char *name)) #define PyNetCDFFile_GetAttribute_NUM 13 /* Set file attribute */ #define PyNetCDFFile_SetAttribute_RET int #define PyNetCDFFile_SetAttribute_PROTO \ Py_PROTO((PyNetCDFFileObject *var, char *name, PyObject *value)) #define PyNetCDFFile_SetAttribute_NUM 14 /* Set file attribute to string value */ #define PyNetCDFFile_SetAttributeString_RET int #define PyNetCDFFile_SetAttributeString_PROTO \ Py_PROTO((PyNetCDFFileObject *var, char *name, char *value)) #define PyNetCDFFile_SetAttributeString_NUM 15 /* Get variable attribute */ #define PyNetCDFVariable_GetAttribute_RET PyObject * #define PyNetCDFVariable_GetAttribute_PROTO \ Py_PROTO((PyNetCDFVariableObject *var, char *name)) #define PyNetCDFVariable_GetAttribute_NUM 16 /* Set variable attribute */ #define PyNetCDFVariable_SetAttribute_RET int #define PyNetCDFVariable_SetAttribute_PROTO \ Py_PROTO((PyNetCDFVariableObject *var, char *name, PyObject *value)) #define PyNetCDFVariable_SetAttribute_NUM 17 /* Set variable attribute to string value */ #define PyNetCDFVariable_SetAttributeString_RET int #define PyNetCDFVariable_SetAttributeString_PROTO \ Py_PROTO((PyNetCDFVariableObject *var, char *name, char *value)) #define PyNetCDFVariable_SetAttributeString_NUM 18 /* Add entry to the history */ #define PyNetCDFFile_AddHistoryLine_RET int #define PyNetCDFFile_AddHistoryLine_PROTO \ Py_PROTO((PyNetCDFFileObject *self, char *text)) #define PyNetCDFFile_AddHistoryLine_NUM 19 /* Write string. Returns -1 if there was an error. */ #define PyNetCDFVariable_WriteString_RET int #define PyNetCDFVariable_WriteString_PROTO \ Py_PROTO((PyNetCDFVariableObject *var, PyStringObject *value)) #define PyNetCDFVariable_WriteString_NUM 20 /* Read string */ #define PyNetCDFVariable_ReadAsString_RET PyStringObject * #define PyNetCDFVariable_ReadAsString_PROTO \ Py_PROTO((PyNetCDFVariableObject *var)) #define PyNetCDFVariable_ReadAsString_NUM 21 /* Total number of C API pointers */ #define PyNetCDF_API_pointers 22 #ifdef _NETCDF_MODULE /* Type object declarations */ staticforward PyTypeObject PyNetCDFFile_Type; staticforward PyTypeObject PyNetCDFVariable_Type; /* Type check macros */ #define PyNetCDFFile_Check(op) ((op)->ob_type == &PyNetCDFFile_Type) #define PyNetCDFVariable_Check(op) ((op)->ob_type == &PyNetCDFVariable_Type) /* C API function declarations */ static PyNetCDFFile_Open_RET PyNetCDFFile_Open PyNetCDFFile_Open_PROTO; static PyNetCDFFile_Close_RET PyNetCDFFile_Close PyNetCDFFile_Close_PROTO; static PyNetCDFFile_Sync_RET PyNetCDFFile_Sync PyNetCDFFile_Sync_PROTO; static PyNetCDFFile_CreateDimension_RET PyNetCDFFile_CreateDimension \ PyNetCDFFile_CreateDimension_PROTO; static PyNetCDFFile_CreateVariable_RET PyNetCDFFile_CreateVariable \ PyNetCDFFile_CreateVariable_PROTO; static PyNetCDFFile_GetVariable_RET PyNetCDFFile_GetVariable \ PyNetCDFFile_GetVariable_PROTO; static PyNetCDFVariable_GetRank_RET PyNetCDFVariable_GetRank \ PyNetCDFVariable_GetRank_PROTO; static PyNetCDFVariable_GetShape_RET PyNetCDFVariable_GetShape \ PyNetCDFVariable_GetShape_PROTO; static PyNetCDFVariable_Indices_RET PyNetCDFVariable_Indices \ PyNetCDFVariable_Indices_PROTO; static PyNetCDFVariable_ReadAsArray_RET PyNetCDFVariable_ReadAsArray \ PyNetCDFVariable_ReadAsArray_PROTO; static PyNetCDFVariable_ReadAsString_RET PyNetCDFVariable_ReadAsString \ PyNetCDFVariable_ReadAsString_PROTO; static PyNetCDFVariable_WriteArray_RET PyNetCDFVariable_WriteArray \ PyNetCDFVariable_WriteArray_PROTO; static PyNetCDFVariable_WriteString_RET PyNetCDFVariable_WriteString \ PyNetCDFVariable_WriteString_PROTO; static PyNetCDFFile_GetAttribute_RET PyNetCDFFile_GetAttribute \ PyNetCDFFile_GetAttribute_PROTO; static PyNetCDFFile_SetAttribute_RET PyNetCDFFile_SetAttribute \ PyNetCDFFile_SetAttribute_PROTO; static PyNetCDFFile_SetAttributeString_RET PyNetCDFFile_SetAttributeString \ PyNetCDFFile_SetAttributeString_PROTO; static PyNetCDFVariable_GetAttribute_RET PyNetCDFVariable_GetAttribute \ PyNetCDFVariable_GetAttribute_PROTO; static PyNetCDFVariable_SetAttribute_RET PyNetCDFVariable_SetAttribute \ PyNetCDFVariable_SetAttribute_PROTO; static PyNetCDFVariable_SetAttributeString_RET \ PyNetCDFVariable_SetAttributeString \ PyNetCDFVariable_SetAttributeString_PROTO; static PyNetCDFFile_AddHistoryLine_RET PyNetCDFFile_AddHistoryLine \ PyNetCDFFile_AddHistoryLine_PROTO; #else /* C API address pointer */ static void **PyNetCDF_API; /* Type check macros */ #define PyNetCDFFile_Check(op) \ ((op)->ob_type == (PyTypeObject *)PyNetCDF_API[PyNetCDFFile_Type_NUM]) #define PyNetCDFVariable_Check(op) \ ((op)->ob_type == (PyTypeObject *)PyNetCDF_API[PyNetCDFVariable_Type_NUM]) /* C API function declarations */ #define PyNetCDFFile_Open \ (*(PyNetCDFFile_Open_RET (*)PyNetCDFFile_Open_PROTO) \ PyNetCDF_API[PyNetCDFFile_Open_NUM]) #define PyNetCDFFile_Close \ (*(PyNetCDFFile_Close_RET (*)PyNetCDFFile_Close_PROTO) \ PyNetCDF_API[PyNetCDFFile_Close_NUM]) #define PyNetCDFFile_Sync \ (*(PyNetCDFFile_Sync_RET (*)PyNetCDFFile_Sync_PROTO) \ PyNetCDF_API[PyNetCDFFile_Sync_NUM]) #define PyNetCDFFile_CreateDimension \ (*(PyNetCDFFile_CreateDimension_RET (*)PyNetCDFFile_CreateDimension_PROTO) \ PyNetCDF_API[PyNetCDFFile_CreateDimension_NUM]) #define PyNetCDFFile_CreateVariable \ (*(PyNetCDFFile_CreateVariable_RET (*)PyNetCDFFile_CreateVariable_PROTO) \ PyNetCDF_API[PyNetCDFFile_CreateVariable_NUM]) #define PyNetCDFFile_GetVariable \ (*(PyNetCDFFile_GetVariable_RET (*)PyNetCDFFile_GetVariable_PROTO) \ PyNetCDF_API[PyNetCDFFile_GetVariable_NUM]) #define PyNetCDFVariable_GetRank \ (*(PyNetCDFVariable_GetRank_RET (*)PyNetCDFVariable_GetRank_PROTO) \ PyNetCDF_API[PyNetCDFVariable_GetRank_NUM]) #define PyNetCDFVariable_GetShape \ (*(PyNetCDFVariable_GetShape_RET (*)PyNetCDFVariable_GetShape_PROTO) \ PyNetCDF_API[PyNetCDFVariable_GetShape_NUM]) #define PyNetCDFVariable_Indices \ (*(PyNetCDFVariable_Indices_RET (*)PyNetCDFVariable_Indices_PROTO) \ PyNetCDF_API[PyNetCDFVariable_Indices_NUM]) #define PyNetCDFVariable_ReadAsArray \ (*(PyNetCDFVariable_ReadAsArray_RET (*)PyNetCDFVariable_ReadAsArray_PROTO) \ PyNetCDF_API[PyNetCDFVariable_ReadAsArray_NUM]) #define PyNetCDFVariable_ReadAsString \ (*(PyNetCDFVariable_ReadAsString_RET (*)PyNetCDFVariable_ReadAsString_PROTO) \ PyNetCDF_API[PyNetCDFVariable_ReadAsString_NUM]) #define PyNetCDFVariable_WriteArray \ (*(PyNetCDFVariable_WriteArray_RET (*)PyNetCDFVariable_WriteArray_PROTO) \ PyNetCDF_API[PyNetCDFVariable_WriteArray_NUM]) #define PyNetCDFVariable_WriteString \ (*(PyNetCDFVariable_WriteString_RET (*)PyNetCDFVariable_WriteString_PROTO) \ PyNetCDF_API[PyNetCDFVariable_WriteString_NUM]) #define PyNetCDFFile_GetAttribute \ (*(PyNetCDFFile_GetAttribute_RET (*)PyNetCDFFile_GetAttribute_PROTO) \ PyNetCDF_API[PyNetCDFFile_GetAttribute_NUM]) #define PyNetCDFFile_SetAttribute \ (*(PyNetCDFFile_SetAttribute_RET (*)PyNetCDFFile_SetAttribute_PROTO) \ PyNetCDF_API[PyNetCDFFile_SetAttribute_NUM]) #define PyNetCDFFile_SetAttributeString \ (*(PyNetCDFFile_SetAttributeString_RET \ (*)PyNetCDFFile_SetAttributeString_PROTO) \ PyNetCDF_API[PyNetCDFFile_SetAttributeString_NUM]) #define PyNetCDFVariable_GetAttribute \ (*(PyNetCDFVariable_GetAttribute_RET (*)PyNetCDFVariable_GetAttribute_PROTO) \ PyNetCDF_API[PyNetCDFVariable_GetAttribute_NUM]) #define PyNetCDFVariable_SetAttribute \ (*(PyNetCDFVariable_SetAttribute_RET (*)PyNetCDFVariable_SetAttribute_PROTO) \ PyNetCDF_API[PyNetCDFVariable_SetAttribute_NUM]) #define PyNetCDFVariable_SetAttributeString \ (*(PyNetCDFVariable_SetAttributeString_RET \ (*)PyNetCDFVariable_SetAttributeString_PROTO) \ PyNetCDF_API[PyNetCDFVariable_SetAttributeString_NUM]) #define PyNetCDFFile_AddHistoryLine \ (*(PyNetCDFFile_AddHistoryLine_RET \ (*)PyNetCDFFile_AddHistoryLine_PROTO) \ PyNetCDF_API[PyNetCDFFile_AddHistoryLine_NUM]) #define import_netcdf() \ { \ PyObject *module = PyImport_ImportModule("Scientific.IO.NetCDF"); \ if (module != NULL) { \ PyObject *module_dict = PyModule_GetDict(module); \ PyObject *c_api_object = PyDict_GetItemString(module_dict, "_C_API"); \ if (PyCObject_Check(c_api_object)) { \ PyNetCDF_API = (void **)PyCObject_AsVoidPtr(c_api_object); \ } \ } \ } #endif #ifdef __cplusplus } #endif #endif /* Py_NETCDFMODULE_H */ ScientificPython-2.9.4/Include/Scientific/PyBSP_API.h0000644000076600000240000001071211501734224022662 0ustar hinsenstaff00000000000000/* * C API functions */ #define PyBSP_Sync_RET void #define PyBSP_Sync_PROTO Py_PROTO((void)) #define PyBSP_Sync_NUM 0 #define PyBSP_SetTagSize_RET void #define PyBSP_SetTagSize_PROTO Py_PROTO((int *tag_nbytes)) #define PyBSP_SetTagSize_NUM 1 #define PyBSP_Send_RET void #define PyBSP_Send_PROTO Py_PROTO((int pid, const void *tag, const void *payload, int payload_nbytes)) #define PyBSP_Send_NUM 2 #define PyBSP_QSize_RET void #define PyBSP_QSize_PROTO Py_PROTO((int *nmessages, int *accum_nbytes)) #define PyBSP_QSize_NUM 3 #define PyBSP_GetTag_RET void #define PyBSP_GetTag_PROTO Py_PROTO((int *status, void *tag)) #define PyBSP_GetTag_NUM 4 #define PyBSP_Move_RET void #define PyBSP_Move_PROTO Py_PROTO((void *payload, int reception_nbytes)) #define PyBSP_Move_NUM 5 #define PyBSP_HPMove_RET int #define PyBSP_HPMove_PROTO Py_PROTO((void **tag_ptr, void **payload_ptr)) #define PyBSP_HPMove_NUM 6 #define PyBSP_SendString_RET int #define PyBSP_SendString_PROTO Py_PROTO((PyStringObject *string, int dest_pid)) #define PyBSP_SendString_NUM 7 #define PyBSP_SendArray_RET int #define PyBSP_SendArray_PROTO Py_PROTO((PyArrayObject *array, int dest_pid)) #define PyBSP_SendArray_NUM 8 #define PyBSP_NumberOfObjects_RET int #define PyBSP_NumberOfObjects_PROTO Py_PROTO((void)) #define PyBSP_NumberOfObjects_NUM 9 #define PyBSP_ReceiveObject_RET PyObject * #define PyBSP_ReceiveObject_PROTO Py_PROTO((void)) #define PyBSP_ReceiveObject_NUM 10 #define PyBSP_API_pointers 11 #ifdef _BSP_MODULE static PyBSP_Sync_RET PyBSP_Sync PyBSP_Sync_PROTO; static PyBSP_SetTagSize_RET PyBSP_SetTagSize PyBSP_SetTagSize_PROTO; static PyBSP_Send_RET PyBSP_Send PyBSP_Send_PROTO; static PyBSP_QSize_RET PyBSP_QSize PyBSP_QSize_PROTO; static PyBSP_GetTag_RET PyBSP_GetTag PyBSP_GetTag_PROTO; static PyBSP_Move_RET PyBSP_Move PyBSP_Move_PROTO; static PyBSP_HPMove_RET PyBSP_HPMove PyBSP_HPMove_PROTO; static PyBSP_SendString_RET PyBSP_SendString PyBSP_SendString_PROTO; static PyBSP_SendArray_RET PyBSP_SendArray PyBSP_SendArray_PROTO; static PyBSP_NumberOfObjects_RET PyBSP_NumberOfObjects PyBSP_NumberOfObjects_PROTO; static PyBSP_ReceiveObject_RET PyBSP_ReceiveObject PyBSP_ReceiveObject_PROTO; #define set_PyBSP_API_pointers(){ \ PyBSP_API[PyBSP_Sync_NUM] = (void *)&PyBSP_Sync; \ PyBSP_API[PyBSP_SetTagSize_NUM] = (void *)&PyBSP_SetTagSize; \ PyBSP_API[PyBSP_Send_NUM] = (void *)&PyBSP_Send; \ PyBSP_API[PyBSP_QSize_NUM] = (void *)&PyBSP_QSize; \ PyBSP_API[PyBSP_GetTag_NUM] = (void *)&PyBSP_GetTag; \ PyBSP_API[PyBSP_Move_NUM] = (void *)&PyBSP_Move; \ PyBSP_API[PyBSP_HPMove_NUM] = (void *)&PyBSP_HPMove; \ PyBSP_API[PyBSP_SendString_NUM] = (void *)&PyBSP_SendString; \ PyBSP_API[PyBSP_SendArray_NUM] = (void *)&PyBSP_SendArray; \ PyBSP_API[PyBSP_NumberOfObjects_NUM] = (void *)&PyBSP_NumberOfObjects; \ PyBSP_API[PyBSP_ReceiveObject_NUM] = (void *)&PyBSP_ReceiveObject; \ } #else static void **PyBSP_API; #define PyBSP_Sync \ (*(PyBSP_Sync_RET (*)PyBSP_Sync_PROTO) \ PyBSP_API[PyBSP_Sync_NUM]) #define PyBSP_SetTagSize \ (*(PyBSP_SetTagSize_RET (*)PyBSP_SetTagSize_PROTO) \ PyBSP_API[PyBSP_SetTagSize_NUM]) #define PyBSP_Send \ (*(PyBSP_Send_RET (*)PyBSP_Send_PROTO) \ PyBSP_API[PyBSP_Send_NUM]) #define PyBSP_QSize \ (*(PyBSP_QSize_RET (*)PyBSP_QSize_PROTO) \ PyBSP_API[PyBSP_QSize_NUM]) #define PyBSP_GetTag \ (*(PyBSP_GetTag_RET (*)PyBSP_GetTag_PROTO) \ PyBSP_API[PyBSP_GetTag_NUM]) #define PyBSP_Move \ (*(PyBSP_Move_RET (*)PyBSP_Move_PROTO) \ PyBSP_API[PyBSP_Move_NUM]) #define PyBSP_HPMove \ (*(PyBSP_HPMove_RET (*)PyBSP_HPMove_PROTO) \ PyBSP_API[PyBSP_HPMove_NUM]) #define PyBSP_SendString \ (*(PyBSP_SendString_RET (*)PyBSP_SendString_PROTO) \ PyBSP_API[PyBSP_SendString_NUM]) #define PyBSP_SendArray \ (*(PyBSP_SendArray_RET (*)PyBSP_SendArray_PROTO) \ PyBSP_API[PyBSP_SendArray_NUM]) #define PyBSP_NumberOfObjects \ (*(PyBSP_NumberOfObjects_RET (*)PyBSP_NumberOfObjects_PROTO) \ PyBSP_API[PyBSP_NumberOfObjects_NUM]) #define PyBSP_ReceiveObject \ (*(PyBSP_ReceiveObject_RET (*)PyBSP_ReceiveObject_PROTO) \ PyBSP_API[PyBSP_ReceiveObject_NUM]) #define import_bsplib() \ { \ PyObject *module = PyImport_ImportModule("Scientific.BSPlib"); \ if (module != NULL) { \ PyObject *module_dict = PyModule_GetDict(module); \ PyObject *c_api_object = PyDict_GetItemString(module_dict, "_C_API"); \ if (PyCObject_Check(c_api_object)) { \ PyBSP_API = (void **)PyCObject_AsVoidPtr(c_api_object); \ } \ } \ } #endif ScientificPython-2.9.4/Include/Scientific/PyMPI_API.h0000644000076600000240000006626111501734224022675 0ustar hinsenstaff00000000000000/* * C API functions */ #define PyMPICommunicator_Type_NUM 0 #define PyMPIRequest_Type_NUM 1 #define PyMPI_DuplicateCommunicator_RET PyObject * #define PyMPI_DuplicateCommunicator_PROTO Py_PROTO((PyMPICommunicatorObject *comm)) #define PyMPI_DuplicateCommunicator_NUM 2 #define PyMPI_SubsetCommunicator_RET PyObject * #define PyMPI_SubsetCommunicator_PROTO Py_PROTO((PyMPICommunicatorObject *comm, PyArrayObject *array)) #define PyMPI_SubsetCommunicator_NUM 3 #define PyMPI_Barrier_RET int #define PyMPI_Barrier_PROTO Py_PROTO((PyMPICommunicatorObject *comm)) #define PyMPI_Barrier_NUM 4 #define PyMPI_Send_RET int #define PyMPI_Send_PROTO Py_PROTO((PyMPICommunicatorObject *comm, void *data, int mpi_type, int len, int dest, int tag)) #define PyMPI_Send_NUM 5 #define PyMPI_SendArray_RET int #define PyMPI_SendArray_PROTO Py_PROTO((PyMPICommunicatorObject *comm, PyArrayObject *array, int dest, int tag)) #define PyMPI_SendArray_NUM 6 #define PyMPI_SendString_RET int #define PyMPI_SendString_PROTO Py_PROTO((PyMPICommunicatorObject *comm, PyStringObject *string, int dest, int tag)) #define PyMPI_SendString_NUM 7 #define PyMPI_SendArrayNonBlocking_RET PyObject * #define PyMPI_SendArrayNonBlocking_PROTO Py_PROTO((PyMPICommunicatorObject *comm, PyArrayObject *array, int dest, int tag)) #define PyMPI_SendArrayNonBlocking_NUM 8 #define PyMPI_SendStringNonBlocking_RET PyObject * #define PyMPI_SendStringNonBlocking_PROTO Py_PROTO((PyMPICommunicatorObject *comm, PyStringObject *string, int dest, int tag)) #define PyMPI_SendStringNonBlocking_NUM 9 #define PyMPI_Receive_RET int #define PyMPI_Receive_PROTO Py_PROTO((PyMPICommunicatorObject *comm, void *buffer, int mpi_type, int len, int source, int tag, int *sourcep, int *tagp, int *lenp)) #define PyMPI_Receive_NUM 10 #define PyMPI_ReceiveArray_RET int #define PyMPI_ReceiveArray_PROTO Py_PROTO((PyMPICommunicatorObject *comm, PyArrayObject *array, int source, int tag, int *sourcep, int *tagp, int *lenp)) #define PyMPI_ReceiveArray_NUM 11 #define PyMPI_ReceiveString_RET PyObject * #define PyMPI_ReceiveString_PROTO Py_PROTO((PyMPICommunicatorObject *comm, int source, int tag, int *sourcep, int *tagp)) #define PyMPI_ReceiveString_NUM 12 #define PyMPI_ReceiveArrayNonBlocking_RET PyObject * #define PyMPI_ReceiveArrayNonBlocking_PROTO Py_PROTO((PyMPICommunicatorObject *comm, PyArrayObject *array, int source, int tag)) #define PyMPI_ReceiveArrayNonBlocking_NUM 13 #define PyMPI_ProbeNonBlocking_RET int #define PyMPI_ProbeNonBlocking_PROTO Py_PROTO((PyMPICommunicatorObject *comm, int source, int tag, int *flagp, int *sourcep, int *tagp)) #define PyMPI_ProbeNonBlocking_NUM 14 #define PyMPI_Broadcast_RET int #define PyMPI_Broadcast_PROTO Py_PROTO((PyMPICommunicatorObject *comm, void *buffer, int mpi_type, int count, int root)) #define PyMPI_Broadcast_NUM 15 #define PyMPI_BroadcastArray_RET int #define PyMPI_BroadcastArray_PROTO Py_PROTO((PyMPICommunicatorObject *comm, PyArrayObject *array, int root)) #define PyMPI_BroadcastArray_NUM 16 #define PyMPI_Share_RET int #define PyMPI_Share_PROTO Py_PROTO((PyMPICommunicatorObject *comm, void *send, void *receive, int mpi_type, int count)) #define PyMPI_Share_NUM 17 #define PyMPI_ShareArray_RET int #define PyMPI_ShareArray_PROTO Py_PROTO((PyMPICommunicatorObject *comm, PyArrayObject *send, PyArrayObject *receive)) #define PyMPI_ShareArray_NUM 18 #define PyMPI_Abort_RET int #define PyMPI_Abort_PROTO Py_PROTO((PyMPICommunicatorObject *comm, int err)) #define PyMPI_Abort_NUM 19 #define PyMPI_Reduce_RET int #define PyMPI_Reduce_PROTO Py_PROTO((PyMPICommunicatorObject *comm, void *sendbuf, void *recvbuf, int count, int datatype, PyMPIOperationObject *op, int root)) #define PyMPI_Reduce_NUM 20 #define PyMPI_Allreduce_RET int #define PyMPI_Allreduce_PROTO Py_PROTO((PyMPICommunicatorObject *comm, void *sendbuf, void *recvbuf, int count, int datatype, PyMPIOperationObject *op)) #define PyMPI_Allreduce_NUM 21 #define PyMPI_ReduceArray_RET int #define PyMPI_ReduceArray_PROTO Py_PROTO((PyMPICommunicatorObject *comm, PyArrayObject *send, PyArrayObject *receive, PyMPIOperationObject *op, int root)) #define PyMPI_ReduceArray_NUM 22 #define PyMPI_AllreduceArray_RET int #define PyMPI_AllreduceArray_PROTO Py_PROTO((PyMPICommunicatorObject *comm, PyArrayObject *send, PyArrayObject *receive, PyMPIOperationObject *op)) #define PyMPI_AllreduceArray_NUM 23 #define PyMPI_Wait_RET int #define PyMPI_Wait_PROTO Py_PROTO((PyMPIRequestObject *comm, void *s)) #define PyMPI_Wait_NUM 24 #define PyMPI_Test_RET int #define PyMPI_Test_PROTO Py_PROTO((PyMPIRequestObject *comm, int *flag, void *s)) #define PyMPI_Test_NUM 25 #define MPI_Abort_RET int #define MPI_Abort_PROTO Py_PROTO((MPI_Comm comm, int errorcode)) #define MPI_Abort_NUM 26 #define MPI_Allgather_RET int #define MPI_Allgather_PROTO Py_PROTO((void *sendbuffer, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)) #define MPI_Allgather_NUM 27 #define MPI_Allgatherv_RET int #define MPI_Allgatherv_PROTO Py_PROTO((void *sendbuffer, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcount, int *displs, MPI_Datatype recvtype, MPI_Comm comm)) #define MPI_Allgatherv_NUM 28 #define MPI_Allreduce_RET int #define MPI_Allreduce_PROTO Py_PROTO((void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)) #define MPI_Allreduce_NUM 29 #define MPI_Alltoall_RET int #define MPI_Alltoall_PROTO Py_PROTO((void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)) #define MPI_Alltoall_NUM 30 #define MPI_Alltoallv_RET int #define MPI_Alltoallv_PROTO Py_PROTO((void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *rdispls, MPI_Datatype recvtype, MPI_Comm comm)) #define MPI_Alltoallv_NUM 31 #define MPI_Barrier_RET int #define MPI_Barrier_PROTO Py_PROTO((MPI_Comm comm)) #define MPI_Barrier_NUM 32 #define MPI_Bcast_RET int #define MPI_Bcast_PROTO Py_PROTO((void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm)) #define MPI_Bcast_NUM 33 #define MPI_Bsend_RET int #define MPI_Bsend_PROTO Py_PROTO((void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)) #define MPI_Bsend_NUM 34 #define MPI_Comm_dup_RET int #define MPI_Comm_dup_PROTO Py_PROTO((MPI_Comm comm, MPI_Comm *newcomm)) #define MPI_Comm_dup_NUM 35 #define MPI_Comm_group_RET int #define MPI_Comm_group_PROTO Py_PROTO((MPI_Comm comm, MPI_Group *group)) #define MPI_Comm_group_NUM 36 #define MPI_Group_incl_RET int #define MPI_Group_incl_PROTO Py_PROTO((MPI_Group group, int n, int *ranks, MPI_Group *newgroup)) #define MPI_Group_incl_NUM 37 #define MPI_Comm_create_RET int #define MPI_Comm_create_PROTO Py_PROTO((MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm)) #define MPI_Comm_create_NUM 38 #define MPI_Group_free_RET int #define MPI_Group_free_PROTO Py_PROTO((MPI_Group *group)) #define MPI_Group_free_NUM 39 #define MPI_Comm_free_RET int #define MPI_Comm_free_PROTO Py_PROTO((MPI_Comm *comm)) #define MPI_Comm_free_NUM 40 #define MPI_Comm_rank_RET int #define MPI_Comm_rank_PROTO Py_PROTO((MPI_Comm comm, int *rank)) #define MPI_Comm_rank_NUM 41 #define MPI_Comm_size_RET int #define MPI_Comm_size_PROTO Py_PROTO((MPI_Comm comm, int *size)) #define MPI_Comm_size_NUM 42 #define MPI_Error_string_RET int #define MPI_Error_string_PROTO Py_PROTO((int errorcode, char *string, int *resultlen)) #define MPI_Error_string_NUM 43 #define MPI_Finalize_RET int #define MPI_Finalize_PROTO Py_PROTO((void)) #define MPI_Finalize_NUM 44 #define MPI_Gather_RET int #define MPI_Gather_PROTO Py_PROTO((void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)) #define MPI_Gather_NUM 45 #define MPI_Gatherv_RET int #define MPI_Gatherv_PROTO Py_PROTO((void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm)) #define MPI_Gatherv_NUM 46 #define MPI_Get_count_RET int #define MPI_Get_count_PROTO Py_PROTO((MPI_Status *status, MPI_Datatype datatype, int *count)) #define MPI_Get_count_NUM 47 #define MPI_Ibsend_RET int #define MPI_Ibsend_PROTO Py_PROTO((void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)) #define MPI_Ibsend_NUM 48 #define MPI_Init_RET int #define MPI_Init_PROTO Py_PROTO((int *argc, char ***argv)) #define MPI_Init_NUM 49 #define MPI_Initialized_RET int #define MPI_Initialized_PROTO Py_PROTO((int *flag)) #define MPI_Initialized_NUM 50 #define MPI_Iprobe_RET int #define MPI_Iprobe_PROTO Py_PROTO((int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status)) #define MPI_Iprobe_NUM 51 #define MPI_Irecv_RET int #define MPI_Irecv_PROTO Py_PROTO((void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request)) #define MPI_Irecv_NUM 52 #define MPI_Irsend_RET int #define MPI_Irsend_PROTO Py_PROTO((void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)) #define MPI_Irsend_NUM 53 #define MPI_Isend_RET int #define MPI_Isend_PROTO Py_PROTO((void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)) #define MPI_Isend_NUM 54 #define MPI_Issend_RET int #define MPI_Issend_PROTO Py_PROTO((void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request)) #define MPI_Issend_NUM 55 #define MPI_Probe_RET int #define MPI_Probe_PROTO Py_PROTO((int source, int tag, MPI_Comm comm, MPI_Status *status)) #define MPI_Probe_NUM 56 #define MPI_Recv_RET int #define MPI_Recv_PROTO Py_PROTO((void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status)) #define MPI_Recv_NUM 57 #define MPI_Reduce_RET int #define MPI_Reduce_PROTO Py_PROTO((void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm)) #define MPI_Reduce_NUM 58 #define MPI_Reduce_scatter_RET int #define MPI_Reduce_scatter_PROTO Py_PROTO((void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)) #define MPI_Reduce_scatter_NUM 59 #define MPI_Rsend_RET int #define MPI_Rsend_PROTO Py_PROTO((void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)) #define MPI_Rsend_NUM 60 #define MPI_Scatter_RET int #define MPI_Scatter_PROTO Py_PROTO((void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)) #define MPI_Scatter_NUM 61 #define MPI_Scatterv_RET int #define MPI_Scatterv_PROTO Py_PROTO((void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)) #define MPI_Scatterv_NUM 62 #define MPI_Send_RET int #define MPI_Send_PROTO Py_PROTO((void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)) #define MPI_Send_NUM 63 #define MPI_Sendrecv_RET int #define MPI_Sendrecv_PROTO Py_PROTO((void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status)) #define MPI_Sendrecv_NUM 64 #define MPI_Ssend_RET int #define MPI_Ssend_PROTO Py_PROTO((void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)) #define MPI_Ssend_NUM 65 #define MPI_Test_RET int #define MPI_Test_PROTO Py_PROTO((MPI_Request *request, int *flag, MPI_Status *status)) #define MPI_Test_NUM 66 #define MPI_Testall_RET int #define MPI_Testall_PROTO Py_PROTO((int count, MPI_Request *array_of_requests, int *flag, MPI_Status *array_of_statuses)) #define MPI_Testall_NUM 67 #define MPI_Testany_RET int #define MPI_Testany_PROTO Py_PROTO((int count, MPI_Request *array_of_requests, int *index, int *flag, MPI_Status *status)) #define MPI_Testany_NUM 68 #define MPI_Wait_RET int #define MPI_Wait_PROTO Py_PROTO((MPI_Request *request, MPI_Status *status)) #define MPI_Wait_NUM 69 #define MPI_Waitall_RET int #define MPI_Waitall_PROTO Py_PROTO((int count, MPI_Request *array_of_requests, MPI_Status *array_of_statuses)) #define MPI_Waitall_NUM 70 #define MPI_Waitany_RET int #define MPI_Waitany_PROTO Py_PROTO((int count, MPI_Request *array_of_requests, int *index, MPI_Status *array_of_statuses)) #define MPI_Waitany_NUM 71 #define MPI_Wtick_RET double #define MPI_Wtick_PROTO Py_PROTO((void)) #define MPI_Wtick_NUM 72 #define MPI_Wtime_RET double #define MPI_Wtime_PROTO Py_PROTO((void)) #define MPI_Wtime_NUM 73 #define PyMPI_API_pointers 74 #ifdef _MPI_MODULE statichere PyTypeObject PyMPICommunicator_Type; #define PyMPICommunicator_Check(op) ((op)->ob_type == &PyMPICommunicator_Type) statichere PyTypeObject PyMPIRequest_Type; #define PyMPIRequest_Check(op) ((op)->ob_type == &PyMPIRequest_Type) static PyMPI_DuplicateCommunicator_RET PyMPI_DuplicateCommunicator PyMPI_DuplicateCommunicator_PROTO; static PyMPI_SubsetCommunicator_RET PyMPI_SubsetCommunicator PyMPI_SubsetCommunicator_PROTO; static PyMPI_Barrier_RET PyMPI_Barrier PyMPI_Barrier_PROTO; static PyMPI_Send_RET PyMPI_Send PyMPI_Send_PROTO; static PyMPI_SendArray_RET PyMPI_SendArray PyMPI_SendArray_PROTO; static PyMPI_SendString_RET PyMPI_SendString PyMPI_SendString_PROTO; static PyMPI_SendArrayNonBlocking_RET PyMPI_SendArrayNonBlocking PyMPI_SendArrayNonBlocking_PROTO; static PyMPI_SendStringNonBlocking_RET PyMPI_SendStringNonBlocking PyMPI_SendStringNonBlocking_PROTO; static PyMPI_Receive_RET PyMPI_Receive PyMPI_Receive_PROTO; static PyMPI_ReceiveArray_RET PyMPI_ReceiveArray PyMPI_ReceiveArray_PROTO; static PyMPI_ReceiveString_RET PyMPI_ReceiveString PyMPI_ReceiveString_PROTO; static PyMPI_ReceiveArrayNonBlocking_RET PyMPI_ReceiveArrayNonBlocking PyMPI_ReceiveArrayNonBlocking_PROTO; static PyMPI_ProbeNonBlocking_RET PyMPI_ProbeNonBlocking PyMPI_ProbeNonBlocking_PROTO; static PyMPI_Broadcast_RET PyMPI_Broadcast PyMPI_Broadcast_PROTO; static PyMPI_BroadcastArray_RET PyMPI_BroadcastArray PyMPI_BroadcastArray_PROTO; static PyMPI_Share_RET PyMPI_Share PyMPI_Share_PROTO; static PyMPI_ShareArray_RET PyMPI_ShareArray PyMPI_ShareArray_PROTO; static PyMPI_Abort_RET PyMPI_Abort PyMPI_Abort_PROTO; static PyMPI_Reduce_RET PyMPI_Reduce PyMPI_Reduce_PROTO; static PyMPI_Allreduce_RET PyMPI_Allreduce PyMPI_Allreduce_PROTO; static PyMPI_ReduceArray_RET PyMPI_ReduceArray PyMPI_ReduceArray_PROTO; static PyMPI_AllreduceArray_RET PyMPI_AllreduceArray PyMPI_AllreduceArray_PROTO; static PyMPI_Wait_RET PyMPI_Wait PyMPI_Wait_PROTO; static PyMPI_Test_RET PyMPI_Test PyMPI_Test_PROTO; #define set_PyMPI_API_pointers(){ \ PyMPI_API[PyMPICommunicator_Type_NUM] = (void *)&PyMPICommunicator_Type; \ PyMPI_API[PyMPIRequest_Type_NUM] = (void *)&PyMPIRequest_Type; \ PyMPI_API[PyMPI_DuplicateCommunicator_NUM] = (void *)&PyMPI_DuplicateCommunicator; \ PyMPI_API[PyMPI_SubsetCommunicator_NUM] = (void *)&PyMPI_SubsetCommunicator; \ PyMPI_API[PyMPI_Barrier_NUM] = (void *)&PyMPI_Barrier; \ PyMPI_API[PyMPI_Send_NUM] = (void *)&PyMPI_Send; \ PyMPI_API[PyMPI_SendArray_NUM] = (void *)&PyMPI_SendArray; \ PyMPI_API[PyMPI_SendString_NUM] = (void *)&PyMPI_SendString; \ PyMPI_API[PyMPI_SendArrayNonBlocking_NUM] = (void *)&PyMPI_SendArrayNonBlocking; \ PyMPI_API[PyMPI_SendStringNonBlocking_NUM] = (void *)&PyMPI_SendStringNonBlocking; \ PyMPI_API[PyMPI_Receive_NUM] = (void *)&PyMPI_Receive; \ PyMPI_API[PyMPI_ReceiveArray_NUM] = (void *)&PyMPI_ReceiveArray; \ PyMPI_API[PyMPI_ReceiveString_NUM] = (void *)&PyMPI_ReceiveString; \ PyMPI_API[PyMPI_ReceiveArrayNonBlocking_NUM] = (void *)&PyMPI_ReceiveArrayNonBlocking; \ PyMPI_API[PyMPI_ProbeNonBlocking_NUM] = (void *)&PyMPI_ProbeNonBlocking; \ PyMPI_API[PyMPI_Broadcast_NUM] = (void *)&PyMPI_Broadcast; \ PyMPI_API[PyMPI_BroadcastArray_NUM] = (void *)&PyMPI_BroadcastArray; \ PyMPI_API[PyMPI_Share_NUM] = (void *)&PyMPI_Share; \ PyMPI_API[PyMPI_ShareArray_NUM] = (void *)&PyMPI_ShareArray; \ PyMPI_API[PyMPI_Abort_NUM] = (void *)&PyMPI_Abort; \ PyMPI_API[PyMPI_Reduce_NUM] = (void *)&PyMPI_Reduce; \ PyMPI_API[PyMPI_Allreduce_NUM] = (void *)&PyMPI_Allreduce; \ PyMPI_API[PyMPI_ReduceArray_NUM] = (void *)&PyMPI_ReduceArray; \ PyMPI_API[PyMPI_AllreduceArray_NUM] = (void *)&PyMPI_AllreduceArray; \ PyMPI_API[PyMPI_Wait_NUM] = (void *)&PyMPI_Wait; \ PyMPI_API[PyMPI_Test_NUM] = (void *)&PyMPI_Test; \ PyMPI_API[MPI_Abort_NUM] = (void *)&MPI_Abort; \ PyMPI_API[MPI_Allgather_NUM] = (void *)&MPI_Allgather; \ PyMPI_API[MPI_Allgatherv_NUM] = (void *)&MPI_Allgatherv; \ PyMPI_API[MPI_Allreduce_NUM] = (void *)&MPI_Allreduce; \ PyMPI_API[MPI_Alltoall_NUM] = (void *)&MPI_Alltoall; \ PyMPI_API[MPI_Alltoallv_NUM] = (void *)&MPI_Alltoallv; \ PyMPI_API[MPI_Barrier_NUM] = (void *)&MPI_Barrier; \ PyMPI_API[MPI_Bcast_NUM] = (void *)&MPI_Bcast; \ PyMPI_API[MPI_Bsend_NUM] = (void *)&MPI_Bsend; \ PyMPI_API[MPI_Comm_dup_NUM] = (void *)&MPI_Comm_dup; \ PyMPI_API[MPI_Comm_group_NUM] = (void *)&MPI_Comm_group; \ PyMPI_API[MPI_Group_incl_NUM] = (void *)&MPI_Group_incl; \ PyMPI_API[MPI_Comm_create_NUM] = (void *)&MPI_Comm_create; \ PyMPI_API[MPI_Group_free_NUM] = (void *)&MPI_Group_free; \ PyMPI_API[MPI_Comm_free_NUM] = (void *)&MPI_Comm_free; \ PyMPI_API[MPI_Comm_rank_NUM] = (void *)&MPI_Comm_rank; \ PyMPI_API[MPI_Comm_size_NUM] = (void *)&MPI_Comm_size; \ PyMPI_API[MPI_Error_string_NUM] = (void *)&MPI_Error_string; \ PyMPI_API[MPI_Finalize_NUM] = (void *)&MPI_Finalize; \ PyMPI_API[MPI_Gather_NUM] = (void *)&MPI_Gather; \ PyMPI_API[MPI_Gatherv_NUM] = (void *)&MPI_Gatherv; \ PyMPI_API[MPI_Get_count_NUM] = (void *)&MPI_Get_count; \ PyMPI_API[MPI_Ibsend_NUM] = (void *)&MPI_Ibsend; \ PyMPI_API[MPI_Init_NUM] = (void *)&MPI_Init; \ PyMPI_API[MPI_Initialized_NUM] = (void *)&MPI_Initialized; \ PyMPI_API[MPI_Iprobe_NUM] = (void *)&MPI_Iprobe; \ PyMPI_API[MPI_Irecv_NUM] = (void *)&MPI_Irecv; \ PyMPI_API[MPI_Irsend_NUM] = (void *)&MPI_Irsend; \ PyMPI_API[MPI_Isend_NUM] = (void *)&MPI_Isend; \ PyMPI_API[MPI_Issend_NUM] = (void *)&MPI_Issend; \ PyMPI_API[MPI_Probe_NUM] = (void *)&MPI_Probe; \ PyMPI_API[MPI_Recv_NUM] = (void *)&MPI_Recv; \ PyMPI_API[MPI_Reduce_NUM] = (void *)&MPI_Reduce; \ PyMPI_API[MPI_Reduce_scatter_NUM] = (void *)&MPI_Reduce_scatter; \ PyMPI_API[MPI_Rsend_NUM] = (void *)&MPI_Rsend; \ PyMPI_API[MPI_Scatter_NUM] = (void *)&MPI_Scatter; \ PyMPI_API[MPI_Scatterv_NUM] = (void *)&MPI_Scatterv; \ PyMPI_API[MPI_Send_NUM] = (void *)&MPI_Send; \ PyMPI_API[MPI_Sendrecv_NUM] = (void *)&MPI_Sendrecv; \ PyMPI_API[MPI_Ssend_NUM] = (void *)&MPI_Ssend; \ PyMPI_API[MPI_Test_NUM] = (void *)&MPI_Test; \ PyMPI_API[MPI_Testall_NUM] = (void *)&MPI_Testall; \ PyMPI_API[MPI_Testany_NUM] = (void *)&MPI_Testany; \ PyMPI_API[MPI_Wait_NUM] = (void *)&MPI_Wait; \ PyMPI_API[MPI_Waitall_NUM] = (void *)&MPI_Waitall; \ PyMPI_API[MPI_Waitany_NUM] = (void *)&MPI_Waitany; \ PyMPI_API[MPI_Wtick_NUM] = (void *)&MPI_Wtick; \ PyMPI_API[MPI_Wtime_NUM] = (void *)&MPI_Wtime; \ } #else #ifndef PYMPI_API_LINKAGE #define PYMPI_API_LINKAGE static #endif PYMPI_API_LINKAGE void **PyMPI_API; #define PyMPICommunicator_Check(op) \ ((op)->ob_type == (PyTypePbject *)PyMPI_API[PyMPICommunicator_Type_Num]) #define PyMPIRequest_Check(op) \ ((op)->ob_type == (PyTypePbject *)PyMPI_API[PyMPIRequest_Type_Num]) #define PyMPI_DuplicateCommunicator \ (*(PyMPI_DuplicateCommunicator_RET (*)PyMPI_DuplicateCommunicator_PROTO) \ PyMPI_API[PyMPI_DuplicateCommunicator_NUM]) #define PyMPI_SubsetCommunicator \ (*(PyMPI_SubsetCommunicator_RET (*)PyMPI_SubsetCommunicator_PROTO) \ PyMPI_API[PyMPI_SubsetCommunicator_NUM]) #define PyMPI_Barrier \ (*(PyMPI_Barrier_RET (*)PyMPI_Barrier_PROTO) \ PyMPI_API[PyMPI_Barrier_NUM]) #define PyMPI_Send \ (*(PyMPI_Send_RET (*)PyMPI_Send_PROTO) \ PyMPI_API[PyMPI_Send_NUM]) #define PyMPI_SendArray \ (*(PyMPI_SendArray_RET (*)PyMPI_SendArray_PROTO) \ PyMPI_API[PyMPI_SendArray_NUM]) #define PyMPI_SendString \ (*(PyMPI_SendString_RET (*)PyMPI_SendString_PROTO) \ PyMPI_API[PyMPI_SendString_NUM]) #define PyMPI_SendArrayNonBlocking \ (*(PyMPI_SendArrayNonBlocking_RET (*)PyMPI_SendArrayNonBlocking_PROTO) \ PyMPI_API[PyMPI_SendArrayNonBlocking_NUM]) #define PyMPI_SendStringNonBlocking \ (*(PyMPI_SendStringNonBlocking_RET (*)PyMPI_SendStringNonBlocking_PROTO) \ PyMPI_API[PyMPI_SendStringNonBlocking_NUM]) #define PyMPI_Receive \ (*(PyMPI_Receive_RET (*)PyMPI_Receive_PROTO) \ PyMPI_API[PyMPI_Receive_NUM]) #define PyMPI_ReceiveArray \ (*(PyMPI_ReceiveArray_RET (*)PyMPI_ReceiveArray_PROTO) \ PyMPI_API[PyMPI_ReceiveArray_NUM]) #define PyMPI_ReceiveString \ (*(PyMPI_ReceiveString_RET (*)PyMPI_ReceiveString_PROTO) \ PyMPI_API[PyMPI_ReceiveString_NUM]) #define PyMPI_ReceiveArrayNonBlocking \ (*(PyMPI_ReceiveArrayNonBlocking_RET (*)PyMPI_ReceiveArrayNonBlocking_PROTO) \ PyMPI_API[PyMPI_ReceiveArrayNonBlocking_NUM]) #define PyMPI_ProbeNonBlocking \ (*(PyMPI_ProbeNonBlocking_RET (*)PyMPI_ProbeNonBlocking_PROTO) \ PyMPI_API[PyMPI_ProbeNonBlocking_NUM]) #define PyMPI_Broadcast \ (*(PyMPI_Broadcast_RET (*)PyMPI_Broadcast_PROTO) \ PyMPI_API[PyMPI_Broadcast_NUM]) #define PyMPI_BroadcastArray \ (*(PyMPI_BroadcastArray_RET (*)PyMPI_BroadcastArray_PROTO) \ PyMPI_API[PyMPI_BroadcastArray_NUM]) #define PyMPI_Share \ (*(PyMPI_Share_RET (*)PyMPI_Share_PROTO) \ PyMPI_API[PyMPI_Share_NUM]) #define PyMPI_ShareArray \ (*(PyMPI_ShareArray_RET (*)PyMPI_ShareArray_PROTO) \ PyMPI_API[PyMPI_ShareArray_NUM]) #define PyMPI_Abort \ (*(PyMPI_Abort_RET (*)PyMPI_Abort_PROTO) \ PyMPI_API[PyMPI_Abort_NUM]) #define PyMPI_Reduce \ (*(PyMPI_Reduce_RET (*)PyMPI_Reduce_PROTO) \ PyMPI_API[PyMPI_Reduce_NUM]) #define PyMPI_Allreduce \ (*(PyMPI_Allreduce_RET (*)PyMPI_Allreduce_PROTO) \ PyMPI_API[PyMPI_Allreduce_NUM]) #define PyMPI_ReduceArray \ (*(PyMPI_ReduceArray_RET (*)PyMPI_ReduceArray_PROTO) \ PyMPI_API[PyMPI_ReduceArray_NUM]) #define PyMPI_AllreduceArray \ (*(PyMPI_AllreduceArray_RET (*)PyMPI_AllreduceArray_PROTO) \ PyMPI_API[PyMPI_AllreduceArray_NUM]) #define PyMPI_Wait \ (*(PyMPI_Wait_RET (*)PyMPI_Wait_PROTO) \ PyMPI_API[PyMPI_Wait_NUM]) #define PyMPI_Test \ (*(PyMPI_Test_RET (*)PyMPI_Test_PROTO) \ PyMPI_API[PyMPI_Test_NUM]) #define MPI_Abort \ (*(MPI_Abort_RET (*)MPI_Abort_PROTO) \ PyMPI_API[MPI_Abort_NUM]) #define MPI_Allgather \ (*(MPI_Allgather_RET (*)MPI_Allgather_PROTO) \ PyMPI_API[MPI_Allgather_NUM]) #define MPI_Allgatherv \ (*(MPI_Allgatherv_RET (*)MPI_Allgatherv_PROTO) \ PyMPI_API[MPI_Allgatherv_NUM]) #define MPI_Allreduce \ (*(MPI_Allreduce_RET (*)MPI_Allreduce_PROTO) \ PyMPI_API[MPI_Allreduce_NUM]) #define MPI_Alltoall \ (*(MPI_Alltoall_RET (*)MPI_Alltoall_PROTO) \ PyMPI_API[MPI_Alltoall_NUM]) #define MPI_Alltoallv \ (*(MPI_Alltoallv_RET (*)MPI_Alltoallv_PROTO) \ PyMPI_API[MPI_Alltoallv_NUM]) #define MPI_Barrier \ (*(MPI_Barrier_RET (*)MPI_Barrier_PROTO) \ PyMPI_API[MPI_Barrier_NUM]) #define MPI_Bcast \ (*(MPI_Bcast_RET (*)MPI_Bcast_PROTO) \ PyMPI_API[MPI_Bcast_NUM]) #define MPI_Bsend \ (*(MPI_Bsend_RET (*)MPI_Bsend_PROTO) \ PyMPI_API[MPI_Bsend_NUM]) #define MPI_Comm_dup \ (*(MPI_Comm_dup_RET (*)MPI_Comm_dup_PROTO) \ PyMPI_API[MPI_Comm_dup_NUM]) #define MPI_Comm_group \ (*(MPI_Comm_group_RET (*)MPI_Comm_group_PROTO) \ PyMPI_API[MPI_Comm_group_NUM]) #define MPI_Group_incl \ (*(MPI_Group_incl_RET (*)MPI_Group_incl_PROTO) \ PyMPI_API[MPI_Group_incl_NUM]) #define MPI_Comm_create \ (*(MPI_Comm_create_RET (*)MPI_Comm_create_PROTO) \ PyMPI_API[MPI_Comm_create_NUM]) #define MPI_Group_free \ (*(MPI_Group_free_RET (*)MPI_Group_free_PROTO) \ PyMPI_API[MPI_Group_free_NUM]) #define MPI_Comm_free \ (*(MPI_Comm_free_RET (*)MPI_Comm_free_PROTO) \ PyMPI_API[MPI_Comm_free_NUM]) #define MPI_Comm_rank \ (*(MPI_Comm_rank_RET (*)MPI_Comm_rank_PROTO) \ PyMPI_API[MPI_Comm_rank_NUM]) #define MPI_Comm_size \ (*(MPI_Comm_size_RET (*)MPI_Comm_size_PROTO) \ PyMPI_API[MPI_Comm_size_NUM]) #define MPI_Error_string \ (*(MPI_Error_string_RET (*)MPI_Error_string_PROTO) \ PyMPI_API[MPI_Error_string_NUM]) #define MPI_Finalize \ (*(MPI_Finalize_RET (*)MPI_Finalize_PROTO) \ PyMPI_API[MPI_Finalize_NUM]) #define MPI_Gather \ (*(MPI_Gather_RET (*)MPI_Gather_PROTO) \ PyMPI_API[MPI_Gather_NUM]) #define MPI_Gatherv \ (*(MPI_Gatherv_RET (*)MPI_Gatherv_PROTO) \ PyMPI_API[MPI_Gatherv_NUM]) #define MPI_Get_count \ (*(MPI_Get_count_RET (*)MPI_Get_count_PROTO) \ PyMPI_API[MPI_Get_count_NUM]) #define MPI_Ibsend \ (*(MPI_Ibsend_RET (*)MPI_Ibsend_PROTO) \ PyMPI_API[MPI_Ibsend_NUM]) #define MPI_Init \ (*(MPI_Init_RET (*)MPI_Init_PROTO) \ PyMPI_API[MPI_Init_NUM]) #define MPI_Initialized \ (*(MPI_Initialized_RET (*)MPI_Initialized_PROTO) \ PyMPI_API[MPI_Initialized_NUM]) #define MPI_Iprobe \ (*(MPI_Iprobe_RET (*)MPI_Iprobe_PROTO) \ PyMPI_API[MPI_Iprobe_NUM]) #define MPI_Irecv \ (*(MPI_Irecv_RET (*)MPI_Irecv_PROTO) \ PyMPI_API[MPI_Irecv_NUM]) #define MPI_Irsend \ (*(MPI_Irsend_RET (*)MPI_Irsend_PROTO) \ PyMPI_API[MPI_Irsend_NUM]) #define MPI_Isend \ (*(MPI_Isend_RET (*)MPI_Isend_PROTO) \ PyMPI_API[MPI_Isend_NUM]) #define MPI_Issend \ (*(MPI_Issend_RET (*)MPI_Issend_PROTO) \ PyMPI_API[MPI_Issend_NUM]) #define MPI_Probe \ (*(MPI_Probe_RET (*)MPI_Probe_PROTO) \ PyMPI_API[MPI_Probe_NUM]) #define MPI_Recv \ (*(MPI_Recv_RET (*)MPI_Recv_PROTO) \ PyMPI_API[MPI_Recv_NUM]) #define MPI_Reduce \ (*(MPI_Reduce_RET (*)MPI_Reduce_PROTO) \ PyMPI_API[MPI_Reduce_NUM]) #define MPI_Reduce_scatter \ (*(MPI_Reduce_scatter_RET (*)MPI_Reduce_scatter_PROTO) \ PyMPI_API[MPI_Reduce_scatter_NUM]) #define MPI_Rsend \ (*(MPI_Rsend_RET (*)MPI_Rsend_PROTO) \ PyMPI_API[MPI_Rsend_NUM]) #define MPI_Scatter \ (*(MPI_Scatter_RET (*)MPI_Scatter_PROTO) \ PyMPI_API[MPI_Scatter_NUM]) #define MPI_Scatterv \ (*(MPI_Scatterv_RET (*)MPI_Scatterv_PROTO) \ PyMPI_API[MPI_Scatterv_NUM]) #define MPI_Send \ (*(MPI_Send_RET (*)MPI_Send_PROTO) \ PyMPI_API[MPI_Send_NUM]) #define MPI_Sendrecv \ (*(MPI_Sendrecv_RET (*)MPI_Sendrecv_PROTO) \ PyMPI_API[MPI_Sendrecv_NUM]) #define MPI_Ssend \ (*(MPI_Ssend_RET (*)MPI_Ssend_PROTO) \ PyMPI_API[MPI_Ssend_NUM]) #define MPI_Test \ (*(MPI_Test_RET (*)MPI_Test_PROTO) \ PyMPI_API[MPI_Test_NUM]) #define MPI_Testall \ (*(MPI_Testall_RET (*)MPI_Testall_PROTO) \ PyMPI_API[MPI_Testall_NUM]) #define MPI_Testany \ (*(MPI_Testany_RET (*)MPI_Testany_PROTO) \ PyMPI_API[MPI_Testany_NUM]) #define MPI_Wait \ (*(MPI_Wait_RET (*)MPI_Wait_PROTO) \ PyMPI_API[MPI_Wait_NUM]) #define MPI_Waitall \ (*(MPI_Waitall_RET (*)MPI_Waitall_PROTO) \ PyMPI_API[MPI_Waitall_NUM]) #define MPI_Waitany \ (*(MPI_Waitany_RET (*)MPI_Waitany_PROTO) \ PyMPI_API[MPI_Waitany_NUM]) #define MPI_Wtick \ (*(MPI_Wtick_RET (*)MPI_Wtick_PROTO) \ PyMPI_API[MPI_Wtick_NUM]) #define MPI_Wtime \ (*(MPI_Wtime_RET (*)MPI_Wtime_PROTO) \ PyMPI_API[MPI_Wtime_NUM]) #define import_mpi() \ { \ PyObject *module = PyImport_ImportModule("Scientific.MPI"); \ if (module != NULL) { \ PyObject *module_dict = PyModule_GetDict(module); \ PyObject *c_api_object = PyDict_GetItemString(module_dict, "_C_API"); \ if (PyCObject_Check(c_api_object)) { \ PyMPI_API = (void **)PyCObject_AsVoidPtr(c_api_object); \ } \ } \ } #endif ScientificPython-2.9.4/Include/scientific_netcdfmodule.h0000644000076600000240000000015611501734163024030 0ustar hinsenstaff00000000000000/* This file exists for backward compatibility with previous releases */ #include "Scientific/netcdfmodule.h" ScientificPython-2.9.4/LICENCE0000644000076600000240000005314611501734140016412 0ustar hinsenstaff00000000000000 CONTRAT DE LICENCE DE LOGICIEL LIBRE CeCILL-C Avertissement Ce contrat est une licence de logiciel libre issue d'une concertation entre ses auteurs afin que le respect de deux grands principes prside sa rdaction: * d'une part, le respect des principes de diffusion des logiciels libres: accs au code source, droits tendus confrs aux utilisateurs, * d'autre part, la dsignation d'un droit applicable, le droit franais, auquel elle est conforme, tant au regard du droit de la responsabilit civile que du droit de la proprit intellectuelle et de la protection qu'il offre aux auteurs et titulaires des droits patrimoniaux sur un logiciel. Les auteurs de la licence CeCILL-C (pour Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre]) sont: Commissariat l'Energie Atomique - CEA, tablissement public de recherche caractre scientifique, technique et industriel, dont le sige est situ 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris. Centre National de la Recherche Scientifique - CNRS, tablissement public caractre scientifique et technologique, dont le sige est situ 3 rue Michel-Ange, 75794 Paris cedex 16. Institut National de Recherche en Informatique et en Automatique - INRIA, tablissement public caractre scientifique et technologique, dont le sige est situ Domaine de Voluceau, Rocquencourt, BP 105, 78153 Le Chesnay cedex. Prambule Ce contrat est une licence de logiciel libre dont l'objectif est de confrer aux utilisateurs la libert de modifier et de rutiliser le logiciel rgi par cette licence. L'exercice de cette libert est assorti d'une obligation de remettre la disposition de la communaut les modifications apportes au code source du logiciel afin de contribuer son volution. L'accessibilit au code source et les droits de copie, de modification et de redistribution qui dcoulent de ce contrat ont pour contrepartie de n'offrir aux utilisateurs qu'une garantie limite et de ne faire peser sur l'auteur du logiciel, le titulaire des droits patrimoniaux et les concdants successifs qu'une responsabilit restreinte. A cet gard l'attention de l'utilisateur est attire sur les risques associs au chargement, l'utilisation, la modification et/ou au dveloppement et la reproduction du logiciel par l'utilisateur tant donn sa spcificit de logiciel libre, qui peut le rendre complexe manipuler et qui le rserve donc des dveloppeurs ou des professionnels avertis possdant des connaissances informatiques approfondies. Les utilisateurs sont donc invits charger et tester l'adquation du logiciel leurs besoins dans des conditions permettant d'assurer la scurit de leurs systmes et/ou de leurs donnes et, plus gnralement, l'utiliser et l'exploiter dans les mmes conditions de scurit. Ce contrat peut tre reproduit et diffus librement, sous rserve de le conserver en l'tat, sans ajout ni suppression de clauses. Ce contrat est susceptible de s'appliquer tout logiciel dont le titulaire des droits patrimoniaux dcide de soumettre l'exploitation aux dispositions qu'il contient. Article 1 - DEFINITIONS Dans ce contrat, les termes suivants, lorsqu'ils seront crits avec une lettre capitale, auront la signification suivante: Contrat: dsigne le prsent contrat de licence, ses ventuelles versions postrieures et annexes. Logiciel: dsigne le logiciel sous sa forme de Code Objet et/ou de Code Source et le cas chant sa documentation, dans leur tat au moment de l'acceptation du Contrat par le Licenci. Logiciel Initial: dsigne le Logiciel sous sa forme de Code Source et ventuellement de Code Objet et le cas chant sa documentation, dans leur tat au moment de leur premire diffusion sous les termes du Contrat. Logiciel Modifi: dsigne le Logiciel modifi par au moins une Contribution Intgre. Code Source: dsigne l'ensemble des instructions et des lignes de programme du Logiciel et auquel l'accs est ncessaire en vue de modifier le Logiciel. Code Objet: dsigne les fichiers binaires issus de la compilation du Code Source. Titulaire: dsigne le ou les dtenteurs des droits patrimoniaux d'auteur sur le Logiciel Initial. Licenci: dsigne le ou les utilisateurs du Logiciel ayant accept le Contrat. Contributeur: dsigne le Licenci auteur d'au moins une Contribution Intgre. Concdant: dsigne le Titulaire ou toute personne physique ou morale distribuant le Logiciel sous le Contrat. Contribution Intgre: dsigne l'ensemble des modifications, corrections, traductions, adaptations et/ou nouvelles fonctionnalits intgres dans le Code Source par tout Contributeur. Module Li: dsigne un ensemble de fichiers sources y compris leur documentation qui, sans modification du Code Source, permet de raliser des fonctionnalits ou services supplmentaires ceux fournis par le Logiciel. Logiciel Driv: dsigne toute combinaison du Logiciel, modifi ou non, et d'un Module Li. Parties: dsigne collectivement le Licenci et le Concdant. Ces termes s'entendent au singulier comme au pluriel. Article 2 - OBJET Le Contrat a pour objet la concession par le Concdant au Licenci d'une licence non exclusive, cessible et mondiale du Logiciel telle que dfinie ci-aprs l'article 5 pour toute la dure de protection des droits portant sur ce Logiciel. Article 3 - ACCEPTATION 3.1 L'acceptation par le Licenci des termes du Contrat est rpute acquise du fait du premier des faits suivants: * (i) le chargement du Logiciel par tout moyen notamment par tlchargement partir d'un serveur distant ou par chargement partir d'un support physique; * (ii) le premier exercice par le Licenci de l'un quelconque des droits concds par le Contrat. 3.2 Un exemplaire du Contrat, contenant notamment un avertissement relatif aux spcificits du Logiciel, la restriction de garantie et la limitation un usage par des utilisateurs expriments a t mis disposition du Licenci pralablement son acceptation telle que dfinie l'article 3.1 ci dessus et le Licenci reconnat en avoir pris connaissance. Article 4 - ENTREE EN VIGUEUR ET DUREE 4.1 ENTREE EN VIGUEUR Le Contrat entre en vigueur la date de son acceptation par le Licenci telle que dfinie en 3.1. 4.2 DUREE Le Contrat produira ses effets pendant toute la dure lgale de protection des droits patrimoniaux portant sur le Logiciel. Article 5 - ETENDUE DES DROITS CONCEDES Le Concdant concde au Licenci, qui accepte, les droits suivants sur le Logiciel pour toutes destinations et pour la dure du Contrat dans les conditions ci-aprs dtailles. Par ailleurs, si le Concdant dtient ou venait dtenir un ou plusieurs brevets d'invention protgeant tout ou partie des fonctionnalits du Logiciel ou de ses composants, il s'engage ne pas opposer les ventuels droits confrs par ces brevets aux Licencis successifs qui utiliseraient, exploiteraient ou modifieraient le Logiciel. En cas de cession de ces brevets, le Concdant s'engage faire reprendre les obligations du prsent alina aux cessionnaires. 5.1 DROIT D'UTILISATION Le Licenci est autoris utiliser le Logiciel, sans restriction quant aux domaines d'application, tant ci-aprs prcis que cela comporte: 1. la reproduction permanente ou provisoire du Logiciel en tout ou partie par tout moyen et sous toute forme. 2. le chargement, l'affichage, l'excution, ou le stockage du Logiciel sur tout support. 3. la possibilit d'en observer, d'en tudier, ou d'en tester le fonctionnement afin de dterminer les ides et principes qui sont la base de n'importe quel lment de ce Logiciel; et ceci, lorsque le Licenci effectue toute opration de chargement, d'affichage, d'excution, de transmission ou de stockage du Logiciel qu'il est en droit d'effectuer en vertu du Contrat. 5.2 DROIT DE MODIFICATION Le droit de modification comporte le droit de traduire, d'adapter, d'arranger ou d'apporter toute autre modification au Logiciel et le droit de reproduire le logiciel en rsultant. Il comprend en particulier le droit de crer un Logiciel Driv. Le Licenci est autoris apporter toute modification au Logiciel sous rserve de mentionner, de faon explicite, son nom en tant qu'auteur de cette modification et la date de cration de celle-ci. 5.3 DROIT DE DISTRIBUTION Le droit de distribution comporte notamment le droit de diffuser, de transmettre et de communiquer le Logiciel au public sur tout support et par tout moyen ainsi que le droit de mettre sur le march titre onreux ou gratuit, un ou des exemplaires du Logiciel par tout procd. Le Licenci est autoris distribuer des copies du Logiciel, modifi ou non, des tiers dans les conditions ci-aprs dtailles. 5.3.1 DISTRIBUTION DU LOGICIEL SANS MODIFICATION Le Licenci est autoris distribuer des copies conformes du Logiciel, sous forme de Code Source ou de Code Objet, condition que cette distribution respecte les dispositions du Contrat dans leur totalit et soit accompagne: 1. d'un exemplaire du Contrat, 2. d'un avertissement relatif la restriction de garantie et de responsabilit du Concdant telle que prvue aux articles 8 et 9, et que, dans le cas o seul le Code Objet du Logiciel est redistribu, le Licenci permette un accs effectif au Code Source complet du Logiciel pendant au moins toute la dure de sa distribution du Logiciel, tant entendu que le cot additionnel d'acquisition du Code Source ne devra pas excder le simple cot de transfert des donnes. 5.3.2 DISTRIBUTION DU LOGICIEL MODIFIE Lorsque le Licenci apporte une Contribution Intgre au Logiciel, les conditions de distribution du Logiciel Modifi en rsultant sont alors soumises l'intgralit des dispositions du Contrat. Le Licenci est autoris distribuer le Logiciel Modifi sous forme de code source ou de code objet, condition que cette distribution respecte les dispositions du Contrat dans leur totalit et soit accompagne: 1. d'un exemplaire du Contrat, 2. d'un avertissement relatif la restriction de garantie et de responsabilit du Concdant telle que prvue aux articles 8 et 9, et que, dans le cas o seul le code objet du Logiciel Modifi est redistribu, le Licenci permette un accs effectif son code source complet pendant au moins toute la dure de sa distribution du Logiciel Modifi, tant entendu que le cot additionnel d'acquisition du code source ne devra pas excder le simple cot de transfert des donnes. 5.3.3 DISTRIBUTION DU LOGICIEL DERIVE Lorsque le Licenci cre un Logiciel Driv, ce Logiciel Driv peut tre distribu sous un contrat de licence autre que le prsent Contrat condition de respecter les obligations de mention des droits sur le Logiciel telles que dfinies l'article 6.4. Dans le cas o la cration du Logiciel Driv a ncessit une modification du Code Source le licenci s'engage ce que: 1. le Logiciel Modifi correspondant cette modification soit rgi par le prsent Contrat, 2. les Contributions Intgres dont le Logiciel Modifi rsulte soient clairement identifies et documentes, 3. le Licenci permette un accs effectif au code source du Logiciel Modifi, pendant au moins toute la dure de la distribution du Logiciel Driv, de telle sorte que ces modifications puissent tre reprises dans une version ultrieure du Logiciel, tant entendu que le cot additionnel d'acquisition du code source du Logiciel Modifi ne devra pas excder le simple cot du transfert des donnes. 5.3.4 COMPATIBILITE AVEC LA LICENCE CeCILL Lorsqu'un Logiciel Modifi contient une Contribution Intgre soumise au contrat de licence CeCILL, ou lorsqu'un Logiciel Driv contient un Module Li soumis au contrat de licence CeCILL, les stipulations prvues au troisime item de l'article 6.4 sont facultatives. Article 6 - PROPRIETE INTELLECTUELLE 6.1 SUR LE LOGICIEL INITIAL Le Titulaire est dtenteur des droits patrimoniaux sur le Logiciel Initial. Toute utilisation du Logiciel Initial est soumise au respect des conditions dans lesquelles le Titulaire a choisi de diffuser son oeuvre et nul autre n'a la facult de modifier les conditions de diffusion de ce Logiciel Initial. Le Titulaire s'engage ce que le Logiciel Initial reste au moins rgi par le Contrat et ce, pour la dure vise l'article 4.2. 6.2 SUR LES CONTRIBUTIONS INTEGREES Le Licenci qui a dvelopp une Contribution Intgre est titulaire sur celle-ci des droits de proprit intellectuelle dans les conditions dfinies par la lgislation applicable. 6.3 SUR LES MODULES LIES Le Licenci qui a dvelopp un Module Li est titulaire sur celui-ci des droits de proprit intellectuelle dans les conditions dfinies par la lgislation applicable et reste libre du choix du contrat rgissant sa diffusion dans les conditions dfinies l'article 5.3.3. 6.4 MENTIONS DES DROITS Le Licenci s'engage expressment: 1. ne pas supprimer ou modifier de quelque manire que ce soit les mentions de proprit intellectuelle apposes sur le Logiciel; 2. reproduire l'identique lesdites mentions de proprit intellectuelle sur les copies du Logiciel modifi ou non; 3. faire en sorte que l'utilisation du Logiciel, ses mentions de proprit intellectuelle et le fait qu'il est rgi par le Contrat soient indiqus dans un texte facilement accessible notamment depuis l'interface de tout Logiciel Driv. Le Licenci s'engage ne pas porter atteinte, directement ou indirectement, aux droits de proprit intellectuelle du Titulaire et/ou des Contributeurs sur le Logiciel et prendre, le cas chant, l'gard de son personnel toutes les mesures ncessaires pour assurer le respect des dits droits de proprit intellectuelle du Titulaire et/ou des Contributeurs. Article 7 - SERVICES ASSOCIES 7.1 Le Contrat n'oblige en aucun cas le Concdant la ralisation de prestations d'assistance technique ou de maintenance du Logiciel. Cependant le Concdant reste libre de proposer ce type de services. Les termes et conditions d'une telle assistance technique et/ou d'une telle maintenance seront alors dtermins dans un acte spar. Ces actes de maintenance et/ou assistance technique n'engageront que la seule responsabilit du Concdant qui les propose. 7.2 De mme, tout Concdant est libre de proposer, sous sa seule responsabilit, ses licencis une garantie, qui n'engagera que lui, lors de la redistribution du Logiciel et/ou du Logiciel Modifi et ce, dans les conditions qu'il souhaite. Cette garantie et les modalits financires de son application feront l'objet d'un acte spar entre le Concdant et le Licenci. Article 8 - RESPONSABILITE 8.1 Sous rserve des dispositions de l'article 8.2, le Licenci a la facult, sous rserve de prouver la faute du Concdant concern, de solliciter la rparation du prjudice direct qu'il subirait du fait du Logiciel et dont il apportera la preuve. 8.2 La responsabilit du Concdant est limite aux engagements pris en application du Contrat et ne saurait tre engage en raison notamment: (i) des dommages dus l'inexcution, totale ou partielle, de ses obligations par le Licenci, (ii) des dommages directs ou indirects dcoulant de l'utilisation ou des performances du Logiciel subis par le Licenci et (iii) plus gnralement d'un quelconque dommage indirect. En particulier, les Parties conviennent expressment que tout prjudice financier ou commercial (par exemple perte de donnes, perte de bnfices, perte d'exploitation, perte de clientle ou de commandes, manque gagner, trouble commercial quelconque) ou toute action dirige contre le Licenci par un tiers, constitue un dommage indirect et n'ouvre pas droit rparation par le Concdant. Article 9 - GARANTIE 9.1 Le Licenci reconnat que l'tat actuel des connaissances scientifiques et techniques au moment de la mise en circulation du Logiciel ne permet pas d'en tester et d'en vrifier toutes les utilisations ni de dtecter l'existence d'ventuels dfauts. L'attention du Licenci a t attire sur ce point sur les risques associs au chargement, l'utilisation, la modification et/ou au dveloppement et la reproduction du Logiciel qui sont rservs des utilisateurs avertis. Il relve de la responsabilit du Licenci de contrler, par tous moyens, l'adquation du produit ses besoins, son bon fonctionnement et de s'assurer qu'il ne causera pas de dommages aux personnes et aux biens. 9.2 Le Concdant dclare de bonne foi tre en droit de concder l'ensemble des droits attachs au Logiciel (comprenant notamment les droits viss l'article 5). 9.3 Le Licenci reconnat que le Logiciel est fourni "en l'tat" par le Concdant sans autre garantie, expresse ou tacite, que celle prvue l'article 9.2 et notamment sans aucune garantie sur sa valeur commerciale, son caractre scuris, innovant ou pertinent. En particulier, le Concdant ne garantit pas que le Logiciel est exempt d'erreur, qu'il fonctionnera sans interruption, qu'il sera compatible avec l'quipement du Licenci et sa configuration logicielle ni qu'il remplira les besoins du Licenci. 9.4 Le Concdant ne garantit pas, de manire expresse ou tacite, que le Logiciel ne porte pas atteinte un quelconque droit de proprit intellectuelle d'un tiers portant sur un brevet, un logiciel ou sur tout autre droit de proprit. Ainsi, le Concdant exclut toute garantie au profit du Licenci contre les actions en contrefaon qui pourraient tre diligentes au titre de l'utilisation, de la modification, et de la redistribution du Logiciel. Nanmoins, si de telles actions sont exerces contre le Licenci, le Concdant lui apportera son aide technique et juridique pour sa dfense. Cette aide technique et juridique est dtermine au cas par cas entre le Concdant concern et le Licenci dans le cadre d'un protocole d'accord. Le Concdant dgage toute responsabilit quant l'utilisation de la dnomination du Logiciel par le Licenci. Aucune garantie n'est apporte quant l'existence de droits antrieurs sur le nom du Logiciel et sur l'existence d'une marque. Article 10 - RESILIATION 10.1 En cas de manquement par le Licenci aux obligations mises sa charge par le Contrat, le Concdant pourra rsilier de plein droit le Contrat trente (30) jours aprs notification adresse au Licenci et reste sans effet. 10.2 Le Licenci dont le Contrat est rsili n'est plus autoris utiliser, modifier ou distribuer le Logiciel. Cependant, toutes les licences qu'il aura concdes antrieurement la rsiliation du Contrat resteront valides sous rserve qu'elles aient t effectues en conformit avec le Contrat. Article 11 - DISPOSITIONS DIVERSES 11.1 CAUSE EXTERIEURE Aucune des Parties ne sera responsable d'un retard ou d'une dfaillance d'excution du Contrat qui serait d un cas de force majeure, un cas fortuit ou une cause extrieure, telle que, notamment, le mauvais fonctionnement ou les interruptions du rseau lectrique ou de tlcommunication, la paralysie du rseau lie une attaque informatique, l'intervention des autorits gouvernementales, les catastrophes naturelles, les dgts des eaux, les tremblements de terre, le feu, les explosions, les grves et les conflits sociaux, l'tat de guerre... 11.2 Le fait, par l'une ou l'autre des Parties, d'omettre en une ou plusieurs occasions de se prvaloir d'une ou plusieurs dispositions du Contrat, ne pourra en aucun cas impliquer renonciation par la Partie intresse s'en prvaloir ultrieurement. 11.3 Le Contrat annule et remplace toute convention antrieure, crite ou orale, entre les Parties sur le mme objet et constitue l'accord entier entre les Parties sur cet objet. Aucune addition ou modification aux termes du Contrat n'aura d'effet l'gard des Parties moins d'tre faite par crit et signe par leurs reprsentants dment habilits. 11.4 Dans l'hypothse o une ou plusieurs des dispositions du Contrat s'avrerait contraire une loi ou un texte applicable, existants ou futurs, cette loi ou ce texte prvaudrait, et les Parties feraient les amendements ncessaires pour se conformer cette loi ou ce texte. Toutes les autres dispositions resteront en vigueur. De mme, la nullit, pour quelque raison que ce soit, d'une des dispositions du Contrat ne saurait entraner la nullit de l'ensemble du Contrat. 11.5 LANGUE Le Contrat est rdig en langue franaise et en langue anglaise, ces deux versions faisant galement foi. Article 12 - NOUVELLES VERSIONS DU CONTRAT 12.1 Toute personne est autorise copier et distribuer des copies de ce Contrat. 12.2 Afin d'en prserver la cohrence, le texte du Contrat est protg et ne peut tre modifi que par les auteurs de la licence, lesquels se rservent le droit de publier priodiquement des mises jour ou de nouvelles versions du Contrat, qui possderont chacune un numro distinct. Ces versions ultrieures seront susceptibles de prendre en compte de nouvelles problmatiques rencontres par les logiciels libres. 12.3 Tout Logiciel diffus sous une version donne du Contrat ne pourra faire l'objet d'une diffusion ultrieure que sous la mme version du Contrat ou une version postrieure. Article 13 - LOI APPLICABLE ET COMPETENCE TERRITORIALE 13.1 Le Contrat est rgi par la loi franaise. Les Parties conviennent de tenter de rgler l'amiable les diffrends ou litiges qui viendraient se produire par suite ou l'occasion du Contrat. 13.2 A dfaut d'accord amiable dans un dlai de deux (2) mois compter de leur survenance et sauf situation relevant d'une procdure d'urgence, les diffrends ou litiges seront ports par la Partie la plus diligente devant les Tribunaux comptents de Paris. Version 1.0 du 2006-09-05. ScientificPython-2.9.4/LICENSE0000644000076600000240000005254711501734142016440 0ustar hinsenstaff00000000000000 CeCILL-C FREE SOFTWARE LICENSE AGREEMENT Notice This Agreement is a Free Software license agreement that is the result of discussions between its authors in order to ensure compliance with the two main principles guiding its drafting: * firstly, compliance with the principles governing the distribution of Free Software: access to source code, broad rights granted to users, * secondly, the election of a governing law, French law, with which it is conformant, both as regards the law of torts and intellectual property law, and the protection that it offers to both authors and holders of the economic rights over software. The authors of the CeCILL-C (for Ce[a] C[nrs] I[nria] L[ogiciel] L[ibre]) license are: Commissariat l'Energie Atomique - CEA, a public scientific, technical and industrial research establishment, having its principal place of business at 25 rue Leblanc, immeuble Le Ponant D, 75015 Paris, France. Centre National de la Recherche Scientifique - CNRS, a public scientific and technological establishment, having its principal place of business at 3 rue Michel-Ange, 75794 Paris cedex 16, France. Institut National de Recherche en Informatique et en Automatique - INRIA, a public scientific and technological establishment, having its principal place of business at Domaine de Voluceau, Rocquencourt, BP 105, 78153 Le Chesnay cedex, France. Preamble The purpose of this Free Software license agreement is to grant users the right to modify and re-use the software governed by this license. The exercising of this right is conditional upon the obligation to make available to the community the modifications made to the source code of the software so as to contribute to its evolution. In consideration of access to the source code and the rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors only have limited liability. In this respect, the risks associated with loading, using, modifying and/or developing or reproducing the software by the user are brought to the user's attention, given its Free Software status, which may make it complicated to use, with the result that its use is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the suitability of the software as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions of security. This Agreement may be freely reproduced and published, provided it is not altered, and that no provisions are either added or removed herefrom. This Agreement may apply to any or all software for which the holder of the economic rights decides to submit the use thereof to its provisions. Article 1 - DEFINITIONS For the purpose of this Agreement, when the following expressions commence with a capital letter, they shall have the following meaning: Agreement: means this license agreement, and its possible subsequent versions and annexes. Software: means the software in its Object Code and/or Source Code form and, where applicable, its documentation, "as is" when the Licensee accepts the Agreement. Initial Software: means the Software in its Source Code and possibly its Object Code form and, where applicable, its documentation, "as is" when it is first distributed under the terms and conditions of the Agreement. Modified Software: means the Software modified by at least one Integrated Contribution. Source Code: means all the Software's instructions and program lines to which access is required so as to modify the Software. Object Code: means the binary files originating from the compilation of the Source Code. Holder: means the holder(s) of the economic rights over the Initial Software. Licensee: means the Software user(s) having accepted the Agreement. Contributor: means a Licensee having made at least one Integrated Contribution. Licensor: means the Holder, or any other individual or legal entity, who distributes the Software under the Agreement. Integrated Contribution: means any or all modifications, corrections, translations, adaptations and/or new functions integrated into the Source Code by any or all Contributors. Related Module: means a set of sources files including their documentation that, without modification to the Source Code, enables supplementary functions or services in addition to those offered by the Software. Derivative Software: means any combination of the Software, modified or not, and of a Related Module. Parties: mean both the Licensee and the Licensor. These expressions may be used both in singular and plural form. Article 2 - PURPOSE The purpose of the Agreement is the grant by the Licensor to the Licensee of a non-exclusive, transferable and worldwide license for the Software as set forth in Article 5 hereinafter for the whole term of the protection granted by the rights over said Software. Article 3 - ACCEPTANCE 3.1 The Licensee shall be deemed as having accepted the terms and conditions of this Agreement upon the occurrence of the first of the following events: * (i) loading the Software by any or all means, notably, by downloading from a remote server, or by loading from a physical medium; * (ii) the first time the Licensee exercises any of the rights granted hereunder. 3.2 One copy of the Agreement, containing a notice relating to the characteristics of the Software, to the limited warranty, and to the fact that its use is restricted to experienced users has been provided to the Licensee prior to its acceptance as set forth in Article 3.1 hereinabove, and the Licensee hereby acknowledges that it has read and understood it. Article 4 - EFFECTIVE DATE AND TERM 4.1 EFFECTIVE DATE The Agreement shall become effective on the date when it is accepted by the Licensee as set forth in Article 3.1. 4.2 TERM The Agreement shall remain in force for the entire legal term of protection of the economic rights over the Software. Article 5 - SCOPE OF RIGHTS GRANTED The Licensor hereby grants to the Licensee, who accepts, the following rights over the Software for any or all use, and for the term of the Agreement, on the basis of the terms and conditions set forth hereinafter. Besides, if the Licensor owns or comes to own one or more patents protecting all or part of the functions of the Software or of its components, the Licensor undertakes not to enforce the rights granted by these patents against successive Licensees using, exploiting or modifying the Software. If these patents are transferred, the Licensor undertakes to have the transferees subscribe to the obligations set forth in this paragraph. 5.1 RIGHT OF USE The Licensee is authorized to use the Software, without any limitation as to its fields of application, with it being hereinafter specified that this comprises: 1. permanent or temporary reproduction of all or part of the Software by any or all means and in any or all form. 2. loading, displaying, running, or storing the Software on any or all medium. 3. entitlement to observe, study or test its operation so as to determine the ideas and principles behind any or all constituent elements of said Software. This shall apply when the Licensee carries out any or all loading, displaying, running, transmission or storage operation as regards the Software, that it is entitled to carry out hereunder. 5.2 RIGHT OF MODIFICATION The right of modification includes the right to translate, adapt, arrange, or make any or all modifications to the Software, and the right to reproduce the resulting software. It includes, in particular, the right to create a Derivative Software. The Licensee is authorized to make any or all modification to the Software provided that it includes an explicit notice that it is the author of said modification and indicates the date of the creation thereof. 5.3 RIGHT OF DISTRIBUTION In particular, the right of distribution includes the right to publish, transmit and communicate the Software to the general public on any or all medium, and by any or all means, and the right to market, either in consideration of a fee, or free of charge, one or more copies of the Software by any means. The Licensee is further authorized to distribute copies of the modified or unmodified Software to third parties according to the terms and conditions set forth hereinafter. 5.3.1 DISTRIBUTION OF SOFTWARE WITHOUT MODIFICATION The Licensee is authorized to distribute true copies of the Software in Source Code or Object Code form, provided that said distribution complies with all the provisions of the Agreement and is accompanied by: 1. a copy of the Agreement, 2. a notice relating to the limitation of both the Licensor's warranty and liability as set forth in Articles 8 and 9, and that, in the event that only the Object Code of the Software is redistributed, the Licensee allows effective access to the full Source Code of the Software at a minimum during the entire period of its distribution of the Software, it being understood that the additional cost of acquiring the Source Code shall not exceed the cost of transferring the data. 5.3.2 DISTRIBUTION OF MODIFIED SOFTWARE When the Licensee makes an Integrated Contribution to the Software, the terms and conditions for the distribution of the resulting Modified Software become subject to all the provisions of this Agreement. The Licensee is authorized to distribute the Modified Software, in source code or object code form, provided that said distribution complies with all the provisions of the Agreement and is accompanied by: 1. a copy of the Agreement, 2. a notice relating to the limitation of both the Licensor's warranty and liability as set forth in Articles 8 and 9, and that, in the event that only the object code of the Modified Software is redistributed, the Licensee allows effective access to the full source code of the Modified Software at a minimum during the entire period of its distribution of the Modified Software, it being understood that the additional cost of acquiring the source code shall not exceed the cost of transferring the data. 5.3.3 DISTRIBUTION OF DERIVATIVE SOFTWARE When the Licensee creates Derivative Software, this Derivative Software may be distributed under a license agreement other than this Agreement, subject to compliance with the requirement to include a notice concerning the rights over the Software as defined in Article 6.4. In the event the creation of the Derivative Software required modification of the Source Code, the Licensee undertakes that: 1. the resulting Modified Software will be governed by this Agreement, 2. the Integrated Contributions in the resulting Modified Software will be clearly identified and documented, 3. the Licensee will allow effective access to the source code of the Modified Software, at a minimum during the entire period of distribution of the Derivative Software, such that such modifications may be carried over in a subsequent version of the Software; it being understood that the additional cost of purchasing the source code of the Modified Software shall not exceed the cost of transferring the data. 5.3.4 COMPATIBILITY WITH THE CeCILL LICENSE When a Modified Software contains an Integrated Contribution subject to the CeCILL license agreement, or when a Derivative Software contains a Related Module subject to the CeCILL license agreement, the provisions set forth in the third item of Article 6.4 are optional. Article 6 - INTELLECTUAL PROPERTY 6.1 OVER THE INITIAL SOFTWARE The Holder owns the economic rights over the Initial Software. Any or all use of the Initial Software is subject to compliance with the terms and conditions under which the Holder has elected to distribute its work and no one shall be entitled to modify the terms and conditions for the distribution of said Initial Software. The Holder undertakes that the Initial Software will remain ruled at least by this Agreement, for the duration set forth in Article 4.2. 6.2 OVER THE INTEGRATED CONTRIBUTIONS The Licensee who develops an Integrated Contribution is the owner of the intellectual property rights over this Contribution as defined by applicable law. 6.3 OVER THE RELATED MODULES The Licensee who develops a Related Module is the owner of the intellectual property rights over this Related Module as defined by applicable law and is free to choose the type of agreement that shall govern its distribution under the conditions defined in Article 5.3.3. 6.4 NOTICE OF RIGHTS The Licensee expressly undertakes: 1. not to remove, or modify, in any manner, the intellectual property notices attached to the Software; 2. to reproduce said notices, in an identical manner, in the copies of the Software modified or not; 3. to ensure that use of the Software, its intellectual property notices and the fact that it is governed by the Agreement is indicated in a text that is easily accessible, specifically from the interface of any Derivative Software. The Licensee undertakes not to directly or indirectly infringe the intellectual property rights of the Holder and/or Contributors on the Software and to take, where applicable, vis--vis its staff, any and all measures required to ensure respect of said intellectual property rights of the Holder and/or Contributors. Article 7 - RELATED SERVICES 7.1 Under no circumstances shall the Agreement oblige the Licensor to provide technical assistance or maintenance services for the Software. However, the Licensor is entitled to offer this type of services. The terms and conditions of such technical assistance, and/or such maintenance, shall be set forth in a separate instrument. Only the Licensor offering said maintenance and/or technical assistance services shall incur liability therefor. 7.2 Similarly, any Licensor is entitled to offer to its licensees, under its sole responsibility, a warranty, that shall only be binding upon itself, for the redistribution of the Software and/or the Modified Software, under terms and conditions that it is free to decide. Said warranty, and the financial terms and conditions of its application, shall be subject of a separate instrument executed between the Licensor and the Licensee. Article 8 - LIABILITY 8.1 Subject to the provisions of Article 8.2, the Licensee shall be entitled to claim compensation for any direct loss it may have suffered from the Software as a result of a fault on the part of the relevant Licensor, subject to providing evidence thereof. 8.2 The Licensor's liability is limited to the commitments made under this Agreement and shall not be incurred as a result of in particular: (i) loss due the Licensee's total or partial failure to fulfill its obligations, (ii) direct or consequential loss that is suffered by the Licensee due to the use or performance of the Software, and (iii) more generally, any consequential loss. In particular the Parties expressly agree that any or all pecuniary or business loss (i.e. loss of data, loss of profits, operating loss, loss of customers or orders, opportunity cost, any disturbance to business activities) or any or all legal proceedings instituted against the Licensee by a third party, shall constitute consequential loss and shall not provide entitlement to any or all compensation from the Licensor. Article 9 - WARRANTY 9.1 The Licensee acknowledges that the scientific and technical state-of-the-art when the Software was distributed did not enable all possible uses to be tested and verified, nor for the presence of possible defects to be detected. In this respect, the Licensee's attention has been drawn to the risks associated with loading, using, modifying and/or developing and reproducing the Software which are reserved for experienced users. The Licensee shall be responsible for verifying, by any or all means, the suitability of the product for its requirements, its good working order, and for ensuring that it shall not cause damage to either persons or properties. 9.2 The Licensor hereby represents, in good faith, that it is entitled to grant all the rights over the Software (including in particular the rights set forth in Article 5). 9.3 The Licensee acknowledges that the Software is supplied "as is" by the Licensor without any other express or tacit warranty, other than that provided for in Article 9.2 and, in particular, without any warranty as to its commercial value, its secured, safe, innovative or relevant nature. Specifically, the Licensor does not warrant that the Software is free from any error, that it will operate without interruption, that it will be compatible with the Licensee's own equipment and software configuration, nor that it will meet the Licensee's requirements. 9.4 The Licensor does not either expressly or tacitly warrant that the Software does not infringe any third party intellectual property right relating to a patent, software or any other property right. Therefore, the Licensor disclaims any and all liability towards the Licensee arising out of any or all proceedings for infringement that may be instituted in respect of the use, modification and redistribution of the Software. Nevertheless, should such proceedings be instituted against the Licensee, the Licensor shall provide it with technical and legal assistance for its defense. Such technical and legal assistance shall be decided on a case-by-case basis between the relevant Licensor and the Licensee pursuant to a memorandum of understanding. The Licensor disclaims any and all liability as regards the Licensee's use of the name of the Software. No warranty is given as regards the existence of prior rights over the name of the Software or as regards the existence of a trademark. Article 10 - TERMINATION 10.1 In the event of a breach by the Licensee of its obligations hereunder, the Licensor may automatically terminate this Agreement thirty (30) days after notice has been sent to the Licensee and has remained ineffective. 10.2 A Licensee whose Agreement is terminated shall no longer be authorized to use, modify or distribute the Software. However, any licenses that it may have granted prior to termination of the Agreement shall remain valid subject to their having been granted in compliance with the terms and conditions hereof. Article 11 - MISCELLANEOUS 11.1 EXCUSABLE EVENTS Neither Party shall be liable for any or all delay, or failure to perform the Agreement, that may be attributable to an event of force majeure, an act of God or an outside cause, such as defective functioning or interruptions of the electricity or telecommunications networks, network paralysis following a virus attack, intervention by government authorities, natural disasters, water damage, earthquakes, fire, explosions, strikes and labor unrest, war, etc. 11.2 Any failure by either Party, on one or more occasions, to invoke one or more of the provisions hereof, shall under no circumstances be interpreted as being a waiver by the interested Party of its right to invoke said provision(s) subsequently. 11.3 The Agreement cancels and replaces any or all previous agreements, whether written or oral, between the Parties and having the same purpose, and constitutes the entirety of the agreement between said Parties concerning said purpose. No supplement or modification to the terms and conditions hereof shall be effective as between the Parties unless it is made in writing and signed by their duly authorized representatives. 11.4 In the event that one or more of the provisions hereof were to conflict with a current or future applicable act or legislative text, said act or legislative text shall prevail, and the Parties shall make the necessary amendments so as to comply with said act or legislative text. All other provisions shall remain effective. Similarly, invalidity of a provision of the Agreement, for any reason whatsoever, shall not cause the Agreement as a whole to be invalid. 11.5 LANGUAGE The Agreement is drafted in both French and English and both versions are deemed authentic. Article 12 - NEW VERSIONS OF THE AGREEMENT 12.1 Any person is authorized to duplicate and distribute copies of this Agreement. 12.2 So as to ensure coherence, the wording of this Agreement is protected and may only be modified by the authors of the License, who reserve the right to periodically publish updates or new versions of the Agreement, each with a separate number. These subsequent versions may address new issues encountered by Free Software. 12.3 Any Software distributed under a given version of the Agreement may only be subsequently distributed under the same version of the Agreement or a subsequent version. Article 13 - GOVERNING LAW AND JURISDICTION 13.1 The Agreement is governed by French law. The Parties agree to endeavor to seek an amicable solution to any disagreements or disputes that may arise during the performance of the Agreement. 13.2 Failing an amicable solution within two (2) months as from their occurrence, and unless emergency proceedings are necessary, the disagreements or disputes shall be referred to the Paris Courts having jurisdiction, by the more diligent Party. Version 1.0 dated 2006-09-05. ScientificPython-2.9.4/MANIFEST.in0000644000076600000240000000142412233734610017160 0ustar hinsenstaff00000000000000include README README.BSP README.MPI README.BSPlib LICENSE LICENCE MANIFEST.in HG_CHANGESET_ID include bsp_virtual bsp_virtual_stackless include scientific_win32_postinstall.py include Scientific/*.pyx include Scientific/*.c include Src/MPI/Scientific_mpi.c Src/MPI/Scientific_mpi.export Src/MPI/mpipython.c Src/MPI/compile.py Src/MPI/impipython include Src/BSPlib/Scientific_bsplib.c Src/BSPlib/Scientific_bsplib.export Src/BSPlib/bsppython.c Src/BSPlib/compile_bsponmpi.py Src/BSPlib/compile_oxford_toolset.py Src/BSPlib/ibsppython include Tests/*.py include Doc/CHANGELOG include Doc/BSP_Tutorial.pdf include Doc/Reference/* include Examples/*.c Examples/*.py Examples/BSP/*.py Examples/README recursive-include Include *.h recursive-include Tools *.py exclude Scientific/BSP/Tasks.py ScientificPython-2.9.4/PKG-INFO0000644000076600000240000000150412270505006016512 0ustar hinsenstaff00000000000000Metadata-Version: 1.0 Name: ScientificPython Version: 2.9.4 Summary: Various Python modules for scientific computing Home-page: http://dirac.cnrs-orleans.fr/ScientificPython/ Author: Konrad Hinsen Author-email: hinsen@cnrs-orleans.fr License: CeCILL-C Description: ScientificPython is a collection of Python modules that are useful for scientific computing. In this collection you will find modules that cover basic geometry (vectors, tensors, transformations, vector and tensor fields), quaternions, automatic derivatives, (linear) interpolation, polynomials, elementary statistics, nonlinear least-squares fits, unit calculations, Fortran-compatible text formatting, 3D visualization via VRML, and two Tk widgets for simple line plots and 3D wireframe models. Platform: UNKNOWN ScientificPython-2.9.4/README0000644000076600000240000001054611501734142016304 0ustar hinsenstaff00000000000000ScientificPython is a collection of Python modules that are useful for scientific applications. Most of them need the Numerical Python extension (aka NumPy), which is available from SourceForge; see http://numpy.sourceforge.net for details. This is release 2.9 of ScientificPython. The odd minor release number indicates a development release. All the documentation is in Doc. To browse the reference manual for all the modules, point your browser at Doc/Reference/index.html. If you find bugs, please tell me, and if you improve something, please send me the modified version. I don't promise anything, but since I use these modules a lot for my own work, I have an interest in keeping them bug-free and usable. For updates, check http://dirac.cnrs-orleans.fr/ScientificPython/ from time to time. Konrad Hinsen Centre de Biophysique Molculaire (CNRS) et Synchrotron Soleil E-Mail: hinsen@cnrs-orleans.fr --------------------------------------------------------------------------- Installation: ------------- Required: Python 2.5 or higher. Most modules also require Numerical Python. If you want to use the netCDF interface module, you also need the netCDF library, version 3.0 or higher. 1) Unix-like systems, including Linux and MacOS X Installation is as simple as python setup.py build python setup.py install (the second command requires root privileges on many installations). This will build the netCDF module if it can find a netCDF installation in either /usr/local or in /usr. If your netCDF installation is elsewhere, set the environment variable "NETCDF_PREFIX" to the directory in which "include/netcdf.h" and "lib/netcdf.so" are located. 2) Windows To build the netCDF interface module, you must have a binary version of netCDF. You can either compile it yourself, or download the precompiled netcdf.dll from the netCDF Web site. You also need the file netcdf.h, which you can find in the netCDF source code distribution. PLEASE MAKE SURE THAT NETCDF.DLL AND NETCDF.H ARE FOR THE SAME NETCDF RELEASE! Installation is as simple as python setup.py build --netcdf_prefix=dir_h --netcdf_dll=dir_dll python setup.py install --netcdf_prefix=dir_h --netcdf_dll=dir_dll where "dir_h" is the directory in which netcdf.h is located and "dir_dll" is the the directory in which netcdf.dll is located. Alternatively, you can create a binary installer using python setup.py bdist_wininst --netcdf_prefix=dir_h --netcdf_dll=dir_dll Using numpy or numarray: ------------------------ There are three nearly compatible implementations of numeric arrays for Python: the original one, Numerical Python (module name "Numeric"), a later rewrite called numarray, and an evolution of Numeric that integrates features from numarray, called numpy. Scientific Python was written for Numeric and still uses Numeric by default. However, it is possible to use numpy or numarray instead of Numeric for all array operations. To do this, use python setup.py build --numpy python setup.py install or python setup.py build --numarray python setup.py install for installation. Note that this is a new feature and not very well tested. Feedback is welcome. Note also that the modules Scientific.Functions.Derivatives Scientific.Functions.FirstDerivatives Scientific.Functions.LeastSquares do not work correctly with numarray because they rely on a feature of Numeric/numpy that is missing in numarray. For the same reason, the modules Scientific.Functions.Interpolation Scientific.Physics.PhysicalQuantities can be used only partially with numarray, the application of mathematical functions to the defined objects does not work. In the long run, numpy is likely to replace both Numeric and numarray. At some point, ScientificPython will thus use numpy by default. --------------------------------------------------------------------------- Examples: --------- The directory Examples provides a few simple example applications, including a C extension module that uses the netCDF C-API. Using Scientific.Visualization.VMD under Windows ------------------------------------------------ If VMD is installed in its default location, everything should work fine automatically. Otherwise, an error message will be printed. The default location is c:\Program Files\University of Illinois\VMD\vmd.exe or its equivalent on non-English Windows versions ("Program Files" changes its name). ScientificPython-2.9.4/README.BSP0000644000076600000240000000732111501734142016724 0ustar hinsenstaff00000000000000BSP programs in Python can be executed in three modes: 1) Using a standard Python interpreter. No special measures need to be taken, the program will execute on a single processor. 2) Using MPI or BSPlib for communication between multiple CPUs. This is the only mode that gives real parallel execution. See below for details. 3) Using the bsp_virtual interpreter. This runs the program with any number of virtual processors, but only one real CPU is used. The main interest of this mode is for debugging, as it permits interactive debugging of any or all virtual processors. See below for details. Note: this code is not very well tested yet. In particular, it might fail with programs that manipulate sys.modules directly. Real parallel execution ----------------------- In order to use the module Scientific.BSP using more than one real processor, you must compile either the BSPlib or the MPI interface. See README.BSPlib and README.MPI for installation details. The BSPlib interface is probably more efficient (I haven't done extensive tests yet), and allows the use of the BSP toolset, on the other hand MPI is more widely available and might thus already be installed on your machine. For serious use, you should probably install both and make comparisons for your own applications. Application programs do not have to be modified to switch between MPI and BSPlib, only the method to run the program on a multiprocessor machine must be adapted. To execute a program in parallel mode, use the mpipython or bsppython executable. The manual for your MPI or BSPlib installation will tell you how to define the number of processors. Interactive execution in parallel mode is possible using the scripts ibsppython and impipython. Note that the latter must be adapted to your MPI installation. These scripts emulate a standard Python interpreter well enough that they can be used in some developmen environments. In particular, they can be used within Emacs Python mode. Virtual parallel execution -------------------------- The script bsp_virtual implements a BSP virtual machine that serializes the execution of any number of virtual processors. There is no significant overhead, but there isn't any real parallelism either, only one CPU is used. However, this mode allows the most convenient interactive development, including interactive debugging on all virtual processors. In combination with Emacs and its Python mode, it is a very convenient development environment for parallel programs. bsp_virtual emulates a standard Python interpreter even better than the interactive BSP scripts mentioned above. In addition, it provides interactive debugging of virtual processes. The commandline syntax is bsp_virtual [options] [script.py] where script.py is a Python script to execute. The options are -i: continue in interactive mode after the script terminates -n np: set the number of (virtual) processors to n (default: 1) -r: print the runtime used by each virtual processor Debugging is handled by the standard pdb, which however is invoked in a different way. Debugging commands are identified by an exclamation mark (!) at the beginning of the command line. The following two debugging commands are available: !pm(pid) Runs a post-mortem inspection after an exception. pid is the processor id to be inspected. Note that *all* processor states can be inspected, not only the one of the process that crashed. !run(pids, command) Run command (a string) under debugger control. pids is a list of processor ids that are subject to debugging. It can also be an integer instead of a list, for debugging a single process. The debugging commands are the same as in the standard pdb. ScientificPython-2.9.4/README.BSPlib0000644000076600000240000000747611501734142017426 0ustar hinsenstaff00000000000000This release of ScientificPython contains support for parallelization via the Bulk Synchronous Parallel library (BSPlib). If you want to write parallelized programs in Python using the BSP module in Scientific Python, you need either the BSPlib interface or the MPI interface (see README.MPI for that one). If you don't want to write parallel code, or don't know what that is, don't read the following, and go on with installation. In the following I will assume that you know what BSPlib is, and that you have it installed on your system BSPlib support in ScientificPython is limited to the message passing functionality, direct remote memory access is not implemented. The Python data types that are supported are strings and Numerical Python arrays. The BSPlib module exists mainly as a low-level support for the module Scientific.BSP, which offers a more convenient high-level interface and allows the transmission of almost arbitrart Python objects. The BSPlib module also provides a C API for use by other extension modules. Here is what you have to do to get BSPlib support in Scientific Python: 1) Build and install Scientific Python as usual (i.e. "python setup.py install" in most cases). 2) Go to the directory Src/BSPlib. 3) Type "python compile.py". 4) Move the resulting executable "bsppython" to a directory on your shell's execution path. This recipe should work on any system with a working installation of BSPlib. It has been tested with version 1.4 under Linux. To execute a BSP program, use bsppython instead of the normal Python interpreter. Programs that use only the high-level module Scientific.BSP will also work with a standard Python interpreter, but only use one processor. Scientific.BSP can also use MPI for low-level communication, if you prefer that option, install MPI support (see README.MPI for details) and run the programs with the mpipython executable. There is also an interactive parallel console, which is highly recommended for program development. It is used much like the standard Python interpreter, and is in fact sufficiently similar that it can be used instead of standard Python with the Emacs mode for Python. That combination is at the moment the best development environment for parallel Python code. The interactive parallel console is a small executable script called "ibsppython", to be found in the Src/BSPlib directory. Copy it anywhere to any directory on the search path of your Unix system. Special thanks to Joe VanAndel for the new compile.py script that works with Python 2.2 as well! In case you wonder why a special Python executable is required, here is some background information: First of all, the BSPlib interface does not work with a standard Python interpreter. The reason is that the BSPlib interface requires that the call to bsp_begin() be the first executed statement in the Python interpreter. Moreover, a modified interpreter is the only way to guarantee that bsp_end() is always called at the end, even if the Python program crashes. The file Src/BSPlib/bsppython.c takes care of these two calls; it is in fact nothing but a slightly modified version of the python interpreter program, python.c. (In case you wonder why it's so small: all the real work is done in the Python library functions that are called.) The second problem is dynamic library support. Depending on your operating system, it might be impossible to use the BSPlib interface module as a dynamic library, because the interpreter and the module might use different copies of the BSPlib code. The safest bet is to link the interface module, Scientific_bsplib, together with the bsppython executable. Other C extension modules can then call BSPlib functions via Python's CObject indirection method. Konrad Hinsen Centre de Biophysique Moleculaire (CNRS) Rue Charles Sadron 45071 Orleans Cedex 2 France E-Mail: hinsen@cnrs-orleans.fr ScientificPython-2.9.4/README.MPI0000644000076600000240000001202411501734142016721 0ustar hinsenstaff00000000000000This release of ScientificPython contains support for parallelization via the Message Passing Interface (MPI). If you don't know what that is, you probably don't need it, so don't read the following, and go on with installation. In the following I will assume that you do know what MPI is, and how to compile and link MPI programs on your platform. MPI support in ScientificPython does not pretend to be complete, it gives access to only the most important MPI function. The strong point of ScientificPython's interface (compared to other MPI interfaces for Python) is the integration into Python: communicators are Python objects, all communication happens via methods defined on communicator objects, support is provided for sending and receiving both string and NumPy array objects. Moreover, Python scripts can rather easily be written in such a way that they work both with and without MPI support, of course using only a single processor when no MPI is available. Finally, there is a full C API as well, which means that other C modules can make use of MPI without having to link to the MPI library, which is particularly useful for dynamic library modules. It also facilitates packaging of MPI-based code, which doesn't need to know anything at all about the MPI library. The module Scientific.MPI is documented in the ScientificPython manual. The main purpose of this file is to explain how to install ScientificPython with MPI support. It works on a couple of platforms without modifications, but that's no guarantee that it will work immediately on yours as well. Here is what you have to do to get MPI support in Scientific Python: 1) Build and install Scientific Python as usual (i.e. "python setup.py install" in most cases). 2) Go to the directory Src/MPI. 3) Type "python compile.py". 4) Move the resulting executable "mpipython" to a directory on your system's execution path. This should work under the condition that your MPI implementation provides a script or executable called "mpicc" which compiles C programs using MPI and does not require any explicitly mentioned libraries. If such a script exists, but with a different name, change the name in the beginning of compile.py. If no such script exists, study compile.py and adapt it as needed... However, all MPI implementations I have used do provide such a script. For running Python code that uses MPI, you must use mpipython, not the standard Python executable. If you use the standard python version, a dummy MPI module is used which behaves much like MPI with a single processor. To test your installation, execute the program Examples/mpi.py using more than one processor. If you use mpipython as the low-level support for the parallelization module Scientific.BSP, you can profit from the interactive parallel console, which is highly recommended for program development. It is used much like the standard Python interpreter, and is in fact sufficiently similar that it can be used instead of standard Python with the Emacs mode for Python. That combination is at the moment the best development environment for parallel Python code. The interactive parallel console is a small executable script called "impipython", to be found in the Src/MPI directory. It contains two hardcoded paths that you must adapt to your installation: the path to the mpipython executable, and the path to the script Concole.py in the ScientificPython installation. You can also change the number of processors to any value you wish, or add other options depending on your MPI installation. In case you wonder why a special Python executable is required, here is some background information: First of all, the MPI interface does not work with a standard Python interpreter. The reason is that MPI (at least some implementations, including MPICH) requires access to the command line parameters *before* Python takes over and puts them into sys.argv. Therefore MPI_Init() must be called before the Python main loop is entered, and it is also advisable to put MPI_Finalize() into a place where it is guaranteed to be executed even if the program crashes. The file Src/mpipython.c takes care of these two calls; it is in fact nothing but a slightly modified version of the python interpreter program, python.c. (In case you wonder why it's so small: all the real work is done in the Python library functions that are called.) The second problem is dynamic library support. If your MPI implementation comes as a dynamic library, then you shouldn't have any problems. If it doesn't, then it might be impossible to use the MPI interface module as a dynamic library, because the interpreter and the module would use different copies of the MPI code, which will probably create problems if MPI uses global variables. The safest bet is to link the interface module, Scientific_mpi, together with the mpipython executable. However, on my system (Linux/MPICH), it works fine as a dynamic library as well, so you might want to try it. Konrad Hinsen Centre de Biophysique Moleculaire (CNRS) Rue Charles Sadron 45071 Orleans Cedex 2 France E-Mail: hinsen@cnrs-orleans.fr ScientificPython-2.9.4/Scientific/0000755000076600000240000000000012270505005017474 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/__init__.py0000644000076600000240000000176412233713204021616 0ustar hinsenstaff00000000000000# # Scientific Python # """ ScientificPython is a collection of Python modules that are useful for scientific computing. In this collection you will find modules that cover basic geometry (vectors, tensors, transformations, vector and tensor fields), quaternions, automatic derivatives, (linear) interpolation, polynomials, elementary statistics, nonlinear least-squares fits, unit calculations, Fortran-compatible text formatting, 3D visualization via VRML, and two Tk widgets for simple line plots and 3D wireframe models. There are also interfaces to the netCDF library (portable structured binary files), to MPI (Message Passing Interface, message-based parallel programming), and to BSPlib (Bulk Synchronous Parallel programming). For details consult the manual. @undocumented: __pkginfo__ @undocumented: LA @undocumented: N @undocumented: Mathematica """ # # Package information # from __pkginfo__ import __version__ # # New exception class # class IterationCountExceededError(ValueError): pass ScientificPython-2.9.4/Scientific/__pkginfo__.py0000644000076600000240000000010712270504304022276 0ustar hinsenstaff00000000000000# Data used both in the package and by setup.py __version__ = '2.9.4' ScientificPython-2.9.4/Scientific/_affinitypropagation.c0000644000076600000240000075627012270504677024113 0ustar hinsenstaff00000000000000/* Generated by Cython 0.19.2 on Fri Jan 24 16:41:50 2014 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS #ifdef PYLONG_BITS_IN_DIGIT #define CYTHON_USE_PYLONG_INTERNALS 0 #else #include "pyconfig.h" #ifdef PYLONG_BITS_IN_DIGIT #define CYTHON_USE_PYLONG_INTERNALS 1 #else #define CYTHON_USE_PYLONG_INTERNALS 0 #endif #endif #endif #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ !PyComplex_Check(o)) #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_VERSION_HEX < 0x02060000 #define Py_TPFLAGS_HAVE_VERSION_TAG 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is a quiet NaN. */ float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__Scientific___affinitypropagation #define __PYX_HAVE_API__Scientific___affinitypropagation #include "string.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) #define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) #define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) #define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return u_end - u - 1; } #else #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen #endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params() { PyObject* sys = NULL; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; sys = PyImport_ImportModule("sys"); if (sys == NULL) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); if (default_encoding == NULL) goto bad; if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (ascii_chars_u == NULL) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", default_encoding_c); goto bad; } } Py_XDECREF(sys); Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return 0; bad: Py_XDECREF(sys); Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params() { PyObject* sys = NULL; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (sys == NULL) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); if (default_encoding == NULL) goto bad; default_encoding_c = PyBytes_AS_STRING(default_encoding); __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(sys); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(sys); Py_XDECREF(default_encoding); return -1; } #endif #endif #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "_affinitypropagation.pyx", "numpy.pxd", "type.pxd", }; /* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil) \ if (acquire_gil) { \ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ PyGILState_Release(__pyx_gilstate_save); \ } else { \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil) \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext() \ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_XDECREF_SET(r, v) do { \ PyObject *tmp = (PyObject *) r; \ r = v; __Pyx_XDECREF(tmp); \ } while (0) #define __Pyx_DECREF_SET(r, v) do { \ PyObject *tmp = (PyObject *) r; \ r = v; __Pyx_DECREF(tmp); \ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ #define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) #define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); #define __Pyx_SetItemInt(o, i, v, size, to_py_func, is_list, wraparound, boundscheck) \ (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_SetItemInt_Fast(o, i, v, is_list, wraparound, boundscheck) : \ __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, int wraparound, int boundscheck); #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) \ __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) static CYTHON_INLINE int __Pyx_PyObject_SetSlice( PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop, PyObject** py_start, PyObject** py_stop, PyObject** py_slice, int has_cstart, int has_cstop, int wraparound); static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, PyObject** py_start, PyObject** py_stop, PyObject** py_slice, int has_cstart, int has_cstop, int wraparound); static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #else #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #endif #endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ typedef struct { int code_line; PyCodeObject* code_object; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'Scientific._affinitypropagation' */ #define __Pyx_MODULE_NAME "Scientific._affinitypropagation" int __pyx_module_is_main_Scientific___affinitypropagation = 0; /* Implementation of 'Scientific._affinitypropagation' */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_pf_10Scientific_20_affinitypropagation__affinityPropagation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dataset, PyArrayObject *__pyx_v_s, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_r, float __pyx_v_damping); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ndarray is not C contiguous"; static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; static char __pyx_k_5[] = "Non-native byte order not supported"; static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_11[] = "Format string allocated too short."; static char __pyx_k_15[] = "_affinityPropagation"; static char __pyx_k_16[] = "/Users/hinsen/Programs/ScientificPython/main/Scientific/_affinitypropagation.pyx"; static char __pyx_k_17[] = "Scientific._affinitypropagation"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__a[] = "a"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__j[] = "j"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__r[] = "r"; static char __pyx_k__s[] = "s"; static char __pyx_k__v[] = "v"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__as[] = "as"; static char __pyx_k__np[] = "np"; static char __pyx_k__ind[] = "ind"; static char __pyx_k__dptr[] = "dptr"; static char __pyx_k__rpos[] = "rpos"; static char __pyx_k__take[] = "take"; static char __pyx_k__a_new[] = "a_new"; static char __pyx_k__float[] = "float"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__r_new[] = "r_new"; static char __pyx_k__range[] = "range"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__nitems[] = "nitems"; static char __pyx_k__damping[] = "damping"; static char __pyx_k__dataset[] = "dataset"; static char __pyx_k__maximum[] = "maximum"; static char __pyx_k__minimum[] = "minimum"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__ind_array[] = "ind_array"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k____import__[] = "__import__"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k__nsimilarities[] = "nsimilarities"; static char __pyx_k__r_update_indices[] = "r_update_indices"; static char __pyx_k__a_update_indices_1[] = "a_update_indices_1"; static char __pyx_k__a_update_indices_2[] = "a_update_indices_2"; static PyObject *__pyx_kp_u_1; static PyObject *__pyx_kp_u_11; static PyObject *__pyx_n_s_15; static PyObject *__pyx_kp_s_16; static PyObject *__pyx_n_s_17; static PyObject *__pyx_kp_u_3; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_8; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____import__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__a; static PyObject *__pyx_n_s__a_new; static PyObject *__pyx_n_s__a_update_indices_1; static PyObject *__pyx_n_s__a_update_indices_2; static PyObject *__pyx_n_s__as; static PyObject *__pyx_n_s__damping; static PyObject *__pyx_n_s__dataset; static PyObject *__pyx_n_s__dptr; static PyObject *__pyx_n_s__float; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__ind; static PyObject *__pyx_n_s__ind_array; static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__maximum; static PyObject *__pyx_n_s__minimum; static PyObject *__pyx_n_s__nitems; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__nsimilarities; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__r; static PyObject *__pyx_n_s__r_new; static PyObject *__pyx_n_s__r_update_indices; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__rpos; static PyObject *__pyx_n_s__s; static PyObject *__pyx_n_s__take; static PyObject *__pyx_n_s__v; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_15; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_9; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_12; static PyObject *__pyx_k_tuple_13; static PyObject *__pyx_k_codeobj_14; /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_20_affinitypropagation_1_affinityPropagation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_10Scientific_20_affinitypropagation_1_affinityPropagation = {__Pyx_NAMESTR("_affinityPropagation"), (PyCFunction)__pyx_pw_10Scientific_20_affinitypropagation_1_affinityPropagation, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_10Scientific_20_affinitypropagation_1_affinityPropagation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_dataset = 0; PyArrayObject *__pyx_v_s = 0; PyArrayObject *__pyx_v_a = 0; PyArrayObject *__pyx_v_r = 0; float __pyx_v_damping; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_affinityPropagation (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__dataset,&__pyx_n_s__s,&__pyx_n_s__a,&__pyx_n_s__r,&__pyx_n_s__damping,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dataset)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__s)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_affinityPropagation", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_affinityPropagation", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__r)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_affinityPropagation", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__damping)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_affinityPropagation", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_affinityPropagation") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_dataset = values[0]; __pyx_v_s = ((PyArrayObject *)values[1]); __pyx_v_a = ((PyArrayObject *)values[2]); __pyx_v_r = ((PyArrayObject *)values[3]); __pyx_v_damping = __pyx_PyFloat_AsFloat(values[4]); if (unlikely((__pyx_v_damping == (float)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_affinityPropagation", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("Scientific._affinitypropagation._affinityPropagation", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_s), __pyx_ptype_5numpy_ndarray, 1, "s", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_5numpy_ndarray, 1, "a", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_r), __pyx_ptype_5numpy_ndarray, 1, "r", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_10Scientific_20_affinitypropagation__affinityPropagation(__pyx_self, __pyx_v_dataset, __pyx_v_s, __pyx_v_a, __pyx_v_r, __pyx_v_damping); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_affinitypropagation.pyx":10 * cimport numpy as np * * def _affinityPropagation(dataset, np.ndarray s, np.ndarray a, # <<<<<<<<<<<<<< * np.ndarray r, float damping): * cdef np.ndarray as */ static PyObject *__pyx_pf_10Scientific_20_affinitypropagation__affinityPropagation(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dataset, PyArrayObject *__pyx_v_s, PyArrayObject *__pyx_v_a, PyArrayObject *__pyx_v_r, float __pyx_v_damping) { PyArrayObject *__pyx_v_as = 0; PyArrayObject *__pyx_v_r_new = 0; PyArrayObject *__pyx_v_a_new = 0; PyArrayObject *__pyx_v_rpos = 0; PyArrayObject *__pyx_v_ind_array = 0; long *__pyx_v_ind; double *__pyx_v_dptr; double __pyx_v_v; int __pyx_v_i; int __pyx_v_j; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; npy_intp __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_affinityPropagation", 0); __Pyx_INCREF((PyObject *)__pyx_v_a); __Pyx_INCREF((PyObject *)__pyx_v_r); /* "Scientific/_affinitypropagation.pyx":23 * cdef int j * * as = a + s # <<<<<<<<<<<<<< * r_new = np.zeros((dataset.nsimilarities,), np.float) * for i from 0 <= i < dataset.nsimilarities: */ __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_a), ((PyObject *)__pyx_v_s)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_as = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_affinitypropagation.pyx":24 * * as = a + s * r_new = np.zeros((dataset.nsimilarities,), np.float) # <<<<<<<<<<<<<< * for i from 0 <= i < dataset.nsimilarities: * ind_array = dataset.r_update_indices[i] */ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s__nsimilarities); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_r_new = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; /* "Scientific/_affinitypropagation.pyx":25 * as = a + s * r_new = np.zeros((dataset.nsimilarities,), np.float) * for i from 0 <= i < dataset.nsimilarities: # <<<<<<<<<<<<<< * ind_array = dataset.r_update_indices[i] * ind = ind_array.data */ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s__nsimilarities); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { /* "Scientific/_affinitypropagation.pyx":26 * r_new = np.zeros((dataset.nsimilarities,), np.float) * for i from 0 <= i < dataset.nsimilarities: * ind_array = dataset.r_update_indices[i] # <<<<<<<<<<<<<< * ind = ind_array.data * dptr = as.data */ __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s__r_update_indices); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_ind_array, ((PyArrayObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "Scientific/_affinitypropagation.pyx":27 * for i from 0 <= i < dataset.nsimilarities: * ind_array = dataset.r_update_indices[i] * ind = ind_array.data # <<<<<<<<<<<<<< * dptr = as.data * v = dptr[ind[0]] */ __pyx_v_ind = ((long *)__pyx_v_ind_array->data); /* "Scientific/_affinitypropagation.pyx":28 * ind_array = dataset.r_update_indices[i] * ind = ind_array.data * dptr = as.data # <<<<<<<<<<<<<< * v = dptr[ind[0]] * for j from 1 <= j < ind_array.shape[0]: */ __pyx_v_dptr = ((double *)__pyx_v_as->data); /* "Scientific/_affinitypropagation.pyx":29 * ind = ind_array.data * dptr = as.data * v = dptr[ind[0]] # <<<<<<<<<<<<<< * for j from 1 <= j < ind_array.shape[0]: * if dptr[ind[j]] > v: */ __pyx_v_v = (__pyx_v_dptr[(__pyx_v_ind[0])]); /* "Scientific/_affinitypropagation.pyx":30 * dptr = as.data * v = dptr[ind[0]] * for j from 1 <= j < ind_array.shape[0]: # <<<<<<<<<<<<<< * if dptr[ind[j]] > v: * v = dptr[ind[j]] */ __pyx_t_6 = (__pyx_v_ind_array->dimensions[0]); for (__pyx_v_j = 1; __pyx_v_j < __pyx_t_6; __pyx_v_j++) { /* "Scientific/_affinitypropagation.pyx":31 * v = dptr[ind[0]] * for j from 1 <= j < ind_array.shape[0]: * if dptr[ind[j]] > v: # <<<<<<<<<<<<<< * v = dptr[ind[j]] * r_new[i] = s[i] - v */ __pyx_t_7 = (((__pyx_v_dptr[(__pyx_v_ind[__pyx_v_j])]) > __pyx_v_v) != 0); if (__pyx_t_7) { /* "Scientific/_affinitypropagation.pyx":32 * for j from 1 <= j < ind_array.shape[0]: * if dptr[ind[j]] > v: * v = dptr[ind[j]] # <<<<<<<<<<<<<< * r_new[i] = s[i] - v * r = damping*r + (1-damping)*r_new */ __pyx_v_v = (__pyx_v_dptr[(__pyx_v_ind[__pyx_v_j])]); goto __pyx_L7; } __pyx_L7:; } /* "Scientific/_affinitypropagation.pyx":33 * if dptr[ind[j]] > v: * v = dptr[ind[j]] * r_new[i] = s[i] - v # <<<<<<<<<<<<<< * r = damping*r + (1-damping)*r_new * */ __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_s), __pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyFloat_FromDouble(__pyx_v_v); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetItemInt(((PyObject *)__pyx_v_r_new), __pyx_v_i, __pyx_t_2, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } /* "Scientific/_affinitypropagation.pyx":34 * v = dptr[ind[j]] * r_new[i] = s[i] - v * r = damping*r + (1-damping)*r_new # <<<<<<<<<<<<<< * * rpos = np.maximum(0., r) */ __pyx_t_2 = PyFloat_FromDouble(__pyx_v_damping); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyNumber_Multiply(__pyx_t_2, ((PyObject *)__pyx_v_r)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyFloat_FromDouble((1.0 - __pyx_v_damping)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, ((PyObject *)__pyx_v_r_new)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF_SET(__pyx_v_r, ((PyArrayObject *)__pyx_t_2)); __pyx_t_2 = 0; /* "Scientific/_affinitypropagation.pyx":36 * r = damping*r + (1-damping)*r_new * * rpos = np.maximum(0., r) # <<<<<<<<<<<<<< * a_new = np.take(r, dataset.a_update_indices_1) * a_new[-dataset.nitems:] = 0. */ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__maximum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyFloat_FromDouble(0.); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_r)); PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_r)); __Pyx_GIVEREF(((PyObject *)__pyx_v_r)); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_rpos = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; /* "Scientific/_affinitypropagation.pyx":37 * * rpos = np.maximum(0., r) * a_new = np.take(r, dataset.a_update_indices_1) # <<<<<<<<<<<<<< * a_new[-dataset.nitems:] = 0. * for i from 0 <= i < dataset.nsimilarities: */ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__take); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s__a_update_indices_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_r)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_r)); __Pyx_GIVEREF(((PyObject *)__pyx_v_r)); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_a_new = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; /* "Scientific/_affinitypropagation.pyx":38 * rpos = np.maximum(0., r) * a_new = np.take(r, dataset.a_update_indices_1) * a_new[-dataset.nitems:] = 0. # <<<<<<<<<<<<<< * for i from 0 <= i < dataset.nsimilarities: * ind_array = dataset.a_update_indices_2[i] */ __pyx_t_2 = PyFloat_FromDouble(0.); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s__nitems); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyNumber_Negative(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_a_new), __pyx_t_2, 0, 0, &__pyx_t_4, NULL, NULL, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "Scientific/_affinitypropagation.pyx":39 * a_new = np.take(r, dataset.a_update_indices_1) * a_new[-dataset.nitems:] = 0. * for i from 0 <= i < dataset.nsimilarities: # <<<<<<<<<<<<<< * ind_array = dataset.a_update_indices_2[i] * ind = ind_array.data */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s__nsimilarities); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_5; __pyx_v_i++) { /* "Scientific/_affinitypropagation.pyx":40 * a_new[-dataset.nitems:] = 0. * for i from 0 <= i < dataset.nsimilarities: * ind_array = dataset.a_update_indices_2[i] # <<<<<<<<<<<<<< * ind = ind_array.data * dptr = rpos.data */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s__a_update_indices_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, __pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_ind_array, ((PyArrayObject *)__pyx_t_4)); __pyx_t_4 = 0; /* "Scientific/_affinitypropagation.pyx":41 * for i from 0 <= i < dataset.nsimilarities: * ind_array = dataset.a_update_indices_2[i] * ind = ind_array.data # <<<<<<<<<<<<<< * dptr = rpos.data * v = dptr[ind[0]] */ __pyx_v_ind = ((long *)__pyx_v_ind_array->data); /* "Scientific/_affinitypropagation.pyx":42 * ind_array = dataset.a_update_indices_2[i] * ind = ind_array.data * dptr = rpos.data # <<<<<<<<<<<<<< * v = dptr[ind[0]] * for j from 1 <= j < ind_array.shape[0]: */ __pyx_v_dptr = ((double *)__pyx_v_rpos->data); /* "Scientific/_affinitypropagation.pyx":43 * ind = ind_array.data * dptr = rpos.data * v = dptr[ind[0]] # <<<<<<<<<<<<<< * for j from 1 <= j < ind_array.shape[0]: * v = v + dptr[ind[j]] */ __pyx_v_v = (__pyx_v_dptr[(__pyx_v_ind[0])]); /* "Scientific/_affinitypropagation.pyx":44 * dptr = rpos.data * v = dptr[ind[0]] * for j from 1 <= j < ind_array.shape[0]: # <<<<<<<<<<<<<< * v = v + dptr[ind[j]] * a_new[i] = a_new[i] + v */ __pyx_t_6 = (__pyx_v_ind_array->dimensions[0]); for (__pyx_v_j = 1; __pyx_v_j < __pyx_t_6; __pyx_v_j++) { /* "Scientific/_affinitypropagation.pyx":45 * v = dptr[ind[0]] * for j from 1 <= j < ind_array.shape[0]: * v = v + dptr[ind[j]] # <<<<<<<<<<<<<< * a_new[i] = a_new[i] + v * a_new[:-dataset.nitems] = np.minimum(0., a_new[:-dataset.nitems]) */ __pyx_v_v = (__pyx_v_v + (__pyx_v_dptr[(__pyx_v_ind[__pyx_v_j])])); } /* "Scientific/_affinitypropagation.pyx":46 * for j from 1 <= j < ind_array.shape[0]: * v = v + dptr[ind[j]] * a_new[i] = a_new[i] + v # <<<<<<<<<<<<<< * a_new[:-dataset.nitems] = np.minimum(0., a_new[:-dataset.nitems]) * a = damping*a + (1-damping)*a_new */ __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_a_new), __pyx_v_i, sizeof(int), PyInt_FromLong, 0, 1, 1); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyFloat_FromDouble(__pyx_v_v); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyNumber_Add(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetItemInt(((PyObject *)__pyx_v_a_new), __pyx_v_i, __pyx_t_1, sizeof(int), PyInt_FromLong, 0, 1, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } /* "Scientific/_affinitypropagation.pyx":47 * v = v + dptr[ind[j]] * a_new[i] = a_new[i] + v * a_new[:-dataset.nitems] = np.minimum(0., a_new[:-dataset.nitems]) # <<<<<<<<<<<<<< * a = damping*a + (1-damping)*a_new * */ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__minimum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyFloat_FromDouble(0.); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s__nitems); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyNumber_Negative(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_a_new), 0, 0, NULL, &__pyx_t_3, NULL, 0, 0, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dataset, __pyx_n_s__nitems); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyNumber_Negative(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_a_new), __pyx_t_4, 0, 0, NULL, &__pyx_t_2, NULL, 0, 0, 1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "Scientific/_affinitypropagation.pyx":48 * a_new[i] = a_new[i] + v * a_new[:-dataset.nitems] = np.minimum(0., a_new[:-dataset.nitems]) * a = damping*a + (1-damping)*a_new # <<<<<<<<<<<<<< * * return a, r */ __pyx_t_4 = PyFloat_FromDouble(__pyx_v_damping); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, ((PyObject *)__pyx_v_a)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyFloat_FromDouble((1.0 - __pyx_v_damping)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, ((PyObject *)__pyx_v_a_new)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF_SET(__pyx_v_a, ((PyArrayObject *)__pyx_t_4)); __pyx_t_4 = 0; /* "Scientific/_affinitypropagation.pyx":50 * a = damping*a + (1-damping)*a_new * * return a, r # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_a)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_a)); __Pyx_GIVEREF(((PyObject *)__pyx_v_a)); __Pyx_INCREF(((PyObject *)__pyx_v_r)); PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_r)); __Pyx_GIVEREF(((PyObject *)__pyx_v_r)); __pyx_r = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("Scientific._affinitypropagation._affinityPropagation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_as); __Pyx_XDECREF((PyObject *)__pyx_v_r_new); __Pyx_XDECREF((PyObject *)__pyx_v_a_new); __Pyx_XDECREF((PyObject *)__pyx_v_rpos); __Pyx_XDECREF((PyObject *)__pyx_v_ind_array); __Pyx_XDECREF((PyObject *)__pyx_v_a); __Pyx_XDECREF((PyObject *)__pyx_v_r); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = ((__pyx_v_info == NULL) != 0); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L4; } /*else*/ { /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L4:; /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_1) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_3) { /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ __pyx_t_2 = (__pyx_v_copy_shape != 0); if (__pyx_t_2) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } goto __pyx_L7; } /*else*/ { /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } __pyx_L7:; /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); __Pyx_INCREF(__pyx_t_4); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_2) { __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L10; } /*else*/ { /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } __pyx_L10:; /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ __pyx_t_5 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0); if (__pyx_t_1) { __pyx_t_2 = (__pyx_v_little_endian != 0); } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0); if (__pyx_t_1) { __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ switch (__pyx_v_t) { /* "numpy.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ case NPY_BYTE: __pyx_v_f = __pyx_k__b; break; /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ case NPY_UBYTE: __pyx_v_f = __pyx_k__B; break; /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ case NPY_SHORT: __pyx_v_f = __pyx_k__h; break; /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ case NPY_USHORT: __pyx_v_f = __pyx_k__H; break; /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ case NPY_INT: __pyx_v_f = __pyx_k__i; break; /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ case NPY_UINT: __pyx_v_f = __pyx_k__I; break; /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ case NPY_LONG: __pyx_v_f = __pyx_k__l; break; /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ case NPY_ULONG: __pyx_v_f = __pyx_k__L; break; /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ case NPY_LONGLONG: __pyx_v_f = __pyx_k__q; break; /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ case NPY_ULONGLONG: __pyx_v_f = __pyx_k__Q; break; /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ case NPY_FLOAT: __pyx_v_f = __pyx_k__f; break; /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ case NPY_DOUBLE: __pyx_v_f = __pyx_k__d; break; /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ case NPY_LONGDOUBLE: __pyx_v_f = __pyx_k__g; break; /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ case NPY_CFLOAT: __pyx_v_f = __pyx_k__Zf; break; /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ case NPY_CDOUBLE: __pyx_v_f = __pyx_k__Zd; break; /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ case NPY_CLONGDOUBLE: __pyx_v_f = __pyx_k__Zg; break; /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ case NPY_OBJECT: __pyx_v_f = __pyx_k__O; break; default: /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = c'\0' # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = '\x00'; } __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":288 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L4; } __pyx_L4:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; long __pyx_t_11; char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } else if (1) { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else { Py_ssize_t index = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); if (__pyx_t_7) { __pyx_t_8 = (__pyx_v_little_endian != 0); } else { __pyx_t_8 = __pyx_t_7; } if (!__pyx_t_8) { /* "numpy.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); if (__pyx_t_7) { __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; } __pyx_t_7 = __pyx_t_10; } else { __pyx_t_7 = __pyx_t_8; } if (__pyx_t_7) { /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_7) break; /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_7) { /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (__pyx_t_7) { /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 98; goto __pyx_L13; } /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 66; goto __pyx_L13; } /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 104; goto __pyx_L13; } /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 72; goto __pyx_L13; } /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 105; goto __pyx_L13; } /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 73; goto __pyx_L13; } /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 108; goto __pyx_L13; } /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 76; goto __pyx_L13; } /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 113; goto __pyx_L13; } /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 81; goto __pyx_L13; } /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 102; goto __pyx_L13; } /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 100; goto __pyx_L13; } /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 103; goto __pyx_L13; } /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 79; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /*else*/ { /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_12; } __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif __Pyx_NAMESTR("_affinitypropagation"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_n_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 1}, {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, {&__pyx_n_s__a_new, __pyx_k__a_new, sizeof(__pyx_k__a_new), 0, 0, 1, 1}, {&__pyx_n_s__a_update_indices_1, __pyx_k__a_update_indices_1, sizeof(__pyx_k__a_update_indices_1), 0, 0, 1, 1}, {&__pyx_n_s__a_update_indices_2, __pyx_k__a_update_indices_2, sizeof(__pyx_k__a_update_indices_2), 0, 0, 1, 1}, {&__pyx_n_s__as, __pyx_k__as, sizeof(__pyx_k__as), 0, 0, 1, 1}, {&__pyx_n_s__damping, __pyx_k__damping, sizeof(__pyx_k__damping), 0, 0, 1, 1}, {&__pyx_n_s__dataset, __pyx_k__dataset, sizeof(__pyx_k__dataset), 0, 0, 1, 1}, {&__pyx_n_s__dptr, __pyx_k__dptr, sizeof(__pyx_k__dptr), 0, 0, 1, 1}, {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__ind, __pyx_k__ind, sizeof(__pyx_k__ind), 0, 0, 1, 1}, {&__pyx_n_s__ind_array, __pyx_k__ind_array, sizeof(__pyx_k__ind_array), 0, 0, 1, 1}, {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__maximum, __pyx_k__maximum, sizeof(__pyx_k__maximum), 0, 0, 1, 1}, {&__pyx_n_s__minimum, __pyx_k__minimum, sizeof(__pyx_k__minimum), 0, 0, 1, 1}, {&__pyx_n_s__nitems, __pyx_k__nitems, sizeof(__pyx_k__nitems), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__nsimilarities, __pyx_k__nsimilarities, sizeof(__pyx_k__nsimilarities), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1}, {&__pyx_n_s__r_new, __pyx_k__r_new, sizeof(__pyx_k__r_new), 0, 0, 1, 1}, {&__pyx_n_s__r_update_indices, __pyx_k__r_update_indices, sizeof(__pyx_k__r_update_indices), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__rpos, __pyx_k__rpos, sizeof(__pyx_k__rpos), 0, 0, 1, 1}, {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1}, {&__pyx_n_s__take, __pyx_k__take, sizeof(__pyx_k__take), 0, 0, 1, 1}, {&__pyx_n_s__v, __pyx_k__v, sizeof(__pyx_k__v), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_k_tuple_9 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_8)); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); /* "Scientific/_affinitypropagation.pyx":10 * cimport numpy as np * * def _affinityPropagation(dataset, np.ndarray s, np.ndarray a, # <<<<<<<<<<<<<< * np.ndarray r, float damping): * cdef np.ndarray as */ __pyx_k_tuple_13 = PyTuple_Pack(15, ((PyObject *)__pyx_n_s__dataset), ((PyObject *)__pyx_n_s__s), ((PyObject *)__pyx_n_s__a), ((PyObject *)__pyx_n_s__r), ((PyObject *)__pyx_n_s__damping), ((PyObject *)__pyx_n_s__as), ((PyObject *)__pyx_n_s__r_new), ((PyObject *)__pyx_n_s__a_new), ((PyObject *)__pyx_n_s__rpos), ((PyObject *)__pyx_n_s__ind_array), ((PyObject *)__pyx_n_s__ind), ((PyObject *)__pyx_n_s__dptr), ((PyObject *)__pyx_n_s__v), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__j)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); __pyx_k_codeobj_14 = (PyObject*)__Pyx_PyCode_New(5, 0, 15, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_16, __pyx_n_s_15, 10, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC init_affinitypropagation(void); /*proto*/ PyMODINIT_FUNC init_affinitypropagation(void) #else PyMODINIT_FUNC PyInit__affinitypropagation(void); /*proto*/ PyMODINIT_FUNC PyInit__affinitypropagation(void) #endif { PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__affinitypropagation(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_affinitypropagation"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_d); #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!PyDict_GetItemString(modules, "Scientific._affinitypropagation")) { if (unlikely(PyDict_SetItemString(modules, "Scientific._affinitypropagation", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if (__pyx_module_is_main_Scientific___affinitypropagation) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "Scientific/_affinitypropagation.pyx":7 * # * * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_affinitypropagation.pyx":10 * cimport numpy as np * * def _affinityPropagation(dataset, np.ndarray s, np.ndarray a, # <<<<<<<<<<<<<< * np.ndarray r, float damping): * cdef np.ndarray as */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10Scientific_20_affinitypropagation_1_affinityPropagation, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_15, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_affinitypropagation.pyx":1 * # Implementation of Affinity Propagation in Cython # <<<<<<<<<<<<<< * # Accelerates DataSet.findCluster by a factor of 5. * # */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { __Pyx_AddTraceback("init Scientific._affinitypropagation", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init Scientific._affinitypropagation"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%s' is not defined", PyString_AS_STRING(name)); #endif } return result; } static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if CYTHON_COMPILING_IN_CPYTHON result = PyDict_GetItem(__pyx_d, name); if (result) { Py_INCREF(result); } else { #else result = PyObject_GetItem(__pyx_d, name); if (!result) { PyErr_Clear(); #endif result = __Pyx_GetBuiltinName(name); } return result; } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; } } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; } } else { PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (likely(l >= 0)) { i += l; } else { if (PyErr_ExceptionMatches(PyExc_OverflowError)) PyErr_Clear(); else return NULL; } } return m->sq_item(o, i); } } #else if (is_list || PySequence_Check(o)) { return PySequence_GetItem(o, i); } #endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; r = PyObject_SetItem(o, j, v); Py_DECREF(j); return r; } static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, int wraparound, int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { PyObject* old = PyList_GET_ITEM(o, n); Py_INCREF(v); PyList_SET_ITEM(o, n, v); Py_DECREF(old); return 1; } } else { PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_ass_item)) { if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (likely(l >= 0)) { i += l; } else { if (PyErr_ExceptionMatches(PyExc_OverflowError)) PyErr_Clear(); else return -1; } } return m->sq_ass_item(o, i, v); } } #else #if CYTHON_COMPILING_IN_PYPY if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) { #else if (is_list || PySequence_Check(o)) { #endif return PySequence_SetItem(o, i, v); } #endif return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } static CYTHON_INLINE int __Pyx_PyObject_SetSlice( PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop, PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { #if CYTHON_COMPILING_IN_CPYTHON PyMappingMethods* mp; #if PY_MAJOR_VERSION < 3 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; if (likely(ms && ms->sq_ass_slice)) { if (!has_cstart) { if (_py_start && (*_py_start != Py_None)) { cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; } else cstart = 0; } if (!has_cstop) { if (_py_stop && (*_py_stop != Py_None)) { cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; } else cstop = PY_SSIZE_T_MAX; } if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { Py_ssize_t l = ms->sq_length(obj); if (likely(l >= 0)) { if (cstop < 0) { cstop += l; if (cstop < 0) cstop = 0; } if (cstart < 0) { cstart += l; if (cstart < 0) cstart = 0; } } else { if (PyErr_ExceptionMatches(PyExc_OverflowError)) PyErr_Clear(); else goto bad; } } return ms->sq_ass_slice(obj, cstart, cstop, value); } #endif mp = Py_TYPE(obj)->tp_as_mapping; if (likely(mp && mp->mp_ass_subscript)) #endif { int result; PyObject *py_slice, *py_start, *py_stop; if (_py_slice) { py_slice = *_py_slice; } else { PyObject* owned_start = NULL; PyObject* owned_stop = NULL; if (_py_start) { py_start = *_py_start; } else { if (has_cstart) { owned_start = py_start = PyInt_FromSsize_t(cstart); if (unlikely(!py_start)) goto bad; } else py_start = Py_None; } if (_py_stop) { py_stop = *_py_stop; } else { if (has_cstop) { owned_stop = py_stop = PyInt_FromSsize_t(cstop); if (unlikely(!py_stop)) { Py_XDECREF(owned_start); goto bad; } } else py_stop = Py_None; } py_slice = PySlice_New(py_start, py_stop, Py_None); Py_XDECREF(owned_start); Py_XDECREF(owned_stop); if (unlikely(!py_slice)) goto bad; } #if CYTHON_COMPILING_IN_CPYTHON result = mp->mp_ass_subscript(obj, py_slice, value); #else result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice); #endif if (!_py_slice) { Py_DECREF(py_slice); } return result; } PyErr_Format(PyExc_TypeError, "'%.200s' object does not support slice %s", Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion"); bad: return -1; } static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { #if CYTHON_COMPILING_IN_CPYTHON PyMappingMethods* mp; #if PY_MAJOR_VERSION < 3 PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; if (likely(ms && ms->sq_slice)) { if (!has_cstart) { if (_py_start && (*_py_start != Py_None)) { cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; } else cstart = 0; } if (!has_cstop) { if (_py_stop && (*_py_stop != Py_None)) { cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; } else cstop = PY_SSIZE_T_MAX; } if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { Py_ssize_t l = ms->sq_length(obj); if (likely(l >= 0)) { if (cstop < 0) { cstop += l; if (cstop < 0) cstop = 0; } if (cstart < 0) { cstart += l; if (cstart < 0) cstart = 0; } } else { if (PyErr_ExceptionMatches(PyExc_OverflowError)) PyErr_Clear(); else goto bad; } } return ms->sq_slice(obj, cstart, cstop); } #endif mp = Py_TYPE(obj)->tp_as_mapping; if (likely(mp && mp->mp_subscript)) #endif { PyObject* result; PyObject *py_slice, *py_start, *py_stop; if (_py_slice) { py_slice = *_py_slice; } else { PyObject* owned_start = NULL; PyObject* owned_stop = NULL; if (_py_start) { py_start = *_py_start; } else { if (has_cstart) { owned_start = py_start = PyInt_FromSsize_t(cstart); if (unlikely(!py_start)) goto bad; } else py_start = Py_None; } if (_py_stop) { py_stop = *_py_stop; } else { if (has_cstop) { owned_stop = py_stop = PyInt_FromSsize_t(cstop); if (unlikely(!py_stop)) { Py_XDECREF(owned_start); goto bad; } } else py_stop = Py_None; } py_slice = PySlice_New(py_start, py_stop, Py_None); Py_XDECREF(owned_start); Py_XDECREF(owned_stop); if (unlikely(!py_slice)) goto bad; } #if CYTHON_COMPILING_IN_CPYTHON result = mp->mp_subscript(obj, py_slice); #else result = PyObject_GetItem(obj, py_slice); #endif if (!_py_slice) { Py_DECREF(py_slice); } return result; } PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); bad: return NULL; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_Restore(type, value, tb); #endif } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(type, value, tb); #endif } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } #if PY_VERSION_HEX < 0x02050000 if (PyClass_Check(type)) { #else if (PyType_Check(type)) { #endif #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyEval_CallObject(type, args); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } #if PY_VERSION_HEX >= 0x03030000 if (cause) { #else if (cause && cause != Py_None) { #endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: Py_XDECREF(owned_instance); return; } #endif static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; /* try absolute import on failure */ } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = (start + end) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_globals = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); } static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { #if PY_VERSION_HEX < 0x03030000 char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ *length = PyBytes_GET_SIZE(defenc); return defenc_c; #else /* PY_VERSION_HEX < 0x03030000 */ if (PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_DATA_SIZE(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ return PyUnicode_AsUTF8AndSize(o, length); #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ #endif /* PY_VERSION_HEX < 0x03030000 */ } else #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (r < 0) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ ScientificPython-2.9.4/Scientific/_affinitypropagation.pyx0000644000076600000240000000273412233733555024474 0ustar hinsenstaff00000000000000# Implementation of Affinity Propagation in Cython # Accelerates DataSet.findCluster by a factor of 5. # # Written by Konrad Hinsen # import numpy as np cimport numpy as np def _affinityPropagation(dataset, np.ndarray s, np.ndarray a, np.ndarray r, float damping): cdef np.ndarray as cdef np.ndarray r_new cdef np.ndarray a_new cdef np.ndarray rpos cdef np.ndarray ind_array cdef long *ind cdef double *dptr cdef double v cdef int i cdef int j as = a + s r_new = np.zeros((dataset.nsimilarities,), np.float) for i from 0 <= i < dataset.nsimilarities: ind_array = dataset.r_update_indices[i] ind = ind_array.data dptr = as.data v = dptr[ind[0]] for j from 1 <= j < ind_array.shape[0]: if dptr[ind[j]] > v: v = dptr[ind[j]] r_new[i] = s[i] - v r = damping*r + (1-damping)*r_new rpos = np.maximum(0., r) a_new = np.take(r, dataset.a_update_indices_1) a_new[-dataset.nitems:] = 0. for i from 0 <= i < dataset.nsimilarities: ind_array = dataset.a_update_indices_2[i] ind = ind_array.data dptr = rpos.data v = dptr[ind[0]] for j from 1 <= j < ind_array.shape[0]: v = v + dptr[ind[j]] a_new[i] = a_new[i] + v a_new[:-dataset.nitems] = np.minimum(0., a_new[:-dataset.nitems]) a = damping*a + (1-damping)*a_new return a, r ScientificPython-2.9.4/Scientific/_interpolation.c0000644000076600000240000066525312270504677022725 0ustar hinsenstaff00000000000000/* Generated by Cython 0.19.2 on Fri Jan 24 16:41:50 2014 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS #ifdef PYLONG_BITS_IN_DIGIT #define CYTHON_USE_PYLONG_INTERNALS 0 #else #include "pyconfig.h" #ifdef PYLONG_BITS_IN_DIGIT #define CYTHON_USE_PYLONG_INTERNALS 1 #else #define CYTHON_USE_PYLONG_INTERNALS 0 #endif #endif #endif #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ !PyComplex_Check(o)) #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_VERSION_HEX < 0x02060000 #define Py_TPFLAGS_HAVE_VERSION_TAG 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is a quiet NaN. */ float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__Scientific___interpolation #define __PYX_HAVE_API__Scientific___interpolation #include "string.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "math.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) #define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) #define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) #define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return u_end - u - 1; } #else #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen #endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params() { PyObject* sys = NULL; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; sys = PyImport_ImportModule("sys"); if (sys == NULL) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); if (default_encoding == NULL) goto bad; if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (ascii_chars_u == NULL) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", default_encoding_c); goto bad; } } Py_XDECREF(sys); Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return 0; bad: Py_XDECREF(sys); Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params() { PyObject* sys = NULL; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (sys == NULL) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); if (default_encoding == NULL) goto bad; default_encoding_c = PyBytes_AS_STRING(default_encoding); __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(sys); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(sys); Py_XDECREF(default_encoding); return -1; } #endif #endif #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "_interpolation.pyx", "numpy.pxd", "type.pxd", }; /* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil) \ if (acquire_gil) { \ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ PyGILState_Release(__pyx_gilstate_save); \ } else { \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil) \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext() \ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_XDECREF_SET(r, v) do { \ PyObject *tmp = (PyObject *) r; \ r = v; __Pyx_XDECREF(tmp); \ } while (0) #define __Pyx_DECREF_SET(r, v) do { \ PyObject *tmp = (PyObject *) r; \ r = v; __Pyx_DECREF(tmp); \ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 #endif static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #else #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #endif #endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ typedef struct { int code_line; PyCodeObject* code_object; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'Scientific._interpolation' */ #define __Pyx_MODULE_NAME "Scientific._interpolation" int __pyx_module_is_main_Scientific___interpolation = 0; /* Implementation of 'Scientific._interpolation' */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_pf_10Scientific_14_interpolation__interpolate(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, PyArrayObject *__pyx_v_axis, PyArrayObject *__pyx_v_values, double __pyx_v_period); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "Point outside grid of values"; static char __pyx_k_3[] = "ndarray is not C contiguous"; static char __pyx_k_5[] = "ndarray is not Fortran contiguous"; static char __pyx_k_7[] = "Non-native byte order not supported"; static char __pyx_k_9[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_10[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_13[] = "Format string allocated too short."; static char __pyx_k_17[] = "/Users/hinsen/Programs/ScientificPython/main/Scientific/_interpolation.pyx"; static char __pyx_k_18[] = "Scientific._interpolation"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__x[] = "x"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__i1[] = "i1"; static char __pyx_k__i2[] = "i2"; static char __pyx_k__np[] = "np"; static char __pyx_k__w1[] = "w1"; static char __pyx_k__w2[] = "w2"; static char __pyx_k__axis[] = "axis"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k__axis_d[] = "axis_d"; static char __pyx_k__axis_s[] = "axis_s"; static char __pyx_k__period[] = "period"; static char __pyx_k__values[] = "values"; static char __pyx_k__npoints[] = "npoints"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__values_d[] = "values_d"; static char __pyx_k__values_s[] = "values_s"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k____import__[] = "__import__"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k___interpolate[] = "_interpolate"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_u_10; static PyObject *__pyx_kp_u_13; static PyObject *__pyx_kp_s_17; static PyObject *__pyx_n_s_18; static PyObject *__pyx_kp_u_3; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____import__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s___interpolate; static PyObject *__pyx_n_s__axis; static PyObject *__pyx_n_s__axis_d; static PyObject *__pyx_n_s__axis_s; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__i1; static PyObject *__pyx_n_s__i2; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__npoints; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__period; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__values; static PyObject *__pyx_n_s__values_d; static PyObject *__pyx_n_s__values_s; static PyObject *__pyx_n_s__w1; static PyObject *__pyx_n_s__w2; static PyObject *__pyx_n_s__x; static PyObject *__pyx_int_15; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_6; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_11; static PyObject *__pyx_k_tuple_12; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_15; static PyObject *__pyx_k_codeobj_16; /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_14_interpolation_1_interpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_10Scientific_14_interpolation_1_interpolate = {__Pyx_NAMESTR("_interpolate"), (PyCFunction)__pyx_pw_10Scientific_14_interpolation_1_interpolate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_10Scientific_14_interpolation_1_interpolate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_x; PyArrayObject *__pyx_v_axis = 0; PyArrayObject *__pyx_v_values = 0; double __pyx_v_period; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_interpolate (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__axis,&__pyx_n_s__values,&__pyx_n_s__period,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_interpolate", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_interpolate", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__period)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_interpolate", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_interpolate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_x = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_axis = ((PyArrayObject *)values[1]); __pyx_v_values = ((PyArrayObject *)values[2]); __pyx_v_period = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_period == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_interpolate", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("Scientific._interpolation._interpolate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_axis), __pyx_ptype_5numpy_ndarray, 1, "axis", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_10Scientific_14_interpolation__interpolate(__pyx_self, __pyx_v_x, __pyx_v_axis, __pyx_v_values, __pyx_v_period); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_interpolation.pyx":12 * double fmod(double x, double y) * * def _interpolate(double x, np.ndarray axis, np.ndarray values, double period): # <<<<<<<<<<<<<< * cdef double *axis_d, *values_d * cdef int axis_s, values_s */ static PyObject *__pyx_pf_10Scientific_14_interpolation__interpolate(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_x, PyArrayObject *__pyx_v_axis, PyArrayObject *__pyx_v_values, double __pyx_v_period) { double *__pyx_v_axis_d; double *__pyx_v_values_d; int __pyx_v_axis_s; int __pyx_v_values_s; int __pyx_v_npoints; int __pyx_v_i1; int __pyx_v_i2; int __pyx_v_i; double __pyx_v_w1; double __pyx_v_w2; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; size_t __pyx_t_4; PyObject *__pyx_t_5 = NULL; double __pyx_t_6; double __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_interpolate", 0); /* "Scientific/_interpolation.pyx":19 * cdef double w1, w2 * * assert axis.descr.type_num == np.NPY_DOUBLE \ # <<<<<<<<<<<<<< * and values.descr.type_num == np.NPY_DOUBLE * npoints = axis.shape[0] */ #ifndef CYTHON_WITHOUT_ASSERTIONS /* "Scientific/_interpolation.pyx":20 * * assert axis.descr.type_num == np.NPY_DOUBLE \ * and values.descr.type_num == np.NPY_DOUBLE # <<<<<<<<<<<<<< * npoints = axis.shape[0] * axis_s = axis.strides[0]/sizeof(double) */ __pyx_t_1 = ((__pyx_v_axis->descr->type_num == NPY_DOUBLE) != 0); if (__pyx_t_1) { __pyx_t_2 = ((__pyx_v_values->descr->type_num == NPY_DOUBLE) != 0); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (unlikely(!__pyx_t_3)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #endif /* "Scientific/_interpolation.pyx":21 * assert axis.descr.type_num == np.NPY_DOUBLE \ * and values.descr.type_num == np.NPY_DOUBLE * npoints = axis.shape[0] # <<<<<<<<<<<<<< * axis_s = axis.strides[0]/sizeof(double) * axis_d = axis.data */ __pyx_v_npoints = (__pyx_v_axis->dimensions[0]); /* "Scientific/_interpolation.pyx":22 * and values.descr.type_num == np.NPY_DOUBLE * npoints = axis.shape[0] * axis_s = axis.strides[0]/sizeof(double) # <<<<<<<<<<<<<< * axis_d = axis.data * values_s = values.strides[0]/sizeof(double) */ __pyx_t_4 = (sizeof(double)); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_axis_s = ((__pyx_v_axis->strides[0]) / __pyx_t_4); /* "Scientific/_interpolation.pyx":23 * npoints = axis.shape[0] * axis_s = axis.strides[0]/sizeof(double) * axis_d = axis.data # <<<<<<<<<<<<<< * values_s = values.strides[0]/sizeof(double) * values_d = values.data */ __pyx_v_axis_d = ((double *)__pyx_v_axis->data); /* "Scientific/_interpolation.pyx":24 * axis_s = axis.strides[0]/sizeof(double) * axis_d = axis.data * values_s = values.strides[0]/sizeof(double) # <<<<<<<<<<<<<< * values_d = values.data * */ __pyx_t_4 = (sizeof(double)); if (unlikely(__pyx_t_4 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_values_s = ((__pyx_v_values->strides[0]) / __pyx_t_4); /* "Scientific/_interpolation.pyx":25 * axis_d = axis.data * values_s = values.strides[0]/sizeof(double) * values_d = values.data # <<<<<<<<<<<<<< * * if period > 0.: # periodic */ __pyx_v_values_d = ((double *)__pyx_v_values->data); /* "Scientific/_interpolation.pyx":27 * values_d = values.data * * if period > 0.: # periodic # <<<<<<<<<<<<<< * x = axis_d[0] + fmod(x-axis_d[0], period) * else: */ __pyx_t_3 = ((__pyx_v_period > 0.) != 0); if (__pyx_t_3) { /* "Scientific/_interpolation.pyx":28 * * if period > 0.: # periodic * x = axis_d[0] + fmod(x-axis_d[0], period) # <<<<<<<<<<<<<< * else: * if x < axis_d[0]-1.e-9 or x > axis_d[(npoints-1)*axis_s]+1.e-9: */ __pyx_v_x = ((__pyx_v_axis_d[0]) + fmod((__pyx_v_x - (__pyx_v_axis_d[0])), __pyx_v_period)); goto __pyx_L3; } /*else*/ { /* "Scientific/_interpolation.pyx":30 * x = axis_d[0] + fmod(x-axis_d[0], period) * else: * if x < axis_d[0]-1.e-9 or x > axis_d[(npoints-1)*axis_s]+1.e-9: # <<<<<<<<<<<<<< * raise ValueError('Point outside grid of values') * i1 = 0 */ __pyx_t_3 = ((__pyx_v_x < ((__pyx_v_axis_d[0]) - 1.e-9)) != 0); if (!__pyx_t_3) { __pyx_t_1 = ((__pyx_v_x > ((__pyx_v_axis_d[((__pyx_v_npoints - 1) * __pyx_v_axis_s)]) + 1.e-9)) != 0); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "Scientific/_interpolation.pyx":31 * else: * if x < axis_d[0]-1.e-9 or x > axis_d[(npoints-1)*axis_s]+1.e-9: * raise ValueError('Point outside grid of values') # <<<<<<<<<<<<<< * i1 = 0 * i2 = npoints-1 */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; } __pyx_L3:; /* "Scientific/_interpolation.pyx":32 * if x < axis_d[0]-1.e-9 or x > axis_d[(npoints-1)*axis_s]+1.e-9: * raise ValueError('Point outside grid of values') * i1 = 0 # <<<<<<<<<<<<<< * i2 = npoints-1 * while i2-i1 > 1: */ __pyx_v_i1 = 0; /* "Scientific/_interpolation.pyx":33 * raise ValueError('Point outside grid of values') * i1 = 0 * i2 = npoints-1 # <<<<<<<<<<<<<< * while i2-i1 > 1: * i = (i1+i2)/2 */ __pyx_v_i2 = (__pyx_v_npoints - 1); /* "Scientific/_interpolation.pyx":34 * i1 = 0 * i2 = npoints-1 * while i2-i1 > 1: # <<<<<<<<<<<<<< * i = (i1+i2)/2 * if axis_d[i*axis_s] > x: */ while (1) { __pyx_t_2 = (((__pyx_v_i2 - __pyx_v_i1) > 1) != 0); if (!__pyx_t_2) break; /* "Scientific/_interpolation.pyx":35 * i2 = npoints-1 * while i2-i1 > 1: * i = (i1+i2)/2 # <<<<<<<<<<<<<< * if axis_d[i*axis_s] > x: * i2 = i */ __pyx_v_i = __Pyx_div_long((__pyx_v_i1 + __pyx_v_i2), 2); /* "Scientific/_interpolation.pyx":36 * while i2-i1 > 1: * i = (i1+i2)/2 * if axis_d[i*axis_s] > x: # <<<<<<<<<<<<<< * i2 = i * else: */ __pyx_t_2 = (((__pyx_v_axis_d[(__pyx_v_i * __pyx_v_axis_s)]) > __pyx_v_x) != 0); if (__pyx_t_2) { /* "Scientific/_interpolation.pyx":37 * i = (i1+i2)/2 * if axis_d[i*axis_s] > x: * i2 = i # <<<<<<<<<<<<<< * else: * i1 = i */ __pyx_v_i2 = __pyx_v_i; goto __pyx_L7; } /*else*/ { /* "Scientific/_interpolation.pyx":39 * i2 = i * else: * i1 = i # <<<<<<<<<<<<<< * if period > 0. and x > axis_d[i2*axis_s]: * i1 = npoints-1 */ __pyx_v_i1 = __pyx_v_i; } __pyx_L7:; } /* "Scientific/_interpolation.pyx":40 * else: * i1 = i * if period > 0. and x > axis_d[i2*axis_s]: # <<<<<<<<<<<<<< * i1 = npoints-1 * i2 = 0 */ __pyx_t_2 = ((__pyx_v_period > 0.) != 0); if (__pyx_t_2) { __pyx_t_3 = ((__pyx_v_x > (__pyx_v_axis_d[(__pyx_v_i2 * __pyx_v_axis_s)])) != 0); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "Scientific/_interpolation.pyx":41 * i1 = i * if period > 0. and x > axis_d[i2*axis_s]: * i1 = npoints-1 # <<<<<<<<<<<<<< * i2 = 0 * w2 = (x-axis_d[i1*axis_s])/(axis_d[i2*axis_s]+period-axis_d[i1*axis_s]) */ __pyx_v_i1 = (__pyx_v_npoints - 1); /* "Scientific/_interpolation.pyx":42 * if period > 0. and x > axis_d[i2*axis_s]: * i1 = npoints-1 * i2 = 0 # <<<<<<<<<<<<<< * w2 = (x-axis_d[i1*axis_s])/(axis_d[i2*axis_s]+period-axis_d[i1*axis_s]) * elif period > 0. and x < axis_d[i1*axis_s]: */ __pyx_v_i2 = 0; /* "Scientific/_interpolation.pyx":43 * i1 = npoints-1 * i2 = 0 * w2 = (x-axis_d[i1*axis_s])/(axis_d[i2*axis_s]+period-axis_d[i1*axis_s]) # <<<<<<<<<<<<<< * elif period > 0. and x < axis_d[i1*axis_s]: * i1 = npoints-1 */ __pyx_t_6 = (__pyx_v_x - (__pyx_v_axis_d[(__pyx_v_i1 * __pyx_v_axis_s)])); __pyx_t_7 = (((__pyx_v_axis_d[(__pyx_v_i2 * __pyx_v_axis_s)]) + __pyx_v_period) - (__pyx_v_axis_d[(__pyx_v_i1 * __pyx_v_axis_s)])); if (unlikely(__pyx_t_7 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_w2 = (__pyx_t_6 / __pyx_t_7); goto __pyx_L8; } /* "Scientific/_interpolation.pyx":44 * i2 = 0 * w2 = (x-axis_d[i1*axis_s])/(axis_d[i2*axis_s]+period-axis_d[i1*axis_s]) * elif period > 0. and x < axis_d[i1*axis_s]: # <<<<<<<<<<<<<< * i1 = npoints-1 * i2 = 0 */ __pyx_t_1 = ((__pyx_v_period > 0.) != 0); if (__pyx_t_1) { __pyx_t_2 = ((__pyx_v_x < (__pyx_v_axis_d[(__pyx_v_i1 * __pyx_v_axis_s)])) != 0); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "Scientific/_interpolation.pyx":45 * w2 = (x-axis_d[i1*axis_s])/(axis_d[i2*axis_s]+period-axis_d[i1*axis_s]) * elif period > 0. and x < axis_d[i1*axis_s]: * i1 = npoints-1 # <<<<<<<<<<<<<< * i2 = 0 * w2 = (x-axis_d[i1*axis_s]+period) \ */ __pyx_v_i1 = (__pyx_v_npoints - 1); /* "Scientific/_interpolation.pyx":46 * elif period > 0. and x < axis_d[i1*axis_s]: * i1 = npoints-1 * i2 = 0 # <<<<<<<<<<<<<< * w2 = (x-axis_d[i1*axis_s]+period) \ * / (axis_d[i2*axis_s]-axis_d[i1*axis_s]+period) */ __pyx_v_i2 = 0; /* "Scientific/_interpolation.pyx":47 * i1 = npoints-1 * i2 = 0 * w2 = (x-axis_d[i1*axis_s]+period) \ # <<<<<<<<<<<<<< * / (axis_d[i2*axis_s]-axis_d[i1*axis_s]+period) * else: */ __pyx_t_7 = ((__pyx_v_x - (__pyx_v_axis_d[(__pyx_v_i1 * __pyx_v_axis_s)])) + __pyx_v_period); /* "Scientific/_interpolation.pyx":48 * i2 = 0 * w2 = (x-axis_d[i1*axis_s]+period) \ * / (axis_d[i2*axis_s]-axis_d[i1*axis_s]+period) # <<<<<<<<<<<<<< * else: * w2 = (x-axis_d[i1*axis_s])/(axis_d[i2*axis_s]-axis_d[i1*axis_s]) */ __pyx_t_6 = (((__pyx_v_axis_d[(__pyx_v_i2 * __pyx_v_axis_s)]) - (__pyx_v_axis_d[(__pyx_v_i1 * __pyx_v_axis_s)])) + __pyx_v_period); if (unlikely(__pyx_t_6 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_w2 = (__pyx_t_7 / __pyx_t_6); goto __pyx_L8; } /*else*/ { /* "Scientific/_interpolation.pyx":50 * / (axis_d[i2*axis_s]-axis_d[i1*axis_s]+period) * else: * w2 = (x-axis_d[i1*axis_s])/(axis_d[i2*axis_s]-axis_d[i1*axis_s]) # <<<<<<<<<<<<<< * w1 = 1.-w2 * return w1*values_d[i1*values_s]+w2*values_d[i2*values_s] */ __pyx_t_6 = (__pyx_v_x - (__pyx_v_axis_d[(__pyx_v_i1 * __pyx_v_axis_s)])); __pyx_t_7 = ((__pyx_v_axis_d[(__pyx_v_i2 * __pyx_v_axis_s)]) - (__pyx_v_axis_d[(__pyx_v_i1 * __pyx_v_axis_s)])); if (unlikely(__pyx_t_7 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_w2 = (__pyx_t_6 / __pyx_t_7); } __pyx_L8:; /* "Scientific/_interpolation.pyx":51 * else: * w2 = (x-axis_d[i1*axis_s])/(axis_d[i2*axis_s]-axis_d[i1*axis_s]) * w1 = 1.-w2 # <<<<<<<<<<<<<< * return w1*values_d[i1*values_s]+w2*values_d[i2*values_s] */ __pyx_v_w1 = (1. - __pyx_v_w2); /* "Scientific/_interpolation.pyx":52 * w2 = (x-axis_d[i1*axis_s])/(axis_d[i2*axis_s]-axis_d[i1*axis_s]) * w1 = 1.-w2 * return w1*values_d[i1*values_s]+w2*values_d[i2*values_s] # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __pyx_t_5 = PyFloat_FromDouble(((__pyx_v_w1 * (__pyx_v_values_d[(__pyx_v_i1 * __pyx_v_values_s)])) + (__pyx_v_w2 * (__pyx_v_values_d[(__pyx_v_i2 * __pyx_v_values_s)])))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("Scientific._interpolation._interpolate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = ((__pyx_v_info == NULL) != 0); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L4; } /*else*/ { /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L4:; /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_1) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_3) { /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ __pyx_t_2 = (__pyx_v_copy_shape != 0); if (__pyx_t_2) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } goto __pyx_L7; } /*else*/ { /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } __pyx_L7:; /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); __Pyx_INCREF(__pyx_t_4); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_2) { __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L10; } /*else*/ { /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } __pyx_L10:; /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ __pyx_t_5 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0); if (__pyx_t_1) { __pyx_t_2 = (__pyx_v_little_endian != 0); } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0); if (__pyx_t_1) { __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ switch (__pyx_v_t) { /* "numpy.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ case NPY_BYTE: __pyx_v_f = __pyx_k__b; break; /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ case NPY_UBYTE: __pyx_v_f = __pyx_k__B; break; /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ case NPY_SHORT: __pyx_v_f = __pyx_k__h; break; /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ case NPY_USHORT: __pyx_v_f = __pyx_k__H; break; /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ case NPY_INT: __pyx_v_f = __pyx_k__i; break; /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ case NPY_UINT: __pyx_v_f = __pyx_k__I; break; /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ case NPY_LONG: __pyx_v_f = __pyx_k__l; break; /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ case NPY_ULONG: __pyx_v_f = __pyx_k__L; break; /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ case NPY_LONGLONG: __pyx_v_f = __pyx_k__q; break; /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ case NPY_ULONGLONG: __pyx_v_f = __pyx_k__Q; break; /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ case NPY_FLOAT: __pyx_v_f = __pyx_k__f; break; /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ case NPY_DOUBLE: __pyx_v_f = __pyx_k__d; break; /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ case NPY_LONGDOUBLE: __pyx_v_f = __pyx_k__g; break; /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ case NPY_CFLOAT: __pyx_v_f = __pyx_k__Zf; break; /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ case NPY_CDOUBLE: __pyx_v_f = __pyx_k__Zd; break; /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ case NPY_CLONGDOUBLE: __pyx_v_f = __pyx_k__Zg; break; /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ case NPY_OBJECT: __pyx_v_f = __pyx_k__O; break; default: /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = c'\0' # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = '\x00'; } __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":288 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L4; } __pyx_L4:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; long __pyx_t_11; char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } else if (1) { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else { Py_ssize_t index = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); if (__pyx_t_7) { __pyx_t_8 = (__pyx_v_little_endian != 0); } else { __pyx_t_8 = __pyx_t_7; } if (!__pyx_t_8) { /* "numpy.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); if (__pyx_t_7) { __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; } __pyx_t_7 = __pyx_t_10; } else { __pyx_t_7 = __pyx_t_8; } if (__pyx_t_7) { /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_7) break; /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_7) { /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (__pyx_t_7) { /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 98; goto __pyx_L13; } /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 66; goto __pyx_L13; } /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 104; goto __pyx_L13; } /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 72; goto __pyx_L13; } /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 105; goto __pyx_L13; } /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 73; goto __pyx_L13; } /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 108; goto __pyx_L13; } /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 76; goto __pyx_L13; } /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 113; goto __pyx_L13; } /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 81; goto __pyx_L13; } /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 102; goto __pyx_L13; } /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 100; goto __pyx_L13; } /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 103; goto __pyx_L13; } /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 79; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /*else*/ { /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_12; } __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif __Pyx_NAMESTR("_interpolation"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s___interpolate, __pyx_k___interpolate, sizeof(__pyx_k___interpolate), 0, 0, 1, 1}, {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, {&__pyx_n_s__axis_d, __pyx_k__axis_d, sizeof(__pyx_k__axis_d), 0, 0, 1, 1}, {&__pyx_n_s__axis_s, __pyx_k__axis_s, sizeof(__pyx_k__axis_s), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__i1, __pyx_k__i1, sizeof(__pyx_k__i1), 0, 0, 1, 1}, {&__pyx_n_s__i2, __pyx_k__i2, sizeof(__pyx_k__i2), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__npoints, __pyx_k__npoints, sizeof(__pyx_k__npoints), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__period, __pyx_k__period, sizeof(__pyx_k__period), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1}, {&__pyx_n_s__values_d, __pyx_k__values_d, sizeof(__pyx_k__values_d), 0, 0, 1, 1}, {&__pyx_n_s__values_s, __pyx_k__values_s, sizeof(__pyx_k__values_s), 0, 0, 1, 1}, {&__pyx_n_s__w1, __pyx_k__w1, sizeof(__pyx_k__w1), 0, 0, 1, 1}, {&__pyx_n_s__w2, __pyx_k__w2, sizeof(__pyx_k__w2), 0, 0, 1, 1}, {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "Scientific/_interpolation.pyx":31 * else: * if x < axis_d[0]-1.e-9 or x > axis_d[(npoints-1)*axis_s]+1.e-9: * raise ValueError('Point outside grid of values') # <<<<<<<<<<<<<< * i1 = 0 * i2 = npoints-1 */ __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_10)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_13)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); /* "Scientific/_interpolation.pyx":12 * double fmod(double x, double y) * * def _interpolate(double x, np.ndarray axis, np.ndarray values, double period): # <<<<<<<<<<<<<< * cdef double *axis_d, *values_d * cdef int axis_s, values_s */ __pyx_k_tuple_15 = PyTuple_Pack(14, ((PyObject *)__pyx_n_s__x), ((PyObject *)__pyx_n_s__axis), ((PyObject *)__pyx_n_s__values), ((PyObject *)__pyx_n_s__period), ((PyObject *)__pyx_n_s__axis_d), ((PyObject *)__pyx_n_s__values_d), ((PyObject *)__pyx_n_s__axis_s), ((PyObject *)__pyx_n_s__values_s), ((PyObject *)__pyx_n_s__npoints), ((PyObject *)__pyx_n_s__i1), ((PyObject *)__pyx_n_s__i2), ((PyObject *)__pyx_n_s__i), ((PyObject *)__pyx_n_s__w1), ((PyObject *)__pyx_n_s__w2)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_15); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); __pyx_k_codeobj_16 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s___interpolate, 12, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC init_interpolation(void); /*proto*/ PyMODINIT_FUNC init_interpolation(void) #else PyMODINIT_FUNC PyInit__interpolation(void); /*proto*/ PyMODINIT_FUNC PyInit__interpolation(void) #endif { PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__interpolation(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_interpolation"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_d); #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!PyDict_GetItemString(modules, "Scientific._interpolation")) { if (unlikely(PyDict_SetItemString(modules, "Scientific._interpolation", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if (__pyx_module_is_main_Scientific___interpolation) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "Scientific/_interpolation.pyx":6 * # * * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_interpolation.pyx":12 * double fmod(double x, double y) * * def _interpolate(double x, np.ndarray axis, np.ndarray values, double period): # <<<<<<<<<<<<<< * cdef double *axis_d, *values_d * cdef int axis_s, values_s */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10Scientific_14_interpolation_1_interpolate, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s___interpolate, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_interpolation.pyx":1 * # Implementation of function interpolation in Cython # <<<<<<<<<<<<<< * # * # Written by Konrad Hinsen */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { __Pyx_AddTraceback("init Scientific._interpolation", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init Scientific._interpolation"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%s' is not defined", PyString_AS_STRING(name)); #endif } return result; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_Restore(type, value, tb); #endif } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(type, value, tb); #endif } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } #if PY_VERSION_HEX < 0x02050000 if (PyClass_Check(type)) { #else if (PyType_Check(type)) { #endif #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyEval_CallObject(type, args); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } #if PY_VERSION_HEX >= 0x03030000 if (cause) { #else if (cause && cause != Py_None) { #endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: Py_XDECREF(owned_instance); return; } #endif static CYTHON_INLINE long __Pyx_div_long(long a, long b) { long q = a / b; long r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; /* try absolute import on failure */ } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = (start + end) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_globals = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); } static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { #if PY_VERSION_HEX < 0x03030000 char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ *length = PyBytes_GET_SIZE(defenc); return defenc_c; #else /* PY_VERSION_HEX < 0x03030000 */ if (PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_DATA_SIZE(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ return PyUnicode_AsUTF8AndSize(o, length); #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ #endif /* PY_VERSION_HEX < 0x03030000 */ } else #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (r < 0) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ ScientificPython-2.9.4/Scientific/_interpolation.pyx0000644000076600000240000000307012233733671023277 0ustar hinsenstaff00000000000000# Implementation of function interpolation in Cython # # Written by Konrad Hinsen # import numpy as np cimport numpy as np cdef extern from "math.h": double fmod(double x, double y) def _interpolate(double x, np.ndarray axis, np.ndarray values, double period): cdef double *axis_d, *values_d cdef int axis_s, values_s cdef int npoints cdef int i1, i2, i cdef double w1, w2 assert axis.descr.type_num == np.NPY_DOUBLE \ and values.descr.type_num == np.NPY_DOUBLE npoints = axis.shape[0] axis_s = axis.strides[0]/sizeof(double) axis_d = axis.data values_s = values.strides[0]/sizeof(double) values_d = values.data if period > 0.: # periodic x = axis_d[0] + fmod(x-axis_d[0], period) else: if x < axis_d[0]-1.e-9 or x > axis_d[(npoints-1)*axis_s]+1.e-9: raise ValueError('Point outside grid of values') i1 = 0 i2 = npoints-1 while i2-i1 > 1: i = (i1+i2)/2 if axis_d[i*axis_s] > x: i2 = i else: i1 = i if period > 0. and x > axis_d[i2*axis_s]: i1 = npoints-1 i2 = 0 w2 = (x-axis_d[i1*axis_s])/(axis_d[i2*axis_s]+period-axis_d[i1*axis_s]) elif period > 0. and x < axis_d[i1*axis_s]: i1 = npoints-1 i2 = 0 w2 = (x-axis_d[i1*axis_s]+period) \ / (axis_d[i2*axis_s]-axis_d[i1*axis_s]+period) else: w2 = (x-axis_d[i1*axis_s])/(axis_d[i2*axis_s]-axis_d[i1*axis_s]) w1 = 1.-w2 return w1*values_d[i1*values_s]+w2*values_d[i2*values_s] ScientificPython-2.9.4/Scientific/_netcdf.c0000644000076600000240000016121512233723033021252 0ustar hinsenstaff00000000000000/* * Objects representing netCDF files and variables. * * Written by Konrad Hinsen * last revision: 2011-6-2 */ #ifdef _WIN32 #define DLL_NETCDF #endif #include "Python.h" #if defined(NUMPY) #include "numpy/arrayobject.h" #else #if defined(NUMARRAY) #include "numarray/arrayobject.h" #else #include "Numeric/arrayobject.h" #endif #endif #include "netcdf.h" #define _NETCDF_MODULE #include "Scientific/netcdfmodule.h" staticforward int netcdf_file_init(PyNetCDFFileObject *self); staticforward PyNetCDFVariableObject * netcdf_variable_new(PyNetCDFFileObject *file, char *name, int id, int type, int ndims, int *dimids, int nattrs); /* Lock granting access to netCDF routines (netCDF isn't thread-safe) */ #ifdef WITH_THREAD #include "pythread.h" PyThread_type_lock netCDF_lock; #define acquire_netCDF_lock() { PyThread_acquire_lock(netCDF_lock, 1); } #define release_netCDF_lock() { PyThread_release_lock(netCDF_lock); } #else #define acquire_netCDF_lock() {} #define release_netCDF_lock() {} #endif /* Typedef for Numeric/NumPy compatibility */ #if !defined(NUMPY) typedef int npy_intp; #endif /* Set error string */ static void netcdf_seterror(void) { char *error; switch (ncerr) { case NC_NOERR: error = "No error"; break; case NC_EBADID: error = "Not a netCDF id"; break; case NC_ENFILE: error = "Too many netCDF files open"; break; case NC_EEXIST: error = "netCDF file exists && NC_NOCLOBBER"; break; case NC_EINVAL: error = "Invalid argument"; break; case NC_EPERM: error = "Write to read only"; break; case NC_ENOTINDEFINE: error = "Operation not allowed in data mode"; break; case NC_EINDEFINE: error = "Operation not allowed in define mode"; break; case NC_EINVALCOORDS: error = "Index exceeds dimension bound"; break; case NC_EMAXDIMS: error = "NC_MAX_DIMS exceeded"; break; case NC_ENAMEINUSE: error = "String match to name in use"; break; case NC_ENOTATT: error = "Attribute not found"; break; case NC_EMAXATTS: error = "NC_MAX_ATTRS exceeded"; break; case NC_EBADTYPE: error = "Not a netCDF data type or _FillValue type mismatch"; break; case NC_EBADDIM: error = "Invalid dimension id or name"; break; case NC_EUNLIMPOS: error = "NC_UNLIMITED in the wrong index"; break; case NC_EMAXVARS: error = "NC_MAX_VARS exceeded"; break; case NC_ENOTVAR: error = "Variable not found"; break; case NC_EGLOBAL: error = "Action prohibited on NC_GLOBAL varid"; break; case NC_ENOTNC: error = "Not a netCDF file"; break; case NC_ESTS: error = "In Fortran, string too short"; break; case NC_EMAXNAME: error = "NC_MAX_NAME exceeded"; break; case NC_EUNLIMIT: error = "NC_UNLIMITED size already in use"; break; case NC_ENORECVARS: error = "nc_rec op when there are no record vars"; break; case NC_ECHAR: error = "Attempt to convert between text & numbers"; break; case NC_EEDGE: error = "Edge+start exceeds dimension bound"; break; case NC_ESTRIDE: error = "Illegal stride"; break; case NC_EBADNAME: error = "Attribute or variable name contains illegal characters"; break; case NC_ERANGE: error = "Numeric conversion not representable"; break; case NC_ENOMEM: error = "Memory allocation (malloc) failure"; break; case NC_EXDR: error = "XDR error"; break; default: error = "Unknown error"; break; } PyErr_SetString(PyExc_IOError, error); } static void netcdf_signalerror(int code) { static char buffer[200]; if (code != NC_NOERR) { Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); sprintf(buffer, "netcdf: %s", nc_strerror(code)); release_netCDF_lock(); Py_END_ALLOW_THREADS; PyErr_SetString(PyExc_IOError, buffer); } } /* * Python equivalents to netCDF data types * * Caution: the following specification may not be fully portable. * The comments indicate the correct netCDF specification. The assignment * of Python types assumes that 'short' is 16-bit and 'int' is 32-bit. */ int data_types[] = {-1, /* not used */ #if defined(NUMPY) PyArray_BYTE, /* signed 8-bit int */ #else PyArray_SBYTE, /* signed 8-bit int */ #endif PyArray_CHAR, /* 8-bit character */ PyArray_SHORT, /* 16-bit signed int */ PyArray_INT, /* 32-bit signed int */ PyArray_FLOAT, /* 32-bit IEEE float */ PyArray_DOUBLE /* 64-bit IEEE float */ }; /* Generic data type functions, similar to those in the netCDF 2 interface. */ static int nc_put_att_any(int ncid, int varid, const char *name, nc_type xtype, size_t len, const void *data) { switch (xtype) { case NC_BYTE: return nc_put_att_uchar(ncid, varid, name, xtype, len, (unsigned char *)data); break; case NC_CHAR: return nc_put_att_text(ncid, varid, name, len, (char *)data); break; case NC_SHORT: return nc_put_att_short(ncid, varid, name, xtype, len, (short *)data); break; case NC_INT: return nc_put_att_int(ncid, varid, name, xtype, len, (int *)data); break; case NC_FLOAT: return nc_put_att_float(ncid, varid, name, xtype, len, (float *)data); break; case NC_DOUBLE: return nc_put_att_double(ncid, varid, name, xtype, len, (double *)data); break; default: return NC_EINVAL; } } static int nc_put_var1_any(int ncid, int varid, nc_type xtype, const size_t *indexp, const void *data) { switch (xtype) { case NC_BYTE: return nc_put_var1_uchar(ncid, varid, indexp, (unsigned char *)data); break; case NC_CHAR: return nc_put_var1_text(ncid, varid, indexp, (char *)data); break; case NC_SHORT: return nc_put_var1_short(ncid, varid, indexp, (short *)data); break; case NC_INT: return nc_put_var1_int(ncid, varid, indexp, (int *)data); break; case NC_FLOAT: return nc_put_var1_float(ncid, varid, indexp, (float *)data); break; case NC_DOUBLE: return nc_put_var1_double(ncid, varid, indexp, (double *)data); break; default: return NC_EINVAL; } } static int nc_put_vars_any(int ncid, int varid, nc_type xtype, const size_t start[], const size_t count[], const ptrdiff_t stride[], const void *data) { switch (xtype) { case NC_BYTE: return nc_put_vars_uchar(ncid, varid, start, count, stride, (unsigned char *)data); break; case NC_CHAR: return nc_put_vars_text(ncid, varid, start, count, stride, (char *)data); break; case NC_SHORT: return nc_put_vars_short(ncid, varid, start, count, stride, (short *)data); break; break; case NC_INT: return nc_put_vars_int(ncid, varid, start, count, stride, (int *)data); break; break; case NC_FLOAT: return nc_put_vars_float(ncid, varid, start, count, stride, (float *)data); break; break; case NC_DOUBLE: return nc_put_vars_double(ncid, varid, start, count, stride, (double *)data); break; default: return NC_EINVAL; } } /* Utility functions */ static void define_mode(PyNetCDFFileObject *file, int define_flag) { if (file->define != define_flag) { Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); if (file->define) nc_enddef(file->id); else nc_redef(file->id); release_netCDF_lock(); file->define = define_flag; Py_END_ALLOW_THREADS; } } static char typecode(int type) { char t; switch(type) { #if defined(NUMPY) case PyArray_STRING: case PyArray_CHAR: t = PyArray_CHARLTR; break; case PyArray_BYTE: t = PyArray_BYTELTR; break; case PyArray_SHORT: t = PyArray_SHORTLTR; break; case PyArray_INT: t = PyArray_INTLTR; break; case PyArray_LONG: t = PyArray_LONGLTR; break; case PyArray_FLOAT: t = PyArray_FLOATLTR; break; case PyArray_DOUBLE: t = PyArray_DOUBLELTR; break; #else case PyArray_UBYTE: t = 'b'; break; case PyArray_SBYTE: t = '1'; break; case PyArray_CHAR: t = 'c'; break; case PyArray_SHORT: t = 's'; break; case PyArray_LONG: t = 'l'; break; case PyArray_INT: t = 'i'; break; case PyArray_FLOAT: t = 'f'; break; case PyArray_DOUBLE: t = 'd'; break; #endif default: t = ' '; } return t; } static nc_type netcdf_type_from_code(char code) { int type; switch(code) { case 'c': case 'S': type = NC_CHAR; break; case 'b': case 'B': case '1': type = NC_BYTE; break; case 's': case 'h': type = NC_SHORT; break; case 'i': case 'l': type = NC_INT; break; case 'f': type = NC_FLOAT; break; case 'd': type = NC_DOUBLE; break; default: type = 0; } return type; } static int netcdf_type_from_type(char array_type) { int type; switch(array_type) { #if !defined(NUMARRAY) case PyArray_CHAR: #if defined(NUMPY) case PyArray_STRING: #endif type = NC_CHAR; break; #endif case PyArray_UBYTE: #if defined(NUMPY) case PyArray_BYTE: #else case PyArray_SBYTE: #endif type = NC_BYTE; break; case PyArray_SHORT: type = NC_SHORT; break; #if !defined(NUMARRAY) case PyArray_INT: #endif case PyArray_LONG: type = NC_INT; break; case PyArray_FLOAT: type = NC_FLOAT; break; case PyArray_DOUBLE: type = NC_DOUBLE; break; default: type = 0; } return type; } static void collect_attributes(int fileid, int varid, PyObject *attributes, int nattrs) { char name[MAX_NC_NAME]; nc_type type; size_t length; npy_intp lengthp; int py_type; int i; for (i = 0; i < nattrs; i++) { Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); nc_inq_attname(fileid, varid, i, name); nc_inq_att(fileid, varid, name, &type, &length); lengthp = length; release_netCDF_lock(); Py_END_ALLOW_THREADS; py_type = data_types[type]; if (py_type == PyArray_CHAR) { char *s = (char *)malloc((length+1)*sizeof(char)); if (s != NULL) { PyObject *string; *s = '\0'; Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); nc_get_att_text(fileid, varid, name, s); release_netCDF_lock(); Py_END_ALLOW_THREADS; s[length] = '\0'; string = PyString_FromString(s); free(s); if (string != NULL) { PyDict_SetItemString(attributes, name, string); Py_DECREF(string); } } } else { #if defined(NUMPY) PyObject *array = PyArray_SimpleNew(1, &lengthp, py_type); #else PyObject *array = PyArray_FromDims(1, &lengthp, py_type); #endif if (array != NULL) { Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ncattget(fileid, varid, name, ((PyArrayObject *)array)->data); release_netCDF_lock(); Py_END_ALLOW_THREADS; array = PyArray_Return((PyArrayObject *)array); if (array != NULL) { PyDict_SetItemString(attributes, name, array); Py_DECREF(array); } } } } } static int set_attribute(int fileid, int varid, PyObject *attributes, char *name, PyObject *value) { if (value == NULL) { int ret; Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_del_att(fileid, varid, name); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret != NC_NOERR) { netcdf_signalerror(ret); return -1; } PyDict_DelItemString(attributes, name); return 0; } else if (PyString_Check(value)) { Py_ssize_t len = PyString_Size(value); char *string = PyString_AsString(value); int ret; Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_put_att_text(fileid, varid, name, (size_t)len, string); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret != NC_NOERR) { netcdf_signalerror(ret); return -1; } PyDict_SetItemString(attributes, name, value); return 0; } else { int ret; PyArrayObject *array = (PyArrayObject *)PyArray_ContiguousFromObject(value, PyArray_NOTYPE, 0, 1); if (array != NULL) { int len = (array->nd == 0) ? 1 : array->dimensions[0]; int type = netcdf_type_from_code(array->descr->type); if (data_types[type] != array->descr->type_num) { PyArrayObject *array2 = (PyArrayObject *) PyArray_Cast(array, data_types[type]); Py_DECREF(array); array = array2; if (array == NULL) return -1; } Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_put_att_any(fileid, varid, name, type, len, array->data); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret != NC_NOERR) { netcdf_signalerror(ret); return -1; } PyDict_SetItemString(attributes, name, (PyObject *)array); return 0; } else return -1; } } static int check_if_open(PyNetCDFFileObject *file, int mode) { /* mode: -1 read, 1 write, 0 other */ if (file == NULL || !file->open) { PyErr_SetString(PyExc_IOError, "netcdf: file has been closed"); return 0; } else { if (mode != 1 || file->write) { return 1; } else { PyErr_SetString(PyExc_IOError, "netcdf: write access to read-only file"); return 0; } } } /* * NetCDFFile object * (type declaration in netcdfmodule.h) */ /* Destroy file object */ static void PyNetCDFFileObject_dealloc(PyNetCDFFileObject *self) { if (self->open) PyNetCDFFile_Close(self); Py_XDECREF(self->dimensions); Py_XDECREF(self->variables); Py_XDECREF(self->attributes); Py_XDECREF(self->name); Py_XDECREF(self->mode); self->ob_type->tp_free((PyObject*)self); } /* Create file object */ static PyObject * PyNetCDFFileObject_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PyNetCDFFileObject *self; self = (PyNetCDFFileObject *)type->tp_alloc(type, 0); if (self != NULL) { self->dimensions = NULL; self->variables = NULL; self->attributes = NULL; self->name = NULL; self->mode = NULL; } return (PyObject *)self; } /* Open file */ static int open_netcdf_file(PyNetCDFFileObject *self, char *filename, char *mode) { int rw, modef, ret; rw = modef = ret = 0; if (strlen(mode) > 1) { if (mode[1] == '+') rw = 1; else if (mode[1] == 's') modef |= NC_SHARE; #ifdef NC_64BIT_OFFSET else if (mode[1] == 'l') modef |= NC_64BIT_OFFSET; #endif #ifdef NC_NETCDF4 else if (mode[1] == '4') modef |= NC_NETCDF4; #endif else ret = -1; } if (strlen(mode) > 2) { if (mode[2] == '+') rw = 1; else if (mode[2] == 's') modef |= NC_SHARE; #ifdef NC_64BIT_OFFSET else if (mode[2] == 'l') modef |= NC_64BIT_OFFSET; #endif #ifdef NC_NETCDF4 else if (mode[2] == '4') modef |= NC_NETCDF4; #endif else ret = -1; } if (ret == -1 || strlen(mode) > 3 || (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a')) { PyErr_SetString(PyExc_IOError, "netcdf: illegal mode specification"); return -1; } self->open = 0; if (mode[0] == 'w') { Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_create(filename, modef|NC_CLOBBER, &self->id); release_netCDF_lock(); Py_END_ALLOW_THREADS; self->define = 1; self->write = 1; if (ret == NC_NOERR) { self->open = 1; netcdf_file_init(self); } } else if (mode[0] == 'a') { Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_open(filename, modef|NC_WRITE, &self->id); self->define = 0; if (ret == ENOENT) { ret = nc_create(filename, modef|NC_NOCLOBBER, &self->id); self->define = 1; } release_netCDF_lock(); Py_END_ALLOW_THREADS; self->write = 1; if (ret == NC_NOERR) { self->open = 1; netcdf_file_init(self); } } else if (mode[0] == 'r') { Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_open(filename, rw ? (modef|NC_WRITE) : (modef|NC_NOWRITE), &self->id); release_netCDF_lock(); Py_END_ALLOW_THREADS; self->define = 0; self->write = rw; if (ret == NC_NOERR) { self->open = 1; netcdf_file_init(self); } } else { return -1; } if (ret != NC_NOERR) { netcdf_signalerror(ret); return -1; } self->name = PyString_FromString(filename); self->mode = PyString_FromString(mode); return 0; } static int PyNetCDFFileObject_init(PyNetCDFFileObject *self, PyObject *args, PyObject *kwds) { char *filename; char *mode = NULL; char *history = NULL; if (!PyArg_ParseTuple(args, "s|ss:NetCDFFile", &filename, &mode, &history)) return -1; if (mode == NULL) mode = "r"; if (open_netcdf_file(self, filename, mode) < 0) { return -1; } if (history != NULL) PyNetCDFFile_AddHistoryLine(self, history); return 0; } static PyNetCDFFileObject * PyNetCDFFile_Open(char *filename, char *mode) { PyNetCDFFileObject *self = (PyNetCDFFileObject *) PyNetCDFFileObject_new(&PyNetCDFFile_Type, NULL, NULL); if (self == NULL) return NULL; if (open_netcdf_file(self, filename, mode) < 0) { PyNetCDFFileObject_dealloc(self); return NULL; } return self; } /* Create variables from file */ static int netcdf_file_init(PyNetCDFFileObject *self) { int ndims, nvars, ngattrs, recdim; int i; self->dimensions = PyDict_New(); self->variables = PyDict_New(); self->attributes = PyDict_New(); Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); nc_inq(self->id, &ndims, &nvars, &ngattrs, &recdim); release_netCDF_lock(); Py_END_ALLOW_THREADS; self->recdim = recdim; for (i = 0; i < ndims; i++) { char name[MAX_NC_NAME]; size_t size; PyObject *size_ob; Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); nc_inq_dim(self->id, i, name, &size); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (i == recdim) PyDict_SetItemString(self->dimensions, name, Py_None); else { size_ob = PyInt_FromLong(size); PyDict_SetItemString(self->dimensions, name, size_ob); Py_DECREF(size_ob); } } for (i = 0; i < nvars; i++) { char name[MAX_NC_NAME]; nc_type datatype; int ndimensions, nattrs; int *dimids; PyNetCDFVariableObject *variable; Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); nc_inq_varname(self->id, i, name); nc_inq_vartype(self->id, i, &datatype); nc_inq_varndims(self->id, i, &ndimensions); nc_inq_varnatts(self->id, i, &nattrs); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ndimensions > 0) { dimids = (int *)malloc(ndimensions*sizeof(int)); if (dimids == NULL) { PyErr_NoMemory(); return 0; } Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); nc_inq_vardimid(self->id, i, dimids); release_netCDF_lock(); Py_END_ALLOW_THREADS; } else dimids = NULL; variable = netcdf_variable_new(self, name, i, data_types[datatype], ndimensions, dimids, nattrs); if (variable != NULL) { PyDict_SetItemString(self->variables, name, (PyObject *)variable); Py_DECREF(variable); } else free(dimids); } collect_attributes(self->id, NC_GLOBAL, self->attributes, ngattrs); return 1; } /* Create dimension */ static int PyNetCDFFile_CreateDimension(PyNetCDFFileObject *file, char *name, long size) { PyObject *size_ob; int id, ret; if (check_if_open(file, 1)) { if (size == 0 && file->recdim != -1) { PyErr_SetString(PyExc_IOError, "netcdf: there is already an unlimited dimension"); return -1; } define_mode(file, 1); Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_def_dim(file->id, name, (size == 0) ? NC_UNLIMITED : size, &id); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret != NC_NOERR) { netcdf_signalerror(ret); return -1; } else { if (size == 0) { PyDict_SetItemString(file->dimensions, name, Py_None); file->recdim = id; } else { size_ob = PyInt_FromLong(size); PyDict_SetItemString(file->dimensions, name, size_ob); Py_DECREF(size_ob); } return 0; } } else return -1; } static PyObject * PyNetCDFFileObject_new_dimension(PyNetCDFFileObject *self, PyObject *args) { char *name; PyObject *size_ob; long size; if (!PyArg_ParseTuple(args, "sO", &name, &size_ob)) return NULL; if (size_ob == Py_None) size = 0; else if (PyInt_Check(size_ob)) size = PyInt_AsLong(size_ob); else { PyErr_SetString(PyExc_TypeError, "size must be None or integer"); return NULL; } if (PyNetCDFFile_CreateDimension(self, name, size) == 0) { Py_INCREF(Py_None); return Py_None; } else return NULL; } static char createDimension_doc[] = ""; /* Create variable */ static PyNetCDFVariableObject * PyNetCDFFile_CreateVariable(PyNetCDFFileObject *file, char *name, int typecode, char **dimension_names, int ndim) { int *dimids; PyNetCDFVariableObject *variable; int ntype, i, ret; if (check_if_open(file, 1)) { define_mode(file, 1); if (ndim == 0) dimids = NULL; else { dimids = (int *)malloc(ndim*sizeof(int)); if (dimids == NULL) return (PyNetCDFVariableObject *)PyErr_NoMemory(); } for (i = 0; i < ndim; i++) { Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); dimids[i] = ncdimid(file->id, dimension_names[i]); ret = nc_inq_dimid(file->id, dimension_names[i], dimids+i); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret != NC_NOERR) { netcdf_signalerror(ret); free(dimids); return NULL; } if (dimids[i] == file->recdim && i > 0) { PyErr_SetString(PyExc_IOError, "netcdf: unlimited dimension must be first"); free(dimids); return NULL; } } ntype = netcdf_type_from_code((char)typecode); Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_def_var(file->id, name, ntype, ndim, dimids, &i); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret != NC_NOERR) { netcdf_signalerror(ret); if (dimids != NULL) free(dimids); return NULL; } variable = netcdf_variable_new(file, name, i, data_types[ntype], ndim, dimids, 0); if (variable != NULL) { PyDict_SetItemString(file->variables, name, (PyObject *)variable); return variable; } else { free(dimids); return NULL; } } else return NULL; } static PyObject * PyNetCDFFileObject_new_variable(PyNetCDFFileObject *self, PyObject *args) { PyNetCDFVariableObject *var; char **dimension_names; PyObject *item, *dim; char *name; Py_ssize_t len_dim; int ndim; char type; int i; if (!PyArg_ParseTuple(args, "scO!", &name, &type, &PyTuple_Type, &dim)) return NULL; len_dim = PyTuple_Size(dim); if (len_dim > INT_MAX) { PyErr_SetString(PyExc_ValueError, "too many dimensions"); return NULL; } ndim = (int)len_dim; if (ndim == 0) dimension_names = NULL; else { dimension_names = (char **)malloc(ndim*sizeof(char *)); if (dimension_names == NULL) { PyErr_SetString(PyExc_MemoryError, "out of memory"); return NULL; } } for (i = 0; i < ndim; i++) { item = PyTuple_GetItem(dim, (Py_ssize_t)i); if (PyString_Check(item)) dimension_names[i] = PyString_AsString(item); else { PyErr_SetString(PyExc_TypeError, "dimension name must be a string"); free(dimension_names); return NULL; } } var = PyNetCDFFile_CreateVariable(self, name, type, dimension_names, ndim); free(dimension_names); return (PyObject *)var; } static char createVariable_doc[] = ""; /* Return a variable object referring to an existing variable */ static PyNetCDFVariableObject * PyNetCDFFile_GetVariable(PyNetCDFFileObject *file, char *name) { return (PyNetCDFVariableObject *)PyDict_GetItemString(file->variables, name); } /* Synchronize output */ static int PyNetCDFFile_Sync(PyNetCDFFileObject *file) { int ret; if (check_if_open(file, 0)) { define_mode(file, 0); Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_sync(file->id); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret == -1) { netcdf_seterror(); return -1; } else return 0; } else return -1; } static PyObject * PyNetCDFFileObject_sync(PyNetCDFFileObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; if (PyNetCDFFile_Sync(self) == 0) { Py_INCREF(Py_None); return Py_None; } else return NULL; } static char sync_doc[] = ""; static char flush_doc[] = "ensures that all modified data is written to the file"; /* Close file */ static int PyNetCDFFile_Close(PyNetCDFFileObject *file) { PyObject *name; PyNetCDFVariableObject *variable; int ret; Py_ssize_t pos; if (!check_if_open(file, 0)) return -1; Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_close(file->id); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret != NC_NOERR) { netcdf_signalerror(ret); ret = -1; } else ret = 0; file->open = 0; pos = 0; while (PyDict_Next(file->variables, &pos, &name, (PyObject **)&variable)) { Py_DECREF(variable->file); variable->file = NULL; } return ret; } static PyObject * PyNetCDFFileObject_close(PyNetCDFFileObject *self, PyObject *args) { char *history = NULL; if (!PyArg_ParseTuple(args, "|s", &history)) return NULL; if (history != NULL) PyNetCDFFile_AddHistoryLine(self, history); if (PyNetCDFFile_Close(self) == 0) { Py_INCREF(Py_None); return Py_None; } else return NULL; } static char close_doc[] = ""; /* Method table */ static PyMethodDef PyNetCDFFileObject_methods[] = { {"close", (PyCFunction)PyNetCDFFileObject_close, 1, close_doc}, {"createDimension", (PyCFunction)PyNetCDFFileObject_new_dimension, 1, createDimension_doc}, {"createVariable", (PyCFunction)PyNetCDFFileObject_new_variable, 1, createVariable_doc}, {"sync", (PyCFunction)PyNetCDFFileObject_sync, 1, sync_doc}, {"flush", (PyCFunction)PyNetCDFFileObject_sync, 1, flush_doc}, {NULL, NULL} /* sentinel */ }; /* Attribute access */ static PyObject * PyNetCDFFile_GetAttribute(PyNetCDFFileObject *self, char *name) { PyObject *value; if (check_if_open(self, -1)) { if (strcmp(name, "dimensions") == 0) { Py_INCREF(self->dimensions); return self->dimensions; } if (strcmp(name, "variables") == 0) { Py_INCREF(self->variables); return self->variables; } if (strcmp(name, "__dict__") == 0) { Py_INCREF(self->attributes); return self->attributes; } value = PyDict_GetItemString(self->attributes, name); if (value != NULL) { Py_INCREF(value); return value; } else { PyErr_Clear(); return Py_FindMethod(PyNetCDFFileObject_methods, (PyObject *)self, name); } } else return NULL; } static int PyNetCDFFile_SetAttribute(PyNetCDFFileObject *self, char *name, PyObject *value) { if (check_if_open(self, 1)) { if (strcmp(name, "dimensions") == 0 || strcmp(name, "variables") == 0 || strcmp(name, "__dict__") == 0) { PyErr_SetString(PyExc_TypeError, "object has read-only attributes"); return -1; } define_mode(self, 1); return set_attribute(self->id, NC_GLOBAL, self->attributes, name, value); } else return -1; } static int PyNetCDFFile_SetAttributeString(PyNetCDFFileObject *self, char *name, char *value) { PyObject *string = PyString_FromString(value); if (string != NULL) return PyNetCDFFile_SetAttribute(self, name, string); else return -1; } static int PyNetCDFFile_AddHistoryLine(PyNetCDFFileObject *self, char *text) { static char *history = "history"; Py_ssize_t alloc, old, new, new_alloc; PyStringObject *new_string; PyObject *h = PyNetCDFFile_GetAttribute(self, history); if (h == NULL) { PyErr_Clear(); alloc = 0; old = 0; new = strlen(text); } else { alloc = PyString_Size(h); old = strlen(PyString_AsString(h)); new = old + strlen(text) + 1; } new_alloc = (new <= alloc) ? alloc : new + 500; new_string = (PyStringObject *)PyString_FromStringAndSize(NULL, new_alloc); if (new_string) { char *s = new_string->ob_sval; int len, ret; memset(s, 0, new_alloc+1); if (h == NULL) len = -1; else { strcpy(s, PyString_AsString(h)); len = strlen(s); s[len] = '\n'; } strcpy(s+len+1, text); ret = PyNetCDFFile_SetAttribute(self, history, (PyObject *)new_string); Py_XDECREF(h); Py_DECREF(new_string); return ret; } else return -1; } /* Printed representation */ static PyObject * PyNetCDFFileObject_repr(PyNetCDFFileObject *file) { char buf[300]; sprintf(buf, "<%s netCDF file '%.256s', mode '%.10s' at %lx>", file->open ? "open" : "closed", PyString_AsString(file->name), PyString_AsString(file->mode), (long)file); return PyString_FromString(buf); } /* Type definition */ statichere PyTypeObject PyNetCDFFile_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "NetCDFFile", /*tp_name*/ sizeof(PyNetCDFFileObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ (destructor)PyNetCDFFileObject_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)PyNetCDFFile_GetAttribute, /*tp_getattr*/ (setattrfunc)PyNetCDFFile_SetAttribute, /*tp_setattr*/ 0, /*tp_compare*/ (reprfunc)PyNetCDFFileObject_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ "NetCDFFile(filename, mode, history_line)\n\nopens a netCDF file\n", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ PyNetCDFFileObject_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)PyNetCDFFileObject_init, /* tp_init */ 0, /* tp_alloc */ PyNetCDFFileObject_new, /* tp_new */ }; /* * NetCDFVariable object * (type declaration in netcdfmodule.h) */ /* Destroy variable object */ static void PyNetCDFVariableObject_dealloc(PyNetCDFVariableObject *self) { if (self->dimids != NULL) free(self->dimids); if (self->dimensions != NULL) free(self->dimensions); if (self->name != NULL) free(self->name); Py_XDECREF(self->file); Py_XDECREF(self->attributes); self->ob_type->tp_free((PyObject*)self); } /* Create variable object */ static PyNetCDFVariableObject * netcdf_variable_new(PyNetCDFFileObject *file, char *name, int id, int type, int ndims, int *dimids, int nattrs) { PyNetCDFVariableObject *self; int recdim; int i; if (check_if_open(file, -1)) { self = PyObject_New(PyNetCDFVariableObject, &PyNetCDFVariable_Type); if (self == NULL) return NULL; self->file = file; Py_INCREF(file); self->id = id; self->type = type; self->nd = ndims; self->dimids = dimids; self->unlimited = 0; Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); nc_inq_unlimdim(file->id, &recdim); self->dimensions = (size_t *)malloc(ndims*sizeof(size_t)); if (self->dimensions != NULL) { for (i = 0; i < ndims; i++) nc_inq_dimlen(file->id, dimids[i], &self->dimensions[i]); if (ndims > 0 && self->dimids[0] == self->file->recdim) self->unlimited = 1; } release_netCDF_lock(); Py_END_ALLOW_THREADS; self->name = (char *)malloc(strlen(name)+1); if (self->name != NULL) strcpy(self->name, name); self->attributes = PyDict_New(); collect_attributes(file->id, self->id, self->attributes, nattrs); return self; } else return NULL; } /* Return value */ static PyObject * PyNetCDFVariableObject_value(PyNetCDFVariableObject *self, PyObject *args) { PyNetCDFIndex *indices; if (!PyArg_ParseTuple(args, "")) return NULL; if (self->nd == 0) indices = NULL; else indices = PyNetCDFVariable_Indices(self); return PyArray_Return(PyNetCDFVariable_ReadAsArray(self, indices)); } /* Assign value */ static PyObject * PyNetCDFVariableObject_assign(PyNetCDFVariableObject *self, PyObject *args) { PyObject *value; PyNetCDFIndex *indices; if (!PyArg_ParseTuple(args, "O", &value)) return NULL; if (self->nd == 0) indices = NULL; else indices = PyNetCDFVariable_Indices(self); if (PyNetCDFVariable_WriteArray(self, indices, value) < 0) return NULL; Py_INCREF(Py_None); return Py_None; } /* Return typecode */ static PyObject * PyNetCDFVariableObject_typecode(PyNetCDFVariableObject *self, PyObject *args) { char t; if (!PyArg_ParseTuple(args, "")) return NULL; t = typecode(self->type); return PyString_FromStringAndSize(&t, (Py_ssize_t)1); } /* Method table */ static PyMethodDef PyNetCDFVariableObject_methods[] = { {"assignValue", (PyCFunction)PyNetCDFVariableObject_assign, 1}, {"getValue", (PyCFunction)PyNetCDFVariableObject_value, 1}, {"typecode", (PyCFunction)PyNetCDFVariableObject_typecode, 1}, {NULL, NULL} /* sentinel */ }; /* Attribute access */ static int PyNetCDFVariable_GetRank(PyNetCDFVariableObject *var) { return var->nd; } static size_t * PyNetCDFVariable_GetShape(PyNetCDFVariableObject *var) { int i; if (check_if_open(var->file, -1)) { Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); for (i = 0; i < var->nd; i++) nc_inq_dimlen(var->file->id, var->dimids[i], &var->dimensions[i]); release_netCDF_lock(); Py_END_ALLOW_THREADS; return var->dimensions; } else return NULL; } static PyObject * PyNetCDFVariable_GetAttribute(PyNetCDFVariableObject *self, char *name) { PyObject *value; if (strcmp(name, "shape") == 0) { PyObject *tuple; int i; if (check_if_open(self->file, -1)) { PyNetCDFVariable_GetShape(self); tuple = PyTuple_New((Py_ssize_t)self->nd); for (i = 0; i < self->nd; i++) PyTuple_SetItem(tuple, (Py_ssize_t)i, PyInt_FromLong(self->dimensions[i])); return tuple; } else return NULL; } if (strcmp(name, "dimensions") == 0) { PyObject *tuple; char name[MAX_NC_NAME]; int i; if (check_if_open(self->file, -1)) { tuple = PyTuple_New((Py_ssize_t)self->nd); for (i = 0; i < self->nd; i++) { Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); nc_inq_dimname(self->file->id, self->dimids[i], name); release_netCDF_lock(); Py_END_ALLOW_THREADS; PyTuple_SetItem(tuple, (Py_ssize_t)i, PyString_FromString(name)); } return tuple; } else return NULL; } if (strcmp(name, "__dict__") == 0) { Py_INCREF(self->attributes); return self->attributes; } value = PyDict_GetItemString(self->attributes, name); if (value != NULL) { Py_INCREF(value); return value; } else { PyErr_Clear(); return Py_FindMethod(PyNetCDFVariableObject_methods, (PyObject *)self,name); } } static int PyNetCDFVariable_SetAttribute(PyNetCDFVariableObject *self, char *name, PyObject *value) { if (check_if_open(self->file, 1)) { if (strcmp(name, "shape") == 0 || strcmp(name, "dimensions") == 0 || strcmp(name, "__dict__") == 0) { PyErr_SetString(PyExc_TypeError, "object has read-only attributes"); return -1; } define_mode(self->file, 1); return set_attribute(self->file->id, self->id, self->attributes, name, value); } else return -1; } static int PyNetCDFVariable_SetAttributeString(PyNetCDFVariableObject *self, char *name, char *value) { PyObject *string = PyString_FromString(value); if (string != NULL) return PyNetCDFVariable_SetAttribute(self, name, string); else return -1; } /* Subscripting */ static Py_ssize_t PyNetCDFVariableObject_length(PyNetCDFVariableObject *self) { if (self->nd > 0) return (Py_ssize_t)self->dimensions[0]; else return (Py_ssize_t)0; } static PyNetCDFIndex * PyNetCDFVariable_Indices(PyNetCDFVariableObject *var) { PyNetCDFIndex *indices = (PyNetCDFIndex *)malloc(var->nd*sizeof(PyNetCDFIndex)); int i; if (indices != NULL) for (i = 0; i < var->nd; i++) { indices[i].start = 0; indices[i].stop = var->dimensions[i]; indices[i].stride = 1; indices[i].item = 0; } else PyErr_SetString(PyExc_MemoryError, "out of memory"); return indices; } static PyArrayObject * PyNetCDFVariable_ReadAsArray(PyNetCDFVariableObject *self, PyNetCDFIndex *indices) { npy_intp *dims; PyArrayObject *array; int i, d; int nitems; int error = 0; d = 0; nitems = 1; if (!check_if_open(self->file, -1)) { free(indices); return NULL; } define_mode(self->file, 0); if (self->nd == 0) dims = NULL; else { dims = (npy_intp *)malloc(self->nd*sizeof(npy_intp)); if (dims == NULL) { free(indices); return (PyArrayObject *)PyErr_NoMemory(); } } for (i = 0; i < self->nd; i++) { error = error || (indices[i].stride <= 0); if (indices[i].start < 0) indices[i].start += self->dimensions[i]; if (indices[i].start < 0) indices[i].start = 0; if (indices[i].start > self->dimensions[i]) indices[i].start = self->dimensions[i]; if (indices[i].item != 0) indices[i].stop = indices[i].start + 1; else { if (indices[i].stop < 0) indices[i].stop += self->dimensions[i]; if (indices[i].stop < 0) indices[i].stop = 0; if (indices[i].stop > self->dimensions[i]) indices[i].stop = self->dimensions[i]; dims[d] = (indices[i].stop-indices[i].start-1)/indices[i].stride+1; if (dims[d] < 0) dims[d] = 0; nitems *= dims[d]; d++; } } if (error) { PyErr_SetString(PyExc_IndexError, "illegal index"); if (dims != NULL) free(dims); if (indices != NULL) free(indices); return NULL; } #if defined(NUMPY) array = (PyArrayObject *)PyArray_SimpleNew (d, dims, self->type); #else array = (PyArrayObject *)PyArray_FromDims(d, dims, self->type); #endif if (array != NULL && nitems > 0) { if (self->nd == 0) { long zero = 0; int ret; Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = ncvarget1(self->file->id, self->id, &zero, array->data); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret == -1) { netcdf_seterror(); Py_DECREF(array); array = NULL; } } else { long *start; long *count; long *stride; start = (long *)malloc(self->nd*sizeof(long)); count = (long *)malloc(self->nd*sizeof(long)); stride = (long *)malloc(self->nd*sizeof(long)); if (start != NULL && count != NULL && stride != NULL) { int ret; for (i = 0; i < self->nd; i++) { start[i] = indices[i].start; stride[i] = indices[i].stride; count[i] = (indices[i].stop-indices[i].start-1)/indices[i].stride+1; } Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = ncvargetg(self->file->id, self->id, start, count, stride, NULL, array->data); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret == -1) { netcdf_seterror(); Py_DECREF(array); array = NULL; } } if (start != NULL) free(start); if (count != NULL) free(count); if (stride != NULL) free(stride); } } free(dims); free(indices); return array; } static PyStringObject * PyNetCDFVariable_ReadAsString(PyNetCDFVariableObject *self) { if (self->type != PyArray_CHAR || self->nd != 1) { PyErr_SetString(PyExc_IOError, "netcdf: not a string variable"); return NULL; } if (check_if_open(self->file, -1)) { int ret; char *temp; PyObject *string; define_mode(self->file, 0); temp = (char *)malloc((self->dimensions[0]+1)*sizeof(char)); if (temp == NULL) return (PyStringObject *)PyErr_NoMemory(); Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_get_var_text(self->file->id, self->id, temp); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret != NC_NOERR) { netcdf_signalerror(ret); string = NULL; } else { temp[self->dimensions[0]] = '\0'; string = PyString_FromString(temp); } free(temp); return (PyStringObject *)string; } else return NULL; } #include "time.h" static int PyNetCDFVariable_WriteArray(PyNetCDFVariableObject *self, PyNetCDFIndex *indices, PyObject *value) { int *dims; PyArrayObject *array; int i, j, d; int nitems; int error = 0; int ret = 0; d = 0; nitems = 1; if (!check_if_open(self->file, 1)) { free(indices); return -1; } if (self->nd == 0) dims = NULL; else { dims = (int *)malloc(self->nd*sizeof(int)); if (dims == NULL) { free(indices); PyErr_SetString(PyExc_MemoryError, "out of memory"); return -1; } } define_mode(self->file, 0); for (i = 0; i < self->nd; i++) { error = error || (indices[i].stride <= 0); if (indices[i].start < 0) indices[i].start += self->dimensions[i]; if (indices[i].start < 0) indices[i].start = 0; if (indices[i].stop < 0) indices[i].stop += self->dimensions[i]; if (indices[i].stop < 0) indices[i].stop = 0; if (i > 0 || !self->unlimited) { if (indices[i].start > self->dimensions[i]) indices[i].start = self->dimensions[i]; if (indices[i].stop > self->dimensions[i]) indices[i].stop = self->dimensions[i]; } if (indices[i].item == 0) { dims[d] = (indices[i].stop-indices[i].start-1)/indices[i].stride+1; if (dims[d] < 0) dims[d] = 0; nitems *= dims[d]; d++; } else indices[i].stop = indices[i].start + 1; } if (error) { PyErr_SetString(PyExc_IndexError, "illegal index"); free(dims); free(indices); return -1; } array = (PyArrayObject *)PyArray_ContiguousFromObject(value, self->type, 0, d); if (array != NULL) { if (self->nd == 0) { size_t zero = 0; Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); error = nc_put_var1_any(self->file->id, self->id, netcdf_type_from_type(self->type), &zero, array->data); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (error != NC_NOERR) { netcdf_signalerror(ret); ret = -1; } } else { size_t *start; size_t *count, *count1; ptrdiff_t *stride; size_t *current; char *loop; long repeat = 1; int lastloop = 0; start = (size_t *)malloc(self->nd*sizeof(size_t)); count = (size_t *)malloc(self->nd*sizeof(size_t)); count1 = (size_t *)malloc(self->nd*sizeof(size_t)); stride = (ptrdiff_t *)malloc(self->nd*sizeof(ptrdiff_t)); current = (size_t *)malloc(self->nd*sizeof(size_t)); loop = (char *)malloc(self->nd*sizeof(char)); if (start != NULL && count != NULL && count1 != NULL && stride != NULL && current != NULL && loop != NULL) { for (i = 0; i < self->nd; i++) { start[i] = indices[i].start; stride[i] = indices[i].stride; count[i] = (indices[i].stop-indices[i].start-1)/indices[i].stride+1; count1[i] = count[i]; current[i] = 0; loop[i] = 0; } for (i = array->nd-1, j = self->nd-1; i >= 0 && j >= 0; i--, j--) { while (j >= 0 && indices[j].item) j--; if (j < 0) { ret = -1; break; } if (array->dimensions[i] != count[j]) { if (self->unlimited && j == 0 && indices[j].stop == self->dimensions[j] && array->dimensions[i] > count[j]) { count[j] = array->dimensions[i]; count1[j] = array->dimensions[i]; } else ret = -1; } } if (i == -1) { lastloop = -1; while (j >= 0) { loop[j] = !indices[j].item; if (loop[j]) { if (lastloop < 0) lastloop = j; repeat *= count[j]; count1[j] = 1; } j--; } } else ret = -1; if (ret == -1) PyErr_SetString(PyExc_ValueError, "shapes are not aligned"); Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); error = NC_NOERR; while (repeat--) { error = nc_put_vars_any(self->file->id, self->id, netcdf_type_from_type(self->type), start, count1, stride, array->data); if (error != NC_NOERR) break; if (lastloop >= 0) { for (i = lastloop; i >= 0; i--) { while (!loop[i] && i >= 0) i--; if (i >= 0) { start[i] += stride[i]; if (++current[i] != count[i]) break; start[i] -= count[i]*stride[i]; current[i] = 0; } } } } if (self->unlimited && error == NC_NOERR) error = nc_inq_dimlen(self->file->id, self->dimids[0], &self->dimensions[0]); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (error != NC_NOERR) { netcdf_signalerror(error); ret = -1; } } if (start != NULL) free(start); if (count != NULL) free(count); if (count1 != NULL) free(count1); if (stride != NULL) free(stride); if (current != NULL) free(current); if (loop != NULL) free(loop); } Py_DECREF(array); free(dims); free(indices); return ret; } else { free(dims); free(indices); return -1; } } static int PyNetCDFVariable_WriteString(PyNetCDFVariableObject *self, PyStringObject *value) { if (self->type != PyArray_CHAR || self->nd != 1) { PyErr_SetString(PyExc_IOError, "netcdf: not a string variable"); return -1; } if (PyString_Size((PyObject *)value) > self->dimensions[0]) { PyErr_SetString(PyExc_ValueError, "string too long"); return -1; } if (check_if_open(self->file, 1)) { int ret; define_mode(self->file, 0); Py_BEGIN_ALLOW_THREADS; acquire_netCDF_lock(); ret = nc_put_var_text(self->file->id, self->id, PyString_AsString((PyObject *)value)); release_netCDF_lock(); Py_END_ALLOW_THREADS; if (ret != NC_NOERR) { netcdf_signalerror(ret); return -1; } return 0; } else return -1; } static PyObject * PyNetCDFVariableObject_item(PyNetCDFVariableObject *self, Py_ssize_t i) { PyNetCDFIndex *indices; if (self->nd == 0) { PyErr_SetString(PyExc_TypeError, "Not a sequence"); return NULL; } indices = PyNetCDFVariable_Indices(self); if (indices != NULL) { indices[0].start = i; indices[0].stop = i+1; indices[0].item = 1; return PyArray_Return(PyNetCDFVariable_ReadAsArray(self, indices)); } return NULL; } static PyObject * PyNetCDFVariableObject_slice(PyNetCDFVariableObject *self, Py_ssize_t low, Py_ssize_t high) { PyNetCDFIndex *indices; if (self->nd == 0) { PyErr_SetString(PyExc_TypeError, "Not a sequence"); return NULL; } indices = PyNetCDFVariable_Indices(self); if (indices != NULL) { indices[0].start = low; indices[0].stop = high; return PyArray_Return(PyNetCDFVariable_ReadAsArray(self, indices)); } return NULL; } static PyObject * PyNetCDFVariableObject_subscript(PyNetCDFVariableObject *self, PyObject *index) { PyNetCDFIndex *indices; if (PyInt_Check(index)) { int i = PyInt_AsLong(index); return PyNetCDFVariableObject_item(self, i); } if (self->nd == 0) { PyErr_SetString(PyExc_TypeError, "Not a sequence"); return NULL; } indices = PyNetCDFVariable_Indices(self); if (indices != NULL) { if (PySlice_Check(index)) { PySlice_GetIndices((PySliceObject *)index, (Py_ssize_t)self->dimensions[0], &indices->start, &indices->stop, &indices->stride); return PyArray_Return(PyNetCDFVariable_ReadAsArray(self, indices)); } if (PyTuple_Check(index)) { int ni; Py_ssize_t len_dim = PyTuple_Size(index); if (len_dim > INT_MAX) { PyErr_SetString(PyExc_ValueError, "too many dimensions"); return NULL; } ni = (int)len_dim; if (ni <= self->nd) { int i, d; d = 0; for (i = 0; i < ni; i++) { PyObject *subscript = PyTuple_GetItem(index, (Py_ssize_t)i); if (PyInt_Check(subscript)) { int n = PyInt_AsLong(subscript); indices[d].start = n; indices[d].stop = n+1; indices[d].item = 1; d++; } else if (PySlice_Check(subscript)) { PySlice_GetIndices((PySliceObject *)subscript, self->dimensions[d], &indices[d].start, &indices[d].stop, &indices[d].stride); d++; } else if (subscript == Py_Ellipsis) { d = self->nd - ni + i + 1; } else { PyErr_SetString(PyExc_TypeError, "illegal subscript type"); free(indices); return NULL; } } return PyArray_Return(PyNetCDFVariable_ReadAsArray(self, indices)); } else { PyErr_SetString(PyExc_IndexError, "too many subscripts"); free(indices); return NULL; } } PyErr_SetString(PyExc_TypeError, "illegal subscript type"); free(indices); } return NULL; } static int PyNetCDFVariableObject_ass_item(PyNetCDFVariableObject *self, Py_ssize_t i, PyObject *value) { PyNetCDFIndex *indices; if (value == NULL) { PyErr_SetString(PyExc_ValueError, "Can't delete elements."); return -1; } if (self->nd == 0) { PyErr_SetString(PyExc_TypeError, "Not a sequence"); return -1; } indices = PyNetCDFVariable_Indices(self); if (indices != NULL) { indices[0].start = i; indices[0].stop = i+1; indices[0].item = 1; return PyNetCDFVariable_WriteArray(self, indices, value); } return -1; } static int PyNetCDFVariableObject_ass_slice(PyNetCDFVariableObject *self, Py_ssize_t low, Py_ssize_t high, PyObject *value) { PyNetCDFIndex *indices; if (value == NULL) { PyErr_SetString(PyExc_ValueError, "Can't delete elements."); return -1; } if (self->nd == 0) { PyErr_SetString(PyExc_TypeError, "Not a sequence"); return -1; } if (low < -(long)self->dimensions[0]) low = -self->dimensions[0]; if (low < 0) low += self->dimensions[0]; if (high < low) high = low; if (self->unlimited && self->dimids[0] == self->file->recdim) { if (high > self->dimensions[0]) high = self->dimensions[0]; } indices = PyNetCDFVariable_Indices(self); if (indices != NULL) { indices[0].start = low; indices[0].stop = high; return PyNetCDFVariable_WriteArray(self, indices, value); } return -1; } static int PyNetCDFVariableObject_ass_subscript(PyNetCDFVariableObject *self, PyObject *index, PyObject *value) { PyNetCDFIndex *indices; if (PyInt_Check(index)) { int i = PyInt_AsLong(index); return PyNetCDFVariableObject_ass_item(self, i, value); } if (value == NULL) { PyErr_SetString(PyExc_ValueError, "Can't delete elements."); return -1; } if (self->nd == 0) { PyErr_SetString(PyExc_TypeError, "Not a sequence"); return -1; } indices = PyNetCDFVariable_Indices(self); if (indices != NULL) { if (PySlice_Check(index)) { PySlice_GetIndices((PySliceObject *)index, self->dimensions[0], &indices->start, &indices->stop, &indices->stride); return PyNetCDFVariable_WriteArray(self, indices, value); } if (PyTuple_Check(index)) { int ni; Py_ssize_t len_dim = PyTuple_Size(index); if (len_dim > INT_MAX) { PyErr_SetString(PyExc_ValueError, "too many dimensions"); return -1; } ni = (int)len_dim; if (ni <= self->nd) { int i, d; d = 0; for (i = 0; i < ni; i++) { PyObject *subscript = PyTuple_GetItem(index, (Py_ssize_t)i); if (PyInt_Check(subscript)) { int n = PyInt_AsLong(subscript); indices[d].start = n; indices[d].stop = n+1; indices[d].item = 1; d++; } else if (PySlice_Check(subscript)) { PySlice_GetIndices((PySliceObject *)subscript, self->dimensions[d], &indices[d].start, &indices[d].stop, &indices[d].stride); d++; } else if (subscript == Py_Ellipsis) { d = self->nd - ni + i + 1; } else { PyErr_SetString(PyExc_TypeError, "illegal subscript type"); free(indices); return -1; } } return PyNetCDFVariable_WriteArray(self, indices, value); } else { PyErr_SetString(PyExc_IndexError, "too many subscripts"); free(indices); return -1; } } PyErr_SetString(PyExc_TypeError, "illegal subscript type"); free(indices); } return -1; } /* Type definition */ static PyObject * PyNetCDFVariableObject_error1(PyNetCDFVariableObject *self, PyNetCDFVariableObject *other) { PyErr_SetString(PyExc_TypeError, "can't add netCDF variables"); return NULL; } static PyObject * PyNetCDFVariableObject_error2(PyNetCDFVariableObject *self, Py_ssize_t n) { PyErr_SetString(PyExc_TypeError, "can't multiply netCDF variables"); return NULL; } static PySequenceMethods PyNetCDFVariableObject_as_sequence = { (lenfunc)PyNetCDFVariableObject_length, /*sq_length*/ (binaryfunc)PyNetCDFVariableObject_error1, /*nb_add*/ (ssizeargfunc)PyNetCDFVariableObject_error2, /*nb_multiply*/ (ssizeargfunc)PyNetCDFVariableObject_item, /*sq_item*/ (ssizessizeargfunc)PyNetCDFVariableObject_slice, /*sq_slice*/ (ssizeobjargproc)PyNetCDFVariableObject_ass_item, /*sq_ass_item*/ (ssizessizeobjargproc)PyNetCDFVariableObject_ass_slice, /*sq_ass_slice*/ }; static PyMappingMethods PyNetCDFVariableObject_as_mapping = { (lenfunc)PyNetCDFVariableObject_length, /*mp_length*/ (binaryfunc)PyNetCDFVariableObject_subscript, /*mp_subscript*/ (objobjargproc)PyNetCDFVariableObject_ass_subscript, /*mp_ass_subscript*/ }; statichere PyTypeObject PyNetCDFVariable_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "NetCDFVariable", /*tp_name*/ sizeof(PyNetCDFVariableObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ (destructor)PyNetCDFVariableObject_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)PyNetCDFVariable_GetAttribute, /*tp_getattr*/ (setattrfunc)PyNetCDFVariable_SetAttribute, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ &PyNetCDFVariableObject_as_sequence, /*tp_as_sequence*/ &PyNetCDFVariableObject_as_mapping, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ "NetCDF Variable", /* tp_doc */ }; /* Table of functions defined in the module */ static PyMethodDef netcdf_methods[] = { {NULL, NULL} /* sentinel */ }; /* Module initialization */ DL_EXPORT(void) init_netcdf(void) { PyObject *m; static void *PyNetCDF_API[PyNetCDF_API_pointers]; /* Initialize netcdf variables */ ncopts = 0; /* Initialize type objects */ PyNetCDFFile_Type.tp_new = PyType_GenericNew; if (PyType_Ready(&PyNetCDFFile_Type) < 0) return; PyNetCDFVariable_Type.tp_new = PyType_GenericNew; if (PyType_Ready(&PyNetCDFVariable_Type) < 0) return; /* Create netCDF lock */ #ifdef WITH_THREAD netCDF_lock = PyThread_allocate_lock(); #endif /* Create the module and add the functions */ m = Py_InitModule("Scientific._netcdf", netcdf_methods); /* Import the array module */ import_array(); /* Initialize C API pointer array and store in module */ PyNetCDF_API[PyNetCDFFile_Type_NUM] = (void *)&PyNetCDFFile_Type; PyNetCDF_API[PyNetCDFVariable_Type_NUM] = (void *)&PyNetCDFVariable_Type; PyNetCDF_API[PyNetCDFFile_Open_NUM] = (void *)&PyNetCDFFile_Open; PyNetCDF_API[PyNetCDFFile_Close_NUM] = (void *)&PyNetCDFFile_Close; PyNetCDF_API[PyNetCDFFile_Sync_NUM] = (void *)&PyNetCDFFile_Sync; PyNetCDF_API[PyNetCDFFile_CreateDimension_NUM] = (void *)&PyNetCDFFile_CreateDimension; PyNetCDF_API[PyNetCDFFile_CreateVariable_NUM] = (void *)&PyNetCDFFile_CreateVariable; PyNetCDF_API[PyNetCDFFile_GetVariable_NUM] = (void *)&PyNetCDFFile_GetVariable; PyNetCDF_API[PyNetCDFVariable_GetRank_NUM] = (void *)&PyNetCDFVariable_GetRank; PyNetCDF_API[PyNetCDFVariable_GetShape_NUM] = (void *)&PyNetCDFVariable_GetShape; PyNetCDF_API[PyNetCDFVariable_Indices_NUM] = (void *)&PyNetCDFVariable_Indices; PyNetCDF_API[PyNetCDFVariable_ReadAsArray_NUM] = (void *)&PyNetCDFVariable_ReadAsArray; PyNetCDF_API[PyNetCDFVariable_ReadAsString_NUM] = (void *)&PyNetCDFVariable_ReadAsString; PyNetCDF_API[PyNetCDFVariable_WriteArray_NUM] = (void *)&PyNetCDFVariable_WriteArray; PyNetCDF_API[PyNetCDFVariable_WriteString_NUM] = (void *)&PyNetCDFVariable_WriteString; PyNetCDF_API[PyNetCDFFile_GetAttribute_NUM] = (void *)&PyNetCDFFile_GetAttribute; PyNetCDF_API[PyNetCDFFile_SetAttribute_NUM] = (void *)&PyNetCDFFile_SetAttribute; PyNetCDF_API[PyNetCDFFile_SetAttributeString_NUM] = (void *)&PyNetCDFFile_SetAttributeString; PyNetCDF_API[PyNetCDFVariable_GetAttribute_NUM] = (void *)&PyNetCDFVariable_GetAttribute; PyNetCDF_API[PyNetCDFVariable_SetAttribute_NUM] = (void *)&PyNetCDFVariable_SetAttribute; PyNetCDF_API[PyNetCDFVariable_SetAttributeString_NUM] = (void *)&PyNetCDFVariable_SetAttributeString; PyNetCDF_API[PyNetCDFFile_AddHistoryLine_NUM] = (void *)&PyNetCDFFile_AddHistoryLine; PyModule_AddObject(m, "_C_API", PyCObject_FromVoidPtr((void *)PyNetCDF_API, NULL)); /* Add the netCDF file type object */ Py_INCREF(&PyNetCDFFile_Type); PyModule_AddObject(m, "NetCDFFile", (PyObject *)&PyNetCDFFile_Type); /* Check for errors */ if (PyErr_Occurred()) Py_FatalError("can't initialize module Scientific._netcdf"); } ScientificPython-2.9.4/Scientific/_vector.c0000644000076600000240000137210512270504677021330 0ustar hinsenstaff00000000000000/* Generated by Cython 0.19.2 on Fri Jan 24 16:41:50 2014 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS #ifdef PYLONG_BITS_IN_DIGIT #define CYTHON_USE_PYLONG_INTERNALS 0 #else #include "pyconfig.h" #ifdef PYLONG_BITS_IN_DIGIT #define CYTHON_USE_PYLONG_INTERNALS 1 #else #define CYTHON_USE_PYLONG_INTERNALS 0 #endif #endif #endif #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ !PyComplex_Check(o)) #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_VERSION_HEX < 0x02060000 #define Py_TPFLAGS_HAVE_VERSION_TAG 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is a quiet NaN. */ float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__Scientific___vector #define __PYX_HAVE_API__Scientific___vector #include "math.h" #include "string.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) #define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) #define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) #define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return u_end - u - 1; } #else #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen #endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params() { PyObject* sys = NULL; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; sys = PyImport_ImportModule("sys"); if (sys == NULL) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); if (default_encoding == NULL) goto bad; if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (ascii_chars_u == NULL) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", default_encoding_c); goto bad; } } Py_XDECREF(sys); Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return 0; bad: Py_XDECREF(sys); Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params() { PyObject* sys = NULL; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (sys == NULL) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); if (default_encoding == NULL) goto bad; default_encoding_c = PyBytes_AS_STRING(default_encoding); __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(sys); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(sys); Py_XDECREF(default_encoding); return -1; } #endif #endif #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 #elif defined(_Complex_I) #define CYTHON_CCOMPLEX 1 #else #define CYTHON_CCOMPLEX 0 #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus #include #else #include #endif #endif #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif static const char *__pyx_f[] = { "_vector.pyx", "numpy.pxd", "type.pxd", }; /* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t */ typedef npy_int8 __pyx_t_5numpy_int8_t; /* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t */ typedef npy_int16 __pyx_t_5numpy_int16_t; /* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< * ctypedef npy_int64 int64_t * #ctypedef npy_int96 int96_t */ typedef npy_int32 __pyx_t_5numpy_int32_t; /* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< * #ctypedef npy_int96 int96_t * #ctypedef npy_int128 int128_t */ typedef npy_int64 __pyx_t_5numpy_int64_t; /* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; /* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; /* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< * ctypedef npy_uint64 uint64_t * #ctypedef npy_uint96 uint96_t */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; /* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< * #ctypedef npy_uint96 uint96_t * #ctypedef npy_uint128 uint128_t */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; /* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< * ctypedef npy_float64 float64_t * #ctypedef npy_float80 float80_t */ typedef npy_float32 __pyx_t_5numpy_float32_t; /* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< * #ctypedef npy_float80 float80_t * #ctypedef npy_float128 float128_t */ typedef npy_float64 __pyx_t_5numpy_float64_t; /* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t */ typedef npy_long __pyx_t_5numpy_int_t; /* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< * ctypedef npy_longlong longlong_t * */ typedef npy_longlong __pyx_t_5numpy_long_t; /* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< * * ctypedef npy_ulong uint_t */ typedef npy_longlong __pyx_t_5numpy_longlong_t; /* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t */ typedef npy_ulong __pyx_t_5numpy_uint_t; /* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< * ctypedef npy_ulonglong ulonglong_t * */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; /* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< * * ctypedef npy_intp intp_t */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; /* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< * ctypedef npy_uintp uintp_t * */ typedef npy_intp __pyx_t_5numpy_intp_t; /* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< * * ctypedef npy_double float_t */ typedef npy_uintp __pyx_t_5numpy_uintp_t; /* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t */ typedef npy_double __pyx_t_5numpy_float_t; /* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< * ctypedef npy_longdouble longdouble_t * */ typedef npy_double __pyx_t_5numpy_double_t; /* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; #else typedef float _Complex __pyx_t_float_complex; #endif #else typedef struct { float real, imag; } __pyx_t_float_complex; #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< double > __pyx_t_double_complex; #else typedef double _Complex __pyx_t_double_complex; #endif #else typedef struct { double real, imag; } __pyx_t_double_complex; #endif /*--- Type declarations ---*/ struct __pyx_obj_10Scientific_7_vector_vector; struct __pyx_obj_10Scientific_7_vector_Vector; /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; /* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< * ctypedef npy_clongdouble clongdouble_t * */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; /* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< * * ctypedef npy_cdouble complex_t */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; /* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; /* "Scientific/_vector.pyx":24 * # only the __init__ method. * # * cdef class vector: # <<<<<<<<<<<<<< * * cdef double xv, yv, zv */ struct __pyx_obj_10Scientific_7_vector_vector { PyObject_HEAD struct __pyx_vtabstruct_10Scientific_7_vector_vector *__pyx_vtab; double xv; double yv; double zv; }; /* "Scientific/_vector.pyx":218 * * * cdef class Vector(vector): # <<<<<<<<<<<<<< * * property __safe_for_unpickling__: */ struct __pyx_obj_10Scientific_7_vector_Vector { struct __pyx_obj_10Scientific_7_vector_vector __pyx_base; }; /* "Scientific/_vector.pyx":24 * # only the __init__ method. * # * cdef class vector: # <<<<<<<<<<<<<< * * cdef double xv, yv, zv */ struct __pyx_vtabstruct_10Scientific_7_vector_vector { void (*set)(struct __pyx_obj_10Scientific_7_vector_vector *, double, double, double); }; static struct __pyx_vtabstruct_10Scientific_7_vector_vector *__pyx_vtabptr_10Scientific_7_vector_vector; /* "Scientific/_vector.pyx":218 * * * cdef class Vector(vector): # <<<<<<<<<<<<<< * * property __safe_for_unpickling__: */ struct __pyx_vtabstruct_10Scientific_7_vector_Vector { struct __pyx_vtabstruct_10Scientific_7_vector_vector __pyx_base; }; static struct __pyx_vtabstruct_10Scientific_7_vector_Vector *__pyx_vtabptr_10Scientific_7_vector_Vector; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil) \ if (acquire_gil) { \ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ PyGILState_Release(__pyx_gilstate_save); \ } else { \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil) \ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext() \ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_XDECREF_SET(r, v) do { \ PyObject *tmp = (PyObject *) r; \ r = v; __Pyx_XDECREF(tmp); \ } while (0) #define __Pyx_DECREF_SET(r, v) do { \ PyObject *tmp = (PyObject *) r; \ r = v; __Pyx_DECREF(tmp); \ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ #define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) #define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 #endif static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); /*proto*/ static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) #define __Pyx_CIMAG(z) ((z).imag()) #else #define __Pyx_CREAL(z) (__real__(z)) #define __Pyx_CIMAG(z) (__imag__(z)) #endif #else #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) #else #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) #endif static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) #define __Pyx_c_difff(a, b) ((a)-(b)) #define __Pyx_c_prodf(a, b) ((a)*(b)) #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) #if 1 #define __Pyx_c_absf(z) (::std::abs(z)) #define __Pyx_c_powf(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) #if 1 #define __Pyx_c_absf(z) (cabsf(z)) #define __Pyx_c_powf(a, b) (cpowf(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) #define __Pyx_c_diff(a, b) ((a)-(b)) #define __Pyx_c_prod(a, b) ((a)*(b)) #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) #if 1 #define __Pyx_c_abs(z) (::std::abs(z)) #define __Pyx_c_pow(a, b) (::std::pow(a, b)) #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) #if 1 #define __Pyx_c_abs(z) (cabs(z)) #define __Pyx_c_pow(a, b) (cpow(a, b)) #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #else #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #endif #endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ typedef struct { int code_line; PyCodeObject* code_object; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'libc.string' */ /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ /* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from 'Scientific._vector' */ static PyTypeObject *__pyx_ptype_10Scientific_7_vector_vector = 0; static PyTypeObject *__pyx_ptype_10Scientific_7_vector_Vector = 0; #define __Pyx_MODULE_NAME "Scientific._vector" int __pyx_module_is_main_Scientific___vector = 0; /* Implementation of 'Scientific._vector' */ static PyObject *__pyx_builtin_NotImplemented; static PyObject *__pyx_builtin_IndexError; static PyObject *__pyx_builtin_ZeroDivisionError; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_AttributeError; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_pf_10Scientific_7_vector_6vector_9is_vector___get__(CYTHON_UNUSED struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_5array___get__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_18__array_priority_____get__(CYTHON_UNUSED struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector___array_wrap__(CYTHON_UNUSED struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, PyObject *__pyx_v_array); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_2__copy__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_4__deepcopy__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_6__getstate__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_8__setstate__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_10__reduce__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_12x(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_14y(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_16z(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_18__repr__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_20__str__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_22__add__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_other); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_24__neg__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_26__sub__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_other); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_28__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /* proto */ #if PY_MAJOR_VERSION < 3 static PyObject *__pyx_pf_10Scientific_7_vector_6vector_30__div__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, double __pyx_v_factor); /* proto */ #endif static PyObject *__pyx_pf_10Scientific_7_vector_6vector_32__richcmp__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */ static Py_ssize_t __pyx_pf_10Scientific_7_vector_6vector_34__len__(CYTHON_UNUSED struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_36__getitem__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, int __pyx_v_index); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_38length(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_40normal(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_42cross(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_other); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_44angle(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_other); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_46asTensor(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_48dyadicProduct(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_6Vector_23__safe_for_unpickling_____get__(CYTHON_UNUSED struct __pyx_obj_10Scientific_7_vector_Vector *__pyx_v_self); /* proto */ static int __pyx_pf_10Scientific_7_vector_6Vector___init__(struct __pyx_obj_10Scientific_7_vector_Vector *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z); /* proto */ static PyObject *__pyx_pf_10Scientific_7_vector_isVector(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static PyObject *__pyx_tp_new_10Scientific_7_vector_vector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_10Scientific_7_vector_Vector(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static char __pyx_k_1[] = "Vector(%f,%f,%f)"; static char __pyx_k_2[] = "_product_with_vector"; static char __pyx_k_3[] = "Can't normalize a zero-length vector"; static char __pyx_k_6[] = "Dyadic product with non-vector"; static char __pyx_k_7[] = "ndarray is not C contiguous"; static char __pyx_k_9[] = "ndarray is not Fortran contiguous"; static char __pyx_k_11[] = "Non-native byte order not supported"; static char __pyx_k_13[] = "unknown dtype code in numpy.pxd (%d)"; static char __pyx_k_14[] = "Format string allocated too short, see comment in numpy.pxd"; static char __pyx_k_17[] = "Format string allocated too short."; static char __pyx_k_21[] = "/Users/hinsen/Programs/ScientificPython/main/Scientific/_vector.pyx"; static char __pyx_k_22[] = "Scientific._vector"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__x[] = "x"; static char __pyx_k__y[] = "y"; static char __pyx_k__z[] = "z"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__np[] = "np"; static char __pyx_k__dot[] = "dot"; static char __pyx_k__memo[] = "memo"; static char __pyx_k__rank[] = "rank"; static char __pyx_k__array[] = "array"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k__Tensor[] = "Tensor"; static char __pyx_k____div__[] = "__div__"; static char __pyx_k__newaxis[] = "newaxis"; static char __pyx_k__Geometry[] = "Geometry"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__isTensor[] = "isTensor"; static char __pyx_k__isVector[] = "isVector"; static char __pyx_k__TypeError[] = "TypeError"; static char __pyx_k__is_vector[] = "is_vector"; static char __pyx_k__IndexError[] = "IndexError"; static char __pyx_k__Scientific[] = "Scientific"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k____import__[] = "__import__"; static char __pyx_k____truediv__[] = "__truediv__"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k__AttributeError[] = "AttributeError"; static char __pyx_k__NotImplemented[] = "NotImplemented"; static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__"; static char __pyx_k__ZeroDivisionError[] = "ZeroDivisionError"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_u_11; static PyObject *__pyx_kp_u_13; static PyObject *__pyx_kp_u_14; static PyObject *__pyx_kp_u_17; static PyObject *__pyx_n_s_2; static PyObject *__pyx_kp_s_21; static PyObject *__pyx_n_s_22; static PyObject *__pyx_kp_s_3; static PyObject *__pyx_kp_s_6; static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__AttributeError; static PyObject *__pyx_n_s__Geometry; static PyObject *__pyx_n_s__IndexError; static PyObject *__pyx_n_s__NotImplemented; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__Scientific; static PyObject *__pyx_n_s__Tensor; static PyObject *__pyx_n_s__TypeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s__ZeroDivisionError; static PyObject *__pyx_n_s____div__; static PyObject *__pyx_n_s____import__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____pyx_vtable__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____truediv__; static PyObject *__pyx_n_s__array; static PyObject *__pyx_n_s__dot; static PyObject *__pyx_n_s__isTensor; static PyObject *__pyx_n_s__isVector; static PyObject *__pyx_n_s__is_vector; static PyObject *__pyx_n_s__memo; static PyObject *__pyx_n_s__newaxis; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__rank; static PyObject *__pyx_n_s__x; static PyObject *__pyx_n_s__y; static PyObject *__pyx_n_s__z; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_15; static PyObject *__pyx_k_slice_4; static PyObject *__pyx_k_slice_5; static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_10; static PyObject *__pyx_k_tuple_12; static PyObject *__pyx_k_tuple_15; static PyObject *__pyx_k_tuple_16; static PyObject *__pyx_k_tuple_18; static PyObject *__pyx_k_tuple_19; static PyObject *__pyx_k_codeobj_20; /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_9is_vector_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_9is_vector_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_9is_vector___get__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":29 * * property is_vector: * def __get__(self): # <<<<<<<<<<<<<< * return 1 * */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_9is_vector___get__(CYTHON_UNUSED struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* "Scientific/_vector.pyx":30 * property is_vector: * def __get__(self): * return 1 # <<<<<<<<<<<<<< * * property array: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_int_1); __pyx_r = __pyx_int_1; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_5array_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_5array_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_5array___get__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":33 * * property array: * def __get__(self): # <<<<<<<<<<<<<< * return np.array([self.xv, self.yv, self.zv]) * */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_5array___get__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "Scientific/_vector.pyx":34 * property array: * def __get__(self): * return np.array([self.xv, self.yv, self.zv]) # <<<<<<<<<<<<<< * * # __array_priority__ and __array_wrap__ are needed to permit */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->xv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->yv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->zv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyList_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("Scientific._vector.vector.array.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_18__array_priority___1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_18__array_priority___1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_18__array_priority_____get__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":39 * # multiplication with numpy scalar types. * property __array_priority__: * def __get__(self): # <<<<<<<<<<<<<< * return 10.0 * */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_18__array_priority_____get__(CYTHON_UNUSED struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "Scientific/_vector.pyx":40 * property __array_priority__: * def __get__(self): * return 10.0 # <<<<<<<<<<<<<< * * def __array_wrap__(self, array): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(10.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.__array_priority__.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_1__array_wrap__(PyObject *__pyx_v_self, PyObject *__pyx_v_array); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_1__array_wrap__(PyObject *__pyx_v_self, PyObject *__pyx_v_array) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__array_wrap__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector___array_wrap__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), ((PyObject *)__pyx_v_array)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":42 * return 10.0 * * def __array_wrap__(self, array): # <<<<<<<<<<<<<< * result = vector() * vector.set(result, array[0], array[1], array[2]) */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector___array_wrap__(CYTHON_UNUSED struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, PyObject *__pyx_v_array) { struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; double __pyx_t_2; double __pyx_t_3; double __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__array_wrap__", 0); /* "Scientific/_vector.pyx":43 * * def __array_wrap__(self, array): * result = vector() # <<<<<<<<<<<<<< * vector.set(result, array[0], array[1], array[2]) * return result */ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_vector.pyx":44 * def __array_wrap__(self, array): * result = vector() * vector.set(result, array[0], array[1], array[2]) # <<<<<<<<<<<<<< * return result * */ __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_array, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_array, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_array, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_vtabptr_10Scientific_7_vector_vector->set(__pyx_v_result, __pyx_t_2, __pyx_t_3, __pyx_t_4); /* "Scientific/_vector.pyx":45 * result = vector() * vector.set(result, array[0], array[1], array[2]) * return result # <<<<<<<<<<<<<< * * def __copy__(self, memo = None): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.__array_wrap__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_3__copy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_3__copy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_memo = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__copy__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__memo,0}; PyObject* values[1] = {0}; /* "Scientific/_vector.pyx":47 * return result * * def __copy__(self, memo = None): # <<<<<<<<<<<<<< * return self * */ values[0] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__memo); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__copy__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_memo = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__copy__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("Scientific._vector.vector.__copy__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_2__copy__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), __pyx_v_memo); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10Scientific_7_vector_6vector_2__copy__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__copy__", 0); /* "Scientific/_vector.pyx":48 * * def __copy__(self, memo = None): * return self # <<<<<<<<<<<<<< * * def __deepcopy__(self, memo = None): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_5__deepcopy__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { CYTHON_UNUSED PyObject *__pyx_v_memo = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__deepcopy__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__memo,0}; PyObject* values[1] = {0}; /* "Scientific/_vector.pyx":50 * return self * * def __deepcopy__(self, memo = None): # <<<<<<<<<<<<<< * return self * */ values[0] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__memo); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__deepcopy__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_memo = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__deepcopy__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("Scientific._vector.vector.__deepcopy__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_4__deepcopy__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), __pyx_v_memo); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_10Scientific_7_vector_6vector_4__deepcopy__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_memo) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__deepcopy__", 0); /* "Scientific/_vector.pyx":51 * * def __deepcopy__(self, memo = None): * return self # <<<<<<<<<<<<<< * * def __getstate__(self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_self)); __pyx_r = ((PyObject *)__pyx_v_self); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_7__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_7__getstate__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getstate__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_6__getstate__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":53 * return self * * def __getstate__(self): # <<<<<<<<<<<<<< * return [self.xv, self.yv, self.zv] * */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_6__getstate__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getstate__", 0); /* "Scientific/_vector.pyx":54 * * def __getstate__(self): * return [self.xv, self.yv, self.zv] # <<<<<<<<<<<<<< * * def __setstate__(self, state): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->xv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->yv); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->zv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyList_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_r = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("Scientific._vector.vector.__getstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_9__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_9__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_8__setstate__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), ((PyObject *)__pyx_v_state)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":56 * return [self.xv, self.yv, self.zv] * * def __setstate__(self, state): # <<<<<<<<<<<<<< * self.xv, self.yv, self.zv = state * */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_8__setstate__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *(*__pyx_t_5)(PyObject *); double __pyx_t_6; double __pyx_t_7; double __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); /* "Scientific/_vector.pyx":57 * * def __setstate__(self, state): * self.xv, self.yv, self.zv = state # <<<<<<<<<<<<<< * * def __reduce__(self): */ if ((likely(PyTuple_CheckExact(__pyx_v_state))) || (PyList_CheckExact(__pyx_v_state))) { PyObject* sequence = __pyx_v_state; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_2 = PyList_GET_ITEM(sequence, 1); __pyx_t_3 = PyList_GET_ITEM(sequence, 2); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); #endif } else { Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_state); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); index = 2; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; __pyx_L3_unpacking_failed:; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L4_unpacking_done:; } __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_8 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->xv = __pyx_t_6; __pyx_v_self->yv = __pyx_t_7; __pyx_v_self->zv = __pyx_t_8; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("Scientific._vector.vector.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_11__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_11__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_10__reduce__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":59 * self.xv, self.yv, self.zv = state * * def __reduce__(self): # <<<<<<<<<<<<<< * return (Vector, (self.xv, self.yv, self.zv)) * */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_10__reduce__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); /* "Scientific/_vector.pyx":60 * * def __reduce__(self): * return (Vector, (self.xv, self.yv, self.zv)) # <<<<<<<<<<<<<< * * cdef void set(self, double x, double y, double z): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->xv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->yv); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->zv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_Vector))); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_Vector))); __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_Vector))); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_r = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("Scientific._vector.vector.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":62 * return (Vector, (self.xv, self.yv, self.zv)) * * cdef void set(self, double x, double y, double z): # <<<<<<<<<<<<<< * self.xv = x * self.yv = y */ static void __pyx_f_10Scientific_7_vector_6vector_set(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, double __pyx_v_x, double __pyx_v_y, double __pyx_v_z) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set", 0); /* "Scientific/_vector.pyx":63 * * cdef void set(self, double x, double y, double z): * self.xv = x # <<<<<<<<<<<<<< * self.yv = y * self.zv = z */ __pyx_v_self->xv = __pyx_v_x; /* "Scientific/_vector.pyx":64 * cdef void set(self, double x, double y, double z): * self.xv = x * self.yv = y # <<<<<<<<<<<<<< * self.zv = z * */ __pyx_v_self->yv = __pyx_v_y; /* "Scientific/_vector.pyx":65 * self.xv = x * self.yv = y * self.zv = z # <<<<<<<<<<<<<< * * def x(self): */ __pyx_v_self->zv = __pyx_v_z; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_13x(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_10Scientific_7_vector_6vector_12x[] = "Returns the x coordinate."; static PyObject *__pyx_pw_10Scientific_7_vector_6vector_13x(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("x (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_12x(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":67 * self.zv = z * * def x(self): # <<<<<<<<<<<<<< * "Returns the x coordinate." * return self.xv */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_12x(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("x", 0); /* "Scientific/_vector.pyx":69 * def x(self): * "Returns the x coordinate." * return self.xv # <<<<<<<<<<<<<< * * def y(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->xv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.x", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_15y(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_10Scientific_7_vector_6vector_14y[] = "Returns the y coordinate."; static PyObject *__pyx_pw_10Scientific_7_vector_6vector_15y(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("y (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_14y(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":71 * return self.xv * * def y(self): # <<<<<<<<<<<<<< * "Returns the y coordinate." * return self.yv */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_14y(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("y", 0); /* "Scientific/_vector.pyx":73 * def y(self): * "Returns the y coordinate." * return self.yv # <<<<<<<<<<<<<< * * def z(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->yv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.y", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_17z(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_10Scientific_7_vector_6vector_16z[] = "Returns the z coordinate."; static PyObject *__pyx_pw_10Scientific_7_vector_6vector_17z(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("z (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_16z(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":75 * return self.yv * * def z(self): # <<<<<<<<<<<<<< * "Returns the z coordinate." * return self.zv */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_16z(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("z", 0); /* "Scientific/_vector.pyx":77 * def z(self): * "Returns the z coordinate." * return self.zv # <<<<<<<<<<<<<< * * def __repr__(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->zv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.z", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_19__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_19__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_18__repr__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":79 * return self.zv * * def __repr__(self): # <<<<<<<<<<<<<< * return 'Vector(%f,%f,%f)' % (self.xv, self.yv, self.zv) * */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_18__repr__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); /* "Scientific/_vector.pyx":80 * * def __repr__(self): * return 'Vector(%f,%f,%f)' % (self.xv, self.yv, self.zv) # <<<<<<<<<<<<<< * * def __str__(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->xv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->yv); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->zv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_r = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("Scientific._vector.vector.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_21__str__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_21__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_20__str__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":82 * return 'Vector(%f,%f,%f)' % (self.xv, self.yv, self.zv) * * def __str__(self): # <<<<<<<<<<<<<< * return str([self.xv, self.yv, self.zv]) * */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_20__str__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); /* "Scientific/_vector.pyx":83 * * def __str__(self): * return str([self.xv, self.yv, self.zv]) # <<<<<<<<<<<<<< * * def __add__(vector self, vector other): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->xv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->yv); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->zv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyList_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyList_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("Scientific._vector.vector.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_23__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_23__add__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__add__ (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_10Scientific_7_vector_vector, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_10Scientific_7_vector_vector, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_22__add__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_other)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":85 * return str([self.xv, self.yv, self.zv]) * * def __add__(vector self, vector other): # <<<<<<<<<<<<<< * result = vector() * vector.set(result, */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_22__add__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_other) { struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__add__", 0); /* "Scientific/_vector.pyx":86 * * def __add__(vector self, vector other): * result = vector() # <<<<<<<<<<<<<< * vector.set(result, * self.xv+other.xv, self.yv+other.yv, self.zv+other.zv) */ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_vector.pyx":88 * result = vector() * vector.set(result, * self.xv+other.xv, self.yv+other.yv, self.zv+other.zv) # <<<<<<<<<<<<<< * return result * */ __pyx_vtabptr_10Scientific_7_vector_vector->set(__pyx_v_result, (__pyx_v_self->xv + __pyx_v_other->xv), (__pyx_v_self->yv + __pyx_v_other->yv), (__pyx_v_self->zv + __pyx_v_other->zv)); /* "Scientific/_vector.pyx":89 * vector.set(result, * self.xv+other.xv, self.yv+other.yv, self.zv+other.zv) * return result # <<<<<<<<<<<<<< * * def __neg__(vector self): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.__add__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_25__neg__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_25__neg__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__neg__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_24__neg__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":91 * return result * * def __neg__(vector self): # <<<<<<<<<<<<<< * result = vector() * vector.set(result, -self.xv, -self.yv, -self.zv) */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_24__neg__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__neg__", 0); /* "Scientific/_vector.pyx":92 * * def __neg__(vector self): * result = vector() # <<<<<<<<<<<<<< * vector.set(result, -self.xv, -self.yv, -self.zv) * return result */ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_vector.pyx":93 * def __neg__(vector self): * result = vector() * vector.set(result, -self.xv, -self.yv, -self.zv) # <<<<<<<<<<<<<< * return result * */ __pyx_vtabptr_10Scientific_7_vector_vector->set(__pyx_v_result, (-__pyx_v_self->xv), (-__pyx_v_self->yv), (-__pyx_v_self->zv)); /* "Scientific/_vector.pyx":94 * result = vector() * vector.set(result, -self.xv, -self.yv, -self.zv) * return result # <<<<<<<<<<<<<< * * def __sub__(vector self, vector other): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.__neg__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_27__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_27__sub__(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__sub__ (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_10Scientific_7_vector_vector, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_10Scientific_7_vector_vector, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_26__sub__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_other)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":96 * return result * * def __sub__(vector self, vector other): # <<<<<<<<<<<<<< * result = vector() * vector.set(result, */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_26__sub__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_other) { struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__sub__", 0); /* "Scientific/_vector.pyx":97 * * def __sub__(vector self, vector other): * result = vector() # <<<<<<<<<<<<<< * vector.set(result, * self.xv-other.xv, self.yv-other.yv, self.zv-other.zv) */ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_vector.pyx":99 * result = vector() * vector.set(result, * self.xv-other.xv, self.yv-other.yv, self.zv-other.zv) # <<<<<<<<<<<<<< * return result * */ __pyx_vtabptr_10Scientific_7_vector_vector->set(__pyx_v_result, (__pyx_v_self->xv - __pyx_v_other->xv), (__pyx_v_self->yv - __pyx_v_other->yv), (__pyx_v_self->zv - __pyx_v_other->zv)); /* "Scientific/_vector.pyx":100 * vector.set(result, * self.xv-other.xv, self.yv-other.yv, self.zv-other.zv) * return result # <<<<<<<<<<<<<< * * def __mul__(x, y): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.__sub__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_29__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_29__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_28__mul__(((PyObject *)__pyx_v_x), ((PyObject *)__pyx_v_y)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":102 * return result * * def __mul__(x, y): # <<<<<<<<<<<<<< * cdef vector v1, v2 * cdef int rmul */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_28__mul__(PyObject *__pyx_v_x, PyObject *__pyx_v_y) { struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_v1 = 0; struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_v2 = 0; int __pyx_v_rmul; PyObject *__pyx_v_Geometry = NULL; PyObject *__pyx_v_product = NULL; struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; double __pyx_t_9; double __pyx_t_10; double __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__mul__", 0); __Pyx_INCREF(__pyx_v_x); __Pyx_INCREF(__pyx_v_y); /* "Scientific/_vector.pyx":105 * cdef vector v1, v2 * cdef int rmul * from Scientific import Geometry # <<<<<<<<<<<<<< * rmul = 0 * if isinstance(y, vector): */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__Geometry)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Geometry)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Geometry)); __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__Scientific), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__Geometry); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __pyx_v_Geometry = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "Scientific/_vector.pyx":106 * cdef int rmul * from Scientific import Geometry * rmul = 0 # <<<<<<<<<<<<<< * if isinstance(y, vector): * if isinstance(x, vector): */ __pyx_v_rmul = 0; /* "Scientific/_vector.pyx":107 * from Scientific import Geometry * rmul = 0 * if isinstance(y, vector): # <<<<<<<<<<<<<< * if isinstance(x, vector): * v1 = x */ __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_y, ((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)); __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { /* "Scientific/_vector.pyx":108 * rmul = 0 * if isinstance(y, vector): * if isinstance(x, vector): # <<<<<<<<<<<<<< * v1 = x * v2 = y */ __pyx_t_4 = __Pyx_TypeCheck(__pyx_v_x, ((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)); __pyx_t_3 = (__pyx_t_4 != 0); if (__pyx_t_3) { /* "Scientific/_vector.pyx":109 * if isinstance(y, vector): * if isinstance(x, vector): * v1 = x # <<<<<<<<<<<<<< * v2 = y * return v1.xv*v2.xv+v1.yv*v2.yv+v1.zv*v2.zv */ if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_10Scientific_7_vector_vector))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_x); __pyx_v_v1 = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_x); /* "Scientific/_vector.pyx":110 * if isinstance(x, vector): * v1 = x * v2 = y # <<<<<<<<<<<<<< * return v1.xv*v2.xv+v1.yv*v2.yv+v1.zv*v2.zv * else: */ if (!(likely(((__pyx_v_y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_y, __pyx_ptype_10Scientific_7_vector_vector))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_y); __pyx_v_v2 = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_y); /* "Scientific/_vector.pyx":111 * v1 = x * v2 = y * return v1.xv*v2.xv+v1.yv*v2.yv+v1.zv*v2.zv # <<<<<<<<<<<<<< * else: * x, y = y, x */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyFloat_FromDouble((((__pyx_v_v1->xv * __pyx_v_v2->xv) + (__pyx_v_v1->yv * __pyx_v_v2->yv)) + (__pyx_v_v1->zv * __pyx_v_v2->zv))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; goto __pyx_L4; } /*else*/ { /* "Scientific/_vector.pyx":113 * return v1.xv*v2.xv+v1.yv*v2.yv+v1.zv*v2.zv * else: * x, y = y, x # <<<<<<<<<<<<<< * rmul = 1 * if Geometry.isTensor(y): */ __pyx_t_5 = __pyx_v_y; __pyx_t_6 = __pyx_v_x; __pyx_v_x = __pyx_t_5; __pyx_t_5 = 0; __pyx_v_y = __pyx_t_6; __pyx_t_6 = 0; /* "Scientific/_vector.pyx":114 * else: * x, y = y, x * rmul = 1 # <<<<<<<<<<<<<< * if Geometry.isTensor(y): * if rmul: */ __pyx_v_rmul = 1; } __pyx_L4:; goto __pyx_L3; } __pyx_L3:; /* "Scientific/_vector.pyx":115 * x, y = y, x * rmul = 1 * if Geometry.isTensor(y): # <<<<<<<<<<<<<< * if rmul: * product = y.dot(Geometry.Tensor(x.array, 1)) */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Geometry, __pyx_n_s__isTensor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_y); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_y); __Pyx_GIVEREF(__pyx_v_y); __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_3) { /* "Scientific/_vector.pyx":116 * rmul = 1 * if Geometry.isTensor(y): * if rmul: # <<<<<<<<<<<<<< * product = y.dot(Geometry.Tensor(x.array, 1)) * else: */ __pyx_t_3 = (__pyx_v_rmul != 0); if (__pyx_t_3) { /* "Scientific/_vector.pyx":117 * if Geometry.isTensor(y): * if rmul: * product = y.dot(Geometry.Tensor(x.array, 1)) # <<<<<<<<<<<<<< * else: * product = Geometry.Tensor(x.array, 1).dot(y) */ __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_y, __pyx_n_s__dot); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Geometry, __pyx_n_s__Tensor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s__array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_v_product = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L6; } /*else*/ { /* "Scientific/_vector.pyx":119 * product = y.dot(Geometry.Tensor(x.array, 1)) * else: * product = Geometry.Tensor(x.array, 1).dot(y) # <<<<<<<<<<<<<< * if product.rank == 1: * result = vector() */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Geometry, __pyx_n_s__Tensor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s__array); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s__dot); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_y); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_y); __Pyx_GIVEREF(__pyx_v_y); __pyx_t_2 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_v_product = __pyx_t_2; __pyx_t_2 = 0; } __pyx_L6:; /* "Scientific/_vector.pyx":120 * else: * product = Geometry.Tensor(x.array, 1).dot(y) * if product.rank == 1: # <<<<<<<<<<<<<< * result = vector() * vector.set(result, product.array[0], */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_product, __pyx_n_s__rank); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_3) { /* "Scientific/_vector.pyx":121 * product = Geometry.Tensor(x.array, 1).dot(y) * if product.rank == 1: * result = vector() # <<<<<<<<<<<<<< * vector.set(result, product.array[0], * product.array[1], product.array[2]) */ __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_v_result = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_t_8); __pyx_t_8 = 0; /* "Scientific/_vector.pyx":122 * if product.rank == 1: * result = vector() * vector.set(result, product.array[0], # <<<<<<<<<<<<<< * product.array[1], product.array[2]) * return result */ __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_product, __pyx_n_s__array); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 0, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "Scientific/_vector.pyx":123 * result = vector() * vector.set(result, product.array[0], * product.array[1], product.array[2]) # <<<<<<<<<<<<<< * return result * else: */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_product, __pyx_n_s__array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_product, __pyx_n_s__array); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_8, 2, sizeof(long), PyInt_FromLong, 0, 0, 1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_vtabptr_10Scientific_7_vector_vector->set(__pyx_v_result, __pyx_t_9, __pyx_t_10, __pyx_t_11); /* "Scientific/_vector.pyx":124 * vector.set(result, product.array[0], * product.array[1], product.array[2]) * return result # <<<<<<<<<<<<<< * else: * return product */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; goto __pyx_L7; } /*else*/ { /* "Scientific/_vector.pyx":126 * return result * else: * return product # <<<<<<<<<<<<<< * elif hasattr(y, "_product_with_vector"): * return y._product_with_vector(x) */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_product); __pyx_r = __pyx_v_product; goto __pyx_L0; } __pyx_L7:; goto __pyx_L5; } /* "Scientific/_vector.pyx":127 * else: * return product * elif hasattr(y, "_product_with_vector"): # <<<<<<<<<<<<<< * return y._product_with_vector(x) * else: */ __pyx_t_3 = PyObject_HasAttr(__pyx_v_y, ((PyObject *)__pyx_n_s_2)); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { /* "Scientific/_vector.pyx":128 * return product * elif hasattr(y, "_product_with_vector"): * return y._product_with_vector(x) # <<<<<<<<<<<<<< * else: * v1 = x */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_y, __pyx_n_s_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_x); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0; goto __pyx_L5; } /*else*/ { /* "Scientific/_vector.pyx":130 * return y._product_with_vector(x) * else: * v1 = x # <<<<<<<<<<<<<< * result = vector() * vector.set(result, v1.xv*y, v1.yv*y, v1.zv*y) */ if (!(likely(((__pyx_v_x) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_x, __pyx_ptype_10Scientific_7_vector_vector))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_x); __pyx_v_v1 = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_x); /* "Scientific/_vector.pyx":131 * else: * v1 = x * result = vector() # <<<<<<<<<<<<<< * vector.set(result, v1.xv*y, v1.yv*y, v1.zv*y) * return result */ __pyx_t_7 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_v_result = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_t_7); __pyx_t_7 = 0; /* "Scientific/_vector.pyx":132 * v1 = x * result = vector() * vector.set(result, v1.xv*y, v1.yv*y, v1.zv*y) # <<<<<<<<<<<<<< * return result * */ __pyx_t_7 = PyFloat_FromDouble(__pyx_v_v1->xv); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyNumber_Multiply(__pyx_t_7, __pyx_v_y); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyFloat_FromDouble(__pyx_v_v1->yv); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = PyNumber_Multiply(__pyx_t_8, __pyx_v_y); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_7); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyFloat_FromDouble(__pyx_v_v1->zv); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyNumber_Multiply(__pyx_t_7, __pyx_v_y); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_8); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_vtabptr_10Scientific_7_vector_vector->set(__pyx_v_result, __pyx_t_11, __pyx_t_10, __pyx_t_9); /* "Scientific/_vector.pyx":133 * result = vector() * vector.set(result, v1.xv*y, v1.yv*y, v1.zv*y) * return result # <<<<<<<<<<<<<< * * def __div__(vector self, double factor): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; } __pyx_L5:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("Scientific._vector.vector.__mul__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_v1); __Pyx_XDECREF((PyObject *)__pyx_v_v2); __Pyx_XDECREF(__pyx_v_Geometry); __Pyx_XDECREF(__pyx_v_product); __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XDECREF(__pyx_v_x); __Pyx_XDECREF(__pyx_v_y); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ #if PY_MAJOR_VERSION < 3 static PyObject *__pyx_pw_10Scientific_7_vector_6vector_31__div__(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_31__div__(PyObject *__pyx_v_self, PyObject *__pyx_arg_factor) { double __pyx_v_factor; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__div__ (wrapper)", 0); assert(__pyx_arg_factor); { __pyx_v_factor = __pyx_PyFloat_AsDouble(__pyx_arg_factor); if (unlikely((__pyx_v_factor == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("Scientific._vector.vector.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_10Scientific_7_vector_vector, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_30__div__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), ((double)__pyx_v_factor)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ /* "Scientific/_vector.pyx":135 * return result * * def __div__(vector self, double factor): # <<<<<<<<<<<<<< * result = vector() * vector.set(result, self.xv/factor, self.yv/factor, self.zv/factor) */ #if PY_MAJOR_VERSION < 3 static PyObject *__pyx_pf_10Scientific_7_vector_6vector_30__div__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, double __pyx_v_factor) { struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__div__", 0); /* "Scientific/_vector.pyx":136 * * def __div__(vector self, double factor): * result = vector() # <<<<<<<<<<<<<< * vector.set(result, self.xv/factor, self.yv/factor, self.zv/factor) * return result */ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_vector.pyx":137 * def __div__(vector self, double factor): * result = vector() * vector.set(result, self.xv/factor, self.yv/factor, self.zv/factor) # <<<<<<<<<<<<<< * return result * */ if (unlikely(__pyx_v_factor == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(__pyx_v_factor == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(__pyx_v_factor == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_vtabptr_10Scientific_7_vector_vector->set(__pyx_v_result, (__pyx_v_self->xv / __pyx_v_factor), (__pyx_v_self->yv / __pyx_v_factor), (__pyx_v_self->zv / __pyx_v_factor)); /* "Scientific/_vector.pyx":138 * result = vector() * vector.set(result, self.xv/factor, self.yv/factor, self.zv/factor) * return result # <<<<<<<<<<<<<< * * __truediv__ = __div__ */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.__div__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } #endif /*!(#if PY_MAJOR_VERSION < 3)*/ /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_33__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_33__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_self), __pyx_ptype_10Scientific_7_vector_vector, 1, "self", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_32__richcmp__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":142 * __truediv__ = __div__ * * def __richcmp__(vector self, other, int op): # <<<<<<<<<<<<<< * if op != 2 and op != 3: * return NotImplemented */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_32__richcmp__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { PyObject *__pyx_v_eq = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); /* "Scientific/_vector.pyx":143 * * def __richcmp__(vector self, other, int op): * if op != 2 and op != 3: # <<<<<<<<<<<<<< * return NotImplemented * if isinstance(other, vector): */ switch (__pyx_v_op) { case 2: case 3: __pyx_t_1 = 0; break; default: __pyx_t_1 = 1; break; } if (__pyx_t_1) { /* "Scientific/_vector.pyx":144 * def __richcmp__(vector self, other, int op): * if op != 2 and op != 3: * return NotImplemented # <<<<<<<<<<<<<< * if isinstance(other, vector): * eq = self.xv == other.x() and self.yv == other.y() \ */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_builtin_NotImplemented); __pyx_r = __pyx_builtin_NotImplemented; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "Scientific/_vector.pyx":145 * if op != 2 and op != 3: * return NotImplemented * if isinstance(other, vector): # <<<<<<<<<<<<<< * eq = self.xv == other.x() and self.yv == other.y() \ * and self.zv == other.z() */ __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "Scientific/_vector.pyx":146 * return NotImplemented * if isinstance(other, vector): * eq = self.xv == other.x() and self.yv == other.y() \ # <<<<<<<<<<<<<< * and self.zv == other.z() * else: */ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->xv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s__x); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "Scientific/_vector.pyx":147 * if isinstance(other, vector): * eq = self.xv == other.x() and self.yv == other.y() \ * and self.zv == other.z() # <<<<<<<<<<<<<< * else: * eq = False */ __pyx_t_5 = PyFloat_FromDouble(__pyx_v_self->yv); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); /* "Scientific/_vector.pyx":146 * return NotImplemented * if isinstance(other, vector): * eq = self.xv == other.x() and self.yv == other.y() \ # <<<<<<<<<<<<<< * and self.zv == other.z() * else: */ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s__y); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "Scientific/_vector.pyx":147 * if isinstance(other, vector): * eq = self.xv == other.x() and self.yv == other.y() \ * and self.zv == other.z() # <<<<<<<<<<<<<< * else: * eq = False */ __pyx_t_6 = PyFloat_FromDouble(__pyx_v_self->zv); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s__z); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_6, __pyx_t_7, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __pyx_t_5; __pyx_t_5 = 0; } else { __pyx_t_7 = __pyx_t_3; __pyx_t_3 = 0; } __pyx_t_3 = __pyx_t_7; __pyx_t_7 = 0; } else { __pyx_t_3 = __pyx_t_4; __pyx_t_4 = 0; } __pyx_v_eq = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L4; } /*else*/ { /* "Scientific/_vector.pyx":149 * and self.zv == other.z() * else: * eq = False # <<<<<<<<<<<<<< * if op == 2: * return eq */ __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_eq = __pyx_t_3; __pyx_t_3 = 0; } __pyx_L4:; /* "Scientific/_vector.pyx":150 * else: * eq = False * if op == 2: # <<<<<<<<<<<<<< * return eq * else: */ __pyx_t_2 = ((__pyx_v_op == 2) != 0); if (__pyx_t_2) { /* "Scientific/_vector.pyx":151 * eq = False * if op == 2: * return eq # <<<<<<<<<<<<<< * else: * return not eq */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_eq); __pyx_r = __pyx_v_eq; goto __pyx_L0; goto __pyx_L5; } /*else*/ { /* "Scientific/_vector.pyx":153 * return eq * else: * return not eq # <<<<<<<<<<<<<< * * def __len__(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_eq); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; } __pyx_L5:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("Scientific._vector.vector.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_eq); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static Py_ssize_t __pyx_pw_10Scientific_7_vector_6vector_35__len__(PyObject *__pyx_v_self); /*proto*/ static Py_ssize_t __pyx_pw_10Scientific_7_vector_6vector_35__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_34__len__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":155 * return not eq * * def __len__(self): # <<<<<<<<<<<<<< * return 3 * */ static Py_ssize_t __pyx_pf_10Scientific_7_vector_6vector_34__len__(CYTHON_UNUSED struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__", 0); /* "Scientific/_vector.pyx":156 * * def __len__(self): * return 3 # <<<<<<<<<<<<<< * * def __getitem__(self, int index): */ __pyx_r = 3; goto __pyx_L0; __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_37__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_37__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_index) { int __pyx_v_index; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); assert(__pyx_arg_index); { __pyx_v_index = __Pyx_PyInt_AsInt(__pyx_arg_index); if (unlikely((__pyx_v_index == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("Scientific._vector.vector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_36__getitem__(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), ((int)__pyx_v_index)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":158 * return 3 * * def __getitem__(self, int index): # <<<<<<<<<<<<<< * if index == 0 or index == -3: * return self.xv */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_36__getitem__(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, int __pyx_v_index) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); /* "Scientific/_vector.pyx":163 * elif index == 1 or index == -2: * return self.yv * elif index == 2 or index == -1: # <<<<<<<<<<<<<< * return self.zv * raise IndexError */ switch (__pyx_v_index) { /* "Scientific/_vector.pyx":159 * * def __getitem__(self, int index): * if index == 0 or index == -3: # <<<<<<<<<<<<<< * return self.xv * elif index == 1 or index == -2: */ case 0: case -3: /* "Scientific/_vector.pyx":160 * def __getitem__(self, int index): * if index == 0 or index == -3: * return self.xv # <<<<<<<<<<<<<< * elif index == 1 or index == -2: * return self.yv */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->xv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; break; /* "Scientific/_vector.pyx":161 * if index == 0 or index == -3: * return self.xv * elif index == 1 or index == -2: # <<<<<<<<<<<<<< * return self.yv * elif index == 2 or index == -1: */ case 1: case -2: /* "Scientific/_vector.pyx":162 * return self.xv * elif index == 1 or index == -2: * return self.yv # <<<<<<<<<<<<<< * elif index == 2 or index == -1: * return self.zv */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->yv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; break; /* "Scientific/_vector.pyx":163 * elif index == 1 or index == -2: * return self.yv * elif index == 2 or index == -1: # <<<<<<<<<<<<<< * return self.zv * raise IndexError */ case 2: case -1: /* "Scientific/_vector.pyx":164 * return self.yv * elif index == 2 or index == -1: * return self.zv # <<<<<<<<<<<<<< * raise IndexError * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->zv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; break; } /* "Scientific/_vector.pyx":165 * elif index == 2 or index == -1: * return self.zv * raise IndexError # <<<<<<<<<<<<<< * * def length(self): */ __Pyx_Raise(__pyx_builtin_IndexError, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_39length(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_10Scientific_7_vector_6vector_38length[] = "Returns the length (norm)."; static PyObject *__pyx_pw_10Scientific_7_vector_6vector_39length(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("length (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_38length(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":167 * raise IndexError * * def length(self): # <<<<<<<<<<<<<< * "Returns the length (norm)." * return sqrt(self.xv*self.xv+self.yv*self.yv+self.zv*self.zv) */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_38length(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("length", 0); /* "Scientific/_vector.pyx":169 * def length(self): * "Returns the length (norm)." * return sqrt(self.xv*self.xv+self.yv*self.yv+self.zv*self.zv) # <<<<<<<<<<<<<< * * def normal(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(sqrt((((__pyx_v_self->xv * __pyx_v_self->xv) + (__pyx_v_self->yv * __pyx_v_self->yv)) + (__pyx_v_self->zv * __pyx_v_self->zv)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.length", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_41normal(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_10Scientific_7_vector_6vector_40normal[] = "Returns a normalized copy."; static PyObject *__pyx_pw_10Scientific_7_vector_6vector_41normal(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("normal (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_40normal(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":171 * return sqrt(self.xv*self.xv+self.yv*self.yv+self.zv*self.zv) * * def normal(self): # <<<<<<<<<<<<<< * "Returns a normalized copy." * cdef double len */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_40normal(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { double __pyx_v_len; struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("normal", 0); /* "Scientific/_vector.pyx":174 * "Returns a normalized copy." * cdef double len * len = sqrt(self.xv*self.xv+self.yv*self.yv+self.zv*self.zv) # <<<<<<<<<<<<<< * if len == 0: * raise ZeroDivisionError, "Can't normalize a zero-length vector" */ __pyx_v_len = sqrt((((__pyx_v_self->xv * __pyx_v_self->xv) + (__pyx_v_self->yv * __pyx_v_self->yv)) + (__pyx_v_self->zv * __pyx_v_self->zv))); /* "Scientific/_vector.pyx":175 * cdef double len * len = sqrt(self.xv*self.xv+self.yv*self.yv+self.zv*self.zv) * if len == 0: # <<<<<<<<<<<<<< * raise ZeroDivisionError, "Can't normalize a zero-length vector" * result = vector() */ __pyx_t_1 = ((__pyx_v_len == 0.0) != 0); if (__pyx_t_1) { /* "Scientific/_vector.pyx":176 * len = sqrt(self.xv*self.xv+self.yv*self.yv+self.zv*self.zv) * if len == 0: * raise ZeroDivisionError, "Can't normalize a zero-length vector" # <<<<<<<<<<<<<< * result = vector() * vector.set(result, self.xv/len, self.yv/len, self.zv/len) */ __Pyx_Raise(__pyx_builtin_ZeroDivisionError, ((PyObject *)__pyx_kp_s_3), 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "Scientific/_vector.pyx":177 * if len == 0: * raise ZeroDivisionError, "Can't normalize a zero-length vector" * result = vector() # <<<<<<<<<<<<<< * vector.set(result, self.xv/len, self.yv/len, self.zv/len) * return result */ __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_result = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_t_2); __pyx_t_2 = 0; /* "Scientific/_vector.pyx":178 * raise ZeroDivisionError, "Can't normalize a zero-length vector" * result = vector() * vector.set(result, self.xv/len, self.yv/len, self.zv/len) # <<<<<<<<<<<<<< * return result * */ if (unlikely(__pyx_v_len == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(__pyx_v_len == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (unlikely(__pyx_v_len == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_vtabptr_10Scientific_7_vector_vector->set(__pyx_v_result, (__pyx_v_self->xv / __pyx_v_len), (__pyx_v_self->yv / __pyx_v_len), (__pyx_v_self->zv / __pyx_v_len)); /* "Scientific/_vector.pyx":179 * result = vector() * vector.set(result, self.xv/len, self.yv/len, self.zv/len) * return result # <<<<<<<<<<<<<< * * def cross(vector self, vector other): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("Scientific._vector.vector.normal", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_43cross(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ static char __pyx_doc_10Scientific_7_vector_6vector_42cross[] = "Returns the cross product with vector |other|."; static PyObject *__pyx_pw_10Scientific_7_vector_6vector_43cross(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cross (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_10Scientific_7_vector_vector, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_42cross(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_other)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":181 * return result * * def cross(vector self, vector other): # <<<<<<<<<<<<<< * "Returns the cross product with vector |other|." * result = vector() */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_42cross(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_other) { struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cross", 0); /* "Scientific/_vector.pyx":183 * def cross(vector self, vector other): * "Returns the cross product with vector |other|." * result = vector() # <<<<<<<<<<<<<< * vector.set(result, self.yv*other.zv-self.zv*other.yv, * self.zv*other.xv-self.xv*other.zv, */ __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_result = ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_vector.pyx":186 * vector.set(result, self.yv*other.zv-self.zv*other.yv, * self.zv*other.xv-self.xv*other.zv, * self.xv*other.yv-self.yv*other.xv) # <<<<<<<<<<<<<< * return result * */ __pyx_vtabptr_10Scientific_7_vector_vector->set(__pyx_v_result, ((__pyx_v_self->yv * __pyx_v_other->zv) - (__pyx_v_self->zv * __pyx_v_other->yv)), ((__pyx_v_self->zv * __pyx_v_other->xv) - (__pyx_v_self->xv * __pyx_v_other->zv)), ((__pyx_v_self->xv * __pyx_v_other->yv) - (__pyx_v_self->yv * __pyx_v_other->xv))); /* "Scientific/_vector.pyx":187 * self.zv*other.xv-self.xv*other.zv, * self.xv*other.yv-self.yv*other.xv) * return result # <<<<<<<<<<<<<< * * def angle(vector self, vector other): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_result)); __pyx_r = ((PyObject *)__pyx_v_result); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("Scientific._vector.vector.cross", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_result); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_45angle(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ static char __pyx_doc_10Scientific_7_vector_6vector_44angle[] = "Returns the angle to vector |other|."; static PyObject *__pyx_pw_10Scientific_7_vector_6vector_45angle(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { CYTHON_UNUSED int __pyx_lineno = 0; CYTHON_UNUSED const char *__pyx_filename = NULL; CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("angle (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_other), __pyx_ptype_10Scientific_7_vector_vector, 1, "other", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_44angle(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), ((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_other)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":189 * return result * * def angle(vector self, vector other): # <<<<<<<<<<<<<< * "Returns the angle to vector |other|." * cdef double cosa */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_44angle(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_other) { double __pyx_v_cosa; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations double __pyx_t_1; double __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("angle", 0); /* "Scientific/_vector.pyx":192 * "Returns the angle to vector |other|." * cdef double cosa * cosa = (self.xv*other.xv+self.yv*other.yv+self.zv*other.zv) / \ # <<<<<<<<<<<<<< * sqrt((self.xv*self.xv+self.yv*self.yv+self.zv*self.zv)* * (other.xv*other.xv+other.yv*other.yv+other.zv*other.zv)) */ __pyx_t_1 = (((__pyx_v_self->xv * __pyx_v_other->xv) + (__pyx_v_self->yv * __pyx_v_other->yv)) + (__pyx_v_self->zv * __pyx_v_other->zv)); /* "Scientific/_vector.pyx":194 * cosa = (self.xv*other.xv+self.yv*other.yv+self.zv*other.zv) / \ * sqrt((self.xv*self.xv+self.yv*self.yv+self.zv*self.zv)* * (other.xv*other.xv+other.yv*other.yv+other.zv*other.zv)) # <<<<<<<<<<<<<< * if cosa > 1.: * cosa = 1. */ __pyx_t_2 = sqrt(((((__pyx_v_self->xv * __pyx_v_self->xv) + (__pyx_v_self->yv * __pyx_v_self->yv)) + (__pyx_v_self->zv * __pyx_v_self->zv)) * (((__pyx_v_other->xv * __pyx_v_other->xv) + (__pyx_v_other->yv * __pyx_v_other->yv)) + (__pyx_v_other->zv * __pyx_v_other->zv)))); if (unlikely(__pyx_t_2 == 0)) { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif PyErr_Format(PyExc_ZeroDivisionError, "float division"); #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_cosa = (__pyx_t_1 / __pyx_t_2); /* "Scientific/_vector.pyx":195 * sqrt((self.xv*self.xv+self.yv*self.yv+self.zv*self.zv)* * (other.xv*other.xv+other.yv*other.yv+other.zv*other.zv)) * if cosa > 1.: # <<<<<<<<<<<<<< * cosa = 1. * if cosa < -1.: */ __pyx_t_3 = ((__pyx_v_cosa > 1.) != 0); if (__pyx_t_3) { /* "Scientific/_vector.pyx":196 * (other.xv*other.xv+other.yv*other.yv+other.zv*other.zv)) * if cosa > 1.: * cosa = 1. # <<<<<<<<<<<<<< * if cosa < -1.: * cosa = -1. */ __pyx_v_cosa = 1.; goto __pyx_L3; } __pyx_L3:; /* "Scientific/_vector.pyx":197 * if cosa > 1.: * cosa = 1. * if cosa < -1.: # <<<<<<<<<<<<<< * cosa = -1. * return acos(cosa) */ __pyx_t_3 = ((__pyx_v_cosa < -1.) != 0); if (__pyx_t_3) { /* "Scientific/_vector.pyx":198 * cosa = 1. * if cosa < -1.: * cosa = -1. # <<<<<<<<<<<<<< * return acos(cosa) * */ __pyx_v_cosa = -1.; goto __pyx_L4; } __pyx_L4:; /* "Scientific/_vector.pyx":199 * if cosa < -1.: * cosa = -1. * return acos(cosa) # <<<<<<<<<<<<<< * * def asTensor(self): */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = PyFloat_FromDouble(acos(__pyx_v_cosa)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("Scientific._vector.vector.angle", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_47asTensor(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_10Scientific_7_vector_6vector_46asTensor[] = "Returns an equivalent tensor object of rank 1."; static PyObject *__pyx_pw_10Scientific_7_vector_6vector_47asTensor(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("asTensor (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_46asTensor(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":201 * return acos(cosa) * * def asTensor(self): # <<<<<<<<<<<<<< * "Returns an equivalent tensor object of rank 1." * from Scientific import Geometry */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_46asTensor(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self) { PyObject *__pyx_v_Geometry = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("asTensor", 0); /* "Scientific/_vector.pyx":203 * def asTensor(self): * "Returns an equivalent tensor object of rank 1." * from Scientific import Geometry # <<<<<<<<<<<<<< * return Geometry.Tensor(self.array, 1) * */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__Geometry)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Geometry)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Geometry)); __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__Scientific), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__Geometry); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __pyx_v_Geometry = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "Scientific/_vector.pyx":204 * "Returns an equivalent tensor object of rank 1." * from Scientific import Geometry * return Geometry.Tensor(self.array, 1) # <<<<<<<<<<<<<< * * def dyadicProduct(self, other): */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Geometry, __pyx_n_s__Tensor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("Scientific._vector.vector.asTensor", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_Geometry); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6vector_49dyadicProduct(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ static char __pyx_doc_10Scientific_7_vector_6vector_48dyadicProduct[] = "Returns the dyadic product with vector or tensor |other|."; static PyObject *__pyx_pw_10Scientific_7_vector_6vector_49dyadicProduct(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("dyadicProduct (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6vector_48dyadicProduct(((struct __pyx_obj_10Scientific_7_vector_vector *)__pyx_v_self), ((PyObject *)__pyx_v_other)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":206 * return Geometry.Tensor(self.array, 1) * * def dyadicProduct(self, other): # <<<<<<<<<<<<<< * "Returns the dyadic product with vector or tensor |other|." * from Scientific import Geometry */ static PyObject *__pyx_pf_10Scientific_7_vector_6vector_48dyadicProduct(struct __pyx_obj_10Scientific_7_vector_vector *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_v_Geometry = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("dyadicProduct", 0); /* "Scientific/_vector.pyx":208 * def dyadicProduct(self, other): * "Returns the dyadic product with vector or tensor |other|." * from Scientific import Geometry # <<<<<<<<<<<<<< * if isinstance(other, vector): * return Geometry.Tensor(self.array[:, np.newaxis] */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__Geometry)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__Geometry)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Geometry)); __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__Scientific), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s__Geometry); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __pyx_v_Geometry = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "Scientific/_vector.pyx":209 * "Returns the dyadic product with vector or tensor |other|." * from Scientific import Geometry * if isinstance(other, vector): # <<<<<<<<<<<<<< * return Geometry.Tensor(self.array[:, np.newaxis] * * other.array[np.newaxis, :], 1) */ __pyx_t_3 = __Pyx_TypeCheck(__pyx_v_other, ((PyObject*)__pyx_ptype_10Scientific_7_vector_vector)); __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { /* "Scientific/_vector.pyx":210 * from Scientific import Geometry * if isinstance(other, vector): * return Geometry.Tensor(self.array[:, np.newaxis] # <<<<<<<<<<<<<< * * other.array[np.newaxis, :], 1) * elif Geometry.isTensor(other): */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Geometry, __pyx_n_s__Tensor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); /* "Scientific/_vector.pyx":211 * if isinstance(other, vector): * return Geometry.Tensor(self.array[:, np.newaxis] * * other.array[np.newaxis, :], 1) # <<<<<<<<<<<<<< * elif Geometry.isTensor(other): * return Geometry.Tensor(self.array, 1)*other */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); /* "Scientific/_vector.pyx":210 * from Scientific import Geometry * if isinstance(other, vector): * return Geometry.Tensor(self.array[:, np.newaxis] # <<<<<<<<<<<<<< * * other.array[np.newaxis, :], 1) * elif Geometry.isTensor(other): */ __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s__newaxis); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_k_slice_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_k_slice_4); __Pyx_GIVEREF(__pyx_k_slice_4); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_t_5)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; /* "Scientific/_vector.pyx":211 * if isinstance(other, vector): * return Geometry.Tensor(self.array[:, np.newaxis] * * other.array[np.newaxis, :], 1) # <<<<<<<<<<<<<< * elif Geometry.isTensor(other): * return Geometry.Tensor(self.array, 1)*other */ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s__array); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__newaxis); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __Pyx_INCREF(__pyx_k_slice_5); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_k_slice_5); __Pyx_GIVEREF(__pyx_k_slice_5); __pyx_t_7 = 0; __pyx_t_7 = PyObject_GetItem(__pyx_t_5, ((PyObject *)__pyx_t_1)); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; goto __pyx_L3; } /* "Scientific/_vector.pyx":212 * return Geometry.Tensor(self.array[:, np.newaxis] * * other.array[np.newaxis, :], 1) * elif Geometry.isTensor(other): # <<<<<<<<<<<<<< * return Geometry.Tensor(self.array, 1)*other * else: */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Geometry, __pyx_n_s__isTensor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_other); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_other); __Pyx_GIVEREF(__pyx_v_other); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { /* "Scientific/_vector.pyx":213 * * other.array[np.newaxis, :], 1) * elif Geometry.isTensor(other): * return Geometry.Tensor(self.array, 1)*other # <<<<<<<<<<<<<< * else: * raise TypeError, "Dyadic product with non-vector" */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_Geometry, __pyx_n_s__Tensor); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__array); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_7 = 0; __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Multiply(__pyx_t_7, __pyx_v_other); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "Scientific/_vector.pyx":215 * return Geometry.Tensor(self.array, 1)*other * else: * raise TypeError, "Dyadic product with non-vector" # <<<<<<<<<<<<<< * * */ __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_s_6), 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("Scientific._vector.vector.dyadicProduct", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_Geometry); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_6Vector_23__safe_for_unpickling___1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_10Scientific_7_vector_6Vector_23__safe_for_unpickling___1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_6Vector_23__safe_for_unpickling_____get__(((struct __pyx_obj_10Scientific_7_vector_Vector *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":221 * * property __safe_for_unpickling__: * def __get__(self): # <<<<<<<<<<<<<< * return 1 * */ static PyObject *__pyx_pf_10Scientific_7_vector_6Vector_23__safe_for_unpickling_____get__(CYTHON_UNUSED struct __pyx_obj_10Scientific_7_vector_Vector *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* "Scientific/_vector.pyx":222 * property __safe_for_unpickling__: * def __get__(self): * return 1 # <<<<<<<<<<<<<< * * def __init__(self, x=None, y=None, z=None): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_int_1); __pyx_r = __pyx_int_1; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_10Scientific_7_vector_6Vector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_10Scientific_7_vector_6Vector_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_x = 0; PyObject *__pyx_v_y = 0; PyObject *__pyx_v_z = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__z,0}; PyObject* values[3] = {0,0,0}; /* "Scientific/_vector.pyx":224 * return 1 * * def __init__(self, x=None, y=None, z=None): # <<<<<<<<<<<<<< * if x is None: * pass # values are pre-initialized to zero */ values[0] = ((PyObject *)Py_None); values[1] = ((PyObject *)Py_None); values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); if (value) { values[0] = value; kw_args--; } } case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); if (value) { values[1] = value; kw_args--; } } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_x = values[0]; __pyx_v_y = values[1]; __pyx_v_z = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 0, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("Scientific._vector.Vector.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_10Scientific_7_vector_6Vector___init__(((struct __pyx_obj_10Scientific_7_vector_Vector *)__pyx_v_self), __pyx_v_x, __pyx_v_y, __pyx_v_z); __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_10Scientific_7_vector_6Vector___init__(struct __pyx_obj_10Scientific_7_vector_Vector *__pyx_v_self, PyObject *__pyx_v_x, PyObject *__pyx_v_y, PyObject *__pyx_v_z) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *(*__pyx_t_8)(PyObject *); double __pyx_t_9; double __pyx_t_10; double __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); /* "Scientific/_vector.pyx":225 * * def __init__(self, x=None, y=None, z=None): * if x is None: # <<<<<<<<<<<<<< * pass # values are pre-initialized to zero * elif y is None and z is None: */ __pyx_t_1 = (__pyx_v_x == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { goto __pyx_L3; } /* "Scientific/_vector.pyx":227 * if x is None: * pass # values are pre-initialized to zero * elif y is None and z is None: # <<<<<<<<<<<<<< * self.xv, self.yv, self.zv = x * else: */ __pyx_t_2 = (__pyx_v_y == Py_None); if ((__pyx_t_2 != 0)) { __pyx_t_1 = (__pyx_v_z == Py_None); __pyx_t_3 = (__pyx_t_1 != 0); } else { __pyx_t_3 = (__pyx_t_2 != 0); } if (__pyx_t_3) { /* "Scientific/_vector.pyx":228 * pass # values are pre-initialized to zero * elif y is None and z is None: * self.xv, self.yv, self.zv = x # <<<<<<<<<<<<<< * else: * self.xv = x */ if ((likely(PyTuple_CheckExact(__pyx_v_x))) || (PyList_CheckExact(__pyx_v_x))) { PyObject* sequence = __pyx_v_x; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 3)) { if (size > 3) __Pyx_RaiseTooManyValuesError(3); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 2); } else { __pyx_t_4 = PyList_GET_ITEM(sequence, 0); __pyx_t_5 = PyList_GET_ITEM(sequence, 1); __pyx_t_6 = PyList_GET_ITEM(sequence, 2); } __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); #else __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); #endif } else { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_x); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; index = 0; __pyx_t_4 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_4)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); index = 1; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); index = 2; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L4_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L5_unpacking_done; __pyx_L4_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L5_unpacking_done:; } __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_10 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_10 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_self->__pyx_base.xv = __pyx_t_9; __pyx_v_self->__pyx_base.yv = __pyx_t_10; __pyx_v_self->__pyx_base.zv = __pyx_t_11; goto __pyx_L3; } /*else*/ { /* "Scientific/_vector.pyx":230 * self.xv, self.yv, self.zv = x * else: * self.xv = x # <<<<<<<<<<<<<< * self.yv = y * self.zv = z */ __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_v_x); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->__pyx_base.xv = __pyx_t_11; /* "Scientific/_vector.pyx":231 * else: * self.xv = x * self.yv = y # <<<<<<<<<<<<<< * self.zv = z * */ __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_v_y); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->__pyx_base.yv = __pyx_t_11; /* "Scientific/_vector.pyx":232 * self.xv = x * self.yv = y * self.zv = z # <<<<<<<<<<<<<< * * # */ __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_v_z); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->__pyx_base.zv = __pyx_t_11; } __pyx_L3:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("Scientific._vector.Vector.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_10Scientific_7_vector_1isVector(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ static PyMethodDef __pyx_mdef_10Scientific_7_vector_1isVector = {__Pyx_NAMESTR("isVector"), (PyCFunction)__pyx_pw_10Scientific_7_vector_1isVector, METH_O, __Pyx_DOCSTR(0)}; static PyObject *__pyx_pw_10Scientific_7_vector_1isVector(PyObject *__pyx_self, PyObject *__pyx_v_x) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("isVector (wrapper)", 0); __pyx_r = __pyx_pf_10Scientific_7_vector_isVector(__pyx_self, ((PyObject *)__pyx_v_x)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "Scientific/_vector.pyx":239 * # as well and is probably more efficient. * # * def isVector(x): # <<<<<<<<<<<<<< * try: * return x.is_vector */ static PyObject *__pyx_pf_10Scientific_7_vector_isVector(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("isVector", 0); /* "Scientific/_vector.pyx":240 * # * def isVector(x): * try: # <<<<<<<<<<<<<< * return x.is_vector * except AttributeError: */ { __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); __Pyx_XGOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_t_2); __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { /* "Scientific/_vector.pyx":241 * def isVector(x): * try: * return x.is_vector # <<<<<<<<<<<<<< * except AttributeError: * return 0 */ __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_x, __pyx_n_s__is_vector); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L7_try_return; } __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L10_try_end; __pyx_L7_try_return:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L0; __pyx_L3_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "Scientific/_vector.pyx":242 * try: * return x.is_vector * except AttributeError: # <<<<<<<<<<<<<< * return 0 */ __pyx_t_5 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError); if (__pyx_t_5) { __Pyx_AddTraceback("Scientific._vector.isVector", __pyx_clineno, __pyx_lineno, __pyx_filename); if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); /* "Scientific/_vector.pyx":243 * return x.is_vector * except AttributeError: * return 0 # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_int_0); __pyx_r = __pyx_int_0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_except_return; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L4_exception_handled; } __pyx_L5_except_error:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L1_error; __pyx_L6_except_return:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); goto __pyx_L0; __pyx_L4_exception_handled:; __Pyx_XGIVEREF(__pyx_t_1); __Pyx_XGIVEREF(__pyx_t_2); __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); __pyx_L10_try_end:; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("Scientific._vector.isVector", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< * # This implementation of getbuffer is geared towards Cython * # requirements, and does not yet fullfill the PEP. */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; int __pyx_v_endian_detector; int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< * * cdef int copy_shape, i, ndim */ __pyx_t_1 = ((__pyx_v_info == NULL) != 0); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * */ __pyx_v_endian_detector = 1; /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< * else: * copy_shape = 0 */ __pyx_v_copy_shape = 1; goto __pyx_L4; } /*else*/ { /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) */ __pyx_v_copy_shape = 0; } __pyx_L4:; /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_1) { /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_3) { /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ __pyx_t_2 = (__pyx_v_copy_shape != 0); if (__pyx_t_2) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ __pyx_t_5 = __pyx_v_ndim; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } goto __pyx_L7; } /*else*/ { /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } __pyx_L7:; /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) */ __pyx_v_info->suboffsets = NULL; /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< * cdef dtype descr = self.descr * cdef list stack */ __pyx_v_f = NULL; /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); __Pyx_INCREF(__pyx_t_4); __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_2) { __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L10; } /*else*/ { /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ __Pyx_INCREF(((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } __pyx_L10:; /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): */ __pyx_t_5 = __pyx_v_descr->type_num; __pyx_v_t = __pyx_t_5; /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0); if (__pyx_t_1) { __pyx_t_2 = (__pyx_v_little_endian != 0); } else { __pyx_t_2 = __pyx_t_1; } if (!__pyx_t_2) { /* "numpy.pxd":256 * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0); if (__pyx_t_1) { __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; } __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ switch (__pyx_v_t) { /* "numpy.pxd":258 * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ case NPY_BYTE: __pyx_v_f = __pyx_k__b; break; /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ case NPY_UBYTE: __pyx_v_f = __pyx_k__B; break; /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ case NPY_SHORT: __pyx_v_f = __pyx_k__h; break; /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ case NPY_USHORT: __pyx_v_f = __pyx_k__H; break; /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ case NPY_INT: __pyx_v_f = __pyx_k__i; break; /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ case NPY_UINT: __pyx_v_f = __pyx_k__I; break; /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ case NPY_LONG: __pyx_v_f = __pyx_k__l; break; /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ case NPY_ULONG: __pyx_v_f = __pyx_k__L; break; /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ case NPY_LONGLONG: __pyx_v_f = __pyx_k__q; break; /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ case NPY_ULONGLONG: __pyx_v_f = __pyx_k__Q; break; /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ case NPY_FLOAT: __pyx_v_f = __pyx_k__f; break; /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ case NPY_DOUBLE: __pyx_v_f = __pyx_k__d; break; /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ case NPY_LONGDOUBLE: __pyx_v_f = __pyx_k__g; break; /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ case NPY_CFLOAT: __pyx_v_f = __pyx_k__Zf; break; /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ case NPY_CDOUBLE: __pyx_v_f = __pyx_k__Zd; break; /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ case NPY_CLONGDOUBLE: __pyx_v_f = __pyx_k__Zg; break; /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ case NPY_OBJECT: __pyx_v_f = __pyx_k__O; break; default: /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_13), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; goto __pyx_L11; } /*else*/ { /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = c'\0' # Terminate format string * */ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ (__pyx_v_f[0]) = '\x00'; } __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; } goto __pyx_L2; __pyx_L0:; if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":288 * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) */ free(__pyx_v_info->format); goto __pyx_L3; } __pyx_L3:; /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< * # info.shape was stored after info.strides in the same block * */ free(__pyx_v_info->strides); goto __pyx_L4; } __pyx_L4:; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(1, a) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(2, a, b) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(3, a, b, c) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(4, a, b, c, d) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< * return PyArray_MultiIterNew(5, a, b, c, d, e) * */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< * # Recursive utility function used in __getbuffer__ to get format * # string. The new location in the format string is returned. */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; PyObject *__pyx_v_fields = 0; PyObject *__pyx_v_childname = NULL; PyObject *__pyx_v_new_offset = NULL; PyObject *__pyx_v_t = NULL; char *__pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; long __pyx_t_11; char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) * cdef tuple fields */ __pyx_v_endian_detector = 1; /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * cdef tuple fields * */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } else if (1) { __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else { Py_ssize_t index = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); if (__pyx_t_7) { __pyx_t_8 = (__pyx_v_little_endian != 0); } else { __pyx_t_8 = __pyx_t_7; } if (!__pyx_t_8) { /* "numpy.pxd":802 * * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); if (__pyx_t_7) { __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; } __pyx_t_7 = __pyx_t_10; } else { __pyx_t_7 = __pyx_t_8; } if (__pyx_t_7) { /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< * f[0] = 120 # "x"; pad byte * f += 1 */ while (1) { __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_7) break; /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< * f += 1 * offset[0] += 1 */ (__pyx_v_f[0]) = 120; /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ __pyx_v_f = (__pyx_v_f + 1); /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ __pyx_t_11 = 0; (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_7) { /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (__pyx_t_7) { /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 98; goto __pyx_L13; } /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 66; goto __pyx_L13; } /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 104; goto __pyx_L13; } /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 72; goto __pyx_L13; } /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 105; goto __pyx_L13; } /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 73; goto __pyx_L13; } /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 108; goto __pyx_L13; } /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 76; goto __pyx_L13; } /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 113; goto __pyx_L13; } /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 81; goto __pyx_L13; } /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 102; goto __pyx_L13; } /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 100; goto __pyx_L13; } /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 103; goto __pyx_L13; } /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L13; } /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 79; goto __pyx_L13; } /*else*/ { /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_13), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } /*else*/ { /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_12; } __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< * * */ __pyx_r = __pyx_v_f; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_child); __Pyx_XDECREF(__pyx_v_fields); __Pyx_XDECREF(__pyx_v_childname); __Pyx_XDECREF(__pyx_v_new_offset); __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< * cdef PyObject* baseptr * if base is None: */ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< * baseptr = NULL * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< * else: * Py_INCREF(base) # important to do this before decref below! */ __pyx_v_baseptr = NULL; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< * baseptr = base * Py_XDECREF(arr.base) */ Py_INCREF(__pyx_v_base); /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< * Py_XDECREF(arr.base) * arr.base = baseptr */ __pyx_v_baseptr = ((PyObject *)__pyx_v_base); } __pyx_L3:; /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< * arr.base = baseptr * */ Py_XDECREF(__pyx_v_arr->base); /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< * * cdef inline object get_array_base(ndarray arr): */ __pyx_v_arr->base = __pyx_v_baseptr; __Pyx_RefNannyFinishContext(); } /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< * return None * else: */ __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< * else: * return arr.base */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; goto __pyx_L3; } /*else*/ { /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); __pyx_r = ((PyObject *)__pyx_v_arr->base); goto __pyx_L0; } __pyx_L3:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_vtabstruct_10Scientific_7_vector_vector __pyx_vtable_10Scientific_7_vector_vector; static PyObject *__pyx_tp_new_10Scientific_7_vector_vector(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_10Scientific_7_vector_vector *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; p = ((struct __pyx_obj_10Scientific_7_vector_vector *)o); p->__pyx_vtab = __pyx_vtabptr_10Scientific_7_vector_vector; return o; } static void __pyx_tp_dealloc_10Scientific_7_vector_vector(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } static PyObject *__pyx_sq_item_10Scientific_7_vector_vector(PyObject *o, Py_ssize_t i) { PyObject *r; PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); Py_DECREF(x); return r; } static PyObject *__pyx_getprop_10Scientific_7_vector_6vector_is_vector(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_10Scientific_7_vector_6vector_9is_vector_1__get__(o); } static PyObject *__pyx_getprop_10Scientific_7_vector_6vector_array(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_10Scientific_7_vector_6vector_5array_1__get__(o); } static PyObject *__pyx_getprop_10Scientific_7_vector_6vector___array_priority__(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_10Scientific_7_vector_6vector_18__array_priority___1__get__(o); } static PyMethodDef __pyx_methods_10Scientific_7_vector_vector[] = { {__Pyx_NAMESTR("__array_wrap__"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_1__array_wrap__, METH_O, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("__copy__"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_3__copy__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("__deepcopy__"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_5__deepcopy__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("__getstate__"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_7__getstate__, METH_NOARGS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_9__setstate__, METH_O, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_11__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("x"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_13x, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10Scientific_7_vector_6vector_12x)}, {__Pyx_NAMESTR("y"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_15y, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10Scientific_7_vector_6vector_14y)}, {__Pyx_NAMESTR("z"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_17z, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10Scientific_7_vector_6vector_16z)}, {__Pyx_NAMESTR("length"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_39length, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10Scientific_7_vector_6vector_38length)}, {__Pyx_NAMESTR("normal"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_41normal, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10Scientific_7_vector_6vector_40normal)}, {__Pyx_NAMESTR("cross"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_43cross, METH_O, __Pyx_DOCSTR(__pyx_doc_10Scientific_7_vector_6vector_42cross)}, {__Pyx_NAMESTR("angle"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_45angle, METH_O, __Pyx_DOCSTR(__pyx_doc_10Scientific_7_vector_6vector_44angle)}, {__Pyx_NAMESTR("asTensor"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_47asTensor, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_10Scientific_7_vector_6vector_46asTensor)}, {__Pyx_NAMESTR("dyadicProduct"), (PyCFunction)__pyx_pw_10Scientific_7_vector_6vector_49dyadicProduct, METH_O, __Pyx_DOCSTR(__pyx_doc_10Scientific_7_vector_6vector_48dyadicProduct)}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_10Scientific_7_vector_vector[] = { {(char *)"is_vector", __pyx_getprop_10Scientific_7_vector_6vector_is_vector, 0, 0, 0}, {(char *)"array", __pyx_getprop_10Scientific_7_vector_6vector_array, 0, 0, 0}, {(char *)"__array_priority__", __pyx_getprop_10Scientific_7_vector_6vector___array_priority__, 0, 0, 0}, {0, 0, 0, 0, 0} }; static PyNumberMethods __pyx_tp_as_number_vector = { __pyx_pw_10Scientific_7_vector_6vector_23__add__, /*nb_add*/ __pyx_pw_10Scientific_7_vector_6vector_27__sub__, /*nb_subtract*/ __pyx_pw_10Scientific_7_vector_6vector_29__mul__, /*nb_multiply*/ #if PY_MAJOR_VERSION < 3 __pyx_pw_10Scientific_7_vector_6vector_31__div__, /*nb_divide*/ #endif 0, /*nb_remainder*/ 0, /*nb_divmod*/ 0, /*nb_power*/ __pyx_pw_10Scientific_7_vector_6vector_25__neg__, /*nb_negative*/ 0, /*nb_positive*/ 0, /*nb_absolute*/ 0, /*nb_nonzero*/ 0, /*nb_invert*/ 0, /*nb_lshift*/ 0, /*nb_rshift*/ 0, /*nb_and*/ 0, /*nb_xor*/ 0, /*nb_or*/ #if PY_MAJOR_VERSION < 3 0, /*nb_coerce*/ #endif 0, /*nb_int*/ #if PY_MAJOR_VERSION < 3 0, /*nb_long*/ #else 0, /*reserved*/ #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ #endif #if PY_MAJOR_VERSION < 3 0, /*nb_hex*/ #endif 0, /*nb_inplace_add*/ 0, /*nb_inplace_subtract*/ 0, /*nb_inplace_multiply*/ #if PY_MAJOR_VERSION < 3 0, /*nb_inplace_divide*/ #endif 0, /*nb_inplace_remainder*/ 0, /*nb_inplace_power*/ 0, /*nb_inplace_lshift*/ 0, /*nb_inplace_rshift*/ 0, /*nb_inplace_and*/ 0, /*nb_inplace_xor*/ 0, /*nb_inplace_or*/ 0, /*nb_floor_divide*/ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ #endif }; static PySequenceMethods __pyx_tp_as_sequence_vector = { __pyx_pw_10Scientific_7_vector_6vector_35__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_10Scientific_7_vector_vector, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_vector = { __pyx_pw_10Scientific_7_vector_6vector_35__len__, /*mp_length*/ __pyx_pw_10Scientific_7_vector_6vector_37__getitem__, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyTypeObject __pyx_type_10Scientific_7_vector_vector = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("Scientific._vector.vector"), /*tp_name*/ sizeof(struct __pyx_obj_10Scientific_7_vector_vector), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_10Scientific_7_vector_vector, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif __pyx_pw_10Scientific_7_vector_6vector_19__repr__, /*tp_repr*/ &__pyx_tp_as_number_vector, /*tp_as_number*/ &__pyx_tp_as_sequence_vector, /*tp_as_sequence*/ &__pyx_tp_as_mapping_vector, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ __pyx_pw_10Scientific_7_vector_6vector_21__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ __pyx_pw_10Scientific_7_vector_6vector_33__richcmp__, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_10Scientific_7_vector_vector, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_10Scientific_7_vector_vector, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_10Scientific_7_vector_vector, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) 0, /*tp_finalize*/ #endif }; static struct __pyx_vtabstruct_10Scientific_7_vector_Vector __pyx_vtable_10Scientific_7_vector_Vector; static PyObject *__pyx_tp_new_10Scientific_7_vector_Vector(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_10Scientific_7_vector_Vector *p; PyObject *o = __pyx_tp_new_10Scientific_7_vector_vector(t, a, k); if (unlikely(!o)) return 0; p = ((struct __pyx_obj_10Scientific_7_vector_Vector *)o); p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_10Scientific_7_vector_vector*)__pyx_vtabptr_10Scientific_7_vector_Vector; return o; } static PyObject *__pyx_getprop_10Scientific_7_vector_6Vector___safe_for_unpickling__(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_10Scientific_7_vector_6Vector_23__safe_for_unpickling___1__get__(o); } static PyMethodDef __pyx_methods_10Scientific_7_vector_Vector[] = { {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_10Scientific_7_vector_Vector[] = { {(char *)"__safe_for_unpickling__", __pyx_getprop_10Scientific_7_vector_6Vector___safe_for_unpickling__, 0, 0, 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_type_10Scientific_7_vector_Vector = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("Scientific._vector.Vector"), /*tp_name*/ sizeof(struct __pyx_obj_10Scientific_7_vector_Vector), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_10Scientific_7_vector_vector, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #endif #if CYTHON_COMPILING_IN_PYPY __pyx_pw_10Scientific_7_vector_6vector_19__repr__, /*tp_repr*/ #else 0, /*tp_repr*/ #endif 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ #if CYTHON_COMPILING_IN_PYPY __pyx_pw_10Scientific_7_vector_6vector_21__str__, /*tp_str*/ #else 0, /*tp_str*/ #endif 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_10Scientific_7_vector_Vector, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_10Scientific_7_vector_Vector, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pw_10Scientific_7_vector_6Vector_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_10Scientific_7_vector_Vector, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) 0, /*tp_finalize*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif __Pyx_NAMESTR("_vector"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0}, {&__pyx_n_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 1}, {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, {&__pyx_n_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 1}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__AttributeError, __pyx_k__AttributeError, sizeof(__pyx_k__AttributeError), 0, 0, 1, 1}, {&__pyx_n_s__Geometry, __pyx_k__Geometry, sizeof(__pyx_k__Geometry), 0, 0, 1, 1}, {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1}, {&__pyx_n_s__NotImplemented, __pyx_k__NotImplemented, sizeof(__pyx_k__NotImplemented), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__Scientific, __pyx_k__Scientific, sizeof(__pyx_k__Scientific), 0, 0, 1, 1}, {&__pyx_n_s__Tensor, __pyx_k__Tensor, sizeof(__pyx_k__Tensor), 0, 0, 1, 1}, {&__pyx_n_s__TypeError, __pyx_k__TypeError, sizeof(__pyx_k__TypeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s__ZeroDivisionError, __pyx_k__ZeroDivisionError, sizeof(__pyx_k__ZeroDivisionError), 0, 0, 1, 1}, {&__pyx_n_s____div__, __pyx_k____div__, sizeof(__pyx_k____div__), 0, 0, 1, 1}, {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____truediv__, __pyx_k____truediv__, sizeof(__pyx_k____truediv__), 0, 0, 1, 1}, {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1}, {&__pyx_n_s__dot, __pyx_k__dot, sizeof(__pyx_k__dot), 0, 0, 1, 1}, {&__pyx_n_s__isTensor, __pyx_k__isTensor, sizeof(__pyx_k__isTensor), 0, 0, 1, 1}, {&__pyx_n_s__isVector, __pyx_k__isVector, sizeof(__pyx_k__isVector), 0, 0, 1, 1}, {&__pyx_n_s__is_vector, __pyx_k__is_vector, sizeof(__pyx_k__is_vector), 0, 0, 1, 1}, {&__pyx_n_s__memo, __pyx_k__memo, sizeof(__pyx_k__memo), 0, 0, 1, 1}, {&__pyx_n_s__newaxis, __pyx_k__newaxis, sizeof(__pyx_k__newaxis), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__rank, __pyx_k__rank, sizeof(__pyx_k__rank), 0, 0, 1, 1}, {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ZeroDivisionError = __Pyx_GetBuiltinName(__pyx_n_s__ZeroDivisionError); if (!__pyx_builtin_ZeroDivisionError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s__AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "Scientific/_vector.pyx":210 * from Scientific import Geometry * if isinstance(other, vector): * return Geometry.Tensor(self.array[:, np.newaxis] # <<<<<<<<<<<<<< * * other.array[np.newaxis, :], 1) * elif Geometry.isTensor(other): */ __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_4); __Pyx_GIVEREF(__pyx_k_slice_4); /* "Scientific/_vector.pyx":211 * if isinstance(other, vector): * return Geometry.Tensor(self.array[:, np.newaxis] * * other.array[np.newaxis, :], 1) # <<<<<<<<<<<<<< * elif Geometry.isTensor(other): * return Geometry.Tensor(self.array, 1)*other */ __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_5); __Pyx_GIVEREF(__pyx_k_slice_5); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == c'>' and little_endian) or */ __pyx_k_tuple_15 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_14)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_15); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_16); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_18); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); /* "Scientific/_vector.pyx":239 * # as well and is probably more efficient. * # * def isVector(x): # <<<<<<<<<<<<<< * try: * return x.is_vector */ __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_n_s__x)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_19); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_21, __pyx_n_s__isVector, 239, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC init_vector(void); /*proto*/ PyMODINIT_FUNC init_vector(void) #else PyMODINIT_FUNC PyInit__vector(void); /*proto*/ PyMODINIT_FUNC PyInit__vector(void) #endif { PyObject *__pyx_t_1 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__vector(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_vector"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_d); #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!PyDict_GetItemString(modules, "Scientific._vector")) { if (unlikely(PyDict_SetItemString(modules, "Scientific._vector", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if (__pyx_module_is_main_Scientific___vector) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ __pyx_vtabptr_10Scientific_7_vector_vector = &__pyx_vtable_10Scientific_7_vector_vector; __pyx_vtable_10Scientific_7_vector_vector.set = (void (*)(struct __pyx_obj_10Scientific_7_vector_vector *, double, double, double))__pyx_f_10Scientific_7_vector_6vector_set; if (PyType_Ready(&__pyx_type_10Scientific_7_vector_vector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_10Scientific_7_vector_vector.tp_dict, __pyx_vtabptr_10Scientific_7_vector_vector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "vector", (PyObject *)&__pyx_type_10Scientific_7_vector_vector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_10Scientific_7_vector_vector = &__pyx_type_10Scientific_7_vector_vector; __pyx_vtabptr_10Scientific_7_vector_Vector = &__pyx_vtable_10Scientific_7_vector_Vector; __pyx_vtable_10Scientific_7_vector_Vector.__pyx_base = *__pyx_vtabptr_10Scientific_7_vector_vector; __pyx_type_10Scientific_7_vector_Vector.tp_base = __pyx_ptype_10Scientific_7_vector_vector; if (PyType_Ready(&__pyx_type_10Scientific_7_vector_Vector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_10Scientific_7_vector_Vector.tp_dict, __pyx_vtabptr_10Scientific_7_vector_Vector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "Vector", (PyObject *)&__pyx_type_10Scientific_7_vector_Vector) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_10Scientific_7_vector_Vector = &__pyx_type_10Scientific_7_vector_Vector; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "Scientific/_vector.pyx":12 * double acos(double x) * * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_vector.pyx":140 * return result * * __truediv__ = __div__ # <<<<<<<<<<<<<< * * def __richcmp__(vector self, other, int op): */ __pyx_t_1 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_10Scientific_7_vector_vector, __pyx_n_s____div__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem((PyObject *)__pyx_ptype_10Scientific_7_vector_vector->tp_dict, __pyx_n_s____truediv__, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; PyType_Modified(__pyx_ptype_10Scientific_7_vector_vector); /* "Scientific/_vector.pyx":239 * # as well and is probably more efficient. * # * def isVector(x): # <<<<<<<<<<<<<< * try: * return x.is_vector */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10Scientific_7_vector_1isVector, NULL, __pyx_n_s_22); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s__isVector, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "Scientific/_vector.pyx":1 * # Implementation of Scientific.Geometry.Vector in Cython # <<<<<<<<<<<<<< * # * # Written by Konrad Hinsen */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< * if arr.base is NULL: * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { __Pyx_AddTraceback("init Scientific._vector", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init Scientific._vector"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%s' is not defined", PyString_AS_STRING(name)); #endif } return result; } static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if CYTHON_COMPILING_IN_CPYTHON result = PyDict_GetItem(__pyx_d, name); if (result) { Py_INCREF(result); } else { #else result = PyObject_GetItem(__pyx_d, name); if (!result) { PyErr_Clear(); #endif result = __Pyx_GetBuiltinName(name); } return result; } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; } } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; } } else { PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (likely(l >= 0)) { i += l; } else { if (PyErr_ExceptionMatches(PyExc_OverflowError)) PyErr_Clear(); else return NULL; } } return m->sq_item(o, i); } } #else if (is_list || PySequence_Check(o)) { return PySequence_GetItem(o, i); } #endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 "cannot import name %.230s", PyString_AS_STRING(name)); #else "cannot import name %S", name); #endif } return value; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_Restore(type, value, tb); #endif } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(type, value, tb); #endif } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } #if PY_VERSION_HEX < 0x02050000 if (PyClass_Check(type)) { #else if (PyType_Check(type)) { #endif #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyEval_CallObject(type, args); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } #if PY_VERSION_HEX >= 0x03030000 if (cause) { #else if (cause && cause != Py_None) { #endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: Py_XDECREF(owned_instance); return; } #endif static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { PyObject *local_type, *local_value, *local_tb; #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) #endif goto bad; #if PY_MAJOR_VERSION >= 3 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; #endif Py_INCREF(local_type); Py_INCREF(local_value); Py_INCREF(local_tb); *type = local_type; *value = local_value; *tb = local_tb; #if CYTHON_COMPILING_IN_CPYTHON tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; /* Make sure tstate is in a consistent state when we XDECREF these objects (DECREF may run arbitrary code). */ Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_SetExcInfo(local_type, local_value, local_tb); #endif return 0; bad: *type = 0; *value = 0; *tb = 0; Py_XDECREF(local_type); Py_XDECREF(local_value); Py_XDECREF(local_tb); return -1; } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) PyObject *ob = PyCapsule_New(vtable, 0, 0); #else PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); #endif if (!ob) goto bad; if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0) goto bad; Py_DECREF(ob); return 0; bad: Py_XDECREF(ob); return -1; } static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) { PyObject *result; result = __Pyx_PyObject_GetAttrStr(nmspace, name); if (!result) result = __Pyx_GetModuleGlobalName(name); return result; } static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); #else PyErr_GetExcInfo(type, value, tb); #endif } static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_SetExcInfo(type, value, tb); #endif } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; /* try absolute import on failure */ } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrtf(z.real*z.real + z.imag*z.imag); #else return hypotf(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { float denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(a, a); case 3: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, a); case 4: z = __Pyx_c_prodf(a, a); return __Pyx_c_prodf(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_absf(a); theta = atan2f(a.imag, a.real); } lnr = logf(r); z_r = expf(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cosf(z_theta); z.imag = z_r * sinf(z_theta); return z; } #endif #endif #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; z.real = x; z.imag = y; return z; } #endif #if CYTHON_CCOMPLEX #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } #if 1 static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if !defined(HAVE_HYPOT) || defined(_MSC_VER) return sqrt(z.real*z.real + z.imag*z.imag); #else return hypot(z.real, z.imag); #endif } static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double r, lnr, theta, z_r, z_theta; if (b.imag == 0 && b.real == (int)b.real) { if (b.real < 0) { double denom = a.real * a.real + a.imag * a.imag; a.real = a.real / denom; a.imag = -a.imag / denom; b.real = -b.real; } switch ((int)b.real) { case 0: z.real = 1; z.imag = 0; return z; case 1: return a; case 2: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(a, a); case 3: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, a); case 4: z = __Pyx_c_prod(a, a); return __Pyx_c_prod(z, z); } } if (a.imag == 0) { if (a.real == 0) { return a; } r = a.real; theta = 0; } else { r = __Pyx_c_abs(a); theta = atan2(a.imag, a.real); } lnr = log(r); z_r = exp(lnr * b.real - theta * b.imag); z_theta = theta * b.real + lnr * b.imag; z.real = z_r * cos(z_theta); z.imag = z_r * sin(z_theta); return z; } #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = (start + end) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_globals = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); } static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { #if PY_VERSION_HEX < 0x03030000 char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ *length = PyBytes_GET_SIZE(defenc); return defenc_c; #else /* PY_VERSION_HEX < 0x03030000 */ if (PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_DATA_SIZE(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ return PyUnicode_AsUTF8AndSize(o, length); #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ #endif /* PY_VERSION_HEX < 0x03030000 */ } else #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (r < 0) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ ScientificPython-2.9.4/Scientific/_vector.pyx0000644000076600000240000001577212233722353021721 0ustar hinsenstaff00000000000000# Implementation of Scientific.Geometry.Vector in Cython # # Written by Konrad Hinsen # cdef extern from "math.h": double sqrt(double x) double acos(double x) import numpy as np cimport numpy as np # # For efficiency reasons (calling __init__ makes the creation of a vector # rather expensive), most of the operations happen in class "vector", which # is not meant to be used directly in application code. Objects of this # class are initialized with zero values and then initialized explicitly # by calling the method "set". # Application code should use the derived class "Vector", which adds # only the __init__ method. # cdef class vector: cdef double xv, yv, zv property is_vector: def __get__(self): return 1 property array: def __get__(self): return np.array([self.xv, self.yv, self.zv]) # __array_priority__ and __array_wrap__ are needed to permit # multiplication with numpy scalar types. property __array_priority__: def __get__(self): return 10.0 def __array_wrap__(self, array): result = vector() vector.set(result, array[0], array[1], array[2]) return result def __copy__(self, memo = None): return self def __deepcopy__(self, memo = None): return self def __getstate__(self): return [self.xv, self.yv, self.zv] def __setstate__(self, state): self.xv, self.yv, self.zv = state def __reduce__(self): return (Vector, (self.xv, self.yv, self.zv)) cdef void set(self, double x, double y, double z): self.xv = x self.yv = y self.zv = z def x(self): "Returns the x coordinate." return self.xv def y(self): "Returns the y coordinate." return self.yv def z(self): "Returns the z coordinate." return self.zv def __repr__(self): return 'Vector(%f,%f,%f)' % (self.xv, self.yv, self.zv) def __str__(self): return str([self.xv, self.yv, self.zv]) def __add__(vector self, vector other): result = vector() vector.set(result, self.xv+other.xv, self.yv+other.yv, self.zv+other.zv) return result def __neg__(vector self): result = vector() vector.set(result, -self.xv, -self.yv, -self.zv) return result def __sub__(vector self, vector other): result = vector() vector.set(result, self.xv-other.xv, self.yv-other.yv, self.zv-other.zv) return result def __mul__(x, y): cdef vector v1, v2 cdef int rmul from Scientific import Geometry rmul = 0 if isinstance(y, vector): if isinstance(x, vector): v1 = x v2 = y return v1.xv*v2.xv+v1.yv*v2.yv+v1.zv*v2.zv else: x, y = y, x rmul = 1 if Geometry.isTensor(y): if rmul: product = y.dot(Geometry.Tensor(x.array, 1)) else: product = Geometry.Tensor(x.array, 1).dot(y) if product.rank == 1: result = vector() vector.set(result, product.array[0], product.array[1], product.array[2]) return result else: return product elif hasattr(y, "_product_with_vector"): return y._product_with_vector(x) else: v1 = x result = vector() vector.set(result, v1.xv*y, v1.yv*y, v1.zv*y) return result def __div__(vector self, double factor): result = vector() vector.set(result, self.xv/factor, self.yv/factor, self.zv/factor) return result __truediv__ = __div__ def __richcmp__(vector self, other, int op): if op != 2 and op != 3: return NotImplemented if isinstance(other, vector): eq = self.xv == other.x() and self.yv == other.y() \ and self.zv == other.z() else: eq = False if op == 2: return eq else: return not eq def __len__(self): return 3 def __getitem__(self, int index): if index == 0 or index == -3: return self.xv elif index == 1 or index == -2: return self.yv elif index == 2 or index == -1: return self.zv raise IndexError def length(self): "Returns the length (norm)." return sqrt(self.xv*self.xv+self.yv*self.yv+self.zv*self.zv) def normal(self): "Returns a normalized copy." cdef double len len = sqrt(self.xv*self.xv+self.yv*self.yv+self.zv*self.zv) if len == 0: raise ZeroDivisionError, "Can't normalize a zero-length vector" result = vector() vector.set(result, self.xv/len, self.yv/len, self.zv/len) return result def cross(vector self, vector other): "Returns the cross product with vector |other|." result = vector() vector.set(result, self.yv*other.zv-self.zv*other.yv, self.zv*other.xv-self.xv*other.zv, self.xv*other.yv-self.yv*other.xv) return result def angle(vector self, vector other): "Returns the angle to vector |other|." cdef double cosa cosa = (self.xv*other.xv+self.yv*other.yv+self.zv*other.zv) / \ sqrt((self.xv*self.xv+self.yv*self.yv+self.zv*self.zv)* (other.xv*other.xv+other.yv*other.yv+other.zv*other.zv)) if cosa > 1.: cosa = 1. if cosa < -1.: cosa = -1. return acos(cosa) def asTensor(self): "Returns an equivalent tensor object of rank 1." from Scientific import Geometry return Geometry.Tensor(self.array, 1) def dyadicProduct(self, other): "Returns the dyadic product with vector or tensor |other|." from Scientific import Geometry if isinstance(other, vector): return Geometry.Tensor(self.array[:, np.newaxis] * other.array[np.newaxis, :], 1) elif Geometry.isTensor(other): return Geometry.Tensor(self.array, 1)*other else: raise TypeError, "Dyadic product with non-vector" cdef class Vector(vector): property __safe_for_unpickling__: def __get__(self): return 1 def __init__(self, x=None, y=None, z=None): if x is None: pass # values are pre-initialized to zero elif y is None and z is None: self.xv, self.yv, self.zv = x else: self.xv = x self.yv = y self.zv = z # # For compatibility reasons, this routine works like its predecessor # by testing the attribute is_vector. However, isinstance() works # as well and is probably more efficient. # def isVector(x): try: return x.is_vector except AttributeError: return 0 ScientificPython-2.9.4/Scientific/BSP/0000755000076600000240000000000012270505005020120 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/BSP/__init__.py0000644000076600000240000000311512270503425022235 0ustar hinsenstaff00000000000000""" High-level parallelization constructs based on the Bulk Synchronous Parallel (BSP) model. Parallelization requires a low-level communications library, which can be either BSPlib or MPI. Programs must be run with the bsppython or mpipython executables in order to use several processors. When run with a standard Python interpreter, only one processor is available. A warning about object identity: when a communication operation transmits a Python object to the same processor, the object in the return list can either be the sent object or a copy of it. Application programs thus should not make any assumptions about received objects being different from sent objects. @undocumented: Tasks @undocumented: core """ from core import numberOfProcessors, processorID, ParValue, ParConstant, \ ParRootConstant, ParData, ParSequence, ParRootSequence, ParMessages, \ ParTuple, ParAccumulator, ParFunction, ParRootFunction, ParIndex, \ ParIterator, ParIndexIterator, ParClass, ParBase, ParInvalid, is_invalid import sys if sys.modules.has_key('epydoc'): import core, types imported_names = dir() core_name = core.__name__ for name in dir(core): if name not in imported_names: continue object = getattr(core, name) if isinstance(object, type) or type(object) == types.ClassType: setattr(object, '__module__', 'Scientific.BSP') elif type(object) == types.FunctionType: object.func_globals['__name__'] = 'Scientific.BSP' core.__name__ = core_name del types del core_name del imported_names del sys ScientificPython-2.9.4/Scientific/BSP/Console.py0000644000076600000240000001223612233734140022103 0ustar hinsenstaff00000000000000# Parallel console for interactive use of Python/BSP # # Written by Konrad Hinsen # last revision: 2006-6-12 # """ Interactive console for parallel computing """ from Scientific.BSP import ParValue, ParRootFunction, \ processorID, numberOfProcessors import Scientific.BSP.core from code import InteractiveInterpreter, InteractiveConsole from cStringIO import StringIO import exceptions, sys # # Special unique object used in synchronization. # class OKToken: def __init__(self): pass ok = OKToken() def isOK(object): try: return object.__class__ is OKToken except AttributeError: return 0 # # Synchronise all processes when there is a possibility than some have crashed. # def synchronize(): done = 0 while not done: put(ok, range(processorID) + range(processorID+1, numberOfProcessors)) status = sync() if len(status) == numberOfProcessors-1: done = 1 for object in status: if not isOK(object): done = 0 # # Special exception object. It is raised by the modified sync() # routine below when it notices that some other process has crashed. # class BSPSyncError(exceptions.Exception): pass # # Modified sync() routine used by interactively executed code # When it captures one of the unique objects (that no other module # can ever generate), it knows that some other process has crashed # prematurely and it crashes its own processes as well to prevent # lockups. # def syncCheck(): messages = sync() for object in messages: if isOK(object): raise BSPSyncError return messages put = Scientific.BSP.core.put sync = Scientific.BSP.core.sync Scientific.BSP.core.sync = syncCheck # # Wrappers around stdout and stderr for printing processor numbers # class OutputStream: def __init__(self, stream): self.stream = stream def write(self, string): global _pid_banner if _pid_banner is not None and string: self.stream.write(_pid_banner) self.stream.write(string) _pid_banner = None def __getattr__(self, attr): return getattr(self.stream, attr) _pid_banner = None # # Type function that works "through" ParValue objects # def typePar(object): if hasattr(object, 'is_parvalue'): return ParValue(type(object.value)) else: return type(object) # # Parallel console run on processor 0 # class ParallelConsole(InteractiveConsole): def __init__(self): namespace = {"__name__": "__console__", "__doc__": None, "type": typePar} InteractiveConsole.__init__(self, namespace) def push(self, line): global _pid_banner self.buffer.append(line) source = "\n".join(self.buffer) put(source, range(1, numberOfProcessors)) sync() _pid_banner = ("-- Processor %d " % processorID) + 40*'-' + '\n' more = self.runsource(source, self.filename) _pid_banner = None synchronize() output = sync() output.sort(lambda a, b: cmp(a[0], b[0])) for pid, stdout, stderr in output: if stdout or stderr: print ("-- Processor %d " % pid) + 40*'-' if stdout: print stdout, if stderr: print stderr, if not more: self.resetbuffer() return more def mainloop(self): cprt = 'Type "copyright", "credits" or "license" for more information.' banner = "Python %s on %s\n%s\n(Parallel console, %d processors)" % \ (sys.version, sys.platform, cprt, numberOfProcessors) while 1: try: self.interact(banner) break except KeyboardInterrupt: print "KeyboardInterrupt" banner = "" put(None, range(1, numberOfProcessors)) sync() # # Interpreter run on all other processors # class ParallelInterpreter(InteractiveInterpreter): def __init__(self): locals = {"__name__": "__console__", "__doc__": None, "type": typePar} InteractiveInterpreter.__init__(self, locals) def mainloop(self): while 1: sys.stdout.close() sys.stdout = StringIO() sys.stderr.close() sys.stderr = StringIO() source = sync()[0] if source is None: break self.runsource(source) synchronize() put((processorID, sys.stdout.getvalue(), sys.stderr.getvalue()), [0]) sync() # # Parallel console function # def console(): sys.stdout = OutputStream(sys.stdout) sys.stderr = OutputStream(sys.stderr) my_console = ParallelConsole() my_console.raw_input = raw_input my_console.mainloop() def interpreter(): sys.stdout = StringIO() sys.stderr = StringIO() my_interpreter = ParallelInterpreter() my_interpreter.mainloop() parallelConsole = ParRootFunction(console, interpreter) # # Run parallel console # if __name__ == '__main__': parallelConsole() ScientificPython-2.9.4/Scientific/BSP/core.py0000644000076600000240000012044212270503410021423 0ustar hinsenstaff00000000000000# High-level parallelization classes # # Written by Konrad Hinsen # from Scientific import N import cPickle, operator, sys, types try: virtual_bsp_machine = sys.virtual_bsp_machine bsplib = None world = None except AttributeError: virtual_bsp_machine = None try: from Scientific import _bsplib as bsplib world = None except ImportError: bsplib = None from Scientific.MPI import world try: if world.__class__.__name__ == "DummyCommunicator": world = None except AttributeError: pass if world is not None: world = world.duplicate() # # Number of processors # if virtual_bsp_machine is not None: numberOfProcessors = virtual_bsp_machine.numberOfProcessors() processorID = virtual_bsp_machine.currentPid() elif bsplib is not None: numberOfProcessors = bsplib.numberOfProcessors processorID = bsplib.processorID elif world is not None: numberOfProcessors = world.size processorID = world.rank else: numberOfProcessors = 1 processorID = 0 # # Low-level communication: send and receive arbitrary objects via MPI # if world is not None: _type_tags = {N.Int8: 3, N.Int16: 4, N.Int32: 5, N.UnsignedInt8: 6, N.Float16: 7, N.Float: 8, N.Complex32: 9, N.Complex64: 10} _type_tags_i = {} for key, value in _type_tags.items(): _type_tags_i[value] = key _debug_flag = 0 def _debug(flag): global _debug_flag _debug_flag = flag def _send(obj, destinations): requests = [] if type(obj) is N.arraytype: send_data = obj try: type_code = send_data.typecode() # Numeric, numarray except AttributeError: type_code = send_data.dtype.char # NumPy tag = _type_tags.get(type_code, 2) if _debug_flag: print world.rank, "sending array (type %s, shape %s) to %s" \ % (type_code, str(obj.shape), str(destinations)) sys.stdout.flush() if tag == 2: send_data = cPickle.dumps(send_data, 1) else: shape = N.array(obj.shape) for pid in destinations: requests.append(world.nonblockingSend(shape, pid, tag)) tag = 1 else: if _debug_flag: print world.rank, "sending non-array object to", destinations sys.stdout.flush() send_data = cPickle.dumps(obj, 1) tag = 2 if _debug_flag: print world.rank, "sending data (%d) to" % tag, destinations sys.stdout.flush() for pid in destinations: requests.append(world.nonblockingSend(send_data, pid, tag)) return requests def _wait(requests): if _debug_flag: print world.rank, "waiting for %d requests" % len(requests) sys.stdout.flush() for r in requests: r.wait() if _debug_flag: print world.rank, "finished waiting" sys.stdout.flush() def _receive(source, tag): if tag == 2: if _debug_flag: print world.rank, "receiving non-array object from", source sys.stdout.flush() data = cPickle.loads(world.receiveString(source, tag)[0]) return data else: if _debug_flag: print world.rank, "receiving array shape from", source sys.stdout.flush() typecode = _type_tags_i.get(tag, None) if typecode is None: raise ValueError("Invalid tag " + `tag`) shape = world.receive(N.Int, source, tag)[0] if _debug_flag: print world.rank, "shape: ", shape print world.rank, "receiving array data from", source sys.stdout.flush() data = world.receive(typecode, source, 1)[0] data.shape = tuple(shape) if _debug_flag: print world.rank, "done receiving" sys.stdout.flush() return data # # BSP communication level: exchange messages and synchronize # if virtual_bsp_machine is not None: put = virtual_bsp_machine.put send = virtual_bsp_machine.send sync = virtual_bsp_machine.sync elif bsplib is not None: def put(obj, pid_list): if type(obj) is not N.arraytype: obj = cPickle.dumps(obj, 1) for pid in pid_list: bsplib.send(obj, pid) def send(messages): for pid, data in messages: put(data, [pid]) def sync(): bsplib.sync() messages = [] while 1: data = bsplib.receive() if data is None: break if type(data) is N.arraytype: messages.append(data) else: messages.append(cPickle.loads(data)) return messages elif world is not None: _requests = [] def put(obj, pid_list): global _requests if len(pid_list) > 0: _requests = _requests + _send(obj, pid_list) def send(messages): global _requests for pid, data in messages: _requests = _requests + _send(data, [pid]) def sync(): global _requests for pid in range(numberOfProcessors): _requests.append(world.nonblockingSend('', pid, 0)) messages = [] pcount = 0 while pcount < numberOfProcessors: test = world.nonblockingProbe() if test is None: continue source, tag = test if tag == 0: pcount = pcount + 1 world.receiveString(source, tag) else: messages.append(_receive(source, tag)) _wait(_requests) _requests = [] world.barrier() return messages else: _messages = [] def put(obj, pid_list): global _messages for pid in pid_list: if pid == 0: _messages.append(obj) else: raise ValueError("invalid pid") def send(messages): for pid, data in messages: put(data, [pid]) def sync(): global _messages messages = _messages _messages = [] return messages # # Higher-level communications layer. This code takes care of the handling # of special objects and of special transfer needs of particular objects. # def retrieveMessages(): return sync() # # The dictionary _wrappers stores the global class corresponding # to each local class. Whenever a global object is constructed # from a local one, the appropriate class is looked up here. # If no wrapper class is found, ParValue is used. # _wrappers = {} def global_object(local_object): try: klass = local_object.__class__ except AttributeError: return ParValue(local_object) wrapper = _wrappers.get(klass, ParValue) return wrapper(local_object) # # ParValue is the base class for all standard distributed-data classes. # class ParValue(object): """ Global data ParValue instances are created internally, but are not meant to be created directly by application programs. Use the subclasses instead. ParValue objects (and those of subclasses) implement the standard arithmetic and comparison operations. They also support attribute requests which are passed on to the local values; the return values are ParValue objects. ParValue objects can also be called if their local values are callable. """ def __init__(self, value, valid=True): """ @param value: the local value @type value: any @param valid: C{True} if the value is valid, C{False} if it is not. Invalid values are not treated, any operation on them produces an invalid result. """ self.value = value self.valid = valid is_parvalue = 1 def __len__(self): return len(self.value) def __repr__(self): if self.valid: return "%s[%d](%s)" % (self.__class__.__name__, processorID, repr(self.value)) else: return "<%s object (no valid data)>" % self.__class__.__name__ __str__ = __repr__ def __call__(self, *args, **kwargs): params = [] valid = self.valid for a in args: p, v = _getValue(a) valid = valid and v params.append(p) kw = {} for key, data in kwargs.items(): p, v = _getValue(data) kw[key] = p valid = valid and v if valid: return global_object(apply(self.value, params, kw)) else: return ParValue(None, 0) def put(self, pid_list): """ Send the local data to all specified processors. @param pid_list: a list of processor IDs to which the data is sent. @type pid_list: Global C{list} of C{int} @returns: a global object whose local value is a list of all the data received from other processors. The order of the data in that list is not defined. @rtype: L{ParValue} """ if self.valid: if not pid_list.valid: raise ValueError("Invalid processor ID list") put(self.value, pid_list.value) return ParValue(retrieveMessages()) def get(self, pid_list): """ Request the local data from all specified processors. @param pid_list: a list of processor IDs to which the data is sent. @type pid_list: Global C{list} of C{int} @returns: a global object whose local value is a list of all the data received from other processors. The order of the data in that list is not defined. @rtype: L{ParValue} """ if not pid_list.valid: raise ValueError("Invalid processor ID list") put(processorID, pid_list.value) destinations = sync() if self.valid: put(self.value, destinations) return ParValue(retrieveMessages()) def broadcast(self, from_pid=0): """ Transmit the local data of one processor to all processors. @param from_pid: the ID of the processor that sends data @type from_pid: C{int} @returns: the transmitted data on all processors @rtype: L{ParValue} """ if processorID == from_pid: if self.valid: put(self.value, range(numberOfProcessors)) else: raise ValueError("Broadcast for invalid data") return ParValue(retrieveMessages()[0]) def fullExchange(self): """ Transmit the local data of each processor to all other processors. @returns: the transmitted data on all processors @rtype: L{ParValue} """ if self.valid: put(self.value, range(numberOfProcessors)) return ParValue(retrieveMessages()) def reduce(self, operator, zero): """ Perform a reduction over the local values of all processors. @param operator: the binary operator used in the reduction @type operator: function of two variables @param zero: the initial value of the reduction @type zero: any @returns: the reduction on processor 0, zero elsewhere @rtype: L{ParValue} """ if self.valid: put(self.value, [0]) return ParValue(reduce(operator, retrieveMessages(), zero), processorID == 0) def accumulate(self, operator, zero): """ Perform an accumulation over the local values of all processors. @param operator: the binary operator used in the accumulation @type operator: function of two variables @param zero: the initial value of the accumulation @type zero: any @returns: on each processor, the reduction of the values from processors with a lower or equal number @rtype: L{ParValue} """ if self.valid: data = self else: data = ParValue(zero) data = data.get(ParValue(range(processorID+1))) return ParValue(reduce(operator, data.value, zero)) def __nonzero__(self): if not self.valid: raise ValueError("invalid local value") return operator.truth(self.value) def alltrue(self): """ @returns: C{True} if the local values on all processors are true. @rtype: Local C{bool} """ if self.valid: put(operator.truth(self.value), [0]) all = sync() if processorID == 0: combined = reduce(operator.and_, all, 1) put(combined, range(numberOfProcessors)) return sync()[0] def anytrue(self): """ @returns: C{True} if at least one of the local values on all processors is true. @rtype: Local C{bool} """ if self.valid: put(operator.truth(self.value), [0]) all = sync() if processorID == 0: combined = reduce(operator.or_, all, 0) put(combined, range(numberOfProcessors)) return sync()[0] def __eq__(self, other): if self.valid and other.valid: return ParValue(self.value == other.value) else: return ParValue(None, 0) def __ne__(self, other): if self.valid and other.valid: return ParValue(self.value != other.value) else: return ParValue(None, 0) def __lt__(self, other): if self.valid and other.valid: return ParValue(self.value < other.value) else: return ParValue(None, 0) def __le__(self, other): if self.valid and other.valid: return ParValue(self.value <= other.value) else: return ParValue(None, 0) def __gt__(self, other): if self.valid and other.valid: return ParValue(self.value > other.value) else: return ParValue(None, 0) def __ge__(self, other): if self.valid and other.valid: return ParValue(self.value >= other.value) else: return ParValue(None, 0) def __neg__(self): if self.valid: return ParValue(-self.value) else: return ParValue(None, 0) def __add__(self, other): if self.valid and other.valid: return ParValue(self.value + other.value) else: return ParValue(None, 0) def __sub__(self, other): if self.valid and other.valid: return ParValue(self.value - other.value) else: return ParValue(None, 0) def __mul__(self, other): if self.valid and other.valid: return ParValue(self.value * other.value) else: return ParValue(None, 0) def __div__(self, other): if self.valid and other.valid: return ParValue(self.value / other.value) else: return ParValue(None, 0) __truediv__ = __div__ def __mod__(self, other): if self.valid and other.valid: return ParValue(self.value % other.value) else: return ParValue(None, 0) def __divmod__(self, other): if self.valid and other.valid: div, mod = divmod(self.value, other.value) return ParValue(div), ParValue(mod) else: return ParValue(None, 0), ParValue(None, 0) def __pow__(self, other): if self.valid and other.valid: return ParValue(self.value ** other.value) else: return ParValue(None, 0) def __getitem__(self, item): if not self.valid: return ParValue(None, 0) if hasattr(item, 'is_parindex'): if not item.valid: return ParValue(None, 0) if item.skip == 0: try: return global_object(self.value[item.start]) except IndexError: return ParValue(None, 0) if item.skip == 1: if item.stop is None: return global_object(self.value[item.start:]) else: return global_object(self.value[item.start:item.stop]) else: return global_object(self.value[item.start:item.stop:item.skip]) elif hasattr(item, 'is_parvalue'): if item.valid: return global_object(self.value[item.value]) else: return ParValue(None, 0) else: return global_object(_getValue(self.value[item])[0]) def __getattr__(self, attr): if attr == 'valid' or attr == '__coerce__': raise AttributeError if not self.valid: return ParValue(None, 0) return global_object(getattr(self.value, attr)) def getattr(self, attr): if not self.valid: return ParValue(None, 0) return global_object(getattr(self.value, attr.value)) def map(self, function): if not self.valid: return ParValue(None, 0) if hasattr(function, 'is_parvalue'): function = function.value return ParValue(map(function, self.value)) # # Extract local value and validity flag from a ParValue def _getValue(x): if isinstance(x, ParValue): return x.value, x.valid else: return x, 1 # # ParConstant represents an identical value on each processor. # class ParConstant(ParValue): """Global constant A subclass of ParValue that stores an identical value on each processor. It must be called with the same argument on all processors, but this is not verified in the current implementation. """ def __init__(self, value): """ @param value: any local or global object @type value: any """ if hasattr(value, 'is_parvalue'): self.value = value.value else: self.value = value self.valid = 1 # # This dummy class is used on nonroot machines because the value on # the root machine might be an object on which instance methods are # called. # class RootNoneObject(object): def __getattr__(self, attr): return None def __getitem__(self, item): return None # # ParRootConstant is a constant on the root machine and None on all # other machines. # class ParRootConstant(ParConstant): """ Global constant present only on processor 0. """ def __init__(self, value): """ @param value: the value to store. @type value: any """ self.value = RootNoneObject() if processorID == 0: if hasattr(value, 'is_parvalue'): self.value = value.value else: self.value = value self.valid = 1 # # ParData generates the local values as a function of processor id # and number of processors. # class ParData(ParValue): """ Global data A subclass of ParValue that calculates its local value from the processor number. """ def __init__(self, function): """ @param function: a function that is called with two arguments (processor number and number of processors in the system) and whose return value becomes the local value of the global object. @type function: function of two arguments """ self.value = function(processorID, numberOfProcessors) self.valid = 1 # # ParSequence objects distribute a sequence over the processors # class ParSequence(ParValue): """ Global distributed sequence The local value of a ParSequence object is a slice of the input sequence, which is constructed such that the concatenation of the local values of all processors equals the input sequence while making the number of elements on each processor as equal as possible. """ def __init__(self, full_sequence): """ @param full_sequence: the full sequence, equal to the concatenation of the local values of all processors @type full_sequence: arbitrary sequence object """ if hasattr(full_sequence, 'is_parvalue'): if not full_sequence.valid: self.valid = 0 self.value = None return full_sequence = full_sequence.value self.length = len(full_sequence) chunk = (self.length+numberOfProcessors-1)/numberOfProcessors self.first = min(processorID*chunk, self.length) self.last = min(self.first+chunk, self.length) self.value = full_sequence[self.first:self.last] self.valid = 1 def totalLength(self): """ @returns: the sum of the lengths of the local values @rtype: C{int} """ return ParValue(self.length) def __getitem__(self, item): """ @param item: an index into the total sequence @type item: C{int} or L{ParIndex} @returns: the element referred to by the index, if it is in the local subset @rtype: any @raise IndexError: if the index refers to an item on another processor """ if not self.valid: return ParValue(None, 0) if hasattr(item, 'is_parindex'): if not item.valid: return ParValue(None, 0) if item.skip == 0: try: return global_object(self.value[item.start-self.first]) except IndexError: return ParValue(None, 0) if item.skip == 1: if item.stop is None: return global_object(self.value[item.start-self.first:]) else: return global_object(self.value[item.start-self.first :item.stop-self.first]) else: return global_object(self.value[item.start-self.first :item.stop-self.first :item.skip]) else: return global_object(self.value[item-self.first]) # # ParRootSequence objects distribute a sequence stored initially on # processor 0 over the processors # class ParRootSequence(ParSequence): """ Global distributed sequence with data taken from processor 0 The local value of a ParRootSequence object is a slice of the input sequence, which is constructed such that the concatenation of the local values of all processors equals the input sequence while making the number of elements on each processor as equal as possible. """ def __init__(self, full_sequence): """ @param full_sequence: on processor 0: the full sequence, equal to the concatenation of the local values of all processors. The local values on the other processors are not used. @type full_sequence: L{ParValue} """ messages = [] if processorID == 0: full_sequence = full_sequence.value length = len(full_sequence) for pid in range(numberOfProcessors): chunk = (length+numberOfProcessors-1)/numberOfProcessors first = min(pid*chunk, length) last = min(first+chunk, length) value = full_sequence[first:last] messages.append((pid, (first, last, length, value))) send(messages) self.first, self.last, self.length, self.value = retrieveMessages()[0] self.valid = 1 # # ParMessages serves to send exchange arbitray data between processors. # class ParMessages(ParValue): """ Global message list """ def __init__(self, messages): """ @param messages: a global object whose local value is a list of (pid, data) pairs. @type messages: Global sequence """ if hasattr(messages, 'is_parvalue'): messages = messages.value self.value = messages self.valid = 1 def processorIds(self): """ @returns: a global object whose local value is a list of all processor Ids referenced in a message @rtype: L{ParValue} """ return ParValue(map(lambda x: x[0], self.value)) def data(self): """ @returns: a global object whose local value is a list of all data items in the messages. @rtype: L{ParValue} """ return ParValue(map(lambda x: x[1], self.value)) def exchange(self): """ Transmit all the messages @returns: a global object containing the received messages @rtype: L{ParValue} """ if self.valid: send(self.value) return ParMessages(retrieveMessages()) # # ParTuple combines several ParValues to speed up communication. # class ParTuple(ParValue): """ Global data tuple ParTuple objects are used to speed up communication when many data items need to be sent to the same processors. The construct a, b, c = ParTuple(a, b, c).put(pids) is logically equivalent to a = a.put(pids); b = b.put(pids); c = c.put(pids) but more efficient. """ def __init__(self, *args): """ @param args: any global objects @type args: C{tuple} """ self.value = map(lambda pv: pv.value, args) self.valid = reduce(operator.and_, map(lambda pv: pv.valid, args)) def __getitem__(self, item): if self.valid: return ParValue(self.value[item]) else: return ParValue(None, 0) def __len__(self): return len(self.value) # # ParAccumulator serves to accumulate data in a parallelized loop. # class ParAccumulator(ParValue): """ Global accumulator ParAccumulator objects are used to perform iterative reduction operations in loops. The initial local value is zero (i.e. the passed-in zero object, not the number 0), which is modified by subsequent calls to the method addValue. """ def __init__(self, operator, zero): """ @param operator: a local function taking two arguments and returning one argument of the same type @type operator: function of two variables @param zero: the initial value for reduction """ self.operator = operator self.zero = zero self.value = zero self.valid = 1 def addValue(self, value): """ Replace the internal value of the accumulator by internal_value = operator(internal_value, value). """ if value.valid: self.value = self.operator(self.value, value.value) def calculateTotal(self): """ @returns: a reduction over the local values on all processors @rtype: L{ParValue} """ return self.reduce(self.operator, self.zero) # # ParFunction represents a set of identical functions # on all processors. # class ParFunction(ParValue): """Global function Global functions are called with global object arguments. The local values of these arguments are then passed to the local function, and the result is returned in a ParValue object. """ def __init__(self, local_function): """ @param local_function: any function @type local_function: callable """ local_function, is_valid = _getValue(local_function) self.value = local_function self.valid = 1 def __repr__(self): return "ParFunction[%d](%s)" % (processorID, self.value.__name__) # # ParRootFunction represents a function with different code for processor # zero and all the others. By default, the other processors do nothing # and return None. # class ParRootFunction(ParFunction): """Asymmetric global function Constructor: ParRootFunction(|root_function|, |other_function|=None) Arguments: Global functions are called with global object arguments. The local values of these arguments are then passed to the local function, and the result is returned in a ParValue object. A ParRootFunction differs from a ParFunction in that it uses a different local function for processor 0 than for the other processors. ParRootFunction objects are commonly used for I/O operations. """ def __init__(self, local_function, other_function=None): """ @param local_function: the local function for processor 0 @type local_function: callable @param other_function: the local function for all other processors. The default is a function that returns None. @type other_function: callable """ local_function, is_valid = _getValue(local_function) if processorID == 0: self.value = local_function else: if other_function is None: def other_function(*args, **kwargs): return RootNoneObject() self.value = other_function self.local_instance = None self.valid = 1 # # ParIndex objects are returned by ParIndexIterator. # class ParIndex(object): """ Parallel index value ParIndex objects are returned by ParIndexIterator. They are not meant ot be created in any other way. """ def __init__(self, index, valid=1): if hasattr(index, 'is_parvalue'): self.valid = index.valid if self.valid: self.start = index.value else: self.start = 0 elif hasattr(index, 'is_parindex'): self.valid = index.valid self.start = index.start else: self.start = index self.valid = valid self.stop = self.start+1 self.skip = 0 def __repr__(self): return "ParIndex[%d](%d)" % (processorID, self.start) is_parindex = 1 class ParSlice(ParIndex): """ Parallel slice value """ def __init__(self, start=0, stop=None, skip=1, valid=1): self.start = start self.stop = stop self.skip = skip self.valid = valid def __repr__(self): return "ParSlice[%d](%d, %d, %d)" % (processorID, self.start, self.stop, self.skip) # # Direct iteration over distributed sequences. # class ParIterator(object): """ Parallel iterator Constructor: ParIterator(|global_sequence|) Arguments: A ParIterator is used to loop element by element over a distributed sequence. At each iteration, the returned item (a global object) contains different elements of the distributed sequence. """ def __init__(self, sequence): """ @param sequence: a global object representing a distributed sequence @type sequence: L{ParSequence} """ self.sequence = sequence.value self.n = len(sequence.value) self.max_n = ParValue(self.n).reduce(max, 0).broadcast().value def __getitem__(self, item): if item >= self.max_n: raise IndexError if item >= self.n: return ParValue(None, 0) return global_object(self.sequence[item]) # # Index iteration over distributed sequences. # class ParIndexIterator(object): """ Parallel index iterator A ParIndexIterator is used to loop index by index over one or more distributed sequences. At each iteration, the returned item (a L{ParIndex} object) contains indices of different elements of the distributed sequence(s). The index objects can be used to index any ParValue object whose local value is a sequence object. """ def __init__(self, sequence): """ @param sequence: a global object representing a distributed sequence @type sequence: L{ParSequence} """ self.n = len(sequence.value) self.max_n = ParValue(self.n).reduce(max, 0).broadcast().value def __getitem__(self, item): if item >= self.max_n: raise IndexError if item >= self.n: return ParIndex(0, 0) return ParIndex(item) # # Distribution class. This effectively turns all methods # into ParMethods and all other attributes inte ParValues. # class ParClass(object): """ Global class Global classes are needed to construct global objects that have more functionalities than offered by the ParValue class hierarchy. When an instance of a global class is generated, each processor generates an instance of the local class that becomes the local value of the new global object. Attribute requests and method calls are passed through to the local objects and the results are assembled into global objects (ParValue or ParFunction). The arguments to methods of a global class must be global objects, the local class methods are then called with the corresponding local values. The local objects are initialized via the special method __parinit__ instead of the usual __init__. This method is called with two special arguments (processor number and total number of processors) followed by the local values of the arguments to the global object initialization call. The local classes must inherit from the base class ParBase (see below), which also provides communication routines. """ def __init__(self, local_class): """ @param local_class: a standard Python class """ self.local_class = local_class self.attributes = {} self._collectAttributes(local_class, self.attributes) try: del self.attributes['__init__'] except KeyError: pass class _Wrapper(object): def __init__(self, local_instance): self.value = local_instance self.valid = 1 is_parvalue = 1 def __repr__(self): if self.attributes.has_key('__repr__'): return "ParClass{%s}[%d](%s)" \ % (self.local_class.__name__, processorID, repr(self.value)) else: return "ParClass{%s}[%d] instance: %s" \ % (self.local_class.__name__, processorID, repr(self.value)) def __getattr__(self, name): try: return global_object(self.value.__dict__[name]) except KeyError: pass try: value = self.attributes[name] except KeyError: value = getattr(self.value, name) if isinstance(value, types.MethodType): return ParMethod(value, self.value) else: return global_object(value) def __getitem__(self, item): item, valid = _getValue(item) if valid: return global_object(self.value[item]) else: return ParValue(None, 0) def __call__(self, *args, **kwargs): params = [] valid = True for a in args: p, v = _getValue(a) valid = valid and v params.append(p) kw = {} for key, data in kwargs.items(): p, v = _getValue(data) kw[key] = p valid = valid and v if valid: return global_object(self.value(*params, **kw)) else: return ParValue(None, 0) self.wrapper = _Wrapper self.wrapper.__module__ = local_class.__module__ self.wrapper.__name__ = "ParClass(%s)" % local_class.__name__ self.wrapper.attributes = self.attributes self.wrapper.local_class = local_class _wrappers[local_class] = self.wrapper def _collectAttributes1(self, klass, attrib_dict): for key in klass.__dict__.keys(): if key not in ['__doc__', '__module__', '__name__', '__bases__']: if not attrib_dict.has_key(key): attrib_dict[key] = getattr(klass, key) def _collectAttributes(self, klass, attrib_dict): self._collectAttributes1(klass, attrib_dict) for base_class in klass.__bases__: self._collectAttributes(base_class, attrib_dict) def __call__(self, *args, **kwargs): args = (processorID, numberOfProcessors) + args local_instance = _DummyClass() local_instance.__class__ = self.local_class local_instance.__parinit__(*args, **kwargs) return self.wrapper(local_instance) # Dummy class class _DummyClass(object): pass # # Special 'invalid' object. It is passed to methods in distributed # object classes and accepted as a return value. # class _ParInvalid(object): pass def is_invalid(obj): return isinstance(obj, _ParInvalid) ParInvalid = _ParInvalid() _wrappers[_ParInvalid] = lambda x: ParValue(None, 0) # # ParMethod represents a set of identical methods # on all processors. # class ParMethod(ParFunction): """ Method of a global class ParMethod objects are created by ParClass. They are not meant to be used directly in application code. """ def __init__(self, local_function, local_instance): self.value = local_function self.local_instance = local_instance self.valid = 1 def __repr__(self): return "ParMethod[%d](%s)" % (processorID, self.value.__name__) def __call__(self, *args, **kwargs): params = [self.local_instance] for a in args: if hasattr(a, 'is_parvalue'): if a.valid: params.append(a.value) else: params.append(ParInvalid) else: params.append(a) kw = {} for key, data in kwargs.items(): if hasattr(data, 'is_parvalue'): if data.valid: kw[key] = data.value else: kw[key] = ParInvalid else: kw[key] = data ret = apply(self.value, params, kw) return global_object(ret) # # Abstract base class that provides communication for ParClasses. # class ParBase(object): """ Distributed data base class Local classes that are to be used in global classes must inherit from this class. """ is_parclass = 1 def put(self, data, pid_list): """ Send data to other processors @param data: the data to be sent @type data: any @param pid_list: the list of processor numbers to which the data is sent @type pid_list: C{list} @returns: the values received from other processors @rtype: C{list} """ put(data, pid_list) return retrieveMessages() def get(self, data, pid_list): """ Request the local values of other processors. @param data: the data to be sent to processors who request it @type data: any @param pid_list: the list of processor numbers to which data requests are sent @type pid_list: C{list} @returns: the values received from other processors @rtype: C{list} """ put(processorID, pid_list) destinations = sync() put(data, destinations) return retrieveMessages() def broadcast(self, data, from_pid=0): """ Send a local value of one processor to all processors. @param data: the data to be transmitted. This value is used only on one processor. @param from_pid: the processor whose data is broadcast @type from_pid: any @returns: the received data @rtype: any """ if processorID == from_pid: put(data, range(numberOfProcessors)) return retrieveMessages()[0] def exchangeMessages(self, message_list): """ @param message_list: a list of (pid, data) pairs to be transmitted @type message_list: C{list} @returns: the incoming data @rtype: C{list} """ send(message_list) return retrieveMessages() ScientificPython-2.9.4/Scientific/BSP/IO.py0000644000076600000240000002417011501734227021013 0ustar hinsenstaff00000000000000# Parallel IO # # Written by Konrad Hinsen # last revision: 2007-5-25 # """ Parallel acces to netCDF files One netCDF dimension is defined for splitting the data among processors such that each processor is responsible for one slice of the file along that dimension. Since netCDF files can be very big, the distribution algorithm gives priority to memory efficiency over CPU time efficiency. The processor that handles the file treats only one slice per superstep, which means that at no time more than one slice must be stored in any processor. """ from Scientific.IO.NetCDF import NetCDFFile from Scientific.BSP.core import ParClass, ParBase, ParInvalid, is_invalid from Scientific import N class _ParNetCDFFile(ParBase): """ Distributed netCDF file A ParNetCDFFile object acts as much as possible like a NetCDFFile object. Variables become ParNetCDFVariable objects, which behave like distributed sequences. Variables that use the dimension named by |split_dimension| are automatically distributed among the processors such that each treats only one slice of the whole file. """ def __parinit__(self, pid, nprocs, filename, split_dimension, mode = 'r', local_access = False): """ @param filename: the name of the netCDF file @type filename: C{str} @param split_dimension: the name of the dimension along which the data is distributed over the processors @type split_dimension: C{str} @param mode: read ('r'), write ('w'), or append ('a') @type mode: C{str} @param local_access: if C{False}, processor 0 is the only one to access the file, all others communicate with processor 0. If C{True} (only for reading), each processor accesses the file directly. In the latter case, the file must be accessible on all processors under the same name. A third mode is 'auto', which uses some heuristics to decide if the file is accessible everywhere: it checks for existence of the file, then compares the size on all processors, and finally verifies that the same variables exist everywhere, with identical names, types, and sizes. @type local_access: C{bool} or C{str} """ if mode != 'r': local_access = 0 self.pid = pid self.nprocs = nprocs self.filename = filename self.split = split_dimension self.local_access = local_access self.read_only = mode == 'r' if local_access or pid == 0: self.file = NetCDFFile(filename, mode) try: length = self.file.dimensions[split_dimension] if length is None: length = -1 except KeyError: length = None variables = {} for name, var in self.file.variables.items(): variables[name] = (name, var.dimensions) if length < 0 and split_dimension in var.dimensions: index = list(var.dimensions).index(split_dimension) length = var.shape[index] else: self.file = None self.split = split_dimension length = None variables = None if not local_access: length = self.broadcast(length) variables = self.broadcast(variables) if length is not None: self._divideData(length) self.variables = {} for name, var in variables.items(): self.variables[name] = _ParNetCDFVariable(self, var[0], var[1], split_dimension) def __repr__(self): return repr(self.filename) def close(self): if self.local_access or self.pid == 0: self.file.close() def createDimension(self, name, length): if name == self.split: if length is None: raise ValueError("Split dimension cannot be unlimited") self._divideData(length) if self.pid == 0: self.file.createDimension(name, length) def createVariable(self, name, typecode, dimensions): if self.pid == 0: var = self.file.createVariable(name, typecode, dimensions) dim = var.dimensions else: dim = 0 name, dim = self.broadcast((name, dim)) self.variables[name] = _ParNetCDFVariable(self, name, dim, self.split) return self.variables[name] def _divideData(self, length): chunk = (length+self.nprocs-1)/self.nprocs self.first = min(self.pid*chunk, length) self.last = min(self.first+chunk, length) if (not self.local_access) and self.pid == 0: self.parts = [] for pid in range(self.nprocs): first = pid*chunk last = min(first+chunk, length) self.parts.append((first, last)) def sync(self): if self.pid == 0: self.file.sync() flush = sync class _ParNetCDFVariable(ParBase): def __init__(self, file, name, dimensions, split_dimension): self.file = file self.pid = file.pid self.nprocs = file.nprocs self.name = name self.dimensions = dimensions self.value = self self.attributes = {} try: self.index = list(dimensions).index(split_dimension) except ValueError: self.index = None def __repr__(self): return repr(self.name) def __getitem__(self, item): item = self._prepareIndices(item) if self.file.local_access : data = self._readData(item, self.file.first, self.file.last) elif self.pid == 0: for pid in range(1, self.nprocs): first, last = self.file.parts[pid] data = self._readData(item, first, last) self.put(data, [pid]) data = self._readData(item, self.file.first, self.file.last) else: for pid in range(1, self.nprocs): messages = self.put(None, []) if messages: data = messages[0] if data is None: return ParInvalid else: return data def __getslice__(self, first, last): return self.__getitem__(slice(first, last)) def __setitem__(self, item, value): item = self._prepareIndices(item) if is_invalid(value): value = None if self.pid == 0: if value is not None: self._writeData(item, value, self.file.first, self.file.last) if self.index is not None: for pid in range(1, self.nprocs): first, last = self.file.parts[pid] data = self.put(None, []) if data and data[0] is not None: self._writeData(item, data[0], first, last) else: if self.index is not None: for pid in range(1, self.nprocs): if pid == self.pid: self.put(value, [0]) else: self.put(None, []) def __setslice__(self, first, last, value): self.__setitem__(slice(first, last), value) def _prepareIndices(self, item): if not hasattr(item, 'is_parindex'): if type(item) != type(()): item = (item,) item = item + (len(self.dimensions)-len(item))*(slice(None),) return item def _readData(self, item, part_first, part_last): item = self._indices(item, part_first, part_last) if item is None: return None else: return self.file.file.variables[self.name][item] def _writeData(self, item, data, part_first, part_last): try: if len(data) == 0: return except TypeError: pass item = self._indices(item, part_first, part_last) if item is not None: try: self.file.file.variables[self.name][item] = N.array(data) except: print self.file.file.variables[self.name].shape print item print N.array(data).shape raise def _indices(self, item, part_first, part_last): if hasattr(item, 'is_parindex'): if not item.valid: return None if item.skip == 0: return item.start+part_first else: return slice(item.start+part_first, item.stop+part_first, item.skip) if self.index is not None: split = item[self.index] if isinstance(split, int): raise ValueError("Must use slice along split dimension") first, last, skip = split.start, split.stop, split.step if first is None: first = 0 if skip is None: skip = 1 n1 = max(0, (part_first-first+skip-1)/skip) first = first + n1*skip if last is None: last = part_last last = min(last, part_last) item = item[:self.index] + (slice(first, last, skip),) + \ item[self.index+1:] return item def __getattr__(self, attr): if self.file.local_access: return getattr(self.file.file.variables[self.name], attr) try: return self.attributes[attr] except KeyError: pass if self.pid == 0: value = getattr(self.file.file.variables[self.name], attr) else: value = None value = self.broadcast(value) if self.file.read_only: self.attributes[attr] = value return value def __len__(self): return self.file.last - self.file.first ParNetCDFVariable = ParClass(_ParNetCDFVariable) ParNetCDFFile = ParClass(_ParNetCDFFile) ScientificPython-2.9.4/Scientific/Clustering/0000755000076600000240000000000012270505005021613 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/Clustering/__init__.py0000644000076600000240000000001511501734227023726 0ustar hinsenstaff00000000000000# Empty file ScientificPython-2.9.4/Scientific/Clustering/AffinityPropagation.py0000644000076600000240000003022712233721050026145 0ustar hinsenstaff00000000000000# Clustering by affinity propagation. # # Written by Konrad Hinsen # """ Clustering by Affinity Propagation This clustering algorithm identifies clusters in a set of data items based on a list of similarities between the items. The result is a list of clusters, each cluster being defined by one 'exemplar' (the item that is most representative of the cluster) and by other items. The number of clusters is not specified in advance. Instead, a parameter called 'preference' indicates how likely each item is to be an exemplar. Often it is set to the same value for all items. Low preference values yield few big clusters, whereas high preference values yield many small clusters. The algorithm is described in: B.J. Frey & D. Dueck, Science 315, 972-976 (2007) """ from Scientific import N import random class DataSet(object): """A collection of data items with similarities """ def __init__(self, items, similarities, symmetric = False, minimal_similarity=None): """ @param items: a sequence of data items @type items: sequence @param similarities: similarity values for item pairs. This parameter can have one of three forms: - a list if triples (index1, index2, similarity), where the indices point into the item list and the similarity is a real number. - a callable object (typically a function or a bound method) that is called with two items and returns the similarity. - an array of shape (N, N), where N is the number of items, containing the similarities. The diagonal elements are not used. @param symmetric: if C{True}, the similarity measure is assumed to be symmetric. If C{False}, no such assumption is made and the input data (if a list) must contain both directions for each pair. If the similarity is defined by a function, it will be called twice of symmtric=False and once if symmetric=True. If the similarity is defined by an array, this parameter is not used. @type symmetric: C{bool} @param minimal_similarity: a cutoff value for the similarities; values smaller than this cutoff are discarded. This is of use for large data sets because both the runtime and the memory consumption increase with the number of similarity values. @type minimal_similarity: C{float} """ self.items = items self.nitems = len(items) self._setupSimilarities(items, similarities, symmetric, minimal_similarity) self._setupIndices() def _setupSimilarities(self, items, similarities, symmetric, minimal_similarity): self.similarities = [] self.index = {} self.smallest_similarity = None self.largest_similarity = None self.median_similarity = None # Check for array of similarities if isinstance(similarities, N.ArrayType): if similarities.shape != 2*(self.nitems,): raise ValueError("Similarity array has wrong shape") for i in range(self.nitems): for k in range(self.nitems): if i != k: self._storeSimilarity(i, k, similarities[i, k], minimal_similarity) # Check for callable similarity function elif callable(similarities): for i in range(self.nitems): for k in range(i+1, self.nitems): s = similarities(self.items[i], self.items[k]) self._storeSimilarity(i, k, s, minimal_similarity) if not symmetric: s = similarities(self.items[k], self.items[i]) self._storeSimilarity(k, i, s, minimal_similarity) # Assume list of (i, k, s) triples else: for i, k, s in similarities: if i < 0 or i > self.nitems or k < 0 or k > self.nitems: raise ValueError("Index out of range in " + str((i, k, s))) if i == k: raise ValueError("Equal indices in " + str((i, k, s))) self._storeSimilarity(i, k, s, minimal_similarity) if symmetric: self._storeSimilarity(k, i, s, minimal_similarity) # Add indices for self terms for i in range(self.nitems): self._storeSimilarity(i, i, None, None) # Convert similarities to array self.nsimilarities = len(self.similarities) self.similarities = N.array(self.similarities[:-self.nitems]) # Find smallest, largest, and median self.smallest_similarity = N.minimum.reduce(self.similarities) self.largest_similarity = N.maximum.reduce(self.similarities) sort_indices = N.argsort(self.similarities) ns = len(self.similarities) if ns % 2 == 1: self.median_similarity = self.similarities[sort_indices[ns/2]] else: self.median_similarity = \ (self.similarities[sort_indices[ns/2]] + self.similarities[sort_indices[ns/2-1]])/2. def _storeSimilarity(self, i, k, s, minimal_similarity): if s >= minimal_similarity: index_by_i = self.index.setdefault(i, {}) index_by_i[k] = len(self.similarities) self.similarities.append(s) def _setupIndices(self): self._setupRIndices() self._setupAIndices1() self._setupAIndices2() self._setupEIndices() def _setupRIndices(self): indices = [] for i in range(self.nsimilarities): indices.append([]) for i in range(self.nitems): for k1, index1 in self.index[i].items(): for k2, index2 in self.index[i].items(): if k2 != k1: indices[index1].append(index2) self.r_update_indices = [N.array(i) for i in indices] def _setupAIndices1(self): indices = N.zeros((self.nsimilarities,), N.Int) for i in range(self.nitems): for k, index in self.index[i].items(): indices[index] = self.index[k][k] self.a_update_indices_1 = indices def _setupAIndices2(self): index_inv = {} for i in range(self.nitems): index_inv[i] = {} for i in range(self.nitems): for k, index in self.index[i].items(): index_inv[k][i] = index indices = self.nsimilarities*[None] for k in range(self.nitems): all = index_inv[k].items() for i, index in all: indices[index] = N.array([x[1] for x in all if x[0] != i and x[0] != k]) self.a_update_indices_2 = indices def _setupEIndices(self): indices = [] for i in range(self.nitems): ii = [] ik = [] for k, index in self.index[i].items(): ii.append(index) ik.append(k) indices.append((N.array(ii), N.array(ik))) self.e_indices = indices def findClusters(self, preferences, max_iterations=500, convergence = 50, damping=0.5): """ @param preferences: the preference values for the cluster identification. This can be either a single number, or a sequence with one value per item. @type preferences: C{float} or sequence of C{float} @param max_iterations: the number of iterations at which the algorithm is stopped even if there is no convergence. @type max_iterations: C{int} @param convergence: the number of iterations during which the cluster decomposition must remain stable before it is returned as converged. @type convergence: C{int} @param damping: a number between 0 and 1 that influences by fast affinity and responsibility values can change. @type damping: C{float} """ preferences = N.array(preferences) if len(preferences.shape) == 0: preferences = preferences + N.zeros((self.nitems,), N.Float) if len(preferences) != self.nitems: raise ValueError("Number of preferences != number of items") noise_scale = 1.e-12*(self.largest_similarity-self.smallest_similarity) s = N.concatenate([self.similarities, preferences]) for i in range(len(s)): s[i] += noise_scale*random.random() a = N.zeros(s.shape, N.Float) r = N.zeros(s.shape, N.Float) iterations_left = max_iterations convergence_count = 0 self.exemplar = N.zeros((self.nitems,), N.Int) while True: a, r = _affinityPropagation(self, s, a, r, damping) e = a + r exemplar = N.zeros((self.nitems,), N.Int) for i in range(self.nitems): ii, ik = self.e_indices[i] exemplar[i] = ik[N.argmax(N.take(e, ii))] if N.logical_and.reduce(exemplar == self.exemplar): convergence_count += 1 if convergence_count == convergence: break else: self.exemplar = exemplar iterations_left -= 1 if iterations_left == 0: raise ValueError("no convergence in %d iterations" % max_iterations) clusters = [] indices = N.arange(self.nitems) exemplar_indices = N.repeat(indices, self.exemplar == indices) for i in exemplar_indices: members = list(N.repeat(indices, self.exemplar == self.exemplar[i])) members.remove(i) members.insert(0, i) clusters.append([self.items[m] for m in members]) return clusters try: from Scientific._affinitypropagation import _affinityPropagation except ImportError: def _affinityPropagation(dataset, s, a, r, damping): aps = a + s r_new = N.zeros(s.shape, N.Float) for i in range(dataset.nsimilarities): r_new[i] = s[i] \ - N.maximum.reduce(N.take(aps, dataset.r_update_indices[i])) r = damping*r + (1-damping)*r_new rpos = N.maximum(0., r) a_new = N.take(r, dataset.a_update_indices_1) a_new[-dataset.nitems:] = 0. for i in range(dataset.nsimilarities): a_new[i] += N.add.reduce(N.take(rpos, dataset.a_update_indices_2[i])) a_new[:-dataset.nitems] = N.minimum(0., a_new[:-dataset.nitems]) a = damping*a + (1-damping)*a_new return a, r if __name__ == "__main__": points = N.array([[-2.341500, 3.696800], [-1.109200, 3.111700], [-1.566900, 1.835100], [-2.658500, 0.664900], [-4.031700, 2.845700], [-3.081000, 2.101100], [2.588000, 1.781900], [3.292300, 3.058500], [4.031700, 1.622300], [3.081000, -0.611700], [0.264100, 0.398900], [1.320400, 2.207400], [0.193700, 3.643600], [1.954200, -0.505300], [1.637300, 1.409600], [-0.123200, -1.516000], [-1.355600, -3.058500], [0.017600, -4.016000], [1.003500, -3.590400], [0.017600, -2.420200], [-1.531700, -0.930900], [-1.144400, 0.505300], [0.616200, -1.516000], [1.707700, -2.207400], [2.095100, 3.430900]]) def simfunc(p1, p2): return -N.sum((p1-p2)**2) data = DataSet(points, simfunc, symmetric=True) clusters = [N.array(c) for c in data.findClusters(data.median_similarity)] for c in clusters: print c from Gnuplot import plot apply(plot, clusters) ScientificPython-2.9.4/Scientific/DictWithDefault.py0000644000076600000240000000253111501734157023103 0ustar hinsenstaff00000000000000# A dictionary with default values for non-existing entries """ Dictionary with default values Note: this module has become obsolete by the introduction of the get method for standard Python dictionaries. It is maintained only in order not to break old code that uses it. """ import UserDict, copy class DictWithDefault(UserDict.UserDict): """ Dictionary with default values Instances of this class act like standard Python dictionaries, except that they return a *copy* of |default| for a key that has no associated value. """ def __init__(self, default): """ @param default: the default value that is returned for a key that has no associated value """ self.data = {} self.default = default UserDict.UserDict.__init__(self) def __getitem__(self, key): """ @param key: the key whose associated value is requested @returns: the associated value. If none is defined, the return value is a copy of the default value. """ try: item = self.data[key] except KeyError: item = copy.copy(self.default) self.data[key] = item return item def __delitem__(self, key): try: del self.data[key] except KeyError: pass ScientificPython-2.9.4/Scientific/DistributedComputing/0000755000076600000240000000000012270505005023644 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/DistributedComputing/__init__.py0000644000076600000240000000001511501734230025751 0ustar hinsenstaff00000000000000# blank file ScientificPython-2.9.4/Scientific/DistributedComputing/MasterSlave.py0000644000076600000240000005267511515301162026462 0ustar hinsenstaff00000000000000# # Master-slave process manager for distributed computing # based on Pyro # # Written by Konrad Hinsen # last revision: 2011-1-18 # """ Distributed computing using a master-slave model The classes in this module provide a simple way to parallelize independent computations in a program. The communication is handled by the Pyro package, which must be installed before this module can be used. Pyro can be obtained from http://pyro.sourceforge.net/. By default, the Pyro name server is used to initialize communication. Please read the Pyro documentation for learning how to use the name server. The principle of the master-slave model is that there is a single master process that defines computational tasks and any number of slave processes that execute these tasks. The master defines task requests and then waits for the results to come in. The slaves wait for a task request, execute it, return the result, and wait for the next task. There can be any number of slave processes, which can be started and terminated independently, the only condition being that no slave process can be started before its master process. This setup makes it possible to perform a lengthy computation using a variable number of processors. Communication between the master and the slave processes passes through a TaskManager object that is created automatically as part of the master process. The task manager stores and hands out task requests and results. The task manager also keeps track of the slave processes. When a slave process disappears (because it was killed or because of a hardware failure), the task manager re-schedules its active task(s) to another slave process. This makes the master-slave system very fault tolerant. Each task manager has a label that makes it possible to distinguish between several master-slave groups running at the same time. It is by the label that slave processes identify the master process for which they work. The script "task_manager" prints statistics about a currently active task manager; it takes the label as an argument. It shows the number of currently active processes (master plus slaves), the number of waiting and running tasks, and the number of results waiting to be picked up. The script Examples/master_slave_demo.py illustrates the use of the master-slave setup in a simple script. Both master and slave processes are defined in the same script. The scripts Examples/master.py and Examples/slave.py show a master-slave setup using two distinct scripts. This is more flexible because task requests and result retrievals can be made from anywhere in the master code. """ from Scientific.DistributedComputing.TaskManager import \ TaskManager, TaskManagerTermination, TaskRaisedException import Pyro.core import Pyro.naming import Pyro.errors import threading import time import copy debug = False class MasterProcess(object): """ Master process in a master-slave setup A master process in a program is implemented by subclassing this class and overriding the method "run", which calls the methods "requestTask" and "retrieveResult". The process is then launched by calling the method "start". """ def __init__(self, label, use_name_server=True): """ @param label: the label that identifies the task manager @type label: C{str} @param use_name_server: If C{True} (default), the task manager is registered with the Pyro name server. If C{False}, the name server is not used and slave processes need to know the host on which the master process is running. @type use_name_server: C{bool} """ self.label = label self.task_manager = TaskManager() self.process_id = \ self.task_manager.registerProcess(info = getMachineInfo()) Pyro.core.initServer(banner=False) self.pyro_ns = None if use_name_server: self.pyro_ns=Pyro.naming.NameServerLocator().getNS() self.manager_thread = threading.Thread(target = self.taskManagerThread) self.manager_thread.start() self.global_states = {} def taskManagerThread(self): """ This method represents the code that is executed in a background thread for remote access to the task manager. """ self.pyro_daemon=Pyro.core.Daemon() if self.pyro_ns is not None: # Make another name server proxy for this thread pyro_ns=Pyro.naming.NameServerLocator().getNS() self.pyro_daemon.useNameServer(pyro_ns) try: pyro_ns.createGroup("TaskManager") except Pyro.errors.NamingError: pass uri = self.pyro_daemon.connect(self.task_manager, "TaskManager.%s" % self.label) try: self.pyro_daemon.requestLoop() finally: self.pyro_daemon.shutdown(True) if self.pyro_ns is not None: try: pyro_ns.unregister("TaskManager.%s" % self.label) except Pyro.errors.NamingError: pass def requestTask(self, tag, *parameters): """ Launches a task request. The task will be executed by a slave process in a method called "do_"+tag that is called with the parameters given in the task request. Note that the order of task executions is not defined. @param tag: a tag identifying the computational task. It corresponds to the name of a method in the slave process. @type tag: C{str} @param parameters: the parameters passed to the corresponding method in the slave process. The only restriction on their types is that all parameters must be picklable. @return: a unique task id @rtype: C{str} """ return self.task_manager.addTaskRequest(tag, parameters) def retrieveResult(self, tag=None): """ @param tag: a tag identifying the computational task from which a return value is requested. If C{None}, results from any task will be accepted. @type tag: C{str} @return: a tuple containing three values: the task id to which the result corresponds, the tag of the computational task, and the result returned by the slave method that handled the task @rtype: C{tuple} @raises TaskRaisedException: if the slave method raised an exception """ try: if tag is None: return self.task_manager.getAnyResult() else: task_id, result = self.task_manager.getResultWithTag(tag) return task_id, tag, result except TaskManagerTermination: return None, None, None def setGlobalState(self, **kw): state_id = min(self.global_states.keys() + [0]) + 1 self.global_states[state_id] = kw.keys() for name, value in kw.items(): label = "state_%d_%s" % (state_id, name) if debug: print "Storing state value ", label self.task_manager.storeData(**{label: value}) return state_id def deleteGlobalState(self, state_id): for name in self.global_states[state_id]: label = "state_%d_%s" % (state_id, name) if debug: print "Deleting state value ", label self.task_manager.deleteData(label) def start(self): """ Starts the master process. """ try: self.run() finally: self.shutdown() def shutdown(self): self.task_manager.terminate() while self.task_manager.numberOfActiveProcesses() > 1: time.sleep(0.1) self.pyro_daemon.shutdown() self.manager_thread.join() def run(self): """ The main routine of the master process. This method must be overridden in subclasses. """ raise NotImplementedError def launchSlaveJobs(self, n=1): """ Launch n slave jobs on the machine that also runs the master job. @param n: the number of slave jobs to be launched. @type n: C{int} """ import subprocess, sys slave_script = ('label="%s"\n' % self.label) + ''' import Pyro.core import Pyro.errors import sys Pyro.core.initClient(banner=False) while True: try: task_manager = \ Pyro.core.getProxyForURI("PYROLOC://localhost/TaskManager.%s" % label) break except Pyro.errors.NamingError: continue try: slave_code = task_manager.retrieveData("slave_code") except KeyError: print "No slave code available for %s" % label raise SystemExit namespace = {} sys.modules["__main__"].SLAVE_PROCESS_LABEL = label sys.modules["__main__"].SLAVE_NAMESPACE = namespace exec slave_code in namespace ''' directory = self.task_manager.retrieveData("cwd") for i in range(n): process = subprocess.Popen([sys.executable], stdin=subprocess.PIPE, cwd=directory) process.stdin.write(slave_script) process.stdin.close() class SlaveProcess(object): """ Slave process in a master-slave setup A concrete slave process in a program is implemented by subclassing this class and adding the methods that handle the computational tasks. Such a method has the name "do_" followed by the tag of the computational task. The process is then launched by calling the method "start". """ def __init__(self, label, master_host=None, watchdog_period=120.): """ @param label: the label that identifies the task manager @type label: C{str} @param master_host: If C{None} (default), the task manager of the master process is located using the Pyro name server. If no name server is used, this parameter must be the hostname of the machine on which the master process runs, plus the port number if it is different from the default (7766). @type master_host: C{str} or C{NoneType} @param watchdog_period: the interval (in seconds) at which the slave process sends messages to the manager to signal that it is still alive. If None, no messages are sent at all. In that case, the manager cannot recognize if the slave job has crashed or been killed. @type watchdog_period: C{int} or C{NoneType} """ Pyro.core.initClient(banner=False) if master_host is None: self.task_manager = \ Pyro.core.getProxyForURI("PYRONAME://TaskManager.%s" % label) else: # URI defaults to "PYROLOC://localhost:7766/" uri = "PYROLOC://%s/TaskManager.%s" % (master_host, label) self.task_manager = Pyro.core.getProxyForURI(uri) self.watchdog_period = watchdog_period self.done = False self.global_state_cache = {} # Compile a dictionary of methods that implement tasks import inspect self.task_methods = {} if debug: print "Scanning task handler methods..." for name, value in inspect.getmembers(self, inspect.isroutine): if name[:3] == "do_": self.task_methods[name] = value if debug: print " found handler for task ", name[:3] if debug: print len(self.task_methods), "task handlers found in class" print "If the slave is defined by a script or module, it is" print "normal that none have been found!" def watchdogThread(self): """ This method is run in a separate thread that pings the master process regularly to signal that it is still alive. """ task_manager = copy.copy(self.task_manager) while True: task_manager.ping(self.process_id) if self.done: break time.sleep(self.watchdog_period) def processParameter(self, parameter): if isinstance(parameter, GlobalStateValue): try: if debug: print "Returning state value", parameter.label return self.global_state_cache[parameter.label] except KeyError: if debug: print "Retrieving state value", parameter.label self.global_state_cache[parameter.label] = \ self.task_manager.retrieveData(parameter.label) return self.global_state_cache[parameter.label] else: return parameter def start(self, namespace=None): """ Starts the slave process. """ if debug: print "Starting slave process" if namespace is None: namespace = self.task_methods self.process_id = \ self.task_manager.registerProcess(self.watchdog_period, info = getMachineInfo()) if self.watchdog_period is not None: self.background_thread = \ threading.Thread(target=self.watchdogThread) self.background_thread.setDaemon(True) self.background_thread.start() # The slave process main loop while True: # Should we terminate for whatever reason? if self.terminationTest(): break # Get a task try: task_id, tag, parameters = \ self.task_manager.getAnyTask(self.process_id) if debug: print "Got task", task_id, "of type", tag except TaskManagerTermination: break # Find the method to call try: method = namespace["do_%s" % tag] except KeyError: if debug: print "No suitable handler was found, returning task." self.task_manager.returnTask(task_id) continue # Replace GlobalStateValue objects by the associated values parameters = tuple(self.processParameter(p) for p in parameters) # Call the method try: if debug: print "Executing task handler..." result = method(*parameters) if debug: print "...done." except KeyboardInterrupt: if debug: print "Keyboard interrupt" self.task_manager.returnTask(task_id) self.task_manager.unregisterProcess(self.process_id) raise except Exception, e: import traceback, StringIO if debug: print "Exception:" traceback.print_exc() tb_text = StringIO.StringIO() traceback.print_exc(None, tb_text) tb_text = tb_text.getvalue() self.task_manager.storeException(task_id, e, tb_text) else: if debug: print "Storing result..." self.task_manager.storeResult(task_id, result) if debug: print "...done." self.task_manager.unregisterProcess(self.process_id) self.done = True # Subclasses can redefine this method def terminationTest(self): return False def getMachineInfo(): import os, platform sysname, nodename, release, version, machine, processor = platform.uname() pid = os.getpid() return "PID %d on %s (%s)" % (pid, nodename, machine) class GlobalStateValue(object): def __init__(self, state_id, name): self.label = "state_%d_%s" % (state_id, name) # # Job handling utility # def runJob(label, master_class, slave_class, watchdog_period=120., launch_slaves=0): """ Creates an instance of the master_class and runs it. A copy of the script and the current working directory are stored in the TaskManager object to enable the task_manager script to launch slave processes. @param label: the label that identifies the task manager @type label: C{str} @param master_class: the class implementing the master process (a subclass of L{MasterProcess}) @param slave_class: the class implementing the slave process (a subclass of L{SlaveProcess}) @param watchdog_period: the interval (in seconds) at which the slave process sends messages to the manager to signal that it is still alive. If None, no messages are sent at all. In that case, the manager cannot recognize if the slave job has crashed or been killed. @type watchdog_period: C{int} or C{NoneType} @param launch_slaves: the number of slaves jobs to launch immediately on the same machine that runs the master process @type launch_slaves: C{int} """ import inspect import os import sys main_module = sys.modules['__main__'] try: slave_label = main_module.SLAVE_PROCESS_LABEL master = label != slave_label except AttributeError: master = True if master: filename = inspect.getsourcefile(main_module) source = file(filename).read() process = master_class(label) process.task_manager.storeData(slave_code = source, cwd = os.getcwd()) if launch_slaves > 0: process.launchSlaveJobs(launch_slaves) process.start() else: slave_class(label, watchdog_period=watchdog_period).start() # # Alternate interface for multi-module programs # def initializeMasterProcess(label, slave_script=None, slave_module=None, use_name_server=True): """ Initializes a master process. @param label: the label that identifies the task manager @type label: C{str} @param slave_script: the file name of the script that defines the corresponding slave process @type slave_script: C{str} @param slave_module: the name of the module that defines the corresponding slave process @type slave_module: C{str} @param use_name_server: If C{True} (default), the task manager is registered with the Pyro name server. If C{False}, the name server is not used and slave processes need to know the host on which the master process is running. @type use_name_server: C{bool} @returns: a process object on which the methods requestTask() and retrieveResult() can be called. @rtype: L{MasterProcess} """ import atexit import os process = MasterProcess(label, use_name_server) atexit.register(process.shutdown) if slave_script is not None or slave_module is not None: if slave_script is not None: source = file(slave_script).read() else: source = """ import Scientific.DistributedComputing.MasterSlave from %s import * """ % slave_module if debug: source += "print 'Slave definitions:'\n" source += "print dir()\n" source += "Scientific.DistributedComputing.MasterSlave.debug=True\n" source += """ Scientific.DistributedComputing.MasterSlave.startSlaveProcess() """ process.task_manager.storeData(slave_code = source, cwd = os.getcwd()) if debug: print "Slave source code:" print 50*'-' print source print 50*'-' return process def startSlaveProcess(label=None, master_host=None): """ Starts a slave process. Must be called at the end of a script that defines or imports all task handlers. @param label: the label that identifies the task manager. May be omitted if the slave process is started through the task_manager script. @type label: C{str} or C{NoneType} @param master_host: If C{None} (default), the task manager of the master process is located using the Pyro name server. If no name server is used, this parameter must be the hostname of the machine on which the master process runs, plus the port number if it is different from the default (7766). @type master_host: C{str} or C{NoneType} """ import sys main_module = sys.modules['__main__'] if label is None: label = main_module.SLAVE_PROCESS_LABEL namespace = main_module.SLAVE_NAMESPACE else: namespace = main_module.__dict__ if debug: print "Initializing slave process", label process = SlaveProcess(label, master_host=None) process.start(namespace) ScientificPython-2.9.4/Scientific/DistributedComputing/TaskManager.py0000644000076600000240000005003411504533630026421 0ustar hinsenstaff00000000000000# # Task manager for distributed computing based on Pyro # # Written by Konrad Hinsen # last revision: 2010-12-22 # import Pyro.core import threading import time """ Task manager for distributed computations. The task manager is used by the module MasterSlave, but can also be used directly for different distributed computing setups. """ debug = False class TaskManagerTermination(Exception): """ Signals that the task manager has no more tasks to handle. """ pass class TaskRaisedException(Exception): """ Signals that an exception was raised inside a task. Four attributes provide information about the task and the exception: "task_id" is the task's id, "tag" is its tag, "exception" contains the original exception object, and "traceback" contains a text representation of the stack traceback at the time of the exception. """ def __init__(self, task_id, tag, exception, traceback): self.task_id = task_id self.tag = tag self.exception = exception self.traceback = traceback class Task(object): """ Describes a task inside the task manager. """ def __init__(self, tag, parameters, task_id): """ @param tag: the tag of the computational task @type tag: C{str} @param parameters: the parameters of the task @type parameters: C{tuple} @param task_id: the task id @type task_id: C{str} """ self.tag = tag self.parameters = parameters self.id = task_id self.requesting_processor = None self.handling_processor = None self.request_time = None self.start_time = None self.end_time = None class TaskQueue(object): """ A FIFO queue for tasks. This class is thread-safe. """ def __init__(self): self.tasks = [] self.tasks_by_tag = {} self.tasks_by_id = {} self.task_available = threading.Condition() self.terminate = False def __len__(self): """ @returns: the number of tasks in the queue @rtype: C{int} """ return len(self.tasks) def terminateWaitingThreads(self): """ Makes all threads waiting for a task raise L{TaskManagerTermination}. """ self.task_available.acquire() self.terminate = True self.task_available.notifyAll() self.task_available.release() def _checkForTermination(self): if self.terminate: self.task_available.release() raise TaskManagerTermination() def addTask(self, task, in_front=False): """ @param task: the task to be added @type task: L{Task} @param in_front: if C{True}, add the task at the beginning of the queue (this is for re-scheduling tasks that were rejected or not properly handled). Otherwise, add the task at the end of the queue. @type in_front: C{bool} """ self.task_available.acquire() self.tasks.append(task) tasks = self.tasks_by_tag.setdefault(task.tag, []) if in_front: tasks.insert(0, task) else: tasks.append(task) self.tasks_by_id[task.id] = task self.task_available.notifyAll() self.task_available.release() def firstTask(self): """ @returns: the first task in the queue @rtype: L{Task} Removes the first task from the queue and returns it. If the task queue is empty, the method blocks until a task becomes available. """ self.task_available.acquire() while not self.tasks: self._checkForTermination() self.task_available.wait() task = self.tasks[0] self._removeTask(task) self.task_available.release() return task def firstTaskWithTag(self, tag): """ @param tag: a task tag @type tag: C{str} @returns: the first task in the queue @rtype: L{Task} Removes the first task with the given tag from the queue and returns it. If no task with the requested tag is available, the method blocks until a matching task becomes available. """ self.task_available.acquire() while not self.tasks_by_tag.get(tag, None): self._checkForTermination() self.task_available.wait() task = self.tasks_by_tag[tag][0] self._removeTask(task) self.task_available.release() return task def taskWithId(self, task_id): """ @param task_id: a task id @type task_id: C{str} @returns: the task with the given task_id @rtype: L{Task} Removes the task with the given task_id from the queue and returns it. If the task is not in the queue, the method blocks until it becomes available. """ self.task_available.acquire() while True: task = self.tasks_by_id.get(task_id, None) if task is not None: break self._checkForTermination() self.task_available.wait() self._removeTask(task) self.task_available.release() return task def _removeTask(self, task): self.tasks.remove(task) self.tasks_by_tag[task.tag].remove(task) del self.tasks_by_id[task.id] def taskCount(self): """ @returns: a dictionary listing the number of tasks for each tag @rtype: C{dict} """ self.task_available.acquire() count = {} for tag, tasks in self.tasks_by_tag.items(): count[tag] = len(tasks) self.task_available.release() return count class TaskManager(Pyro.core.ObjBase): """ Manager for computational tasks. A TaskManager accepts task requests and hands them out to other processes. It stores the results that can then be picked up by the requester. A TaskManager also keeps track of its compute processes. If a process disappears, its running tasks are re-scheduled for execution by another compute process. TaskManangers are thread-safe. """ def __init__(self): Pyro.core.ObjBase.__init__(self) self.id_counter = 0 self.waiting_tasks = TaskQueue() self.running_tasks = TaskQueue() self.finished_tasks = TaskQueue() self.results = {} self.process_counter = 0 self.active_processes = [] self.process_info = [] self.tasks_by_process = [] self.data = {} self.lock = threading.RLock() self.watchdog = None def registerProcess(self, watchdog_period=None, info=None): """ @param watchdog_period: the period at which the registering process promises to ping the task manager to signal that is still alive. If C{None}, no pings are expected. @type watchdog_period: C{int} or C{NoneType} @param info: an information string telling something about the machine running the process @type info: C{str} @returns: a unique process id @rtype: C{int} Registers a process with the task manager. All processes must call this method before making any other task manager calls. """ self.lock.acquire() process_id = self.process_counter self.process_counter += 1 self.active_processes.append(process_id) self.process_info.append(info) self.tasks_by_process.append([]) self.lock.release() if watchdog_period is not None: if self.watchdog is None: self.watchdog = Watchdog(self) self.watchdog.registerProcess(process_id, watchdog_period) return process_id def unregisterProcess(self, process_id): """ @param process_id: the id of the process @type process_id: C{int} Removes the process from the task manager's process list. All processes should unregister when they are no longer available for accepting tasks. The task manager will also unregister processes itself if they do not ping the task manager at the promised frequency. """ if debug: print "Unregistering process", process_id self.lock.acquire() position = self.active_processes.index(process_id) for t in self.tasks_by_process[position]: self.returnTask(t.id) assert len(self.tasks_by_process[position]) == 0 del self.tasks_by_process[position] del self.active_processes[position] del self.process_info[position] self.lock.release() if self.watchdog is not None: self.watchdog.unregisterProcess(process_id) def ping(self, process_id): """ @param process_id: the id of the process @type process_id: C{int} Tells the task manager that a process is still alive. """ if self.watchdog is not None: self.watchdog.ping(process_id) def numberOfActiveProcesses(self): """ @returns: the number of active processes @rtype: C{int} """ return len(self.active_processes) def activeProcessInfo(self, pid): """ @param pid: the number of an active process @type pid: C{int} @returns: information about the active process number pid @rtype: C{str} """ return self.process_info[pid] def numberOfTasks(self): """ @returns: a tuple of dictionaries containing the number of waiting tasks, the number of running tasks, and the number of results waiting to be retrieved. Each dictionary contains the count for each tag. @rtype: C{tuple} """ self.lock.acquire() waiting = self.waiting_tasks.taskCount() running = self.running_tasks.taskCount() finished = self.finished_tasks.taskCount() self.lock.release() return waiting, running, finished def addTaskRequest(self, tag, parameters, process_id=None): """ @param tag: the tag of the task being requested @type tag: C{str} @param parameters: the parameters to be passed to the task @param process_id: the id of the requesting process (optional) @type process_id: C{int} @returns: the task id @rtype: C{str} """ self.lock.acquire() task_id = tag + '_' + str(self.id_counter) self.id_counter += 1 self.lock.release() new_task = Task(tag, parameters, task_id) if process_id: new_task.requesting_processor = process_id new_task.request_time = time.time() self.waiting_tasks.addTask(new_task) if debug: print "Task request %s: %s(%s)" % (task_id, tag, str(parameters)) return task_id def getTaskWithTag(self, tag, process_id=None): """ @param tag: a task tag @type tag: C{str} @param process_id: the id of the retrieving process (optional) @type process_id: C{int} @returns: the task id and the parameters @rtype: C{tuple} Returns a waiting task with the given tag. The task is removed from the list of waiting tasks and added to the list of running tasks. """ task = self.waiting_tasks.firstTaskWithTag(tag) self._checkoutTask(task, process_id) return task.id, task.parameters def getAnyTask(self, process_id=None): """ @param process_id: the id of the retrieving process (optional) @type process_id: C{int} @returns: the task id, the task tag, and the parameters @rtype: C{tuple} Returns a waiting task of arbitrary tag. The task is removed from the list of waiting tasks and added to the list of running tasks. """ task = self.waiting_tasks.firstTask() self._checkoutTask(task, process_id) return task.id, task.tag, task.parameters def _checkoutTask(self, task, process_id): task.handling_processor = process_id task.start_time = time.time() self.running_tasks.addTask(task) if process_id is not None: self.lock.acquire() position = self.active_processes.index(process_id) self.tasks_by_process[position].append(task) self.lock.release() if debug: print "Handing out task %s to process %s" \ % (task.id, str(process_id)) def storeResult(self, task_id, result): """ @param task_id: the id of the task for which the result is provided @type task_id: C{str} @param result: the result of the task Stores the result associated with the task. The task is removed from the list of running tasks and added to the list of finished tasks. """ if debug: print "Task %s yielded result %s" % (task_id, result) self.lock.acquire() self.results[task_id] = result self.lock.release() task = self.running_tasks.taskWithId(task_id) task.end_time = time.time() task.completed = True self.finished_tasks.addTask(task) self._removeTask(task) def storeException(self, task_id, exception, traceback): """ @param task_id: the id of the task for which the result is provided @type task_id: C{str} @param exception: the exception raised by the task @param traceback: a text version of the stack traceback at the time of the exception @type traceback: C{str} Stores the exception associated with the task. The task is removed from the list of running tasks and added to the list of finished tasks. When the result is retrieved by another process, L{TaskRaisedException} is raised. """ if debug: print "Task %s raised exception %s" % (task_id, exception) self.lock.acquire() self.results[task_id] = (exception, traceback) self.lock.release() task = self.running_tasks.taskWithId(task_id) task.end_time = time.time() task.completed = False self.finished_tasks.addTask(task) self._removeTask(task) def returnTask(self, task_id): """ @param task_id: the id of the task for which the result is provided @type task_id: C{str} Removes a task from the list of running tasks and put its back at the beginning of the list of waiting tasks. This method should be called by a process that has obtained a task but cannot handle it. """ if debug: print "Task %s returned" % task_id task = self.running_tasks.taskWithId(task_id) self._removeTask(task) task.start_time = None task.handling_processor = None self.waiting_tasks.addTask(task, in_front=True) def _removeTask(self, task): if task.handling_processor is not None: self.lock.acquire() try: position = self.active_processes.index(task.handling_processor) self.tasks_by_process[position].remove(task) except ValueError: pass self.lock.release() def getAnyResult(self): """ @returns: the task id, the task tag, and the result of the task @rtype: C{tuple} Returns the result of an arbitrary finished task. The task is removed from the list of finished tasks. """ task = self.finished_tasks.firstTask() result = self.results[task.id] del self.results[task.id] if task.completed: return task.id, task.tag, result else: raise TaskRaisedException(task.id, task.tag, result[0], result[1]) def getResultWithTag(self, tag): """ @param tag: a task tag @returns: the task id and the result of the task @rtype: C{tuple} Returns the result of a finished task that has the given tag. The task is removed from the list of finished tasks. """ task = self.finished_tasks.firstTaskWithTag(tag) result = self.results[task.id] del self.results[task.id] if debug: print "Handed out result of %s" % task.id if task.completed: return task.id, result else: raise TaskRaisedException(task.id, task.tag, result[0], result[1]) def storeData(self, **kw): """ @param kw: a keyword list of data items to be stored @type kw: C{dict} This routine permits processes to exchange arbitrary data items through the task manager. """ self.lock.acquire() for label, data in kw.items(): self.data[label] = data self.lock.release() def retrieveData(self, label): """ @param label: the label of the data item to be retrieved @type label: C{str} """ self.lock.acquire() data = self.data[label] self.lock.release() return data def deleteData(self, label): """ @param label: the label of the data item to be deleted @type label: C{str} """ self.lock.acquire() del self.data[label] self.lock.release() def terminate(self): """ Signals that no more tasks or results will be requested. All waiting threads will be terminated by raising L{TaskManagerTermination}. """ if debug: print "Terminating" self.waiting_tasks.terminateWaitingThreads() self.running_tasks.terminateWaitingThreads() self.finished_tasks.terminateWaitingThreads() class Watchdog(object): """ A background process that watches compute tasks and unregisters those that do not ping the task manager at the promised interval. """ def __init__(self, task_manager): self.task_manager = task_manager self.ping_period = {} self.last_ping = {} self.done = False self.lock = threading.RLock() self.background_thread = threading.Thread(target = self.watchdogThread) self.background_thread.setDaemon(True) self.thread_started = False def registerProcess(self, process_id, ping_period): self.lock.acquire() self.ping_period[process_id] = ping_period self.last_ping[process_id] = time.time() if not self.thread_started: self.background_thread.start() self.thread_started = True self.lock.release() def unregisterProcess(self, process_id): self.lock.acquire() try: del self.ping_period[process_id] del self.last_ping[process_id] except KeyError: # KeyError happens when processes without watchdog are unregistered pass self.lock.release() def ping(self, process_id): self.lock.acquire() self.last_ping[process_id] = time.time() self.lock.release() def terminate(self, blocking=False): self.done = True if blocking: self.background_thread.join() def watchdogThread(self): while True: now = time.time() dead_processes = [] min_delay = min(self.ping_period.values() + [60.]) self.lock.acquire() for process_id in self.ping_period.keys(): delay = now-self.last_ping[process_id] if delay > 4*self.ping_period[process_id]: dead_processes.append(process_id) self.lock.release() for process_id in dead_processes: if debug: print "Process %d died" % process_id self.task_manager.unregisterProcess(process_id) if self.done: break time.sleep(min_delay) ScientificPython-2.9.4/Scientific/FFT.py0000644000076600000240000000035112233714145020472 0ustar hinsenstaff00000000000000# This package exists for compatibility with previous releases # of ScientificPython that supported both NumPy and the old # Numeric package. Please don't use it in new code, use numpy # directly. from numpy.oldnumeric.fft import * ScientificPython-2.9.4/Scientific/Functions/0000755000076600000240000000000012270505005021444 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/Functions/__init__.py0000644000076600000240000000001511501734230023551 0ustar hinsenstaff00000000000000# Empty file ScientificPython-2.9.4/Scientific/Functions/Derivatives.py0000644000076600000240000003146412132557055024324 0ustar hinsenstaff00000000000000# Automatic nth-order derivatives # # Written by Konrad Hinsen # last revision: 2007-5-25 # """ Automatic differentiation for functions of any number of variables up to any order An instance of the class DerivVar represents the value of a function and the values of its partial X{derivatives} with respect to a list of variables. All common mathematical operations and functions are available for these numbers. There is no restriction on the type of the numbers fed into the code; it works for real and complex numbers as well as for any Python type that implements the necessary operations. If only first-order derivatives are required, the module FirstDerivatives should be used. It is compatible to this one, but significantly faster. Example:: print sin(DerivVar(2)) produces the output:: (0.909297426826, [-0.416146836547]) The first number is the value of sin(2); the number in the following list is the value of the derivative of sin(x) at x=2, i.e. cos(2). When there is more than one variable, DerivVar must be called with an integer second argument that specifies the number of the variable. Example:: >>>x = DerivVar(7., 0) >>>y = DerivVar(42., 1) >>>z = DerivVar(pi, 2) >>>print (sqrt(pow(x,2)+pow(y,2)+pow(z,2))) produces the output >>>(42.6950770511, [0.163953328662, 0.98371997197, 0.0735820818365]) The numbers in the list are the partial derivatives with respect to x, y, and z, respectively. Higher-order derivatives are requested with an optional third argument to DerivVar. Example:: >>>x = DerivVar(3., 0, 3) >>>y = DerivVar(5., 1, 3) >>>print sqrt(x*y) produces the output >>>(3.87298334621, >>> [0.645497224368, 0.387298334621], >>> [[-0.107582870728, 0.0645497224368], >>> [0.0645497224368, -0.0387298334621]], >>> [[[0.053791435364, -0.0107582870728], >>> [-0.0107582870728, -0.00645497224368]], >>> [[-0.0107582870728, -0.00645497224368], >>> [-0.00645497224368, 0.0116189500386]]]) The individual orders can be extracted by indexing:: >>>print sqrt(x*y)[0] >>>3.87298334621 >>>print sqrt(x*y)[1] >>>[0.645497224368, 0.387298334621] An n-th order derivative is represented by a nested list of depth n. When variables with different differentiation orders are mixed, the result has the lower one of the two orders. An exception are zeroth-order variables, which are treated as constants. Caution: Higher-order derivatives are implemented by recursively using DerivVars to represent derivatives. This makes the code very slow for high orders. Note: It doesn't make sense to use multiple DerivVar objects with different values for the same variable index in one calculation, but there is no check for this. I.e.:: >>>print DerivVar(3, 0)+DerivVar(5, 0) produces >>>(8, [2]) but this result is meaningless. """ from Scientific import N; Numeric = N # The following class represents variables with derivatives: class DerivVar: """ Numerical variable with automatic derivatives of arbitrary order """ def __init__(self, value, index=0, order = 1, recursive = None): """ @param value: the numerical value of the variable @type value: number @param index: the variable index, which serves to distinguish between variables and as an index for the derivative lists. Each explicitly created instance of DerivVar must have a unique index. @type index: C{int} @param order: the derivative order @type order: C{int} @raise ValueError: if order < 0 """ if order < 0: raise ValueError('Negative derivative order') self.value = value if recursive: d = 0 else: d = 1 if type(index) == type([]): self.deriv = index elif order == 0: self.deriv = [] elif order == 1: self.deriv = index*[0] + [d] else: self.deriv = [] for i in range(index): self.deriv.append(DerivVar(0, index, order-1, 1)) self.deriv.append(DerivVar(d, index, order-1, 1)) self.order = order def toOrder(self, order): """ @param order: the highest derivative order to be kept @type order: C{int} @return: a DerivVar object with a lower derivative order @rtype: L{DerivVar} """ if self.order <= order: return self if order == 0: return self.value return DerivVar(self.value, map(lambda x, o=order-1: x.toOrder(o), self.deriv), order) def __getitem__(self, order): """ @param order: derivative order @type order: C{int} @return: a list of all derivatives of the given order @rtype: C{list} @raise ValueError: if order < 0 or order > self.order """ if order < 0 or order > self.order: raise ValueError('Index out of range') if order == 0: return self.value else: return map(lambda d, i=order-1: _indexDeriv(d,i), self.deriv) def __repr__(self): return repr(tuple(map(lambda n, x=self: x[n], range(self.order+1)))) def __str__(self): return str(tuple(map(lambda n, x=self: x[n], range(self.order+1)))) def __coerce__(self, other): if isDerivVar(other): if self.order==other.order or self.order==0 or other.order==0: return self, other order = min(self.order, other.order) return self.toOrder(order), other.toOrder(order) else: return self, DerivVar(other, [], 0) def __cmp__(self, other): return cmp(self.value, other.value) def __neg__(self): return DerivVar(-self.value,map(lambda a: -a, self.deriv), self.order) def __pos__(self): return self def __abs__(self): absvalue = abs(self.value) return DerivVar(absvalue, map(lambda a, d=self.value/absvalue: d*a, self.deriv), self.order) def __nonzero__(self): return self.value != 0 def __add__(self, other): return DerivVar(self.value + other.value, _mapderiv(lambda a,b: a+b, self.deriv, other.deriv), max(self.order, other.order)) __radd__ = __add__ def __sub__(self, other): return DerivVar(self.value - other.value, _mapderiv(lambda a,b: a-b, self.deriv, other.deriv), max(self.order, other.order)) def __rsub__(self, other): return DerivVar(other.value - self.value, _mapderiv(lambda a,b: a-b, other.deriv, self.deriv), max(self.order, other.order)) def __mul__(self, other): if self.order < 2: s1 = self.value else: s1 = self.toOrder(self.order-1) if other.order < 2: o1 = other.value else: o1 = other.toOrder(other.order-1) return DerivVar(self.value*other.value, _mapderiv(lambda a,b: a+b, map(lambda x,f=o1: f*x, self.deriv), map(lambda x,f=s1: f*x, other.deriv)), max(self.order, other.order)) __rmul__ = __mul__ def __div__(self, other): if not other.value: raise ZeroDivisionError('DerivVar division') if self.order < 2: s1 = self.value else: s1 = self.toOrder(self.order-1) if other.order < 2: o1i = 1./other.value else: o1i = 1./other.toOrder(other.order-1) return DerivVar(_toFloat(self.value)/other.value, _mapderiv(lambda a,b: a-b, map(lambda x,f=o1i: x*f, self.deriv), map(lambda x,f=s1*pow(o1i, 2): f*x, other.deriv)), max(self.order, other.order)) def __rdiv__(self, other): return other/self __truediv__ = __div__ def __pow__(self, other, z=None): if z is not None: raise TypeError('DerivVar does not support ternary pow()') if len(other.deriv) > 0: return Numeric.exp(Numeric.log(self)*other) else: if self.order < 2: ps1 = other.value*pow(self.value, other.value-1) else: ps1 = other.value*pow(self.toOrder(self.order-1), other.value-1) return DerivVar(pow(self.value, other.value), map(lambda x,f=ps1: f*x, self.deriv), max(self.order, other.order)) def __rpow__(self, other): return pow(other, self) def _mathfunc(self, f, d): if self.order < 2: fd = d(self.value) else: fd = d(self.toOrder(self.order-1)) return DerivVar(f(self.value), map(lambda x, f=fd: f*x, self.deriv), self.order) def exp(self): return self._mathfunc(Numeric.exp, Numeric.exp) def log(self): return self._mathfunc(Numeric.log, lambda x: 1./x) def log10(self): return self._mathfunc(Numeric.log10, lambda x: 1./(x*Numeric.log(10))) def sqrt(self): return self._mathfunc(Numeric.sqrt, lambda x: 0.5/Numeric.sqrt(x)) def sign(self): if self.value == 0: raise ValueError("can't differentiate sign() at zero") return self._mathfunc(Numeric.sign, lambda x: 0) def sin(self): return self._mathfunc(Numeric.sin, Numeric.cos) def cos(self): return self._mathfunc(Numeric.cos, lambda x: -Numeric.sin(x)) def tan(self): return self._mathfunc(Numeric.tan, lambda x: 1.+pow(Numeric.tan(x),2)) def sinh(self): return self._mathfunc(Numeric.sinh, Numeric.cosh) def cosh(self): return self._mathfunc(Numeric.cosh, Numeric.sinh) def tanh(self): return self._mathfunc(Numeric.tanh, lambda x: 1./pow(Numeric.cosh(x),2)) def arcsin(self): return self._mathfunc(Numeric.arcsin, lambda x: 1./Numeric.sqrt(1.-pow(x,2))) def arccos(self): return self._mathfunc(Numeric.arccos, lambda x: -1./Numeric.sqrt(1.-pow(x,2))) def arctan(self): return self._mathfunc(Numeric.arctan, lambda x: 1./(1+pow(x,2))) def arctan2(self, other): if self.order < 2: s1 = self.value else: s1 = self.toOrder(self.order-1) if other.order < 2: o1 = other.value else: o1 = other.toOrder(other.order-1) den = s1*s1+o1*o1 s1 = s1/den o1 = o1/den return DerivVar(Numeric.arctan2(self.value, other.value), _mapderiv(lambda a,b: a-b, map(lambda x,f=o1: x*f, self.deriv), map(lambda x,f=s1: x*f, other.deriv)), max(self.order, other.order)) # Type check def isDerivVar(x): """ @param x: an arbitrary object @return: True if x is a DerivVar object, False otherwise @rtype: C{bool} """ return hasattr(x,'value') and hasattr(x,'deriv') and hasattr(x,'order') # Map a binary function on two first derivative lists def _mapderiv(func, a, b): nvars = max(len(a), len(b)) a = a + (nvars-len(a))*[0] b = b + (nvars-len(b))*[0] return map(func, a, b) # Convert argument to float if it is integer def _toFloat(x): if isinstance(x, int): return float(x) return x # Subscript for DerivVar or ordinary number def _indexDeriv(d, i): if isDerivVar(d): return d[i] if i != 0: raise ValueError('Internal error') return d # Define vector of DerivVars def DerivVector(x, y, z, index=0, order = 1): """ @param x: x component of the vector @type x: number @param y: y component of the vector @type y: number @param z: z component of the vector @type z: number @param index: the DerivVar index for the x component. The y and z components receive consecutive indices. @type index: C{int} @param order: the derivative order @type order: C{int} @return: a vector whose components are DerivVar objects @rtype: L{Scientific.Geometry.Vector} """ from Scientific.Geometry.VectorModule import Vector if isDerivVar(x) and isDerivVar(y) and isDerivVar(z): return Vector(x, y, z) else: return Vector(DerivVar(x, index, order), DerivVar(y, index+1, order), DerivVar(z, index+2, order)) ScientificPython-2.9.4/Scientific/Functions/FindRoot.py0000644000076600000240000000620411501734230023544 0ustar hinsenstaff00000000000000# 'Safe' Newton-Raphson for numerical root-finding # # Written by Scott M. Ransom # last revision: 14 Nov 98 # # Cosmetic changes by Konrad Hinsen # last revision: 2006-11-23 # """ Newton-Raphson for numerical root finding Example:: >>>from Scientific.Functions.FindRoot import newtonRaphson >>>from Scientific.N import pi, sin, cos >>>def func(x): >>> return (2*x*cos(x) - sin(x))*cos(x) - x + pi/4.0 >>>newtonRaphson(func, 0.0, 1.0, 1.0e-12) yields 0.952847864655. """ from FirstDerivatives import DerivVar def newtonRaphson(function, lox, hix, xacc): """ X{Newton-Raphson} algorithm for X{root} finding. The algorithm used is a safe version of Newton-Raphson (see page 366 of Numerical Recipes in C, 2ed). @param function: function of one numerical variable that uses only those operations that are defined for DerivVar objects in the module L{Scientific.Functions.FirstDerivatives} @type function: callable @param lox: lower limit of the search interval @type lox: C{float} @param hix: upper limit of the search interval @type hix: C[{loat} @param xacc: requested absolute precision of the root @type xacc: C{float} @returns: a root of function between lox and hix @rtype: C{float} @raises ValueError: if C{function(lox)} and C{function(hix)} have the same sign, or if there is no convergence after 500 iterations """ maxit = 500 tmp = function(DerivVar(lox)) fl = tmp[0] tmp = function(DerivVar(hix)) fh = tmp[0] if ((fl > 0.0 and fh > 0.0) or (fl < 0.0 and fh < 0.0)): raise ValueError("Root must be bracketed") if (fl == 0.0): return lox if (fh == 0.0): return hix if (fl < 0.0): xl=lox xh=hix else: xh=lox xl=hix rts=0.5*(lox+hix) dxold=abs(hix-lox) dx=dxold tmp = function(DerivVar(rts)) f = tmp[0] df = tmp[1][0] for j in range(maxit): if ((((rts-xh)*df-f)*((rts-xl)*df-f) > 0.0) or (abs(2.0*f) > abs(dxold*df))): dxold=dx dx=0.5*(xh-xl) rts=xl+dx if (xl == rts): return rts else: dxold=dx dx=f/df temp=rts rts=rts-dx if (temp == rts): return rts if (abs(dx) < xacc): return rts tmp = function(DerivVar(rts)) f = tmp[0] df = tmp[1][0] if (f < 0.0): xl=rts else: xh=rts raise ValueError("Maximum number of iterations exceeded") # Test code if __name__ == '__main__': from Scientific.Numeric import pi, sin, cos def _func(x): return ((2*x*cos(x) - sin(x))*cos(x) - x + pi/4.0) _r = newtonRaphson(_func, 0.0, 1.0, 1.0e-12) _theo = 0.9528478646549419474413332 print '' print 'Finding the root (between 0.0 and 1.0) of:' print ' (2*x*cos(x) - sin(x))*cos(x) - x + pi/4 = 0' print '' print 'Safe-style Newton-Raphson gives (xacc = 1.0e-12) =', _r print 'Theoretical result (correct to all shown digits) = %15.14f' % _theo print '' ScientificPython-2.9.4/Scientific/Functions/FirstDerivatives.py0000644000076600000240000003070212132557055025326 0ustar hinsenstaff00000000000000# Automatic first-order derivatives # # Written by Konrad Hinsen # last revision: 2010-4-14 # """ Automatic differentiation for functions with any number of variables Instances of the class DerivVar represent the values of a function and its partial X{derivatives} with respect to a list of variables. All common mathematical operations and functions are available for these numbers. There is no restriction on the type of the numbers fed into the code; it works for real and complex numbers as well as for any Python type that implements the necessary operations. This module is as far as possible compatible with the n-th order derivatives module Derivatives. If only first-order derivatives are required, this module is faster than the general one. Example:: print sin(DerivVar(2)) produces the output:: (0.909297426826, [-0.416146836547]) The first number is the value of sin(2); the number in the following list is the value of the derivative of sin(x) at x=2, i.e. cos(2). When there is more than one variable, DerivVar must be called with an integer second argument that specifies the number of the variable. Example:: >>>x = DerivVar(7., 0) >>>y = DerivVar(42., 1) >>>z = DerivVar(pi, 2) >>>print (sqrt(pow(x,2)+pow(y,2)+pow(z,2))) produces the output >>>(42.6950770511, [0.163953328662, 0.98371997197, 0.0735820818365]) The numbers in the list are the partial derivatives with respect to x, y, and z, respectively. Note: It doesn't make sense to use DerivVar with different values for the same variable index in one calculation, but there is no check for this. I.e.:: >>>print DerivVar(3, 0)+DerivVar(5, 0) produces >>>(8, [2]) but this result is meaningless. """ from Scientific import N; Numeric = N # The following class represents variables with derivatives: class DerivVar: """ Numerical variable with automatic derivatives of first order """ def __init__(self, value, index=0, order=1): """ @param value: the numerical value of the variable @type value: number @param index: the variable index, which serves to distinguish between variables and as an index for the derivative lists. Each explicitly created instance of DerivVar must have a unique index. @type index: C{int} @param order: the derivative order, must be zero or one @type order: C{int} @raise ValueError: if order < 0 or order > 1 """ if order < 0 or order > 1: raise ValueError('Only first-order derivatives') self.value = value if order == 0: self.deriv = [] elif type(index) == type([]): self.deriv = index else: self.deriv = index*[0] + [1] def __getitem__(self, order): """ @param order: derivative order @type order: C{int} @return: a list of all derivatives of the given order @rtype: C{list} @raise ValueError: if order < 0 or order > 1 """ if order < 0 or order > 1: raise ValueError('Index out of range') if order == 0: return self.value else: return self.deriv def __repr__(self): return `(self.value, self.deriv)` def __str__(self): return str((self.value, self.deriv)) def __coerce__(self, other): if isDerivVar(other): return self, other else: return self, DerivVar(other, []) def __cmp__(self, other): return cmp(self.value, other.value) def __neg__(self): return DerivVar(-self.value, map(lambda a: -a, self.deriv)) def __pos__(self): return self def __abs__(self): # cf maple signum # derivate of abs absvalue = abs(self.value) return DerivVar(absvalue, map(lambda a, d=self.value/absvalue: d*a, self.deriv)) def __nonzero__(self): return self.value != 0 def __add__(self, other): return DerivVar(self.value + other.value, _mapderiv(lambda a,b: a+b, self.deriv, other.deriv)) __radd__ = __add__ def __sub__(self, other): return DerivVar(self.value - other.value, _mapderiv(lambda a,b: a-b, self.deriv, other.deriv)) def __rsub__(self, other): return DerivVar(other.value - self.value, _mapderiv(lambda a,b: a-b, other.deriv, self.deriv)) def __mul__(self, other): return DerivVar(self.value*other.value, _mapderiv(lambda a,b: a+b, map(lambda x,f=other.value:f*x, self.deriv), map(lambda x,f=self.value:f*x, other.deriv))) __rmul__ = __mul__ def __div__(self, other): if not other.value: raise ZeroDivisionError('DerivVar division') inv = 1./other.value return DerivVar(self.value*inv, _mapderiv(lambda a,b: a-b, map(lambda x,f=inv: f*x, self.deriv), map(lambda x,f=self.value*inv*inv: f*x, other.deriv))) def __rdiv__(self, other): return other/self __truediv__ = __div__ def __pow__(self, other, z=None): if z is not None: raise TypeError('DerivVar does not support ternary pow()') val1 = pow(self.value, other.value-1) val = val1*self.value deriv1 = map(lambda x, f=val1*other.value: f*x, self.deriv) if isDerivVar(other) and len(other.deriv) > 0: deriv2 = map(lambda x, f=val*Numeric.log(self.value): f*x, other.deriv) return DerivVar(val, _mapderiv(lambda a,b: a+b, deriv1, deriv2)) else: return DerivVar(val, deriv1) def __rpow__(self, other): return pow(other, self) def exp(self): v = Numeric.exp(self.value) return DerivVar(v, map(lambda x, f=v: f*x, self.deriv)) def log(self): v = Numeric.log(self.value) d = 1./self.value return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def log10(self): v = Numeric.log10(self.value) d = 1./(self.value * Numeric.log(10)) return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def sqrt(self): v = Numeric.sqrt(self.value) d = 0.5/v return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def sign(self): if self.value == 0: raise ValueError("can't differentiate sign() at zero") return DerivVar(Numeric.sign(self.value), 0) def sin(self): v = Numeric.sin(self.value) d = Numeric.cos(self.value) return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def cos(self): v = Numeric.cos(self.value) d = -Numeric.sin(self.value) return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def tan(self): v = Numeric.tan(self.value) d = 1.+pow(v,2) return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def sinh(self): v = Numeric.sinh(self.value) d = Numeric.cosh(self.value) return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def cosh(self): v = Numeric.cosh(self.value) d = Numeric.sinh(self.value) return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def tanh(self): v = Numeric.tanh(self.value) d = 1./pow(Numeric.cosh(self.value),2) return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def arcsin(self): v = Numeric.arcsin(self.value) d = 1./Numeric.sqrt(1.-pow(self.value,2)) return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def arccos(self): v = Numeric.arccos(self.value) d = -1./Numeric.sqrt(1.-pow(self.value,2)) return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def arctan(self): v = Numeric.arctan(self.value) d = 1./(1.+pow(self.value,2)) return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) def arctan2(self, other): den = self.value*self.value+other.value*other.value s = self.value/den o = other.value/den return DerivVar(Numeric.arctan2(self.value, other.value), _mapderiv(lambda a, b: a-b, map(lambda x, f=o: f*x, self.deriv), map(lambda x, f=s: f*x, other.deriv))) def gamma(self): from transcendental import gamma, psi v = gamma(self.value) d = v*psi(self.value) return DerivVar(v, map(lambda x, f=d: f*x, self.deriv)) # Type check def isDerivVar(x): """ @param x: an arbitrary object @return: True if x is a DerivVar object, False otherwise @rtype: bool """ return hasattr(x,'value') and hasattr(x,'deriv') # Map a binary function on two first derivative lists def _mapderiv(func, a, b): nvars = max(len(a), len(b)) a = a + (nvars-len(a))*[0] b = b + (nvars-len(b))*[0] return map(func, a, b) # Define vector of DerivVars def DerivVector(x, y, z, index=0): """ @param x: x component of the vector @type x: number @param y: y component of the vector @type y: number @param z: z component of the vector @type z: number @param index: the DerivVar index for the x component. The y and z components receive consecutive indices. @type index: C{int} @return: a vector whose components are DerivVar objects @rtype: L{Scientific.Geometry.Vector} """ from Scientific.Geometry.VectorModule import Vector if isDerivVar(x) and isDerivVar(y) and isDerivVar(z): return Vector(x, y, z) else: return Vector(DerivVar(x, index), DerivVar(y, index+1), DerivVar(z, index+2)) # Functions with derivatives class DerivFn(object): """ Function with derivatives, applicable to DerivVar objects """ def __init__(self, fn, *deriv_fns): """ @param fn: a Python function from numbers to numbers @param *deriv_fns: Python functions from numbers to numbers defining the partial derivatives of the defined function with respect to its arguments. There must be as many derivative functions as the main function has arguments. """ self.fn = fn self.deriv_fns = deriv_fns def __call__(self, *args): """ Apply the function to the supplied arguments. The number of arguments must be equal to the number of derivative functions given in the constructor. The arguments can be plain numbers or DerivVar objects. The return value is a DerivVar object. """ assert len(args) == len(self.deriv_fns) values = [] derivs = [] nderivs = 0 for x in args: if isinstance(x, DerivVar): values.append(x.value) derivs.append(x.deriv) nderivs = max(nderivs, len(x.deriv)) else: values.append(x) derivs.append([]) derivs = [d+(nderivs-len(d))*[0] for d in derivs] v = self.fn(*values) d = [f(*values) for f in self.deriv_fns] rderivs = nderivs*[0] for i in range(len(d)): rderivs = [r+d[i]*x for (r, x) in zip(rderivs, derivs[i])] if rderivs: return DerivVar(v, rderivs) else: return v class NumDerivFn(DerivFn): """ Function with derivatives evaluated by numerical approximation, applicable to DerivVar objects """ def __init__(self, fn, *hs): """ @param fn: a Python function from numbers to numbers @param hs: one step value h for each argument of the function. The ith partial derivative is calculated symmetrically as (f(xs[i]+hs[i])-f(xs[i]-hs[i]))/(2.*hs[i]). """ deriv_fns = [] for i in range(len(hs)): h = hs[i] deriv_fns.append(self._makeDerivFn(fn, i, h)) DerivFn.__init__(self, fn, *deriv_fns) def _makeDerivFn(self, fn, i, h): def deriv_fn(*args): args_p = args[:i] + (args[i]+h,) + args[i+1:] args_m = args[:i] + (args[i]-h,) + args[i+1:] return (fn(*args_p)-fn(*args_m))/(2.*h) return deriv_fn ScientificPython-2.9.4/Scientific/Functions/Interpolation.py0000644000076600000240000004442612233721015024657 0ustar hinsenstaff00000000000000# This module provides interpolation for functions defined on a grid. # # Written by Konrad Hinsen # """ Interpolation of functions defined on a grid """ from Scientific import N import Polynomial from Scientific.indexing import index_expression from Scientific._interpolation import _interpolate import operator # # General interpolating functions. # class InterpolatingFunction: """X{Function} defined by values on a X{grid} using X{interpolation} An interpolating function of M{n} variables with M{m}-dimensional values is defined by an M{(n+m)}-dimensional array of values and M{n} one-dimensional arrays that define the variables values corresponding to the grid points. The grid does not have to be equidistant. An InterpolatingFunction object has attributes C{real} and C{imag} like a complex function (even if its values are real). """ def __init__(self, axes, values, default = None, period = None): """ @param axes: a sequence of one-dimensional arrays, one for each variable, specifying the values of the variables at the grid points in ascending order @type axes: sequence of N.array @param values: the function values on the grid @type values: N.array @param default: the value of the function outside the grid. A value of C{None} means that the function is undefined outside the grid and that any attempt to evaluate it there raises an exception. @type default: number or C{None} @param period: the period for each of the variables, or C{None} for variables in which the function is not periodic. @type period: sequence of numbers or C{None} """ if len(axes) > len(values.shape): raise ValueError('Inconsistent arguments') for i, axis in enumerate(axes): if len(axis.shape) != 1: raise ValueError("Axes must be 1D arrays") if len(axis) != values.shape[i]: raise ValueError("Axes must match value array") if N.logical_or.reduce(axis[1:]-axis[:-1] <= 0.): raise ValueError("Axis values must be distinct and " "in ascending order") self.axes = list(axes) self.shape = sum([axis.shape for axis in self.axes], ()) self.values = values self.default = default if period is None: period = len(self.axes)*[None] self.period = period if len(self.period) != len(self.axes): raise ValueError('Inconsistent arguments') for a, p in zip(self.axes, self.period): if p is not None and a[0]+p <= a[-1]: raise ValueError('Period too short') def __call__(self, *points): """ @returns: the function value obtained by linear interpolation @rtype: number @raise TypeError: if the number of arguments (C{len(points)}) does not match the number of variables of the function @raise ValueError: if the evaluation point is outside of the domain of definition and no default value is defined """ if len(points) != len(self.axes): raise TypeError('Wrong number of arguments') if len(points) == 1: # Fast Pyrex implementation for the important special case # of a function of one variable with all arrays of type double. period = self.period[0] if period is None: period = 0. try: return _interpolate(points[0], self.axes[0], self.values, period) except: # Run the Python version if anything goes wrong pass try: neighbours = map(_lookup, points, self.axes, self.period) except ValueError, text: if self.default is not None: return self.default else: raise ValueError(text) slices = sum([item[0] for item in neighbours], ()) values = self.values[slices] for item in neighbours: weight = item[1] values = (1.-weight)*values[0]+weight*values[1] return values def __len__(self): """ @returns: number of variables @rtype: C{int} """ return len(self.axes[0]) def __getitem__(self, i): """ @param i: any indexing expression possible for C{N.array} that does not use C{N.NewAxis} @type i: indexing expression @returns: an InterpolatingFunction whose number of variables is reduced, or a number if no variable is left @rtype: L{InterpolatingFunction} or number @raise TypeError: if i is not an allowed index expression """ if isinstance(i, int): if len(self.axes) == 1: return (self.axes[0][i], self.values[i]) else: return self._constructor(self.axes[1:], self.values[i]) elif isinstance(i, slice): axes = [self.axes[0][i]] + self.axes[1:] return self._constructor(axes, self.values[i]) elif isinstance(i, tuple): axes = [] rest = self.axes[:] for item in i: if not isinstance(item, int): axes.append(rest[0][item]) del rest[0] axes = axes + rest return self._constructor(axes, self.values[i]) else: raise TypeError("illegal index type") def __getslice__(self, i, j): """ @param i: lower slice index @type i: C{int} @param j: upper slice index @type j: C{int} @returns: an InterpolatingFunction whose number of variables is reduced by one, or a number if no variable is left @rtype: L{InterpolatingFunction} or number """ axes = [self.axes[0][i:j]] + self.axes[1:] return self._constructor(axes, self.values[i:j]) def __getattr__(self, attr): if attr == 'real': values = self.values try: values = values.real except ValueError: pass default = self.default try: default = default.real except: pass return self._constructor(self.axes, values, default. self.period) elif attr == 'imag': try: values = self.values.imag except ValueError: values = 0*self.values default = self.default try: default = self.default.imag except: try: default = 0*self.default except: default = None return self._constructor(self.axes, values, default, self.period) else: raise AttributeError(attr) def selectInterval(self, first, last, variable=0): """ @param first: lower limit of an axis interval @type first: C{float} @param last: upper limit of an axis interval @type last: C{float} @param variable: the index of the variable of the function along which the interval restriction is applied @type variable: C{int} @returns: a new InterpolatingFunction whose grid is restricted @rtype: L{InterpolatingFunction} """ x = self.axes[variable] c = N.logical_and(N.greater_equal(x, first), N.less_equal(x, last)) i_axes = self.axes[:variable] + [N.compress(c, x)] + \ self.axes[variable+1:] i_values = N.compress(c, self.values, variable) return self._constructor(i_axes, i_values, None, None) def derivative(self, variable = 0): """ @param variable: the index of the variable of the function with respect to which the X{derivative} is taken @type variable: C{int} @returns: a new InterpolatingFunction containing the numerical derivative @rtype: L{InterpolatingFunction} """ diffaxis = self.axes[variable] ai = index_expression[::] + \ (len(self.values.shape)-variable-1) * index_expression[N.NewAxis] period = self.period[variable] if period is None: ui = variable*index_expression[::] + \ index_expression[1::] + index_expression[...] li = variable*index_expression[::] + \ index_expression[:-1:] + index_expression[...] d_values = (self.values[ui]-self.values[li]) / \ (diffaxis[1:]-diffaxis[:-1])[ai] diffaxis = 0.5*(diffaxis[1:]+diffaxis[:-1]) else: u = N.take(self.values, range(1, len(diffaxis))+[0], axis=variable) l = self.values ua = N.concatenate((diffaxis[1:], period+diffaxis[0:1])) la = diffaxis d_values = (u-l)/(ua-la)[ai] diffaxis = 0.5*(ua+la) d_axes = self.axes[:variable]+[diffaxis]+self.axes[variable+1:] d_default = None if self.default is not None: d_default = 0. return self._constructor(d_axes, d_values, d_default, self.period) def integral(self, variable = 0): """ @param variable: the index of the variable of the function with respect to which the X{integration} is performed @type variable: C{int} @returns: a new InterpolatingFunction containing the numerical X{integral}. The integration constant is defined such that the integral at the first grid point is zero. @rtype: L{InterpolatingFunction} """ if self.period[variable] is not None: raise ValueError('Integration over periodic variables not defined') intaxis = self.axes[variable] ui = variable*index_expression[::] + \ index_expression[1::] + index_expression[...] li = variable*index_expression[::] + \ index_expression[:-1:] + index_expression[...] uai = index_expression[1::] + (len(self.values.shape)-variable-1) * \ index_expression[N.NewAxis] lai = index_expression[:-1:] + (len(self.values.shape)-variable-1) * \ index_expression[N.NewAxis] i_values = 0.5*N.add.accumulate((self.values[ui] +self.values[li])* \ (intaxis[uai]-intaxis[lai]), variable) s = list(self.values.shape) s[variable] = 1 z = N.zeros(tuple(s)) return self._constructor(self.axes, N.concatenate((z, i_values), variable), None) def definiteIntegral(self, variable = 0): """ @param variable: the index of the variable of the function with respect to which the X{integration} is performed @type variable: C{int} @returns: a new InterpolatingFunction containing the numerical X{integral}. The integration constant is defined such that the integral at the first grid point is zero. If the original function has only one free variable, the definite integral is a number @rtype: L{InterpolatingFunction} or number """ if self.period[variable] is not None: raise ValueError('Integration over periodic variables not defined') intaxis = self.axes[variable] ui = variable*index_expression[::] + \ index_expression[1::] + index_expression[...] li = variable*index_expression[::] + \ index_expression[:-1:] + index_expression[...] uai = index_expression[1::] + (len(self.values.shape)-variable-1) * \ index_expression[N.NewAxis] lai = index_expression[:-1:] + (len(self.values.shape)-variable-1) * \ index_expression[N.NewAxis] i_values = 0.5*N.add.reduce((self.values[ui]+self.values[li]) * \ (intaxis[uai]-intaxis[lai]), variable) if len(self.axes) == 1: return i_values else: i_axes = self.axes[:variable] + self.axes[variable+1:] return self._constructor(i_axes, i_values, None) def fitPolynomial(self, order): """ @param order: the order of the X{polynomial} to be fitted @type order: C{int} @returns: a polynomial whose coefficients have been obtained by a X{least-squares} fit to the grid values @rtype: L{Scientific.Functions.Polynomial} """ for p in self.period: if p is not None: raise ValueError('Polynomial fit not possible ' + 'for periodic function') points = _combinations(self.axes) return Polynomial._fitPolynomial(order, points, N.ravel(self.values)) def __abs__(self): values = abs(self.values) try: default = abs(self.default) except: default = self.default return self._constructor(self.axes, values, default) def _mathfunc(self, function): if self.default is None: default = None else: default = function(self.default) return self._constructor(self.axes, function(self.values), default) def exp(self): return self._mathfunc(N.exp) def log(self): return self._mathfunc(N.log) def sqrt(self): return self._mathfunc(N.sqrt) def sin(self): return self._mathfunc(N.sin) def cos(self): return self._mathfunc(N.cos) def tan(self): return self._mathfunc(N.tan) def sinh(self): return self._mathfunc(N.sinh) def cosh(self): return self._mathfunc(N.cosh) def tanh(self): return self._mathfunc(N.tanh) def arcsin(self): return self._mathfunc(N.arcsin) def arccos(self): return self._mathfunc(N.arccos) def arctan(self): return self._mathfunc(N.arctan) InterpolatingFunction._constructor = InterpolatingFunction # # Interpolating function on data in netCDF file # class NetCDFInterpolatingFunction(InterpolatingFunction): """Function defined by values on a grid in a X{netCDF} file A subclass of L{InterpolatingFunction}. """ def __init__(self, filename, axesnames, variablename, default = None, period = None): """ @param filename: the name of the netCDF file @type filename: C{str} @param axesnames: the names of the netCDF variables that contain the axes information @type axesnames: sequence of C{str} @param variablename: the name of the netCDF variable that contains the data values @type variablename: C{str} @param default: the value of the function outside the grid. A value of C{None} means that the function is undefined outside the grid and that any attempt to evaluate it there raises an exception. @type default: number or C{None} @param period: the period for each of the variables, or C{None} for variables in which the function is not periodic. @type period: sequence of numbers or C{None} """ from Scientific.IO.NetCDF import NetCDFFile self.file = NetCDFFile(filename, 'r') self.axes = [self.file.variables[n] for n in axesnames] for a in self.axes: if len(a.dimensions) != 1: raise ValueError("axes must be 1d arrays") self.values = self.file.variables[variablename] if tuple(v.dimensions[0] for v in self.axes) != self.values.dimensions: raise ValueError("axes and values have incompatible dimensions") self.default = default self.shape = () for axis in self.axes: self.shape = self.shape + axis.shape if period is None: period = len(self.axes)*[None] self.period = period if len(self.period) != len(self.axes): raise ValueError('Inconsistent arguments') for a, p in zip(self.axes, self.period): if p is not None and a[0]+p <= a[-1]: raise ValueError('Period too short') NetCDFInterpolatingFunction._constructor = InterpolatingFunction # Helper functions def _lookup(point, axis, period): if period is None: j = int(N.int_sum(N.less_equal(axis, point))) if j == len(axis): if N.fabs(point - axis[j-1]) < 1.e-9: return index_expression[j-2:j:1], 1. else: j = 0 if j == 0: raise ValueError('Point outside grid of values') i = j-1 weight = (point-axis[i])/(axis[j]-axis[i]) return index_expression[i:j+1:1], weight else: point = axis[0] + (point-axis[0]) % period j = int(N.int_sum(N.less_equal(axis, point))) i = j-1 if j == len(axis): weight = (point-axis[i])/(axis[0]+period-axis[i]) return index_expression[0:i+1:i], 1.-weight else: weight = (point-axis[i])/(axis[j]-axis[i]) return index_expression[i:j+1:1], weight def _combinations(axes): if len(axes) == 1: return map(lambda x: (x,), axes[0]) else: rest = _combinations(axes[1:]) l = [] for x in axes[0]: for y in rest: l.append((x,)+y) return l # Test code if __name__ == '__main__': ## axis = N.arange(0,1.1,0.1) ## values = N.sqrt(axis) ## s = InterpolatingFunction((axis,), values) ## print s(0.22), N.sqrt(0.22) ## sd = s.derivative() ## print sd(0.35), 0.5/N.sqrt(0.35) ## si = s.integral() ## print si(0.42), (0.42**1.5)/1.5 ## print s.definiteIntegral() ## values = N.sin(axis[:,N.NewAxis])*N.cos(axis) ## sc = InterpolatingFunction((axis,axis),values) ## print sc(0.23, 0.77), N.sin(0.23)*N.cos(0.77) axis = N.arange(20)*(2.*N.pi)/20. values = N.sin(axis) s = InterpolatingFunction((axis,), values, period=(2.*N.pi,)) c = s.derivative() for x in N.arange(0., 15., 1.): print x print N.sin(x), s(x) print N.cos(x), c(x) ScientificPython-2.9.4/Scientific/Functions/LeastSquares.py0000644000076600000240000001252511501734230024437 0ustar hinsenstaff00000000000000# This module contains functions to do general non-linear # least squares fits. # # Written by Konrad Hinsen # last revision: 2008-8-18 # """ Non-linear least squares fitting Usage example:: from Scientific.N import exp def f(param, t): return param[0]*exp(-param[1]/t) data_quantum = [(100, 3.445e+6),(200, 2.744e+7), (300, 2.592e+8),(400, 1.600e+9)] data_classical = [(100, 4.999e-8),(200, 5.307e+2), (300, 1.289e+6),(400, 6.559e+7)] print leastSquaresFit(f, (1e13,4700), data_classical) def f2(param, t): return 1e13*exp(-param[0]/t) print leastSquaresFit(f2, (3000.,), data_quantum) """ from Scientific import N, LA from FirstDerivatives import DerivVar from Scientific import IterationCountExceededError def _chiSquare(model, parameters, data): n_param = len(parameters) chi_sq = 0. alpha = N.zeros((n_param, n_param)) for point in data: sigma = 1 if len(point) == 3: sigma = point[2] f = model(parameters, point[0]) chi_sq = chi_sq + ((f-point[1])/sigma)**2 d = N.array(f[1])/sigma alpha = alpha + d[:,N.NewAxis]*d return chi_sq, alpha def leastSquaresFit(model, parameters, data, max_iterations=None, stopping_limit = 0.005, validator = None): """General non-linear least-squares fit using the X{Levenberg-Marquardt} algorithm and X{automatic differentiation}. @param model: the function to be fitted. It will be called with two parameters: the first is a tuple containing all fit parameters, and the second is the first element of a data point (see below). The return value must be a number. Since automatic differentiation is used to obtain the derivatives with respect to the parameters, the function may only use the mathematical functions known to the module FirstDerivatives. @type model: callable @param parameters: a tuple of initial values for the fit parameters @type parameters: C{tuple} of numbers @param data: a list of data points to which the model is to be fitted. Each data point is a tuple of length two or three. Its first element specifies the independent variables of the model. It is passed to the model function as its first parameter, but not used in any other way. The second element of each data point tuple is the number that the return value of the model function is supposed to match as well as possible. The third element (which defaults to 1.) is the statistical variance of the data point, i.e. the inverse of its statistical weight in the fitting procedure. @type data: C{list} @returns: a list containing the optimal parameter values and the chi-squared value describing the quality of the fit @rtype: C{(list, float)} """ n_param = len(parameters) p = () i = 0 for param in parameters: p = p + (DerivVar(param, i),) i = i + 1 id = N.identity(n_param) l = 0.001 chi_sq, alpha = _chiSquare(model, p, data) niter = 0 while 1: delta = LA.solve_linear_equations(alpha+l*N.diagonal(alpha)*id, -0.5*N.array(chi_sq[1])) next_p = map(lambda a,b: a+b, p, delta) if validator is not None: while not validator(*next_p): delta *= 0.8 next_p = map(lambda a,b: a+b, p, delta) next_chi_sq, next_alpha = _chiSquare(model, next_p, data) if next_chi_sq > chi_sq: l = 10.*l else: l = 0.1*l if chi_sq[0] - next_chi_sq[0] < stopping_limit: break p = next_p chi_sq = next_chi_sq alpha = next_alpha niter = niter + 1 if max_iterations is not None and niter == max_iterations: raise IterationCountExceededError return [p[0] for p in next_p], next_chi_sq[0] # # The special case of n-th order polynomial fits # was contributed by David Ascher. Note: this could also be # done with linear least squares, e.g. from LinearAlgebra. # def _polynomialModel(params, t): r = 0.0 for i in range(len(params)): r = r + params[i]*N.power(t, i) return r def polynomialLeastSquaresFit(parameters, data): """ Least-squares fit to a polynomial whose order is defined by the number of parameter values. @note: This could also be done with a linear least squares fit from L{Scientific.LA} @param parameters: a tuple of initial values for the polynomial coefficients @type parameters: C{tuple} @param data: the data points, as for L{leastSquaresFit} @type data: C{list} """ return leastSquaresFit(_polynomialModel, parameters, data) # Test code if __name__ == '__main__': from Scientific.N import exp def f(param, t): return param[0]*exp(-param[1]/t) data_quantum = [(100, 3.445e+6),(200, 2.744e+7), (300, 2.592e+8),(400, 1.600e+9)] data_classical = [(100, 4.999e-8),(200, 5.307e+2), (300, 1.289e+6),(400, 6.559e+7)] print leastSquaresFit(f, (1e13,4700), data_classical) def f2(param, t): return 1e13*exp(-param[0]/t) print leastSquaresFit(f2, (3000.,), data_quantum) ScientificPython-2.9.4/Scientific/Functions/Polynomial.py0000644000076600000240000001706612270503777024171 0ustar hinsenstaff00000000000000# This module defines a multivariate polynomial class # # Written by Konrad Hinsen # last revision: 2008-12-15 # """ Polynomials in any number of variables """ from Scientific import N, LA; Numeric = N; LinearAlgebra = LA from Scientific.indexing import index_expression # Class definition class Polynomial: """X{Multivariate} X{polynomial} Instances of this class represent polynomials of any order and in any number of variables. The coefficients and thus the values can be real or complex. Polynomials can be evaluated like functions. """ def __init__(self, coefficients): """ @param coefficients: an M{N}-dimnesional array for a polynomial in M{N} variables. C{coeffcients[i, j, ...]} is the coefficient of M{x_1^i x_2^j ...} @type coefficients: C{Numeric.array} or nested list of numbers """ self.coeff = Numeric.array(coefficients) self.dim = len(self.coeff.shape) is_polynomial = 1 def __call__(self, *args): """ @param args: tuple of values, one for each variable of the polynomial @type args: C{tuple} of numbers @returns: the value of the polynomial at the given point @rtype: number @raise TypeError: if the number of arguments is not equal to the number of variable of the polynomial """ if len(args) != self.dim: raise TypeError('Wrong number of arguments') p = _powers(args, self.coeff.shape) return Numeric.add.reduce(Numeric.ravel(p*self.coeff)) def __repr__(self): if self.dim == 1: return "Polynomial(%s)" % repr(list(self.coeff)) else: return "Polynomial(%s)" % repr(self.coeff) def __coerce__(self, other): if hasattr(other, 'is_polynomial'): return (self, other) elif hasattr(other, 'is_rational_function'): return None else: return (self, Polynomial([other])) def __add__(self, other): dim = max(self.dim, other.dim) shape = Numeric.zeros((dim,), Numeric.Int) shape[:self.dim] = self.coeff.shape shape[:other.dim] = Numeric.maximum(shape[:other.dim], other.coeff.shape) coeff1 = Numeric.zeros_st(shape, self.coeff) index = tuple(map(lambda d: slice(0, d), self.coeff.shape) + \ (dim-self.dim)*[0]) coeff1[index] = self.coeff coeff2 = Numeric.zeros_st(shape, other.coeff) index = tuple(map(lambda d: slice(0, d), other.coeff.shape) + \ (dim-other.dim)*[0]) coeff2[index] = other.coeff return Polynomial(coeff1+coeff2) def __mul__(self, other): if self.dim != 1 or other.dim != 1: raise ValueError("not implemented") c = Numeric.multiply.outer(self.coeff, other.coeff) temp = Numeric.concatenate((c, Numeric.zeros(2*(c.shape[0],))), 1) temp = Numeric.ravel(temp)[:-c.shape[0]] temp.shape = (c.shape[0], c.shape[0]+c.shape[1]-1) return Polynomial(Numeric.sum(temp)) def __div__(self, other): if self.dim != 1 or other.dim != 1: raise ValueError("not implemented") if len(other.coeff) == 1: return Polynomial(self.coeff/other.coeff[0]) from Rational import RationalFunction return RationalFunction(self, other) __truediv__ = __div__ def __rdiv__(self, other): from Rational import RationalFunction return RationalFunction(other, self) def derivative(self, variable=0): """ @param variable: the index of the variable with respect to which the X{derivative} is taken @type variable: C{int} @returns: a polynomial of reduced order in one variable @rtype: L{Polynomial} """ n = self.coeff.shape[variable] if n == 1: return Polynomial(apply(Numeric.zeros, self.dim*(1,))) index = variable*index_expression[::] + \ index_expression[1::] + index_expression[...] factor = Numeric.arange(1.,n) factor = factor[index_expression[::] + (self.dim-variable-1) * \ index_expression[Numeric.NewAxis]] return Polynomial(factor*self.coeff[index]) def integral(self, variable=0): """ @param variable: the index of the variable with respect to which the X{integral} is computed @type variable: C{int} @returns: a polynomial of higher order in one variable @rtype: L{Polynomial} """ n = self.coeff.shape[variable] factor = 1./Numeric.arange(1.,n+1) factor = factor[index_expression[::] + (self.dim-variable-1) * \ index_expression[Numeric.NewAxis]] s = map(None, self.coeff.shape) s[variable] = 1 z = apply(Numeric.zeros, tuple(s)) intcoeff = Numeric.concatenate((z, factor*self.coeff), variable) return Polynomial(intcoeff) def zeros(self): """ Find the X{zeros} (X{roots}) of the polynomial by diagonalization of the associated Frobenius matrix. @returns: an array containing the zeros @rtype: C{Numeric.array} @note: this is defined only for polynomials in one variable @raise ValueError: is the polynomial has more than one variable """ if self.dim != 1: raise ValueError("not implemented") n = len(self.coeff)-1 if n == 0: return Numeric.array([]) a = Numeric.zeros_st((n, n), self.coeff) if n > 1: a[1:, :-1] = Numeric.identity(n-1) a[:, -1] = -self.coeff[:-1]/self.coeff[-1] from Scientific.LA import eigenvalues return eigenvalues(a) # Polynomial fit constructor for use in module Interpolation def _fitPolynomial(order, points, values): if len(points) != len(values): raise ValueError('Inconsistent arguments') if type(order) != type(()): order = (order,) order = tuple(map(lambda n: n+1, order)) if not _isSequence(points[0]): points = map(lambda p: (p,), points) if len(order) != len(points[0]): raise ValueError('Inconsistent arguments') if Numeric.multiply.reduce(order) > len(points): raise ValueError('Not enough points') matrix = [] for p in points: matrix.append(Numeric.ravel(_powers(p, order))) matrix = Numeric.array(matrix) values = Numeric.array(values) inv = LinearAlgebra.generalized_inverse(matrix) coeff = Numeric.dot(inv, values) #coeff = LinearAlgebra.linear_least_squares(matrix, values)[0] coeff = Numeric.reshape(coeff, order) return Polynomial(coeff) # Helper functions def _powers(x, n): p = 1. index = index_expression[::] + \ (len(x)-1)*index_expression[Numeric.NewAxis] for i in range(len(x)): pi = Numeric.multiply.accumulate(Numeric.array([1.]+(n[i]-1)*[x[i]])) p = p*pi[index] index = index[-1:] + index[:-1] return p def _isSequence(object): n = -1 try: n = len(object) except: pass return n >= 0 # Test code if __name__ == '__main__': p1 = Polynomial([1.,0.3,1.,-0.4]) x = -1.9 print p1(x), ((-0.4*x+1.)*x+0.3)*x+1. zeros = p1.zeros() for z in zeros: print z, p1(z) p2 = Polynomial([[1.,0.3],[-0.2,0.5]]) y = 0.3 print p2(x,y), 1. + 0.3*y - 0.2*x + 0.5*x*y fit = _fitPolynomial(2, [1.,2.,3.,4.], [2.,4.,8.,14.]) print fit.coeff ScientificPython-2.9.4/Scientific/Functions/Rational.py0000644000076600000240000001362312132557055023605 0ustar hinsenstaff00000000000000# This module defines a univariate rational function class # # Written by Konrad Hinsen # last revision: 2006-6-12 # """ Rational functions in one variable """ from Polynomial import Polynomial from Scientific import N; Numeric = N class RationalFunction: """Rational Function Instances of this class represent rational functions in a single variable. They can be evaluated like functions. Rational functions support addition, subtraction, multiplication, and division. """ def __init__(self, numerator, denominator=[1.]): """ @param numerator: polynomial in one variable, or a list of polynomial coefficients @type numerator: L{Scientific.Functions.Polynomial.Polynomial} or C{list} of numbers @param denominator: polynomial in one variable, or a list of polynomial coefficients @type denominator: L{Scientific.Functions.Polynomial.Polynomial} or C{list} of numbers """ if hasattr(numerator, 'is_polynomial'): self.numerator = numerator else: self.numerator = Polynomial(numerator) if hasattr(denominator, 'is_polynomial'): self.denominator = denominator else: self.denominator = Polynomial(denominator) self._normalize() is_rational_function = 1 def __call__(self, value): return self.numerator(value)/self.denominator(value) def __repr__(self): return "RationalFunction(%s,%s)" % (repr(list(self.numerator.coeff)), repr(list(self.denominator.coeff))) def _normalize(self): self.numerator = self._truncate(self.numerator) self.denominator = self._truncate(self.denominator) n = 0 while 1: if self.numerator.coeff[n] != 0: break if self.denominator.coeff[n] != 0: break n = n + 1 if n == len(self.numerator.coeff): break if n > 0: self.numerator = Polynomial(self.numerator.coeff[n:]) self.denominator = Polynomial(self.denominator.coeff[n:]) factor = self.denominator.coeff[-1] if factor != 1.: self.numerator = self.numerator/factor self.denominator = self.denominator/factor def _truncate(self, poly): if poly.coeff[-1] != 0.: return poly coeff = poly.coeff while len(coeff) > 1 and coeff[-1] == 0.: coeff = coeff[:-1] return Polynomial(coeff) def __coerce__(self, other): if hasattr(other, 'is_rational_function'): return (self, other) elif hasattr(other, 'is_polynomial'): return (self, RationalFunction(other, [1.])) else: return (self, RationalFunction([other], [1.])) def __mul__(self, other): return RationalFunction(self.numerator*other.numerator, self.denominator*other.denominator) __rmul__ = __mul__ def __div__(self, other): return RationalFunction(self.numerator*other.denominator, self.denominator*other.numerator) __truediv__ = __div__ def __rdiv__(self, other): return RationalFunction(other.numerator*self.denominator, other.denominator*self.numerator) def __add__(self, other): return RationalFunction(self.numerator*other.denominator+ self.denominator*other.numerator, self.denominator*other.denominator) __radd__ = __add__ def __sub__(self, other): return RationalFunction(self.numerator*other.denominator- self.denominator*other.numerator, self.denominator*other.denominator) def __rsub__(self, other): return RationalFunction(other.numerator*self.denominator- other.denominator*self.numerator, self.denominator*other.denominator) def divide(self, shift=0): """ @param shift: the power of the independent variable by which the numerator is multiplied prior to division @type shift: C{int} (non-negative) @return: a polynomial and a rational function such that the sum of the two is equal to the original rational function. The returned rational function's numerator is of lower order than its denominator. @rtype: (L{Scientific.Functions.Polynomial.Polynomial}, L{RationalFunction}) """ num = Numeric.array(self.numerator.coeff, copy=1) if shift > 0: num = Numeric.concatenate((shift*[0.], num)) den = self.denominator.coeff den_order = len(den) coeff = [] while len(num) >= den_order: q = num[-1]/den[-1] coeff.append(q) num[-den_order:] = num[-den_order:]-q*den num = num[:-1] if not coeff: coeff = [0] coeff.reverse() if len(num) == 0: num = [0] return Polynomial(coeff), RationalFunction(num, den) def zeros(self): """ Find the X{zeros} (X{roots}) of the numerator by diagonalization of the associated Frobenius matrix. @returns: an array containing the zeros @rtype: C{Numeric.array} """ return self.numerator.zeros() def poles(self): """ Find the X{poles} (zeros of the denominator) by diagonalization of the associated Frobenius matrix. @returns: an array containing the poles @rtype: C{Numeric.array} """ return self.denominator.zeros() # Test code if __name__ == '__main__': p = Polynomial([1., 1.]) invp = 1./p pr = RationalFunction(p) print pr+invp ScientificPython-2.9.4/Scientific/Functions/Romberg.py0000644000076600000240000001002611501734230023412 0ustar hinsenstaff00000000000000# Romberg quadratures for numeric integration. # # Written by Scott M. Ransom # last revision: 14 Nov 98 # # Cosmetic changes by Konrad Hinsen # last revision: 2006-11-23 # """ Numerical integration using the Romberg algorithm """ def trapezoid(function, interval, numtraps): """ Numerical X{integration} using the X{trapezoidal} rule Example:: >>>from Scientific.Functions.Romberg import trapezoid >>>from Scientific.N import pi, tan >>>trapezoid(tan, (0.0, pi/3.0), 100) yields 0.69317459482518262 @param function: a function of one variable @type function: callable @param interval: the lower and upper limit of the integration interval @type interval: sequence of two C{float}s @param numtraps: the number of trapezoids @type numtraps: C{int} @returns: the numerical integral of the function over the interval @rtype: number """ lox, hix = interval h = float(hix-lox)/numtraps sum = 0.5*(function(lox)+function(hix)) for i in range(1, numtraps): sum = sum + function(lox + i*h) return h*sum def _difftrap(function, interval, numtraps): # Perform part of the trapezoidal rule to integrate a function. # Assume that we had called _difftrap with all lower powers-of-2 # starting with 1. Calling _difftrap only returns the summation # of the new ordinates. It does _not_ multiply by the width # of the trapezoids. This must be performed by the caller. # 'function' is the function to evaluate. # 'interval' is a sequence with lower and upper limits # of integration. # 'numtraps' is the number of trapezoids to use (must be a # power-of-2). if numtraps<=0: print "numtraps must be > 0 in _difftrap()." return elif numtraps==1: return 0.5*(function(interval[0])+function(interval[1])) else: numtosum = numtraps/2 h = float(interval[1]-interval[0])/numtosum lox = interval[0] + 0.5 * h; sum = 0.0 for i in range(0, numtosum): sum = sum + function(lox + i*h) return sum def _romberg_diff(b, c, k): # Compute the differences for the Romberg quadrature corrections. # See Forman Acton's "Real Computing Made Real," p 143. tmp = 4.0**k return (tmp * c - b)/(tmp - 1.0) def romberg(function, interval, accuracy=1.0E-7): """ Numerical X{integration} using the X{Romberg} method Example:: >>>from Scientific.Functions.Romberg import romberg >>>from Scientific.N import pi, tan >>>romberg(tan, (0.0, pi/3.0)) yields '0.693147180562' @param function: a function of one variable @type function: callable @param interval: the lower and upper limit of the integration interval @type interval: sequence of two C{float}s @param accuracy: convergence criterion (absolute error) @type accuracy: C{float} @returns: the numerical integral of the function over the interval @rtype: number """ i = n = 1 intrange = interval[1] - interval[0] ordsum = _difftrap(function, interval, n) result = intrange * ordsum resmat = [[result]] lastresult = result + accuracy * 2.0 while (abs(result - lastresult) > accuracy): n = n * 2 ordsum = ordsum + _difftrap(function, interval, n) resmat.append([]) resmat[i].append(intrange * ordsum / n) for k in range(i): resmat[i].append(_romberg_diff(resmat[i-1][k], resmat[i][k], k+1)) result = resmat[i][i] lastresult = resmat[i-1][i-1] i = i + 1 return result # Test code if __name__ == '__main__': from math import tan, pi print '' r = romberg(tan, (0.5, 1.0)) t = trapezoid(tan, (0.5, 1.0), 1000) theo = 0.485042229942291 print '' print 'Trapezoidal rule with 1000 function evaluations =', t print 'Theoretical result (correct to all shown digits) = %15.14f' % theo print '' ScientificPython-2.9.4/Scientific/Geometry/0000755000076600000240000000000012270505005021267 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/Geometry/__init__.py0000644000076600000240000000406612233720413023407 0ustar hinsenstaff00000000000000# Subpackage Scientific.Geometry # # Written by: Konrad Hinsen # """ Geometrical quantities and objects The geometrical quantities are vectors and tensors, transformations, and quaternions as descriptions of rotations. There are also tensor fields, which were included here (rather than in L{Scientific.Functions}) because they are most often used in a geometric context. Finally, there are classes for elementary geometrical objects such as spheres and planes. @undocumented: VectorModule* @undocumented: TensorModule* """ # Pretend that Vector and Tensor are defined directly # in Scientific.Geometry. try: import Scientific._vector Vector = Scientific._vector.Vector isVector = Scientific._vector.isVector except ImportError: import VectorModule Vector = VectorModule.Vector isVector = VectorModule.isVector del VectorModule import TensorModule Tensor = TensorModule.Tensor isTensor = TensorModule.isTensor del TensorModule # Some useful constants ex = Vector(1., 0., 0.) ey = Vector(0., 1., 0.) ez = Vector(0., 0., 1.) nullVector = Vector(0., 0., 0.) delta = Tensor([[1, 0, 0], [0, 1, 0], [0, 0, 1]]) epsilon = Tensor([[[ 0, 0, 0], [ 0, 0, 1], [ 0, -1, 0]], [[ 0, 0, -1], [ 0, 0, 0], [ 1, 0, 0]], [[ 0, 1, 0], [-1, 0, 0], [ 0, 0, 0]]]) import sys if sys.modules.has_key('epydoc'): import VectorModule, TensorModule Vector = VectorModule.Vector isVector = VectorModule.isVector vm_name = VectorModule.__name__ tm_name = TensorModule.__name__ Vector.__module__ = 'Scientific.Geometry' Tensor.__module__ = 'Scientific.Geometry' isVector.func_globals['__name__'] = 'Scientific.Geometry' isTensor.func_globals['__name__'] = 'Scientific.Geometry' VectorModule.__name__ = vm_name TensorModule.__name__ = tm_name del VectorModule del TensorModule del vm_name del tm_name del sys ScientificPython-2.9.4/Scientific/Geometry/Objects3D.py0000644000076600000240000003571411501734230023433 0ustar hinsenstaff00000000000000# This module defines some geometrical objects in 3D-space. # # Written by Konrad Hinsen # last revision: 2007-4-27 # """ Geometrical objects in 3D space """ from Scientific.Geometry import Vector from Scientific import N; Numeric = N # Small number _eps = 1.e-16 # # The base class # class GeometricalObject3D: """ Geometrical object in 3D space This is an abstract base class; to create instances, use one of the subclasses. """ def intersectWith(self, other): """ @param other: another geometrical object @type other: L{GeometricalObject3D} @returns: the geometrical object that results from the intersection with other. If there is no intersection, the result is C{None}. @rtype: L{GeometricalObject3D} or C{NoneType} @note: Intersection is not implemented for all possible pairs of objects. A 'ValueError' is raised for combinations that haven't been implemented yet. """ if self.__class__ > other.__class__: self, other = other, self try: f, switch = _intersectTable[(self.__class__, other.__class__)] if switch: return f(other, self) else: return f(self, other) except KeyError: raise ValueError("Can't calculate intersection of " + self.__class__.__name__ + " with " + other.__class__.__name__) def hasPoint(self, point): """ @param point: a point in space @type point: L{Scientific.Geometry.Vector} @returns: C{True} if point is in the object @rtype: C{bool} """ return self.distanceFrom(point) < _eps def distanceFrom(self, point): """ @param point: a point in space @type point: L{Scientific.Geometry.Vector} @returns the distance of point from the closest point of the object @rtype: C{float} """ raise ValueError("not yet implemented") def volume(self): """ @returns: the volume of the object. The result is C{None} for unbounded objects and zero for lower-dimensional objects. @rtype: C{float} or C{NoneType} """ raise ValueError("not yet implemented") _intersectTable = {} # # Spheres # class Sphere(GeometricalObject3D): """ Sphere """ def __init__(self, center, radius): """ @param center: the point that is the center of the sphere @type center: L{Scientific.Geometry.Vector} @param radius: the radius @type radius: C{float} """ self.center = center self.radius = radius def volume(self): return (4.*Numeric.pi/3.) * self.radius**3 def distanceFrom(self, point): d = (point-self.center).length() - self.radius if d < 0.: return 0. else: return d # # Planes # class Plane(GeometricalObject3D): """ Plane """ def __init__(self, *args): """ There are two calling patterns: - Plane(point, normal), where point (a vector) is an arbitrary point in the plane and normal (a vector) indicated the direction normal to the plane. - Plane(p1, p2, p3), where each argument is a vector and describes a point in the plane. The three points may not be colinear. """ if len(args) == 2: # point, normal self.normal = args[1].normal() self.distance_from_zero = self.normal*args[0] else: # three points v1 = args[1]-args[0] v2 = args[2]-args[1] self.normal = (v1.cross(v2)).normal() self.distance_from_zero = self.normal*args[1] def distanceFrom(self, point): return abs(self.normal*point-self.distance_from_zero) def projectionOf(self, point): """ @param point: a point in space @type point: L{Scientific.Geometry.Vector} @returns: the projection of point onto the plane @rtype: L{Scientific.Geometry.Vector} """ distance = self.normal*point-self.distance_from_zero return point - distance*self.normal def rotate(self, axis, angle): """ @param axis: the rotation axis @type axis: L{Scientific.Geometry.Vector} @param angle: the rotation angle @type angle: C{float} @returns: a copy of the plane rotated around the coordinate origin @rtype: L{Plane} """ point = rotatePoint(self.distance_from_zero*self.normal, axis, angle) normal = rotateDirection(self.normal, axis, angle) return Plane(point, normal) def volume(self): return 0. # # Infinite cones # class Cone(GeometricalObject3D): """ Cone """ def __init__(self, tip, axis, angle): """ @param tip: the location of the tip @type tip: L{Scientific.Geometry.Vector} @param axis: direction of the symmetry axis @type axis: L{Scientific.Geometry.Vector} @param angle: the angle between the symmetry axis and the surface @type angle: C{float} """ self.center = tip self.axis = axis.normal() self.angle = angle def volume(self): return None # # Circles # class Circle(GeometricalObject3D): """ Circle """ def __init__(self, center, normal, radius): """ @param center: the location of the center @type center: L{Scientific.Geometry.Vector} @param normal: a direction nornal to the plane of the circle @type normal: L{Scientific.Geometry.Vector} @param radius: the radius of the circle @type radius: C{float} """ self.center = center self.normal = normal self.radius = radius def volume(self): return 0. # # Lines # class Line(GeometricalObject3D): """ Line """ def __init__(self, point, direction): """ @param point: any point on the line @type point: L{Scientific.Geometry.Vector} @param direction: the direction of the line @type direction: L{Scientific.Geometry.Vector} """ self.point = point self.direction = direction.normal() def distanceFrom(self, point): d = self.point-point d = d - (d*self.direction)*self.direction return d.length() def projectionOf(self, point): """ @param point: a point in space @type point: L{Scientific.Geometry.Vector} @returns: the projection of point onto the line @rtype: L{Scientific.Geometry.Vector} """ d = self.point-point d = d - (d*self.direction)*self.direction return point+d def volume(self): return 0. # # Intersection calculations # def _addIntersectFunction(f, class1, class2): switch = class1 > class2 if switch: class1, class2 = class2, class1 _intersectTable[(class1, class2)] = (f, switch) # Sphere with sphere def _intersectSphereSphere(sphere1, sphere2): r1r2 = sphere2.center-sphere1.center d = r1r2.length() if d > sphere1.radius+sphere2.radius: return None if d+min(sphere1.radius, sphere2.radius) < \ max(sphere1.radius, sphere2.radius): return None x = 0.5*(d**2 + sphere1.radius**2 - sphere2.radius**2)/d h = Numeric.sqrt(sphere1.radius**2-x**2) normal = r1r2.normal() return Circle(sphere1.center + x*normal, normal, h) _addIntersectFunction(_intersectSphereSphere, Sphere, Sphere) # Sphere with cone def _intersectSphereCone(sphere, cone): if sphere.center != cone.center: raise ValueError("Not yet implemented") from_center = sphere.radius*Numeric.cos(cone.angle) radius = sphere.radius*Numeric.sin(cone.angle) return Circle(cone.center+cone.axis*from_center, cone.axis, radius) _addIntersectFunction(_intersectSphereCone, Sphere, Cone) # Plane with plane def _intersectPlanePlane(plane1, plane2): if abs(abs(plane1.normal*plane2.normal)-1.) < _eps: if abs(plane1.distance_from_zero-plane2.distance_from_zero) < _eps: return plane1 else: return None else: direction = plane1.normal.cross(plane2.normal) point_in_1 = plane1.distance_from_zero*plane1.normal point_in_both = point_in_1 - (point_in_1*plane2.normal - plane2.distance_from_zero)*plane2.normal return Line(point_in_both, direction) _addIntersectFunction(_intersectPlanePlane, Plane, Plane) # Circle with plane def _intersectCirclePlane(circle, plane): if abs(abs(circle.normal*plane.normal)-1.) < _eps: if plane.hasPoint(circle.center): return circle else: return None else: line = plane.intersectWith(Plane(circle.center, circle.normal)) x = line.distanceFrom(circle.center) if x > circle.radius: return None else: angle = Numeric.arccos(x/circle.radius) along_line = Numeric.sin(angle)*circle.radius normal = circle.normal.cross(line.direction) if line.distanceFrom(circle.center+normal) > x: normal = -normal return (circle.center+x*normal-line.direction*along_line, circle.center+x*normal+line.direction*along_line) _addIntersectFunction(_intersectCirclePlane, Circle, Plane) # # Rotation # def rotateDirection(vector, axis, angle): s = Numeric.sin(angle) c = Numeric.cos(angle) c1 = 1-c axis = axis.direction return axis.cross(vector)*s + ((axis*vector)*axis)*c1 + vector*c def rotatePoint(point, axis, angle): return axis.point + rotateDirection(point-axis.point, axis, angle) # # Lattices # # # Lattice base class # class Lattice: def __init__(self, function): if function is not None: self.elements = map(function, self.elements) def __getitem__(self, item): return self.elements[item] def __setitem__(self, item, value): self.elements[item] = value def __len__(self): return len(self.elements) # # General rhombic lattice # class RhombicLattice(Lattice): """ Lattice with rhombic elementary cell A lattice object contains values defined on a finite periodic structure that is created by replicating a given elementary cell along the three lattice vectors. The elementary cell can contain any number of points. """ def __init__(self, elementary_cell, lattice_vectors, cells, function=None, base=None): """ @param elementary_cell: a list of the points in the elementary cell @type elementary_cell: C{list} of L{Scientific.Geometry.Vector} @param lattice_vectors: the edges of the elementary cell @type lattice_vectors: C{tuple} of three L{Scientific.Geometry.Vector} @param cells: a tuple of three integers, indicating how often the elementary cell should be replicated along each lattice vector @param cells: C{tuple} of C{int} @param function: the function to be applied to each point in the lattice in order to obtain the value stored in the lattice. If no function is specified, the point itself becomes the value stored in the lattice. @type function: callable @param base: an offset added to all lattice points @type base: L{Scientific.Geometry.Vector} """ if len(lattice_vectors) != len(cells): raise TypeError('Inconsistent dimension specification') if base is None: base = Vector(0, 0, 0) self.dimension = len(lattice_vectors) self.elements = [] self.makeLattice(elementary_cell, lattice_vectors, cells, base) Lattice.__init__(self, function) def makeLattice(self, elementary_cell, lattice_vectors, cells, base): if len(cells) == 0: for p in elementary_cell: self.elements.append(p+base) else: for i in range(cells[0]): self.makeLattice(elementary_cell, lattice_vectors[1:], cells[1:], base+i*lattice_vectors[0]) # # Bravais lattice # class BravaisLattice(RhombicLattice): """ General Bravais lattice This is a subclass of RhombicLattice, describing the special case of an elementary cell containing one point. """ def __init__(self, lattice_vectors, cells, function=None, base=None): """ @param lattice_vectors: the edges of the elementary cell @type lattice_vectors: C{tuple} of three L{Scientific.Geometry.Vector} @param cells: a tuple of three integers, indicating how often the elementary cell should be replicated along each lattice vector @param cells: C{tuple} of C{int} @param function: the function to be applied to each point in the lattice in order to obtain the value stored in the lattice. If no function is specified, the point itself becomes the value stored in the lattice. @type function: callable @param base: an offset added to all lattice points @type base: L{Scientific.Geometry.Vector} """ cell = [Vector(0,0,0)] RhombicLattice.__init__(self, cell, lattice_vectors, cells, function, base) # # Simple cubic lattice # class SCLattice(BravaisLattice): """Simple cubic lattice This is a subclass of BravaisLattice, describing the special case of a cubic elementary cell. """ def __init__(self, cellsize, cells, function=None, base=None): """ @param cellsize: the edge length of the cubic elementary cell @type cellsize: C{float} @param cells: a tuple of three integers, indicating how often the elementary cell should be replicated along each lattice vector @param cells: C{tuple} of C{int} @param function: the function to be applied to each point in the lattice in order to obtain the value stored in the lattice. If no function is specified, the point itself becomes the value stored in the lattice. @type function: callable @param base: an offset added to all lattice points @type base: L{Scientific.Geometry.Vector} """ lattice_vectors = (cellsize*Vector(1., 0., 0.), cellsize*Vector(0., 1., 0.), cellsize*Vector(0., 0., 1.)) if type(cells) != type(()): cells = 3*(cells,) BravaisLattice.__init__(self, lattice_vectors, cells, function, base) ScientificPython-2.9.4/Scientific/Geometry/Quaternion.py0000644000076600000240000001220212132557055023774 0ustar hinsenstaff00000000000000# This module defines a class representing quaternions. # It contains just what is needed for using quaternions as representations # of rotations in 3d space. # # Written by Konrad Hinsen # last revision: 2006-11-23 # """ Quaternions as representations of rotations in 3D space """ from Scientific import N; Numeric = N from Scientific.Geometry import Transformation class Quaternion: """ Quaternion (hypercomplex number) This implementation of quaternions is not complete; only the features needed for representing rotation matrices by quaternions are implemented. Quaternions support addition, subtraction, and multiplication, as well as multiplication and division by scalars. Division by quaternions is not provided, because quaternion multiplication is not associative. Use multiplication by the inverse instead. The four components can be extracted by indexing. """ def __init__(self, *data): """ There are two calling patterns: - Quaternion(q0, q1, q2, q3) (from four real components) - Quaternion(q) (from a sequence containing the four components) """ if len(data) == 1: self.array = Numeric.array(data[0]) elif len(data) == 4: self.array = Numeric.array(data) is_quaternion = 1 def __getitem__(self, item): return self.array[item] def __add__(self, other): return Quaternion(self.array+other.array) def __sub__(self, other): return Quaternion(self.array-other.array) def __mul__(self, other): if isQuaternion(other): return Quaternion(Numeric.dot(self.asMatrix(), other.asMatrix())[:, 0]) else: return Quaternion(self.array*other) def __rmul__(self, other): if isQuaternion(other): raise ValueError('Not yet implemented') return Quaternion(self.array*other) def __div__(self, other): if isQuaternion(other): raise ValueError('Division by quaternions is not allowed.') return Quaternion(self.array/other) __truediv__ = __div__ def __rdiv__(self, other): raise ValueError('Division by quaternions is not allowed.') def __repr__(self): return 'Quaternion(' + str(list(self.array)) + ')' def dot(self, other): return Numeric.add.reduce(self.array*other.array) def norm(self): """ @returns: the norm @rtype: C{float} """ return Numeric.sqrt(self.dot(self)) def normalized(self): """ @returns: the quaternion scaled such that its norm is 1 @rtype: L{Quaternion} """ return self/self.norm() def inverse(self): """ @returns: the inverse @rtype: L{Quaternion} """ import Scientific.LA inverse = Scientific.LA.inverse(self.asMatrix()) return Quaternion(inverse[:, 0]) def asMatrix(self): """ @returns: a 4x4 matrix representation @rtype: C{Numeric.array} """ return Numeric.dot(self._matrix, self.array) _matrix = Numeric.zeros((4,4,4)) _matrix[0,0,0] = 1 _matrix[0,1,1] = -1 _matrix[0,2,2] = -1 _matrix[0,3,3] = -1 _matrix[1,0,1] = 1 _matrix[1,1,0] = 1 _matrix[1,2,3] = -1 _matrix[1,3,2] = 1 _matrix[2,0,2] = 1 _matrix[2,1,3] = 1 _matrix[2,2,0] = 1 _matrix[2,3,1] = -1 _matrix[3,0,3] = 1 _matrix[3,1,2] = -1 _matrix[3,2,1] = 1 _matrix[3,3,0] = 1 def asRotation(self): """ @returns: the corresponding rotation matrix @rtype: L{Scientific.Geometry.Transformation.Rotation} @raises ValueError: if the quaternion is not normalized """ if Numeric.fabs(self.norm()-1.) > 1.e-5: raise ValueError('Quaternion not normalized') d = Numeric.dot(Numeric.dot(self._rot, self.array), self.array) return Transformation.Rotation(d) _rot = Numeric.zeros((3,3,4,4)) _rot[0,0, 0,0] = 1 _rot[0,0, 1,1] = 1 _rot[0,0, 2,2] = -1 _rot[0,0, 3,3] = -1 _rot[1,1, 0,0] = 1 _rot[1,1, 1,1] = -1 _rot[1,1, 2,2] = 1 _rot[1,1, 3,3] = -1 _rot[2,2, 0,0] = 1 _rot[2,2, 1,1] = -1 _rot[2,2, 2,2] = -1 _rot[2,2, 3,3] = 1 _rot[0,1, 1,2] = 2 _rot[0,1, 0,3] = -2 _rot[0,2, 0,2] = 2 _rot[0,2, 1,3] = 2 _rot[1,0, 0,3] = 2 _rot[1,0, 1,2] = 2 _rot[1,2, 0,1] = -2 _rot[1,2, 2,3] = 2 _rot[2,0, 0,2] = -2 _rot[2,0, 1,3] = 2 _rot[2,1, 0,1] = 2 _rot[2,1, 2,3] = 2 # Type check def isQuaternion(x): """ @param x: any object @type x: any @returns: C{True} if x is a quaternion """ return hasattr(x,'is_quaternion') # Test data if __name__ == '__main__': from Scientific.Geometry import Vector axis = Vector(1., -2., 1.).normal() phi = 0.2 sin_phi_2 = Numeric.sin(0.5*phi) cos_phi_2 = Numeric.cos(0.5*phi) quat = Quaternion(cos_phi_2, sin_phi_2*axis[0], sin_phi_2*axis[1], sin_phi_2*axis[2]) rot = quat.asRotation() print rot.axisAndAngle() ScientificPython-2.9.4/Scientific/Geometry/TensorAnalysis.py0000644000076600000240000003513711501734230024630 0ustar hinsenstaff00000000000000# This module provides a class representing scalar, vector, and tensor fields. # # Written by Konrad Hinsen # last revision: 2007-6-12 # """ Vector and tensor fields with derivatives """ from Scientific import N; Numeric = N from Scientific.Geometry import Vector, Tensor from Scientific.indexing import index_expression from Scientific.Functions import Interpolation # # General tensor field base class # class TensorField(Interpolation.InterpolatingFunction): """Tensor field of arbitrary rank A tensor field is described by a tensor at each point of a three-dimensional rectangular grid. The grid spacing must be uniform. Tensor fields are implemented as a subclass of InterpolatingFunction from the module Scientific.Functions.Interpolation and thus share all methods defined in that class. Evaluation: - 'tensorfield(x, y, z)' (three coordinates) - 'tensorfield(coordinates)' (sequence containing three coordinates) """ def __init__(self, rank, axes, values, default = None, period = (None, None, None), check = True): """ @param rank: the tensor rank @type rank: C{int} @param axes: three arrays specifying the axis ticks for the three axes @type axes: sequence of C{Numeric.array} of rank 1 @param values: an array containing the field values. Its first three dimensions correspond to the x, y, z directions and must have lengths compatible with the axis arrays. The remaining dimensions must have length 3. @type values: C{Numeric.array} of rank+3 dimensions @param default: the value of the field for points outside the grid. A value of 'None' means that an exception will be raised for an attempt to evaluate the field outside the grid. Any other value must a tensor of the correct rank. @type default: L{Scientific.Geometry.Tensor} or C{NoneType} @param period: the period for each of the variables, or C{None} for variables in which the function is not periodic. @type period: sequence of length three @raise ValueError: if the arguments are not consistent """ if check: if len(axes) != 3: raise ValueError('Field must have three axes') if len(period) != 3: raise ValueError('Field requires three period values') if len(values.shape) != 3 + rank: raise ValueError('Values must have rank ' + `rank`) if values.shape[3:] != rank*(3,): raise ValueError('Values must have dimension 3') self.rank = rank self.spacing = [] for axis in axes: d = axis[1:]-axis[:-1] self.spacing.append(d[0]) if check: dmin = Numeric.minimum.reduce(d) if abs(dmin-Numeric.maximum.reduce(d)) > 0.0001*dmin: raise ValueError('Grid must be equidistant') Interpolation.InterpolatingFunction.__init__(self, axes, values, default, period) def __call__(self, *points): if len(points) == 1: points = tuple(points[0]) value = apply(Interpolation.InterpolatingFunction.__call__, (self, ) + points) if self.rank == 0: return value elif self.rank == 1: return Vector(value) else: return Tensor(value) def __getitem__(self, index): if isinstance(index, int): index = (index,) rank = self.rank - len(index) if rank < 0: raise ValueError('Number of indices too large') index = index_expression[...] + index + rank*index_expression[::] try: default = self.default[index] except TypeError: default = None if rank == 0: return ScalarField(self.axes, self.values[index], default, self.period, False) elif rank == 1: return VectorField(self.axes, self.values[index], default, self.period, False) else: return TensorField(self.axes, rank, self.values[index], default, self.period, False) def zero(self): """ @returns: a tensor of the same rank as the field values with all elements equal to zero @rtype: L{Scientifc.Geometry.Tensor} """ if self.rank == 0: return 0. else: return Tensor(Numeric.zeros(self.rank*(3,), Numeric.Float)) def derivative(self, variable): """ @param variable: 0 for x, 1 for y, 2 for z @type variable: C{int} @returns: the derivative with respect to variable @rtype: L{TensorField} """ period = self.period[variable] if period is None: ui = variable*index_expression[::] + \ index_expression[2::] + index_expression[...] li = variable*index_expression[::] + \ index_expression[:-2:] + index_expression[...] d_values = 0.5*(self.values[ui]-self.values[li]) \ /self.spacing[variable] diffaxis = self.axes[variable][1:-1] d_axes = self.axes[:variable]+[diffaxis]+self.axes[variable+1:] else: u = N.take(self.values, range(2, len(self.axes[variable]))+[0, 1], axis=variable) l = self.values d_values = (u-l)/self.spacing[variable] d_axes = self.axes d_default = None if self.default is not None: d_default = Numeric.zeros(self.rank*(3,), Numeric.Float) return self._constructor(d_axes, d_values, d_default, self.period, False) def allDerivatives(self): """ @returns: all three derivatives (x, y, z) on equal-sized grids @rtype: (L{TensorField}, L{TensorField}, L{TensorField}) """ x = self.derivative(0) y = self.derivative(1) z = self.derivative(2) if self.period[0] is None: y._reduceAxis(0) z._reduceAxis(0) if self.period[1] is None: x._reduceAxis(1) z._reduceAxis(1) if self.period[2] is None: x._reduceAxis(2) y._reduceAxis(2) return x, y, z def _reduceAxis(self, variable): self.axes[variable] = self.axes[variable][1:-1] i = variable*index_expression[::] + \ index_expression[1:-1:] + index_expression[...] self.values = self.values[i] def _checkCompatibility(self, other): if self.period != other.period: raise ValueError("Periods don't match") def __add__(self, other): self._checkCompatibility(other) if self.default is None or other.default is None: default = None else: default = self.default + other.default return self._constructor(self.axes, self.values+other.values, default, self.period, False) def __sub__(self, other): self._checkCompatibility(other) if self.default is None or other.default is None: default = None else: default = self.default - other.default return self._constructor(self.axes, self.values-other.values, default, self.period, False) # # Scalar field class definition # class ScalarField(TensorField): """Scalar field (tensor field of rank 0) A subclass of TensorField. """ def __init__(self, axes, values, default = None, period = (None, None, None), check = True): """ @param axes: three arrays specifying the axis ticks for the three axes @type axes: sequence of C{Numeric.array} of rank 1 @param values: an array containing the field values. The three dimensions correspond to the x, y, z directions and must have lengths compatible with the axis arrays. @type values: C{Numeric.array} of 3 dimensions @param default: the value of the field for points outside the grid. A value of 'None' means that an exception will be raised for an attempt to evaluate the field outside the grid. Any other value must a tensor of the correct rank. @type default: number or C{NoneType} @param period: the period for each of the variables, or C{None} for variables in which the function is not periodic. @type period: sequence of length three @raise ValueError: if the arguments are not consistent """ TensorField.__init__(self, 0, axes, values, default, period, check) def gradient(self): """ @returns: the gradient @rtype: L{VectorField} """ x, y, z = self.allDerivatives() grad = Numeric.transpose(Numeric.array([x.values, y.values, z.values]), [1,2,3,0]) if self.default is None: default = None else: default = Numeric.zeros((3,), Numeric.Float) return VectorField(x.axes, grad, default, self.period, False) def laplacian(self): """ @returns: the laplacian (gradient of divergence) @rtype L{ScalarField} """ return self.gradient().divergence() ScalarField._constructor = ScalarField # # Vector field class definition # class VectorField(TensorField): """Vector field (tensor field of rank 1) A subclass of TensorField. """ def __init__(self, axes, values, default = None, period = (None, None, None), check = True): """ @param axes: three arrays specifying the axis ticks for the three axes @type axes: sequence of C{Numeric.array} of rank 1 @param values: an array containing the field values. Its first three dimensions correspond to the x, y, z directions and must have lengths compatible with the axis arrays. The fourth dimension must have length 3. @type values: C{Numeric.array} of four dimensions @param default: the value of the field for points outside the grid. A value of 'None' means that an exception will be raised for an attempt to evaluate the field outside the grid. Any other value must a vector @type default: L{Scientific.Geometry.Vector} or C{NoneType} @param period: the period for each of the variables, or C{None} for variables in which the function is not periodic. @type period: sequence of length three @raise ValueError: if the arguments are not consistent """ TensorField.__init__(self, 1, axes, values, default, period, check) def zero(self): return Vector(0., 0., 0.) def _divergence(self, x, y, z): return x[0] + y[1] + z[2] def _curl(self, x, y, z): curl_x = y.values[..., 2] - z.values[..., 1] curl_y = z.values[..., 0] - x.values[..., 2] curl_z = x.values[..., 1] - y.values[..., 0] curl = Numeric.transpose(Numeric.array([curl_x, curl_y, curl_z]), [1,2,3,0]) if self.default is None: default = None else: default = Numeric.zeros((3,), Numeric.Float) return VectorField(x.axes, curl, default, self.period, False) def _strain(self, x, y, z): strain = Numeric.transpose(Numeric.array([x.values, y.values, z.values]), [1,2,3,0,4]) strain = 0.5*(strain+Numeric.transpose(strain, [0,1,2,4,3])) trace = (strain[..., 0,0] + strain[..., 1,1] + strain[..., 2,2])/3. strain = strain - trace[..., Numeric.NewAxis, Numeric.NewAxis] * \ Numeric.identity(3)[Numeric.NewAxis, Numeric.NewAxis, Numeric.NewAxis, :, :] if self.default is None: default = None else: default = Numeric.zeros((3, 3), Numeric.Float) return TensorField(2, x.axes, strain, default, self.period, False) def divergence(self): """ @returns: the divergence @rtype L{ScalarField} """ x, y, z = self.allDerivatives() return self._divergence(x, y, z) def curl(self): """ @returns: the curl @rtype L{VectorField} """ x, y, z = self.allDerivatives() return self._curl(x, y, z) def strain(self): """ @returns: the strain @rtype L{TensorField} of rank 2 """ x, y, z = self.allDerivatives() return self._strain(x, y, z) def divergenceCurlAndStrain(self): """ @returns: all derivative fields: divergence, curl, and strain @rtype (L{ScalarField}, L{VectorField}, L{TensorField}) """ x, y, z = self.allDerivatives() return self._divergence(x, y, z), self._curl(x, y, z), \ self._strain(x, y, z) def laplacian(self): """ @returns: the laplacian @rtype L{VectorField} """ x, y, z = self.allDerivatives() return self._divergence(x, y, z).gradient()-self._curl(x, y, z).curl() def length(self): """ @returns: a scalar field corresponding to the length (norm) of the vector field. @rtype: L{ScalarField} """ l = Numeric.sqrt(Numeric.add.reduce(self.values**2, -1)) if self.default is None: default = None else: try: default = Numeric.sqrt(Numeric.add.reduce(self.default)) except ValueError: default = None return ScalarField(self.axes, l, default, self.period, False) VectorField._constructor = VectorField # # Test code # if __name__ == '__main__': from Numeric import * axis = arange(0., 1., 0.1) values = zeros((10,10,10,3), Float) zero = VectorField(3*(axis,), values) div = zero.divergence() curl = zero.curl() strain = zero.strain() zero = VectorField(3*(axis,), values, period=(1.1, 1.1, 1.1)) div = zero.divergence() curl = zero.curl() strain = zero.strain() ScientificPython-2.9.4/Scientific/Geometry/TensorModule.py0000644000076600000240000001601012132557055024270 0ustar hinsenstaff00000000000000# This module defines 3d geometrical tensors with the standard # operations on them. The elements are stored in an array. # # Written by Konrad Hinsen # last revision: 2006-11-23 # from Scientific import N; Numeric = N class Tensor: """Tensor in 3D space Tensors support the usual arithmetic operations ('t1', 't2': tensors, 'v': vector, 's': scalar): - 't1+t2' (addition) - 't1-t2' (subtraction) - 't1*t2' (tensorial (outer) product) - 't1*v' (contraction with a vector, same as t1.dot(v.asTensor())) - 's*t1', 't1*s' (multiplication with a scalar) - 't1/s' (division by a scalar) The coordinates can be extracted by indexing; a tensor of rank N can be indexed like an array of dimension N. Tensors are I{immutable}, i.e. their elements cannot be changed. Tensor elements can be any objects on which the standard arithmetic operations are defined. However, eigenvalue calculation is supported only for float elements. """ is_tensor = 1 def __init__(self, elements, nocheck = None): """ @param elements: 2D array or nested list specifying the nine tensor components [[xx, xy, xz], [yx, yy, yz], [zx, zy, zz]] @type elements: C{Numeric.array} or C{list} """ self.array = N.array(elements) if nocheck is None: if not N.logical_and.reduce(N.equal(N.array(self.array.shape), 3)): raise ValueError('Tensor must have length 3 along any axis') self.rank = len(self.array.shape) def __repr__(self): return 'Tensor(' + str(self) + ')' def __str__(self): return str(self.array) def __add__(self, other): return Tensor(self.array+other.array, 1) __radd__ = __add__ def __neg__(self): return Tensor(-self.array, 1) def __sub__(self, other): return Tensor(self.array-other.array, 1) def __rsub__(self, other): return Tensor(other.array-self.array, 1) def __mul__(self, other): from Scientific import Geometry if isTensor(other): a = self.array[self.rank*(slice(None),)+(N.NewAxis,)] b = other.array[other.rank*(slice(None),)+(N.NewAxis,)] return Tensor(N.innerproduct(a, b), 1) elif Geometry.isVector(other): return other.__rmul__(self) else: return Tensor(self.array*other, 1) def __rmul__(self, other): return Tensor(self.array*other, 1) def __div__(self, other): if isTensor(other): raise TypeError("Can't divide by a tensor") else: return Tensor(self.array/(1.*other), 1) __truediv__ = __div__ def __rdiv__(self, other): raise TypeError("Can't divide by a tensor") def __cmp__(self, other): if not isTensor(other): return NotImplemented if self.rank != other.rank: return 1 else: return not N.logical_and.reduce( N.equal(self.array, other.array).flat) def __len__(self): return 3 def __getitem__(self, index): elements = self.array[index] if type(elements) == type(self.array): return Tensor(elements) else: return elements def asVector(self): """ @returns: an equivalent vector object @rtype: L{Scientific.Geometry.Vector} @raises ValueError: if rank > 1 """ from Scientific import Geometry if self.rank == 1: return Geometry.Vector(self.array) else: raise ValueError('rank > 1') def dot(self, other): """ @returns: the contraction with other @rtype: L{Tensor} """ if isTensor(other): a = self.array b = N.transpose(other.array, range(1, other.rank)+[0]) return Tensor(N.innerproduct(a, b), 1) else: return Tensor(self.array*other, 1) def diagonal(self, axis1=0, axis2=1): if self.rank == 2: return Tensor([self.array[0,0], self.array[1,1], self.array[2,2]]) else: if axis2 < axis1: axis1, axis2 = axis2, axis1 raise ValueError('Not yet implemented') def trace(self, axis1=0, axis2=1): """ @returns: the trace of the tensor @rtype: type of tensor elements @raises ValueError: if rank !=2 """ if self.rank == 2: return self.array[0,0]+self.array[1,1]+self.array[2,2] else: raise ValueError('Not yet implemented') def transpose(self): """ @returns: the transposed (index reversed) tensor @rtype: L{Tensor} """ return Tensor(N.transpose(self.array)) def symmetricalPart(self): """ @returns: the symmetrical part of the tensor @rtype: L{Tensor} @raises ValueError: if rank !=2 """ if self.rank == 2: return Tensor(0.5*(self.array + \ N.transpose(self.array, N.array([1,0]))), 1) else: raise ValueError('Not yet implemented') def asymmetricalPart(self): """ @returns: the asymmetrical part of the tensor @rtype: L{Tensor} @raises ValueError: if rank !=2 """ if self.rank == 2: return Tensor(0.5*(self.array - \ N.transpose(self.array, N.array([1,0]))), 1) else: raise ValueError('Not yet implemented') def eigenvalues(self): """ @returns: the eigenvalues of the tensor @rtype: C{Numeric.array} @raises ValueError: if rank !=2 """ if self.rank == 2: from Scientific.LA import eigenvalues return eigenvalues(self.array) else: raise ValueError('Undefined operation') def diagonalization(self): """ @returns: the eigenvalues of the tensor and a tensor representing the rotation matrix to the diagonal form @rtype: (C{Numeric.array}, L{Tensor}) @raises ValueError: if rank !=2 """ if self.rank == 2: from Scientific.LA import eigenvectors ev, vectors = eigenvectors(self.array) return ev, Tensor(vectors) else: raise ValueError, 'Undefined operation' def inverse(self): """ @returns: the inverse of the tensor @rtype: L{Tensor} @raises ValueError: if rank !=2 """ if self.rank == 2: from Scientific.LA import inverse return Tensor(inverse(self.array)) else: raise ValueError('Undefined operation') # Type check def isTensor(x): """ @returns: C{True} if x is a L{Tensor} """ return hasattr(x,'is_tensor') ScientificPython-2.9.4/Scientific/Geometry/Transformation.py0000644000076600000240000004267111730661750024673 0ustar hinsenstaff00000000000000# This module defines classes that represent coordinate translations, # rotations, and combinations of translation and rotation. # # Written by: Konrad Hinsen # Contributions from Pierre Legrand # last revision: 2011-1-24 # """ Linear transformations in 3D space """ from Scientific import Geometry from Scientific import N from math import atan2 # # Abstract base classes # class Transformation: """ Linear coordinate transformation. Transformation objects represent linear coordinate transformations in a 3D space. They can be applied to vectors, returning another vector. If t is a transformation and v is a vector, t(v) returns the transformed vector. Transformations support composition: if t1 and t2 are transformation objects, t1*t2 is another transformation object which corresponds to applying t1 B{after} t2. This class is an abstract base class. Instances can only be created of concrete subclasses, i.e. translations or rotations. """ def __call__(self, vector): """ @param vector: the input vector @type vector: L{Scientific.Geometry.Vector} @returns: the transformed vector @rtype: L{Scientific.Geometry.Vector} """ return NotImplementedError def inverse(self): """ @returns: the inverse transformation @rtype: L{Transformation} """ return NotImplementedError # # Rigid body transformations # class RigidBodyTransformation(Transformation): """ Combination of translations and rotations """ def rotation(self): """ @returns: the rotational component @rtype: L{Rotation} """ pass def translation(self): """ @returns: the translational component. In the case of a mixed rotation/translation, this translation is executed B{after} the rotation. @rtype: L{Translation} """ pass def screwMotion(self): """ @returns: the four parameters (reference, direction, angle, distance) of a screw-like motion that is equivalent to the transformation. The screw motion consists of a displacement of distance (a C{float}) along direction (a normalized L{Scientific.Geometry.Vector}) plus a rotation of angle radians around an axis pointing along direction and passing through the point reference (a L{Scientific.Geometry.Vector}). """ pass # # Pure translation # class Translation(RigidBodyTransformation): """ Translational transformation """ def __init__(self, vector): """ @param vector: the displacement vector @type vector: L{Scientific.Geometry.Vector} """ self.vector = vector is_translation = 1 def asLinearTransformation(self): return LinearTransformation(Geometry.delta, self.vector) def __mul__(self, other): if hasattr(other, 'is_translation'): return Translation(self.vector + other.vector) elif hasattr(other, 'is_rotation'): return RotationTranslation(other.tensor, self.vector) elif hasattr(other, 'is_rotation_translation'): return RotationTranslation(other.tensor, other.vector+self.vector) else: return self.asLinearTransformation()*other.asLinearTransformation() def __call__(self, vector): return self.vector + vector def displacement(self): """ @returns: the displacement vector """ return self.vector def rotation(self): return Rotation(Geometry.ez, 0.) def translation(self): return self def inverse(self): return Translation(-self.vector) def screwMotion(self): l = self.vector.length() if l == 0.: return Geometry.Vector(0.,0.,0.), \ Geometry.Vector(0.,0.,1.), 0., 0. else: return Geometry.Vector(0.,0.,0.), self.vector/l, 0., l # # Pure rotation # class Rotation(RigidBodyTransformation): """ Rotational transformation """ def __init__(self, *args): """ There are two calling patterns: - Rotation(tensor), where tensor is a L{Scientific.Geometry.Tensor} of rank 2 containing the rotation matrix. - Rotation(axis, angle), where axis is a L{Scientific.Geometry.Vector} and angle a number (the angle in radians). """ if len(args) == 1: self.tensor = args[0] if not Geometry.isTensor(self.tensor): self.tensor = Geometry.Tensor(self.tensor) elif len(args) == 2: axis, angle = args axis = axis.normal() projector = axis.dyadicProduct(axis) self.tensor = projector - \ N.sin(angle)*Geometry.epsilon*axis + \ N.cos(angle)*(Geometry.delta-projector) else: raise TypeError('one or two arguments required') is_rotation = 1 def asLinearTransformation(self): return LinearTransformation(self.tensor, Geometry.nullVector) def __mul__(self, other): if hasattr(other, 'is_rotation'): return Rotation(self.tensor.dot(other.tensor)) elif hasattr(other, 'is_translation'): return RotationTranslation(self.tensor, self.tensor*other.vector) elif hasattr(other, 'is_rotation_translation'): return RotationTranslation(self.tensor.dot(other.tensor), self.tensor*other.vector) else: return self.asLinearTransformation()*other.asLinearTransformation() def __call__(self,other): if hasattr(other,'is_vector'): return self.tensor*other elif hasattr(other, 'is_tensor') and other.rank == 2: _rinv=self.tensor.inverse() return _rinv.dot(other.dot(self.tensor)) elif hasattr(other, 'is_tensor') and other.rank == 1: return self.tensor.dot(other) else: raise ValueError('incompatible object') def axisAndAngle(self): """ @returns: the axis (a normalized vector) and angle (in radians). The angle is in the interval (-pi, pi] @rtype: (L{Scientific.Geometry.Vector}, C{float}) """ asym = -self.tensor.asymmetricalPart() axis = Geometry.Vector(asym[1,2], asym[2,0], asym[0,1]) sine = axis.length() if abs(sine) > 1.e-10: axis = axis/sine projector = axis.dyadicProduct(axis) cosine = (self.tensor-projector).trace()/(3.-axis*axis) angle = angleFromSineAndCosine(sine, cosine) else: t = 0.5*(self.tensor+Geometry.delta) i = N.argmax(t.diagonal().array) axis = (t[i]/N.sqrt(t[i,i])).asVector() angle = 0. if t.trace() < 2.: angle = N.pi return axis, angle def threeAngles(self, e1, e2, e3, tolerance=1e-7): """ Find three angles a1, a2, a3 such that Rotation(a1*e1)*Rotation(a2*e2)*Rotation(a3*e3) is equal to the rotation object. e1, e2, and e3 are non-zero vectors. There are two solutions, both of which are computed. @param e1: a rotation axis @type e1: L{Scientific.Geometry.Vector} @param e2: a rotation axis @type e2: L{Scientific.Geometry.Vector} @param e3: a rotation axis @type e3: L{Scientific.Geometry.Vector} @returns: a list containing two arrays of shape (3,), each containing the three angles of one solution @rtype: C{list} of C{N.array} @raise ValueError: if two consecutive axes are parallel """ # Written by Pierre Legrand (pierre.legrand@synchrotron-soleil.fr) # # Basically this is a reimplementation of the David # Thomas's algorithm [1] described by Gerard Bricogne in [2]: # # [1] "Modern Equations of Diffractometry. Goniometry." D.J. Thomas # Acta Cryst. (1990) A46 Page 321-343. # # [2] "The ECC Cooperative Programming Workshop on Position-Sensitive # Detector Software." G. Bricogne, # Computational aspect of Protein Crystal Data Analysis, # Proceedings of the Daresbury Study Weekend (23-24/01/1987) # Page 122-126 e1 = e1.normal() e2 = e2.normal() e3 = e3.normal() # We are searching for the three angles a1, a2, a3 # If 2 consecutive axes are parallel: decomposition is not meaningful if (e1.cross(e2)).length() < tolerance or \ (e2.cross(e3)).length() < tolerance : raise ValueError('Consecutive parallel axes. Too many solutions') w = self(e3) # Solve the equation : _a.cosx + _b.sinx = _c _a = e1*e3 - (e1*e2)*(e2*e3) _b = e1*(e2.cross(e3)) _c = e1*w - (e1*e2)*(e2*e3) _norm = (_a**2 + _b**2)**0.5 # Checking for possible errors in initial Rot matrix if _norm == 0: raise ValueError('FAILURE 1, norm = 0') if abs(_c/_norm) > 1+tolerance: raise ValueError('FAILURE 2' + 'malformed rotation Tensor (non orthogonal?) %.8f' % (_c/_norm)) #if _c/_norm > 1: raise ValueError('Step1: No solution') _th = angleFromSineAndCosine(_b/_norm, _a/_norm) _xmth = N.arccos(_c/_norm) # a2a and a2b are the two possible solutions to the equation. a2a = mod_angle((_th + _xmth), 2*N.pi) a2b = mod_angle((_th - _xmth), 2*N.pi) solutions = [] # for each solution, find the two other angles (a1, a3). for a2 in (a2a, a2b): R2 = Rotation(e2, a2) v = R2(e3) v1 = v - (v*e1)*e1 w1 = w - (w*e1)*e1 norm = ((v1*v1)*(w1*w1))**0.5 if norm == 0: # in that case rotation 1 and 3 are about the same axis # so any solution for rotation 1 is OK a1 = 0. else: cosa1 = (v1*w1)/norm sina1 = v1*(w1.cross(e1))/norm a1 = mod_angle(angleFromSineAndCosine(sina1, cosa1), 2*N.pi) R3 = Rotation(e2, -1*a2)*Rotation(e1, -1*a1)*self # u = normalized test vector perpendicular to e3 # if e2 and e3 are // we have an exception before. # if we take u = e1^e3 then it will not work for # Euler and Kappa axes. u = (e2.cross(e3)).normal() cosa3 = u*R3(u) sina3 = u*(R3(u).cross(e3)) a3 = mod_angle(angleFromSineAndCosine(sina3, cosa3), 2*N.pi) solutions.append(N.array([a1, a2, a3])) # Gives the closest solution to 0,0,0 first if N.add.reduce(solutions[0]**2) > \ N.add.reduce(solutions[1]**2): solutions = [solutions[1], solutions[0]] return solutions def asQuaternion(self): """ @returns: a quaternion representing the same rotation @rtype: L{Scientific.Geometry.Quaternion.Quaternion} """ from Quaternion import Quaternion axis, angle = self.axisAndAngle() sin_angle_2 = N.sin(0.5*angle) cos_angle_2 = N.cos(0.5*angle) return Quaternion(cos_angle_2, sin_angle_2*axis[0], sin_angle_2*axis[1], sin_angle_2*axis[2]) def rotation(self): return self def translation(self): return Translation(Geometry.Vector(0.,0.,0.)) def inverse(self): return Rotation(self.tensor.transpose()) def screwMotion(self): axis, angle = self.axisAndAngle() return Geometry.Vector(0., 0., 0.), axis, angle, 0. # # Combined translation and rotation # class RotationTranslation(RigidBodyTransformation): """ Combined translational and rotational transformation. Objects of this class are not created directly, but can be the result of a composition of rotations and translations. """ def __init__(self, tensor, vector): self.tensor = tensor self.vector = vector is_rotation_translation = 1 def asLinearTransformation(self): return LinearTransformation(self.tensor, self.vector) def __mul__(self, other): if hasattr(other, 'is_rotation'): return RotationTranslation(self.tensor.dot(other.tensor), self.vector) elif hasattr(other, 'is_translation'): return RotationTranslation(self.tensor, self.tensor*other.vector+self.vector) elif hasattr(other, 'is_rotation_translation'): return RotationTranslation(self.tensor.dot(other.tensor), self.tensor*other.vector+self.vector) else: return self.asLinearTransformation()*other.asLinearTransformation() def __call__(self, vector): return self.tensor*vector + self.vector def rotation(self): return Rotation(self.tensor) def translation(self): return Translation(self.vector) def inverse(self): return Rotation(self.tensor.transpose())*Translation(-self.vector) # def screwMotion1(self): # import Scientific.LA # axis, angle = self.rotation().axisAndAngle() # d = self.vector*axis # x = d*axis-self.vector # r0 = N.dot(Scientific.LA.generalized_inverse( # self.tensor.array-N.identity(3)), x.array) # return Geometry.Vector(r0), axis, angle, d def screwMotion(self): axis, angle = self.rotation().axisAndAngle() d = self.vector*axis if d < 0.: d = -d axis = -axis angle = -angle if abs(angle) < 1.e-9: r0 = Geometry.Vector(0., 0., 0.) angle = 0. else: x = d*axis-self.vector r0 = -0.5*((N.cos(0.5*angle)/N.sin(0.5*angle))*axis.cross(x)+x) return r0, axis, angle % (2.*N.pi), d # # Scaling # class Scaling(Transformation): """ Scaling """ def __init__(self, scale_factor): """ @param scale_factor: the scale factor @type scale_factor: C{float} """ self.scale_factor = scale_factor is_scaling = 1 def asLinearTransformation(self): return LinearTransformation(self.scale_factor*Geometry.delta, Geometry.nullVector) def __call__(self, vector): return self.scale_factor*vector def __mul__(self, other): if hasattr(other, 'is_scaling'): return Scaling(self.scale_factor*other.scale_factor) else: return self.asLinearTransformation()*other.asLinearTransformation() def inverse(self): return Scaling(1./self.scale_factor) # # Inversion is scaling by -1 # class Inversion(Scaling): def __init__(self): Scaling.__init__(self, -1.) # # Shear # class Shear(Transformation): def __init__(self, *args): if len(args) == 1: if Geometry.isTensor(args[0]): self.tensor = args[0] else: self.tensor = Geometry.Tensor(args[0]) assert self.tensor.rank == 2 elif len(args) == 3 and Geometry.isVector(args[0]) \ and Geometry.isVector(args[1]) and Geometry.isVector(args[2]): self.tensor = Geometry.Tensor([args[0].array, args[1].array, args[2].array]).transpose() def asLinearTransformation(self): return LinearTransformation(self.tensor, Geometry.nullVector) def __mul__(self, other): return self.asLinearTransformation()*other def __call__(self, vector): return self.tensor*vector def inverse(self): return Shear(self.tensor.inverse()) # # General linear transformation # class LinearTransformation(Transformation): """ General linear transformation. Objects of this class are not created directly, but can be the result of a composition of transformations. """ def __init__(self, tensor, vector): self.tensor = tensor self.vector = vector def asLinearTransformation(self): return self def __mul__(self, other): other = other.asLinearTransformation() return LinearTransformation(self.tensor.dot(other.tensor), self.tensor*other.vector+self.vector) def __call__(self, vector): return self.tensor*vector + self.vector def inverse(self): return LinearTransformation(self.tensor.inverse(), -self.vector) # Utility functions def angleFromSineAndCosine(y, x): return atan2(y, x) def mod_angle(angle, mod): return (angle + mod/2.) % mod - mod/2 # Test code if __name__ == '__main__': t = Translation(Geometry.Vector(1.,-2.,0)) r = Rotation(Geometry.Vector(0.1, -2., 0.5), 1.e-10) q = r.asQuaternion() angles = r.threeAngles(Geometry.Vector(1., 0., 0.), Geometry.Vector(0., 1., 0.), Geometry.Vector(0., 0., 1.)) c = t*r print c.screwMotion() s = Scaling(2.) all = s*t*r print all(Geometry.ex) ScientificPython-2.9.4/Scientific/Geometry/VectorModule.py0000644000076600000240000001561412132557055024271 0ustar hinsenstaff00000000000000# This module defines 3d geometrical vectors with the standard # operations on them. The elements are stored in an # array. # # Written by Konrad Hinsen # last revision: 2008-8-27 # from Scientific import N; Numeric = N class Vector: """Vector in 3D space Constructor: Vectors support the usual arithmetic operations ('v1', 'v2': vectors, 's': scalar): - 'v1+v2' (addition) - 'v1-v2' (subtraction) - 'v1*v2' (scalar product) - 's*v1', 'v1*s' (multiplication with a scalar) - 'v1/s' (division by a scalar) The three coordinates can be extracted by indexing. Vectors are B{immutable}, i.e. their elements cannot be changed. Vector elements can be any objects on which the standard arithmetic operations plus the functions sqrt and arccos are defined. """ is_vector = 1 def __init__(self, x=None, y=None, z=None): """ There are two supported calling patterns: 1. C{Vector(x, y, z)} (from three coordinates) 2. C{Vector(coordinates)} (from any sequence containing three coordinates) """ if x is None: self.array = [0.,0.,0.] elif y is None and z is None: self.array = x else: self.array = [x,y,z] self.array = Numeric.array(self.array) def __getstate__(self): return list(self.array) def __setstate__(self, state): self.array = Numeric.array(state) def __copy__(self, memo = None): return self __deepcopy__ = __copy__ def __repr__(self): return 'Vector(%s,%s,%s)' % (`self.array[0]`,\ `self.array[1]`,`self.array[2]`) def __str__(self): return `list(self.array)` def __add__(self, other): return Vector(self.array+other.array) __radd__ = __add__ def __neg__(self): return Vector(-self.array) def __sub__(self, other): return Vector(self.array-other.array) def __rsub__(self, other): return Vector(other.array-self.array) def __mul__(self, other): from Scientific import Geometry if isVector(other): return Numeric.add.reduce(self.array*other.array) elif Geometry.isTensor(other): product = Geometry.Tensor(self.array).dot(other) if product.rank == 1: return Vector(product.array) else: return product elif hasattr(other, "_product_with_vector"): return other._product_with_vector(self) else: return Vector(Numeric.multiply(self.array, other)) def __rmul__(self, other): from Scientific import Geometry if Geometry.isTensor(other): product = other.dot(Geometry.Tensor(self.array)) if product.rank == 1: return Vector(product.array) else: return product else: return Vector(Numeric.multiply(self.array, other)) def __div__(self, other): if isVector(other): raise TypeError("Can't divide by a vector") else: return Vector(Numeric.divide(self.array,1.*other)) __truediv__ = __div__ def __rdiv__(self, other): raise TypeError("Can't divide by a vector") def __cmp__(self, other): if isVector(other): return cmp(Numeric.add.reduce(abs(self.array-other.array)), 0) return NotImplemented def __len__(self): return 3 def __getitem__(self, index): return self.array[index] def x(self): """ @returns: the x coordinate @rtype: type of vector elements """ return self.array[0] def y(self): """ @returns: the y coordinate @rtype: type of vector elements """ return self.array[1] def z(self): """ @returns: the z coordinate @rtype: type of vector elements """ return self.array[2] def length(self): """ @returns: the length (norm) of the vector @rtype: type of vector elements """ return Numeric.sqrt(Numeric.add.reduce(self.array*self.array)) def normal(self): """ @returns: a normalized (length 1) copy of the vector @rtype: L{Vector} @raises ZeroDivisionError: if vector length is zero """ len = Numeric.sqrt(Numeric.add.reduce(self.array*self.array)) if len == 0: raise ZeroDivisionError("Can't normalize a zero-length vector") return Vector(Numeric.divide(self.array, len)) def cross(self, other): """ @param other: a vector @type other: L{Vector} @returns: cross product with other @rtype: L{Vector} """ if not isVector(other): raise TypeError("Cross product with non-vector") return Vector(self.array[1]*other.array[2] -self.array[2]*other.array[1], self.array[2]*other.array[0] -self.array[0]*other.array[2], self.array[0]*other.array[1] -self.array[1]*other.array[0]) def asTensor(self): """ @returns: an equivalent rank-1 tensor object @rtype: L{Scientific.Geometry.Tensor} """ from Scientific import Geometry return Geometry.Tensor(self.array, 1) def dyadicProduct(self, other): """ @param other: a vector or a tensor @type other: L{Vector} or L{Scientific.Geometry.Tensor} @returns: the dyadic product with other @rtype: L{Scientific.Geometry.Tensor} @raises TypeError: if other is not a vector or a tensor """ from Scientific import Geometry if isVector(other): return Geometry.Tensor(self.array[:, N.NewAxis] * other.array[N.NewAxis, :], 1) elif Geometry.isTensor(other): return Geometry.Tensor(self.array, 1)*other else: raise TypeError("Dyadic product with non-vector") def angle(self, other): """ @param other: a vector @type other: L{Vector} @returns: the angle to other @rtype: C{float} @raises TypeError: if other is not a vector """ if not isVector(other): raise TypeError("Angle between vector and non-vector") cosa = Numeric.add.reduce(self.array*other.array) / \ Numeric.sqrt(Numeric.add.reduce(self.array*self.array) * \ Numeric.add.reduce(other.array*other.array)) cosa = max(-1.,min(1.,cosa)) return Numeric.arccos(cosa) # Type check def isVector(x): """ @returns: C{True} if x is a L{Vector} """ return hasattr(x,'is_vector') ScientificPython-2.9.4/Scientific/indexing.py0000644000076600000240000000260311501734163021661 0ustar hinsenstaff00000000000000# A nicer way to build up index tuples for arrays. # # You can do all this with slice() plus a few special objects, # but there's a lot to remember. This version is simpler because # it uses the standard array indexing syntax. # # Written by Konrad Hinsen # last revision: 2006-6-12 # """ Array indexing utility This module provides a convenient method for constructing array indices algorithmically. It provides one importable object, L{index_expression}. For any index combination, including slicing and axis insertion, C{a[indices]} is the same as C{a[index_expression[indices]]} for any array {a}. However, C{index_expression[indices]} can be used anywhere in Python code and returns a tuple of indexing objects that can be used in the construction of complex index expressions. Sole restriction: Slices must be specified in the double-colon form, i.e. C{a[::]} is allowed, whereas C{a[:]} is not. """ class _index_expression_class: import sys maxint = sys.maxint def __init__(self): pass def __getitem__(self, item): if type(item) != type(()): return (item,) else: return item def __len__(self): return self.maxint def __getslice__(self, start, stop): if stop == self.maxint: stop = None return self[start:stop:None] index_expression = _index_expression_class() ScientificPython-2.9.4/Scientific/IO/0000755000076600000240000000000012270505005020003 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/IO/__init__.py0000644000076600000240000000006611501734230022116 0ustar hinsenstaff00000000000000# Empty file """ @undocumented: PDBExportFilters """ ScientificPython-2.9.4/Scientific/IO/ArrayIO.py0000644000076600000240000001100611501734230021661 0ustar hinsenstaff00000000000000# Array I/O to text files # # Written by Konrad Hinsen # last revision: 2006-6-23 # """ Basic support for I/O of one- and two-dimensional numerical arrays to and from plain text files The text file format is very simple and used by many other programs as well: - each line corresponds to one row of the array - the numbers within a line are separated by white space - lines starting with # are ignored (comment lines) An array containing only one line or one column is returned as a one-dimensional array on reading. One-dimensional arrays are written as one item per line. Numbers in files to be read must conform to Python/C syntax. For reading files containing Fortran-style double-precision numbers (exponent prefixed by D), use the module L{Scientific.IO.FortranFormat}. """ from Scientific.IO.TextFile import TextFile from Scientific import N; Numeric = N import string def readArray(filename): """ Read array data from a file This function works for arbitrary data types (every array element can be given by an arbitrary Python expression), but at the price of being slow. For large arrays, use L{readFloatArray} or L{readIntegerArray} if possible. @param filename: the name of the file to read @type filename: C{str} @returns: an array containing the data from the file @rtype: C{Numeric.array} """ data = [] for line in TextFile(filename): if len(line) == 0 and len(data) > 0: break if line[0] != '#': data.append(map(eval, string.split(line))) a = Numeric.array(data) if a.shape[0] == 1 or a.shape[1] == 1: a = Numeric.ravel(a) return a def readFloatArray(filename): """ Read array data from a file into an array of floats @param filename: the name of the file to read @type filename: C{str} @returns: an array containing the data from the file @rtype: C{Numeric.array} of C{float} """ data = [] for line in TextFile(filename): if line[0] != '#': data.append(map(string.atof, string.split(line))) a = Numeric.array(data) if a.shape[0] == 1 or a.shape[1] == 1: a = Numeric.ravel(a) return a def readIntegerArray(filename): """ Read array data from a file into an array of integers @param filename: the name of the file to read @type filename: C{str} @returns: an array containing the data from the file @rtype: C{Numeric.array} of C{int} """ data = [] for line in TextFile(filename): if line[0] != '#': data.append(map(string.atoi, string.split(line))) a = Numeric.array(data) if a.shape[0] == 1 or a.shape[1] == 1: a = Numeric.ravel(a) return a def writeArray(array, filename, mode='w'): """ Write a text representation of an array to a file. @param array: the array to be written @type array: C{Numeric.array} @param filename: the name of the output file @type filename: C{str} @param mode: the file access mode, 'w' (new file) or 'a' (append) @type mode: C{str} """ file = TextFile(filename, mode) if len(array.shape) == 1: array = array[:, Numeric.NewAxis] for line in array: for element in line: file.write(`element` + ' ') file.write('\n') file.close() # # Write several data sets (one point per line) to a text file, # with a separator line between data sets. This is sufficient # to make input files for most plotting programs. # def writeDataSets(datasets, filename, separator = ''): """ Write multiple datasets to a text file. @param datasets: a sequence of datasets describing a curve to be plotted. Each dataset is either a 1d-array (list of values) or a 2d-array of shape N x 2 (list of (x, y) pairs). Nested lists can be used instead of arrays. @param filename: the name of the output file @type filename: C{str} @param separator: the contents of the line that is written between two datasets @type separator: C{str} """ file = TextFile(filename, 'w') nsets = len(datasets) for i in range(nsets): d = Numeric.array(list(datasets[i])) if len(d.shape) == 1: d = d[:, Numeric.NewAxis] for point in d: for number in point: file.write(`number` + ' ') file.write('\n') if (i < nsets-1): file.write(separator + '\n') file.close() ScientificPython-2.9.4/Scientific/IO/FortranFormat.py0000644000076600000240000002450111501734230023143 0ustar hinsenstaff00000000000000# This module defines a class that handles I/O using # Fortran-compatible format specifications. # # # Warning: Fortran formatting is a complex business and I don't # claim that this module works for anything complicated. It knows # only the most frequent formatting options. Known limitations: # # 1) Only A, D, E, F, G, I, and X formats are supported (plus string constants # for output). # 2) No direct support for complex numbers. You have to split them into # real and imaginary parts before output, and for input you get # two float numbers anyway. # 3) No overflow check. If an output field gets too large, it will # take more space, instead of being replaced by stars. # # # Written by Konrad Hinsen # With contributions from Andreas Prlic # last revision: 2008-8-18 # """ Fortran-style formatted input/output This module provides two classes that aid in reading and writing Fortran-formatted text files. Examples:: Input:: >>>s = ' 59999' >>>format = FortranFormat('2I4') >>>line = FortranLine(s, format) >>>print line[0] >>>print line[1] prints:: >>>5 >>>9999 Output:: >>>format = FortranFormat('2D15.5') >>>line = FortranLine([3.1415926, 2.71828], format) >>>print str(line) prints:: '3.14159D+00 2.71828D+00' """ import string # # The class FortranLine represents a single line of input/output, # which can be accessed as text or as a list of items. # class FortranLine: """Fortran-style record in formatted files FortranLine objects represent the content of one record of a Fortran-style formatted file. Indexing yields the contents as Python objects, whereas transformation to a string (using the built-in function 'str') yields the text representation. Restrictions: 1. Only A, D, E, F, G, I, and X formats are supported (plus string constants for output). 2. No direct support for complex numbers; they must be split into real and imaginary parts before output. 3. No overflow check. If an output field gets too large, it will take more space, instead of being replaced by stars according to Fortran conventions. """ def __init__(self, line, format, length = 80): """ @param line: either a sequence of Python objects, or a string formatted according to Fortran rules @param format: either a Fortran-style format string, or a L{FortranFormat} object. A FortranFormat should be used when the same format string is used repeatedly, because then the rather slow parsing of the string is performed only once. @param length: the length of the Fortran record. This is relevant only when data is a string; this string is then extended by spaces to have the indicated length. The default value of 80 is almost always correct. """ if type(line) == type(''): self.text = line self.data = None else: self.text = None self.data = line if type(format) == type(''): self.format = FortranFormat(format) else: self.format = format self.length = length if self.text is None: self._output() if self.data is None: self._input() def __len__(self): """ @returns: the number of data elements in the record @rtype: C{int} """ return len(self.data) def __getitem__(self, i): """ @param i: index @type i: C{int} @returns: the ith data element """ return self.data[i] def __getslice__(self, i, j): """ @param i: start index @type i: C{int} @param j: end index @type j: C{int} @returns: a list containing the ith to jth data elements """ return self.data[i:j] def __str__(self): """ @returns: a Fortran-formatted text representation of the data record @rtype: C{str} """ return self.text def isBlank(self): """ @returns: C{True} if the line contains only whitespace @rtype: C{bool} """ return len(string.strip(self.text)) == 0 def _input(self): text = self.text if len(text) < self.length: text = text + (self.length-len(text))*' ' self.data = [] for field in self.format: l = field[1] s = text[:l] text = text[l:] type = field[0] value = None if type == 'A': value = s elif type == 'I': s = string.strip(s) if len(s) == 0: value = 0 else: # by AP # sometimes a line does not match to expected format, # e.g.: pdb2myd.ent.Z chain: - model: 0 : CONECT***** # catch this and set value to None try: value = string.atoi(s) except: value = None elif type == 'D' or type == 'E' or type == 'F' or type == 'G': s = string.lower(string.strip(s)) n = string.find(s, 'd') if n >= 0: s = s[:n] + 'e' + s[n+1:] if len(s) == 0: value = 0. else: try: value = string.atof(s) except: value = None if value is not None: self.data.append(value) def _output(self): data = self.data self.text = '' for field in self.format: type = field[0] if type == "'": self.text = self.text + field[1] elif type == 'X': self.text = self.text + field[1]*' ' else: # fields that use input data length = field[1] if len(field) > 2: fraction = field[2] value = data[0] data = data[1:] if type == 'A': self.text = self.text + (value+length*' ')[:length] else: # numeric fields if value is None: s = '' elif type == 'I': s = `value` elif type == 'D': s = ('%'+`length`+'.'+`fraction`+'e') % value n = string.find(s, 'e') s = s[:n] + 'D' + s[n+1:] elif type == 'E': s = ('%'+`length`+'.'+`fraction`+'e') % value elif type == 'F': s = ('%'+`length`+'.'+`fraction`+'f') % value elif type == 'G': s = ('%'+`length`+'.'+`fraction`+'g') % value else: raise ValueError('Not yet implemented') s = string.upper(s) self.text = self.text + ((length*' ')+s)[-length:] self.text = string.rstrip(self.text) # # The class FortranFormat represents a format specification. # It ought to work for correct specifications, but there is # little error checking. # class FortranFormat: """ Parsed Fortran-style format string FortranFormat objects can be used as arguments when constructing FortranLine objects instead of the plain format string. If a format string is used more than once, embedding it into a FortranFormat object has the advantage that the format string is parsed only once. """ def __init__(self, format, nested = False): """ @param format: a Fortran format specification @type format: C{str} @param nested: I{for internal use} """ fields = [] format = string.strip(format) while format and format[0] != ')': n = 0 while format[0] in string.digits: n = 10*n + string.atoi(format[0]) format = format[1:] if n == 0: n = 1 type = string.upper(format[0]) if type == "'": eof = string.find(format, "'", 1) text = format[1:eof] format = format[eof+1:] else: format = string.strip(format[1:]) if type == '(': subformat = FortranFormat(format, 1) fields = fields + n*subformat.fields format = subformat.rest eof = string.find(format, ',') if eof >= 0: format = format[eof+1:] else: eof = string.find(format, ',') if eof >= 0: field = format[:eof] format = format[eof+1:] else: eof = string.find(format, ')') if eof >= 0: field = format[:eof] format = format[eof+1:] else: field = format format = '' if type == "'": field = (type, text) else: dot = string.find(field, '.') if dot > 0: length = string.atoi(field[:dot]) fraction = string.atoi(field[dot+1:]) field = (type, length, fraction) else: if field: length = string.atoi(field) else: length = 1 field = (type, length) fields = fields + n*[field] self.fields = fields if nested: self.rest = format def __len__(self): return len(self.fields) def __getitem__(self, i): return self.fields[i] # Test code if __name__ == '__main__': f = FortranFormat("'!!',D10.3,F10.3,G10.3,'!!'") l = FortranLine([1.5707963, 3.14159265358, 2.71828], f) print str(l) f = FortranFormat("F12.0") l = FortranLine('2.1D2', f) print l[0] ScientificPython-2.9.4/Scientific/IO/NetCDF.py0000644000076600000240000001557412233721375021445 0ustar hinsenstaff00000000000000# The netCDF interface is mostly written in C; this module only # adds some luxury and puts everything in its proper place in the # package hierarchy. # # Written by Konrad Hinsen # """ Python interface to the netCDF library """ import sys if sys.modules.has_key('epydoc'): # Fake code just for the docstrings! from Scientific._netcdf import _C_API class NetCDFFile: """ X{netCDF} file A NetCDFFile object has two standard attributes: 'dimensions' and 'variables'. The values of both are dictionaries, mapping dimension names to their associated lengths and variable names to variables, respectively. Application programs should never modify these dictionaries. All other attributes correspond to global attributes defined in the netCDF file. Global file attributes are created by assigning to an attribute of the NetCDFFile object. """ def __init__(self, filename, mode): """ @param filename: name of the netCDF file. By convention, netCDF files have the extension ".nc", but this is not enforced. The filename may contain a home directory indication starting with "~". @type filename: C{str} @param mode: access mode. "r" means read-only; no data can be modified. "w" means write; a new file is created, an existing file with the same name is deleted. "a" means append (in analogy with serial files); an existing file is opened for reading and writing, if the file does not exist it is created. "r+" is similar to "a", but the file must already exist. An "s" can be appended to any of the modes listed above; it indicates that the file will be opened or created in "share" mode, which reduces buffering in order to permit simultaneous read access by other processes to a file that is being written. When creating a file in write mode, an "l" or "4" can be appended to use the large-file format (introduced with netCDF 3.6) or the HDF5 format (introduced with netCDF 4). @type mode: C{str} """ raise ImportError("this code should never be executed") def close(self): """ Close the file. Any read or write access to the file or one of its variables after closing raises an exception. """ pass def createDimension(self, name, length): """ @param name: the name of the dimension @type name: C{str} @param length: the length of the new dimension. C{None} stands for the unlimited dimension. Note that there can be only one unlimited dimension per file. @type length: C{int} or C{NoneType} """ pass def createVariable(self, name, type, dimensions): """ @param name: the name of the new variable @type name: C{str} @param type: the data type of the elements; the same one-letter codes as in C{Numeric} are used and the use of the pre-defined constants (Numeric.Float etc.) is strongly recommended. @type type: C{str} @param dimensions: a tuple of dimension names that have been defined earlier @type dimensions: C{tuple} of C{str} @returns: the object corresponding to the new variable @rtype: L{NetCDFVariable} """ pass def sync(self): """ Write all buffered data to the disk file. """ flush = sync class NetCDFVariable: """ Variable in a netCDF file NetCDFVariable objects are constructed by calling the method 'createVariable' on the L{NetCDFFile} object. NetCDFVariable objects behave much like array objects defined in module Numeric, except that their data resides in a file. Data is read by indexing and written by assigning to an indexed subset; the entire array can be accessed by the index '[:]' or using the methods 'getValue' and 'assignValue'. NetCDFVariable objects also have attribute "shape" with the same meaning as for arrays, but the shape cannot be modified. There is another read-only attribute "dimensions", whose value is the tuple of dimension names. All other attributes correspond to variable attributes defined in the netCDF file. Variable attributes are created by assigning to an attribute of the NetCDFVariable object. B{Note:} If a file open for reading is simultaneously written by another program, the size of the unlimited dimension may change. Every time the shape of a variable is requested, the current size will be obtained from the file. For reading and writing, the size obtained during the last shape request is used. This ensures consistency: foo[-1] means the same thing no matter how often it is evaluated, as long as the shape is not re-evaluated in between. """ def __init__(self, *args): raise ImportError("this code should never be executed") def assignValue(self, value): """ Assign a new value to the variable. This method allows assignment to scalar variables, which cannot be indexed. @param value: the new value for the variable """ pass def getValue(self): """ Return the value of the variable. This method allows access to scalar variables, which cannot be indexed. @returns: the current value of the variable """ pass def typecode(self): """ @returns: the variable's type code @rtype: C{str} """ pass else: # This is the real code. from Scientific._netcdf import * from Scientific._netcdf import _C_API import os _NetCDFFile = NetCDFFile def NetCDFFile(filename, mode=None, history=None): filename = os.path.expanduser(filename) args = (filename,) if mode is not None: args = args + (mode,) if history is not None: args = args + (history,) return apply(_NetCDFFile, args) del sys ScientificPython-2.9.4/Scientific/IO/PDB.py0000644000076600000240000015440312037537270021003 0ustar hinsenstaff00000000000000# This module handles input and output of PDB files. # # Written by Konrad Hinsen # Last revision: 2012-10-17 # """ Parsing and writing of Protein Data Bank (PDB) files This module provides classes that represent PDB (Protein Data Bank) files and configurations contained in PDB files. It provides access to PDB files on two levels: low-level (line by line) and high-level (chains, residues, and atoms). Caution: The PDB file format has been heavily abused, and it is probably impossible to write code that can deal with all variants correctly. This modules tries to read the widest possible range of PDB files, but gives priority to a correct interpretation of the PDB format as defined by the Brookhaven National Laboratory. A special problem are atom names. The PDB file format specifies that the first two letters contain the right-justified chemical element name. A later modification allowed the initial space in hydrogen names to be replaced by a digit. Many programs ignore all this and treat the name as an arbitrary left-justified four-character name. This makes it difficult to extract the chemical element accurately; most programs write the '"CA"' for C_alpha in such a way that it actually stands for a calcium atom. For this reason a special element field has been added later, but only few files use it. In the absence of an element field, the code in this module attempts to guess the element using all information available. The low-level routines in this module do not try to deal with the atom name problem; they return and expect four-character atom names including spaces in the correct positions. The high-level routines use atom names without leading or trailing spaces, but provide and use the element field whenever possible. For output, they use the element field to place the atom name correctly, and for input, they construct the element field content from the atom name if no explicit element field is found in the file. Except where indicated, numerical values use the same units and conventions as specified in the PDB format description. Example:: >>>conf = Structure('example.pdb') >>>print conf >>>for residue in conf.residues: >>> for atom in residue: >>> print atom @undocumented: atom_format @undocumented: anisou_format @undocumented: conect_format @undocumented: ter_format @undocumented: model_format @undocumented: header_format @undocumented: cryst1_format @undocumented: scalen_format @undocumented: mtrixn_format @undocumented: generic_format @undocumented: export_filters @undocumented: DummyChain """ from Scientific.IO.TextFile import TextFile from Scientific.IO.FortranFormat import FortranFormat, FortranLine from Scientific.Geometry import Vector, Tensor from Scientific import N from PDBExportFilters import export_filters import copy, string # # Fortran formats for PDB entries # atom_format = FortranFormat('A6,I5,1X,A4,A1,A4,A1,I4,A1,3X,3F8.3,2F6.2,' + '6X,A4,2A2') anisou_format = FortranFormat('A6,I5,1X,A4,A1,A4,A1,I4,A1,1X,6I7,2X,A4,2A2') conect_format = FortranFormat('A6,11I5') ter_format = FortranFormat('A6,I5,6X,A4,A1,I4,A1') model_format = FortranFormat('A6,4X,I4') header_format = FortranFormat('A6,4X,A40,A9,3X,A4') cryst1_format = FortranFormat('A6,3F9.3,3F7.2,1X,A11,I4') scalen_format = FortranFormat('A6,4X,3F10.6,5X,F10.5') mtrixn_format = FortranFormat('A6,1X,I3,3F10.6,5X,F10.5,4X,I1') generic_format = FortranFormat('A6,A74') # # Amino acid and nucleic acid residues # amino_acids = ['ALA', 'ARG', 'ASN', 'ASP', 'CYS', 'CYX', 'GLN', 'GLU', 'GLY', 'HIS', 'HID', 'HIE', 'HIP', 'HSD', 'HSE', 'HSP', 'ILE', 'LEU', 'LYS', 'MET', 'PHE', 'PRO', 'SER', 'THR', 'TRP', 'TYR', 'VAL', 'ACE', 'NME', 'NHE'] nucleic_acids = [ 'A', 'C', 'G', 'I', 'T', 'U', '+A', '+C', '+G', '+I', '+T', '+U', 'RA', 'RC', 'RG', 'RU', 'DA', 'DC', 'DG', 'DT', 'RA5', 'RC5', 'RG5', 'RU5', 'DA5', 'DC5', 'DG5', 'DT5', 'RA3', 'RC3', 'RG3', 'RU3', 'DA3', 'DC3', 'DG3', 'DT3', 'RAN', 'RCN', 'RGN', 'RUN', 'DAN', 'DCN', 'DGN', 'DTN', ] def defineAminoAcidResidue(symbol): """ Make the parser recognize a particular residue type as an amino acid residue @param symbol: the three-letter code for an amino acid @type symbol: C{str} """ symbol = symbol.upper() if symbol not in amino_acids: amino_acids.append(symbol) def defineNucleicAcidResidue(symbol): """ Make the parser recognize a particular residue type as an nucleic acid residue @param symbol: the one-letter code for a nucleic acid @type symbol: C{str} """ symbol = symbol.upper() if symbol not in nucleic_acids: nucleic_acids.append(symbol) # # Low-level file object. It represents line contents as Python dictionaries. # For output, there are additional methods that generate sequence numbers # for everything. # class PDBFile: """ X{PDB} file with access at the record level The low-level file access is handled by the module L{Scientific.IO.TextFile}, therefore compressed files and URLs (for reading) can be used as well. """ def __init__(self, file_or_filename, mode = 'r', subformat = None): """ @param file_or_filename: the name of the PDB file, or a file object @type file_or_filename: C{str} or C{file} @param mode: the file access mode, 'r' (read) or 'w' (write) @type mode: C{str} @param subformat: indicates a specific dialect of the PDB format. Subformats are defined in L{Scientific.IO.PDBExportFilters}; they are used only when writing. @type subformat: C{str} or C{NoneType} """ if isinstance(file_or_filename, basestring): self.file = TextFile(file_or_filename, mode) else: self.file = file_or_filename self.output = mode[0].lower() == 'w' self.export_filter = None if subformat is not None: export = export_filters.get(subformat, None) if export is not None: self.export_filter = export() self.open = 1 if self.output: self.data = {'serial_number': 0, 'residue_number': 0, 'chain_id': '', 'segment_id': ''} self.het_flag = 0 self.chain_number = -1 def readLine(self): """ Return the contents of the next non-blank line (= record) The return value is a tuple whose first element (a string) contains the record type. For supported record types (HEADER, CRYST1, SCALEn, MTRIXn, ATOM, HETATM, ANISOU, TERM, MODEL, CONECT), the items from the remaining fields are put into a dictionary which is returned as the second tuple element. Most dictionary elements are strings or numbers; atom positions are returned as a vector, and anisotropic temperature factors are returned as a rank-2 tensor, already multiplied by 1.e-4. White space is stripped from all strings except for atom names, whose correct interpretation can depend on an initial space. For unsupported record types, the second tuple element is a string containing the remaining part of the record. @returns: the contents of one PDB record @rtype: C{tuple} """ while 1: line = self.file.readline() if not line: return ('END','') if line[-1] == '\n': line = line[:-1] line = line.strip() if line: break line = line.ljust(80) type = line[:6].strip() if type == 'ATOM' or type == 'HETATM': line = FortranLine(line, atom_format) data = {'serial_number': line[1], 'name': line[2], 'alternate': line[3].strip(), 'residue_name': line[4].strip(), 'chain_id': line[5].strip(), 'residue_number': line[6], 'insertion_code': line[7].strip(), 'position': Vector(line[8:11]), 'occupancy': line[11], 'temperature_factor': line[12], 'segment_id': line[13].strip(), 'element': line[14].strip(), 'charge': line[15].strip()} return type, data elif type == 'ANISOU': line = FortranLine(line, anisou_format) data = {'serial_number': line[1], 'name': line[2], 'alternate': line[3].strip(), 'residue_name': line[4].strip(), 'chain_id': line[5].strip(), 'residue_number': line[6], 'insertion_code': line[7].strip(), 'u': 1.e-4*Tensor([[line[8], line[11], line[12]], [line[11], line[9] , line[13]], [line[12], line[13], line[10]]]), 'segment_id': line[14].strip(), 'element': line[15].strip(), 'charge': line[16].strip()} return type, data elif type == 'TER': line = FortranLine(line, ter_format) data = {'serial_number': line[1], 'residue_name': line[2].strip(), 'chain_id': line[3].strip(), 'residue_number': line[4], 'insertion_code': line[5].strip()} return type, data elif type == 'CONECT': line = FortranLine(line, conect_format) data = {'serial_number': line[1], 'bonded': [i for i in line[2:6] if i > 0], 'hydrogen_bonded': [i for i in line[6:10] if i > 0], 'salt_bridged': [i for i in line[10:12] if i > 0]} return type, data elif type == 'MODEL': line = FortranLine(line, model_format) data = {'serial_number': line[1]} return type, data elif type == 'HEADER': line = FortranLine(line, header_format) data = {'compound': line[1], 'date': line[2], 'pdb_code': line[3]} return type, data elif type == 'CRYST1': line = FortranLine(line, cryst1_format) data = {'a': line[1], 'b': line[2], 'c': line[3], 'alpha': line[4], 'beta': line[5], 'gamma': line[6], 'space_group': line[7], 'z': line[8]} return type, data elif type[:-1] == 'SCALE': line = FortranLine(line, scalen_format) data = {'s1': line[1], 's2': line[2], 's3': line[3], 'u': line[4]} return type, data elif type[:-1] == 'MTRIX': line = FortranLine(line, mtrixn_format) data = {'serial': line[1], 'm1': line[2], 'm2': line[3], 'm3': line[4], 'v': line[5], 'given': line[6] == 1} return type, data else: return type, line[6:] def writeLine(self, type, data): """ Write a line using record type and data dictionary in the same format as returned by readLine(). Default values are provided for non-essential information, so the data dictionary need not contain all entries. @param type: PDB record type @type type: C{str} @param data: PDB record data @type data: C{tuple} """ if self.export_filter is not None: type, data = self.export_filter.processLine(type, data) if type is None: return line = [type] if type == 'ATOM' or type == 'HETATM': format = atom_format position = data['position'] line = line + [data.get('serial_number', 1), data.get('name'), data.get('alternate', ''), data.get('residue_name', '').rjust(3), data.get('chain_id', ''), data.get('residue_number', 1), data.get('insertion_code', ''), position[0], position[1], position[2], data.get('occupancy', 0.), data.get('temperature_factor', 0.), data.get('segment_id', ''), data.get('element', '').rjust(2), data.get('charge', '')] elif type == 'ANISOU': format = anisou_format u = 1.e4*data['u'] u = [int(u[0,0]), int(u[1,1]), int(u[2,2]), int(u[0,1]), int(u[0,2]), int(u[1,2])] line = line + [data.get('serial_number', 1), data.get('name'), data.get('alternate', ''), data.get('residue_name').rjust(3), data.get('chain_id', ''), data.get('residue_number', 1), data.get('insertion_code', '')] \ + u \ + [data.get('segment_id', ''), data.get('element', '').rjust(2), data.get('charge', '')] elif type == 'TER': format = ter_format line = line + [data.get('serial_number', 1), data.get('residue_name').rjust(3), data.get('chain_id', ''), data.get('residue_number', 1), data.get('insertion_code', '')] elif type == 'CONECT': format = conect_format line = line + [data.get('serial_number')] line = line + (data.get('bonded', [])+4*[None])[:4] line = line + (data.get('hydrogen_bonded', [])+4*[None])[:4] line = line + (data.get('salt_bridged', [])+2*[None])[:2] elif type == 'MODEL': format = model_format line = line + [data.get('serial_number')] elif type == 'CRYST1': format = cryst1_format line = line + [data.get('a'), data.get('b'), data.get('c'), data.get('alpha'), data.get('beta'), data.get('gamma'), data.get('space_group'), data.get('z')] elif type[:-1] == 'SCALE': format = scalen_format line = line + [data.get('s1'), data.get('s2'), data.get('s3'), data.get('u')] elif type[:-1] == 'MTRIX': format = scalen_format line = line + [data.get('serial'), data.get('m1'), data.get('m2'), data.get('m3'), data.get('v'), int(data.get('given'))] elif type == 'HEADER': format = header_format line = line + [data.get('compound', ''), data.get('date', ''), data.get('pdb_code')] else: format = generic_format line = line + [data] self.file.write(str(FortranLine(line, format)) + '\n') def writeComment(self, text): """ Write text into one or several comment lines. Each line of the text is prefixed with 'REMARK' and written to the file. @param text: the comment contents @type text: C{str} """ while text: eol = text.find('\n') if eol == -1: eol = len(text) self.file.write('REMARK %s \n' % text[:eol]) text = text[eol+1:] def writeAtom(self, name, position, occupancy=0.0, temperature_factor=0.0, element='', alternate=''): """ Write an ATOM or HETATM record using the information supplied. The residue and chain information is taken from the last calls to the methods L{nextResidue} and L{nextChain}. @param name: the atom name @type name: C{str} @param position: the atom position @type position: L{Scientific.Geometry.Vector} @param occupancy: the occupancy @type occupancy: C{float} @param temperature_factor: the temperature factor (B-factor) @type temperature_factor: C{float} @param element: the chemical element @type element: C{str} @param alternate: the alternate location character @type element: C{str} """ if self.het_flag: type = 'HETATM' else: type = 'ATOM' name = name.upper() if element != '' and len(element) == 1 and name and name[0] == element and len(name) < 4: name = ' ' + name self.data['name'] = name self.data['position'] = position self.data['serial_number'] = (self.data['serial_number'] + 1) % 100000 self.data['alternate'] = alternate self.data['occupancy'] = occupancy self.data['temperature_factor'] = temperature_factor self.data['element'] = element self.writeLine(type, self.data) def nextResidue(self, name, number = None, terminus = None): """ Signal the beginning of a new residue, starting with the next call to L{writeAtom}. @param name: the residue name @type name: C{str} @param number: the residue number. If C{None}, the residues will be numbered sequentially, starting from 1. @type number: C{int} or C{NoneType} @param terminus: C{None}, "C", or "N". This information is passed to export filters that can use this information in order to use different atom or residue names in terminal residues. """ name = name.upper() if self.export_filter is not None: name, number = self.export_filter.processResidue(name, number, terminus) self.het_flag = not (name in amino_acids or name in nucleic_acids) self.data['residue_name'] = name self.data['residue_number'] = (self.data['residue_number'] + 1) % 10000 self.data['insertion_code'] = '' if number is not None: if isinstance(number, int): if number >= 0: self.data['residue_number'] = number % 10000 else: self.data['residue_number'] = -((-number) % 1000) else: self.data['residue_number'] = number.number % 10000 self.data['insertion_code'] = number.insertion_code def nextChain(self, chain_id = None, segment_id = ''): """ Signal the beginning of a new chain. @param chain_id: a chain identifier. If C{None}, consecutive letters from the alphabet are used. @type chain_id: C{str} or C{NoneType} @param segment_id: a chain identifier @type segment_id: C{str} """ if chain_id is None: self.chain_number = (self.chain_number + 1) % len(self._chain_ids) chain_id = self._chain_ids[self.chain_number] if self.export_filter is not None: chain_id, segment_id = \ self.export_filter.processChain(chain_id, segment_id) self.data['chain_id'] = (chain_id+' ')[:1] self.data['segment_id'] = (segment_id+' ')[:4] self.data['residue_number'] = 0 _chain_ids = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' def terminateChain(self): """ Signal the end of a chain. """ if self.export_filter is not None: self.export_filter.terminateChain() self.data['serial_number'] = (self.data['serial_number'] + 1) % 100000 self.writeLine('TER', self.data) self.data['chain_id'] = '' self.data['segment_id'] = '' def close(self): """ Close the file. This method B{must} be called for write mode because otherwise the file will be incomplete. """ if self.open: if self.output: self.file.write('END\n') self.file.close() self.open = 0 def __del__(self): self.close() # # High-level object representation of PDB file contents. # # # Representation of objects. # class Atom: """ Atom in a PDB structure """ def __init__(self, name, position, **properties): """ @param name: the atom name @type name: C{str} @param position: the atom position @type position: L{Scientific.Geometry.Vector} @param properties: any other atom properties as keyword parameters. These properties are stored in the atom object and can be accessed by indexing, as for dictionaries. """ self.position = position self.properties = properties if self.properties.get('element', '') == '': if name[0] == ' ' or name[0] in string.digits: self.properties['element'] = name[1] elif name[1] in string.digits: self.properties['element'] = name[0] else: self.properties['element'] = name[0:2] self.name = name.strip() self.parent = None def __getitem__(self, item): """ @param item: the name of a property, including "name" or "position" @type item: C{str} @returns: the property value """ try: return self.properties[item] except KeyError: if item == 'name': return self.name elif item == 'position': return self.position else: raise KeyError("Undefined atom property: " + repr(item)) def __setitem__(self, item, value): """ @param item: the name of an existing or to be defined property @type item: C{str} @param value: the new value for the property """ self.properties[item] = value def __str__(self): return self.__class__.__name__ + ' ' + self.name + \ ' at ' + str(self.position) __repr__ = __str__ def type(self): """ @returns: the six-letter record type, ATOM or HETATM @rtype: C{str} """ return 'ATOM ' def writeToFile(self, file): """ Write an atom record to a file @param file: a PDB file object or a filename @type file: L{PDBFile} or C{str} """ close = 0 if type(file) == type(''): file = PDBFile(file, 'w') close = 1 file.writeAtom(self.name, self.position, self.properties.get('occupancy', 0.), self.properties.get('temperature_factor', 0.), self.properties.get('element', '')) if close: file.close() class HetAtom(Atom): """ HetAtom in a PDB structure A subclass of Atom, which differs only in the return value of the method type(). """ def type(self): return 'HETATM' class Group: """ Atom group (residue or molecule) in a PDB file This is an abstract base class. Instances can be created using one of the subclasses (L{Molecule}, L{AminoAcidResidue}, L{NucleotideResidue}). Group objects permit iteration over atoms with for-loops, as well as extraction of atoms by indexing with the atom name. """ def __init__(self, name, atoms = None, number = None): """ @param name: the name of the group @type name: C{str} @param atoms: a list of atoms (or C{None} for no atoms) @type atoms: C{list} or C{NoneType} @param number: the PDB residue number (or C{None}) @type number: C{int} or C{NoneType} """ self.name = name self.number = number self.atom_list = [] self.atoms = {} if atoms: self.atom_list = atoms for a in atoms: self.atoms[a.name] = a def __len__(self): return len(self.atom_list) def __getitem__(self, item): """ @param item: an integer index or an atom name @type item: C{int} or C{str} """ if isinstance(item, int): return self.atom_list[item] else: return self.atoms[item] def __str__(self): s = self.__class__.__name__ + ' ' + self.name + ':\n' for atom in self.atom_list: s = s + ' ' + `atom` + '\n' return s __repr__ = __str__ def isCompatible(self, residue_data): return residue_data['residue_name'] == self.name \ and residue_data['residue_number'] == self.number def addAtom(self, atom): """ Add an atom to the group @param atom: the atom @type atom: L{Atom} """ self.atom_list.append(atom) self.atoms[atom.name] = atom atom.parent = self def deleteAtom(self, atom): """ Remove an atom from the group @param atom: the atom to be removed @type atom: L{Atom} @raises KeyError: if the atom is not part of the group """ self.atom_list.remove(atom) del self.atoms[atom.name] atom.parent = None def deleteHydrogens(self): """ Remove all hydrogen atoms of the group """ delete = [] for a in self.atom_list: if a.name[0] == 'H' or (a.name[0] in string.digits and a.name[1] == 'H'): delete.append(a) for a in delete: self.deleteAtom(a) def changeName(self, name): """ Set the PDB residue name @param name: the new name @type name: C{str} """ self.name = name def writeToFile(self, file): """ Write the group to a file @param file: a PDBFile object or a file name @type file: L{PDBFile} or C{str} """ close = 0 if type(file) == type(''): file = PDBFile(file, 'w') close = 1 file.nextResidue(self.name, self.number, None) for a in self.atom_list: a.writeToFile(file) if close: file.close() class Molecule(Group): """ Molecule in a PDB file B{Note:} In PDB files, non-chain molecules are treated as residues, there is no separate molecule definition. This module defines every residue as a molecule that is not an amino acid residue or a nucleotide residue. """ pass class Residue(Group): pass class AminoAcidResidue(Residue): """ Amino acid residue in a PDB file """ is_amino_acid = 1 def isCTerminus(self): """ @returns: C{True} if the residue is in C-terminal configuration, i.e. if it has a second oxygen bound to the carbon atom of the peptide group. C{False} otherwise. @rtype: C{bool} """ return self.name == 'NME' \ or self.atoms.has_key('OXT') \ or self.atoms.has_key('OT2') def isNTerminus(self): """ @returns: C{True} if the residue is in N-terminal configuration, i.e. if it contains more than one hydrogen bound to be nitrogen atom of the peptide group. C{False} otherwise. @rtype: C{bool} """ return self.atoms.has_key('1HT') or self.atoms.has_key('2HT') \ or self.atoms.has_key('3HT') def addAtom(self, atom): Residue.addAtom(self, atom) if atom.name == 'CA': # Make sure it's not a calcium atom.properties['element'] = 'C' def writeToFile(self, file): close = 0 if type(file) == type(''): file = PDBFile(file, 'w') close = 1 terminus = None if self.isCTerminus(): terminus = 'C' if self.isNTerminus(): terminus = 'N' file.nextResidue(self.name, self.number, terminus) for a in self.atom_list: a.writeToFile(file) if close: file.close() class NucleotideResidue(Residue): """ Nucleotide residue in a PDB file """ is_nucleotide = 1 def __init__(self, name, atoms = None, number = None): self.pdbname = name name = name.strip() if name[0] != 'D' and name[0] != 'R': name = 'D' + name Residue.__init__(self, name, atoms, number) for a in atoms: if a.name == 'O2*' or a.name == "O2'": # Ribose self.name = 'R' + self.name[1:] def isCompatible(self, residue_data): return (residue_data['residue_name'] == self.name or residue_data['residue_name'] == self.pdbname) \ and residue_data['residue_number'] == self.number def addAtom(self, atom): Residue.addAtom(self, atom) if atom.name == 'O2*' or atom.name == "O2'": # Ribose self.name = 'R' + self.name[1:] def hasRibose(self): """ @returns: C{True} if the residue has an atom named O2* @rtype: C{bool} """ return self.atoms.has_key('O2*') or self.atoms.has_key("O2'") def hasDesoxyribose(self): """ @returns: C{True} if the residue has no atom named O2* @rtype: C{bool} """ return not self.hasRibose() def hasPhosphate(self): """ @returns: C{True} if the residue has a phosphate group @rtype: C{bool} """ return self.atoms.has_key('P') def hasTerminalH(self): """ @returns: C{True} if the residue has a 3-terminal H atom @rtype: C{bool} """ return self.atoms.has_key('H3T') def writeToFile(self, file): close = 0 if type(file) == type(''): file = PDBFile(file, 'w') close = 1 terminus = None if not self.hasPhosphate(): terminus = '5' file.nextResidue(self.name[1:], self.number, terminus) for a in self.atom_list: a.writeToFile(file) if close: file.close() class Chain: """Chain of PDB residues This is an abstract base class. Instances can be created using one of the subclasses (L{PeptideChain}, L{NucleotideChain}). Chain objects respond to len() and return their residues by indexing with integers. """ def __init__(self, residues = None, chain_id = None, segment_id = None): """ @param residues: a list of residue objects, or C{None} meaning that the chain is initially empty @type residues: C{list} or C{NoneType} @param chain_id: a one-letter chain identifier or C{None} @type chain_id: C{str} or C{NoneType} @param segment_id: a multi-character segment identifier or C{None} @type segment_id: C{str} or C{NoneType} """ if residues is None: self.residues = [] else: self.residues = residues self.chain_id = chain_id self.segment_id = segment_id def __len__(self): """ @returns: the number of residues in the chain @rtype: C{int} """ return len(self.residues) def sequence(self): """ @returns: the list of residue names @rtype: C{list} of C{str} """ return [r.name for r in self.residues] def __getitem__(self, index): """ @param index: an index into the chain @type index: C{int} @returns: the residue corresponding to the index @rtype: L{AminoAcidResidue} or L{NucleotideResidue} @raises IndexError: if index exceeds the chain length """ return self.residues[index] def __getslice__(self, i1, i2): """ @param i1: in index into the chain @type i1: C{int} @param i2: in index into the chain @type i12 C{int} @returns: the subchain from i1 to i2 @rtype: L{PeptideChain} or L{NucleotideChain} """ return self.__class__(self.residues[i1:i2]) def addResidue(self, residue): """ Add a residue at the end of the chain @param residue: the residue to be added @type residue: L{AminoAcidResidue} or L{NucleotideResidue} """ self.residues.append(residue) def removeResidues(self, first, last): """ Remove residues in a given index range. @param first: the index of the first residue to be removed @type first: C{int} @param last: the index of the first residue to be kept, or C{None} meaning remove everything to the end of the chain. @type last: C{int} or C{NoneType} """ if last is None: del self.residues[first:] else: del self.residues[first:last] def deleteHydrogens(self): """ Remove all hydrogen atoms in the chain """ for r in self.residues: r.deleteHydrogens() def writeToFile(self, file): """ Write the chain to a file @param file: a PDBFile object or a file name @type file: L{PDBFile} or C{str} """ close = 0 if type(file) == type(''): file = PDBFile(file, 'w') close = 1 file.nextChain(self.chain_id, self.segment_id) for r in self.residues: r.writeToFile(file) file.terminateChain() if close: file.close() class PeptideChain(Chain): """ Peptide chain in a PDB file """ def isTerminated(self): """ @returns: C{True} if the last residue is in C-terminal configuration @rtype: C{bool} """ return self.residues and self.residues[-1].isCTerminus() def isCompatible(self, chain_data, residue_data): return chain_data['chain_id'] == self.chain_id and \ chain_data['segment_id'] == self.segment_id and \ residue_data['residue_name'] in amino_acids class NucleotideChain(Chain): """ Nucleotide chain in a PDB file """ def isTerminated(self): """ @returns: C{True} if the last residue is in 3-terminal configuration @rtype: C{bool} @note: There is no way to perform this test with standard PDB files. The algorithm used works for certain non-standard files only. """ return self.residues and \ (self.residues[-1].name[-1] == '3' or self.residues[-1].hasTerminalH()) def isCompatible(self, chain_data, residue_data): return chain_data['chain_id'] == self.chain_id and \ chain_data['segment_id'] == self.segment_id and \ residue_data['residue_name'] in nucleic_acids class DummyChain(Chain): def __init__(self, structure, chain_id, segment_id): self.structure = structure self.chain_id = chain_id self.segment_id = segment_id def isTerminated(self): return 0 def addResidue(self, residue): self.structure.addMolecule(residue) def isCompatible(self, chain_data, residue_data): return chain_data['chain_id'] == self.chain_id and \ chain_data['segment_id'] == self.segment_id and \ residue_data['residue_name'] not in amino_acids and \ residue_data['residue_name'] not in nucleic_acids # # Residue number class for dealing with insertion codes # class ResidueNumber: """ PDB residue number Most PDB residue numbers are simple integers, but when insertion codes are used a number can consist of an integer plus a letter. Such compound residue numbers are represented by this class. """ def __init__(self, number, insertion_code): """ @param number: the numeric part of the residue number @type number: C{int} @param insertion_code: the letter part of the residue number @type insertion_code: C{str} """ self.number = number self.insertion_code = insertion_code def __cmp__(self, other): if isinstance(other, int): if self.number == other: return 1 else: return cmp(self.number, other) if self.number == other.number: return cmp(self.insertion_code, other.insertion_code) else: return cmp(self.number, other.number) def __str__(self): return str(self.number) + self.insertion_code __repr__ = __str__ # # The configuration class. # class Structure: """ A high-level representation of the contents of a PDB file The components of a structure can be accessed in several ways ('s' is an instance of this class): - 's.residues' is a list of all PDB residues, in the order in which they occurred in the file. - 's.peptide_chains' is a list of PeptideChain objects, containing all peptide chains in the file in their original order. - 's.nucleotide_chains' is a list of NucleotideChain objects, containing all nucleotide chains in the file in their original order. - 's.molecules' is a list of all PDB residues that are neither amino acid residues nor nucleotide residues, in their original order. - 's.objects' is a list of all high-level objects (peptide chains, nucleotide chains, and molecules) in their original order. - 's.to_fractional' is the transformation from real-space coordinates to fractional coordinates, as read from the SCALEn records. - 's.from_fractional' is the transformation from fractional coordinates to real-space coordinates, the inverse of s.to_fractional. - 's.ncs_transformations' is a list of transformations that describe non-crystallographic symmetries, as read from the MTRIXn records. - if a CRYST1 record exists, 's.a', 's.b', 's.c', 's.alpha', 's.beta', 's.gamma' are the parameters of the unit cell and 's.space_group' is a string indicating the space group. If no CRYST1 record exists, all those values are None. Furthermore, 's.cs_transformations' is a list of transformations that describe crystallographic symmetries. If no CRYST1 record exists, the list is empty. An iteration over a Structure instance by a for-loop is equivalent to an iteration over the residue list. """ def __init__(self, file_or_filename, model = 0, alternate_code = 'A'): """ @param file_or_filename: the name of the PDB file, or a file object. Compressed files and URLs are accepted, as for class L{PDBFile}. @type file_or_filename: C{str} or C{file} @param model: the number of the model to read from a multiple-model file. Only one model can be treated at a time. @type model: C{int} @param alternate_code: the version of the positions to be read from a file with alternate positions. @type alternate_code: single-letter C{str} """ if isinstance(file_or_filename, basestring): self.filename = file_or_filename else: self.filename = '' self.model = model self.alternate = alternate_code self.pdb_code = '' self.residues = [] self.objects = [] self.peptide_chains = [] self.nucleotide_chains = [] self.molecules = {} self.to_fractional = self.from_fractional = None self.ncs_transformations = [] self.cs_transformations = [] self.a = self.b = self.c = None self.alpha = self.beta = self.gamma = None self.space_group = None self.parseFile(PDBFile(file_or_filename)) self.findSpaceGroupTransformations() peptide_chain_constructor = PeptideChain nucleotide_chain_constructor = NucleotideChain molecule_constructor = Molecule def __len__(self): return len(self.residues) def __getitem__(self, item): return self.residues[item] def deleteHydrogens(self): """ Remove all hydrogen atoms """ for r in self.residues: r.deleteHydrogens() def splitPeptideChain(self, number, position): """ Split a peptide chain into two chains The two chain fragments remain adjacent in the peptide chain list, i.e. the numbers of all following chains increase by one. @param number: the number of the peptide chain to be split @type number: C{int} @param position: the residue index at which the chain is split. @type position: C{int} """ self._splitChain(self.peptide_chain_constructor, self.peptide_chains, number, position) def splitNucleotideChain(self, number, position): """ Split a nucleotide chain into two chains The two chain fragments remain adjacent in the nucleotide chain list, i.e. the numbers of all following chains increase by one. @param number: the number of the nucleotide chain to be split @type number: C{int} @param position: the residue index at which the chain is split. @type position: C{int} """ self._splitChain(self.nucleotide_chain_constructor, self.nucleotide_chains, number, position) def _splitChain(self, constructor, chain_list, number, position): chain = chain_list[number] part1 = constructor(chain.residues[:position], chain.chain_id, chain.segment_id) part2 = constructor(chain.residues[position:]) chain_list[number:number+1] = [part1, part2] index = self.objects.index(chain) self.objects[index:index+1] = [part1, part2] def joinPeptideChains(self, first, second): """ Join two peptide chains into a single one. The new chain occupies the position of the first chain, the second one is removed from the peptide chain list. @param first: the number of the first chain @type first: C{int} @param second: the number of the second chain @type second: C{int} """ self._joinChains(self.peptide_chain_constructor, self.peptide_chains, first, second) def joinNucleotideChains(self, first, second): """ Join two nucleotide chains into a single one. The new chain occupies the position of the first chain, the second one is removed from the nucleotide chain list. @param first: the number of the first chain @type first: C{int} @param second: the number of the second chain @type second: C{int} """ self._joinChains(self.nucleotide_chain_constructor, self.nucleotide_chains, first, second) def _joinChains(self, constructor, chain_list, first, second): chain1 = chain_list[first] chain2 = chain_list[second] total = constructor(chain1.residues+chain2.residues, chain1.chain_id, chain1.segment_id) chain_list[first] = total del chain_list[second] index = self.objects.index(chain1) self.objects[index] = total index = self.objects.index(chain2) del self.objects[index] def addMolecule(self, molecule): try: molecule_list = self.molecules[molecule.name] except KeyError: molecule_list = [] self.molecules[molecule.name] = molecule_list molecule_list.append(molecule) self.objects.append(molecule) def deleteResidue(self, residue): self.residues.remove(residue) delete = None for type, mlist in self.molecules.items(): try: mlist.remove(residue) except ValueError: pass if len(mlist) == 0: delete = type if delete is not None: del self.molecules[delete] delete = None for chain in self.peptide_chains + self.nucleotide_chains: try: chain.residues.remove(residue) except ValueError: pass if len(chain.residues) == 0: delete = chain if delete is not None: try: self.peptide_chains.remove(chain) except ValueError: pass try: self.nucleotide_chains.remove(chain) except ValueError: pass try: self.objects.remove(residue) except ValueError: pass def extractData(self, data): atom_data = {} for name in ['serial_number', 'name', 'position', 'occupancy', 'temperature_factor']: atom_data[name] = data[name] for name in ['alternate', 'charge']: value = data[name] if value: atom_data[name] = value element = data['element'] if element != '': try: int(element) except ValueError: atom_data['element'] = element residue_data = {'residue_name': data['residue_name']} number = data['residue_number'] insertion = data['insertion_code'] if insertion == '': residue_data['residue_number'] = number else: residue_data['residue_number'] = ResidueNumber(number, insertion) chain_data = {} for name in ['chain_id', 'segment_id']: chain_data[name] = data[name] if chain_data['segment_id'] == self.pdb_code: chain_data['segment_id'] = '' return atom_data, residue_data, chain_data def newResidue(self, residue_data): name = residue_data['residue_name'] residue_number = residue_data['residue_number'] if name in amino_acids: residue = AminoAcidResidue(name, [], residue_number) elif name in nucleic_acids: residue = NucleotideResidue(name, [], residue_number) else: residue = self.molecule_constructor(name, [], residue_number) self.residues.append(residue) return residue def newChain(self, residue, chain_data): if hasattr(residue, 'is_amino_acid'): chain = self.peptide_chain_constructor([], chain_data['chain_id'], chain_data['segment_id']) self.peptide_chains.append(chain) self.objects.append(chain) elif hasattr(residue, 'is_nucleotide'): chain = self.nucleotide_chain_constructor([], chain_data['chain_id'], chain_data['segment_id']) self.nucleotide_chains.append(chain) self.objects.append(chain) else: chain = DummyChain(self, chain_data['chain_id'], chain_data['segment_id']) return chain def parseFile(self, file): atom = None residue = None chain = None read = self.model == 0 while 1: type, data = file.readLine() if type == 'END': break elif type == 'HEADER': self.pdb_code = data['pdb_code'] elif type == 'CRYST1': for name, value in data.items(): setattr(self, name, value) self.space_group = self.space_group.strip() elif type[:-1] == 'SCALE': if not hasattr(self, '_scale_matrix'): self._scale_matrix = {} self._scale_matrix[type[-1]] = data if type[-1] == '3': # last line read from Scientific.Geometry.Transformation \ import Shear, Translation l1 = self._scale_matrix['1'] l2 = self._scale_matrix['2'] l3 = self._scale_matrix['3'] s = N.array([[l1['s1'], l1['s2'], l1['s3']], [l2['s1'], l2['s2'], l2['s3']], [l3['s1'], l3['s2'], l3['s3']]]) u = Vector(l1['u'], l2['u'], l3['u']) self.to_fractional = Translation(u)*Shear(s) self.from_fractional = self.to_fractional.inverse() del self._scale_matrix elif type[:-1] == 'MTRIX': if not hasattr(self, '_ncs_matrix'): self._ncs_matrix = {} self._ncs_matrix[type[-1]] = data if type[-1] == '3': # last line read from Scientific.Geometry.Transformation \ import Rotation, Translation l1 = self._ncs_matrix['1'] l2 = self._ncs_matrix['2'] l3 = self._ncs_matrix['3'] m = N.array([[l1['m1'], l1['m2'], l1['m3']], [l2['m1'], l2['m2'], l2['m3']], [l3['m1'], l3['m2'], l3['m3']]]) v = Vector(l1['v'], l2['v'], l3['v']) tr = Translation(v)*Rotation(Tensor(m)) tr.given = data['given'] tr.serial = data['serial'] self.ncs_transformations.append(tr) del self._ncs_matrix elif type == 'MODEL': read = data['serial_number'] == self.model if self.model == 0 and len(self.residues) == 0: read = 1 elif type == 'ENDMDL': read = 0 elif read: if type == 'ATOM' or type == 'HETATM': alt = data['alternate'] if alt == '' or alt == self.alternate: atom_data, residue_data, chain_data = \ self.extractData(data) if type == 'ATOM': atom = apply(Atom, (), atom_data) else: atom = apply(HetAtom, (), atom_data) new_chain = chain is None or \ not chain.isCompatible(chain_data, residue_data) new_residue = new_chain or residue is None \ or not residue.isCompatible(residue_data) if new_residue and chain is not None and \ chain.isTerminated(): new_chain = 1 if new_residue: residue = self.newResidue(residue_data) if new_chain: chain = self.newChain(residue, chain_data) chain.addResidue(residue) residue.addAtom(atom) elif type == 'ANISOU': alt = data['alternate'] if alt == '' or alt == self.alternate: if atom is None: raise ValueError("ANISOU record before " + "ATOM record") atom['u'] = data['u'] elif type == 'TERM': if chain is None: raise ValueError("TERM record before chain") chain = None def findSpaceGroupTransformations(self): if self.space_group is not None and self.to_fractional is not None: from Scientific.IO.PDBSpaceGroups import \ getSpaceGroupTransformations try: trs = getSpaceGroupTransformations(self.space_group) except KeyError: return for tr in trs: tr = self.from_fractional*tr*self.to_fractional self.cs_transformations.append(tr) def renumberAtoms(self): """ Renumber all atoms sequentially starting with 1 """ n = 0 for residue in self.residues: for atom in residue: atom['serial_number'] = n n = n + 1 def __repr__(self): s = self.__class__.__name__ + "(" + repr(self.filename) if self.model != 0: s = s + ", model=" + repr(self.model) if self.alternate != 'A': s = s + ", alternate_code = " + repr(self.alternate) s = s + "):\n" for name, list in [("Peptide", self.peptide_chains), ("Nucleotide", self.nucleotide_chains)]: for c in list: s = s + " " + name + " chain " if c.segment_id: s = s + c.segment_id + " " elif c.chain_id: s = s + c.chain_id + " " s = s + "of length " + repr(len(c)) + "\n" for name, list in self.molecules.items(): s = s + " " + repr(len(list)) + " " + name + " molecule" if len(list) == 1: s = s + "\n" else: s = s + "s\n" return s def writeToFile(self, file): """ Write everything to a file @param file: a PDB file object or a filename @type file: L{PDBFile} or C{str} """ close = 0 if type(file) == type(''): file = PDBFile(file, 'w') close = 1 for o in self.objects: o.writeToFile(file) if close: file.close() if __name__ == '__main__': if 0: file = PDBFile('~/3lzt.pdb') copy = PDBFile('test.pdb', 'w', 'xplor') while 1: type, data = file.readLine() if type == 'END': break copy.writeLine(type, data) copy.close() if 1: s = Structure('~/Programs/MMTK/main/MMTK/Database/PDB/insulin.pdb') print s ScientificPython-2.9.4/Scientific/IO/PDBExportFilters.py0000644000076600000240000000150511501734230023516 0ustar hinsenstaff00000000000000# Export filters for PDB output. # # # A convenient base class... # class PDBExportFilter: def processLine(self, type, data): return type, data def processResidue(self, name, number, terminus): return name, number def processChain(self, chain_id, segment_id): return chain_id, segment_id def terminateChain(self): pass # # XPlor export filter import string class XPlorExportFilter(PDBExportFilter): xplor_atom_names = {' OXT': 'OT2'} def processLine(self, type, data): if type == 'TER': return None, data if type == 'ATOM' or type == 'HETATM' or type == 'ANISOU': name = self.xplor_atom_names.get(data['name'], data['name']) data['name'] = name return type, data export_filters = {'xplor': XPlorExportFilter} ScientificPython-2.9.4/Scientific/IO/PDBSpaceGroups.py0000644000076600000240000037462411501734231023157 0ustar hinsenstaff00000000000000# This module has been generated automatically from space group information # obtained from the Computational Crystallography Toolbox # from Scientific.Geometry import Vector, Tensor from Scientific.Geometry.Transformation import Rotation, Translation from Scientific import N class SpaceGroup(object): def __init__(self, number, labels, transformations): self.number = number self.labels = labels self.transformations = [] for rot, trans in transformations: self.transformations.append(Translation(trans)*Rotation(Tensor(rot))) _space_group_table = {} def getSpaceGroupTransformations(space_group_label_or_number): try: return _space_group_table[space_group_label_or_number].transformations except KeyError: pass space_group_label = ''.join(space_group_label_or_number.split()) return _space_group_table[space_group_label].transformations transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(1, ['C1^1', '1', 'P 1', 'P1'], transformations) _space_group_table[1] = sg _space_group_table['C1^1'] = sg _space_group_table['1'] = sg _space_group_table['P 1'] = sg _space_group_table['P1'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(3, ['C2^1', 'P 2y', 'P121', 'P2:b', '3:b', 'C2^1', 'P 2', 'P112', 'P2:c', '3:c', 'C2^1', 'P 2x', 'P211', 'P2:a', '3:a'], transformations) _space_group_table[3] = sg _space_group_table['C2^1'] = sg _space_group_table['P 2y'] = sg _space_group_table['P121'] = sg _space_group_table['P2:b'] = sg _space_group_table['3:b'] = sg _space_group_table['C2^1'] = sg _space_group_table['P 2'] = sg _space_group_table['P112'] = sg _space_group_table['P2:c'] = sg _space_group_table['3:c'] = sg _space_group_table['C2^1'] = sg _space_group_table['P 2x'] = sg _space_group_table['P211'] = sg _space_group_table['P2:a'] = sg _space_group_table['3:a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,0.) transformations.append((rot, trans)) sg = SpaceGroup(4, ['C2^2', 'P 2yb', 'P1211', 'P21:b', '4:b', 'C2^2', 'P 2c', 'P1121', 'P21:c', '4:c', 'C2^2', 'P 2xa', 'P2111', 'P21:a', '4:a'], transformations) _space_group_table[4] = sg _space_group_table['C2^2'] = sg _space_group_table['P 2yb'] = sg _space_group_table['P1211'] = sg _space_group_table['P21:b'] = sg _space_group_table['4:b'] = sg _space_group_table['C2^2'] = sg _space_group_table['P 2c'] = sg _space_group_table['P1121'] = sg _space_group_table['P21:c'] = sg _space_group_table['4:c'] = sg _space_group_table['C2^2'] = sg _space_group_table['P 2xa'] = sg _space_group_table['P2111'] = sg _space_group_table['P21:a'] = sg _space_group_table['4:a'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) sg = SpaceGroup(5, ['C2^3', 'C 2y', 'C121', 'C2:b1', '5:b1', 'C2^3', 'A 2y', 'A121', 'C2:b2', '5:b2', 'C2^3', 'I 2y', 'I121', 'C2:b3', '5:b3', 'C2^3', 'A 2', 'A112', 'C2:c1', '5:c1', 'C2^3', 'B 2', 'B2', 'B112', 'C2:c2', '5:c2', 'C2^3', 'I 2', 'I112', 'C2:c3', '5:c3', 'C2^3', 'B 2x', 'B211', 'C2:a1', '5:a1', 'C2^3', 'C 2x', 'C211', 'C2:a2', '5:a2', 'C2^3', 'I 2x', 'I211', 'C2:a3', '5:a3'], transformations) _space_group_table[5] = sg _space_group_table['C2^3'] = sg _space_group_table['C 2y'] = sg _space_group_table['C121'] = sg _space_group_table['C2:b1'] = sg _space_group_table['5:b1'] = sg _space_group_table['C2^3'] = sg _space_group_table['A 2y'] = sg _space_group_table['A121'] = sg _space_group_table['C2:b2'] = sg _space_group_table['5:b2'] = sg _space_group_table['C2^3'] = sg _space_group_table['I 2y'] = sg _space_group_table['I121'] = sg _space_group_table['C2:b3'] = sg _space_group_table['5:b3'] = sg _space_group_table['C2^3'] = sg _space_group_table['A 2'] = sg _space_group_table['A112'] = sg _space_group_table['C2:c1'] = sg _space_group_table['5:c1'] = sg _space_group_table['C2^3'] = sg _space_group_table['B 2'] = sg _space_group_table['B2'] = sg _space_group_table['B112'] = sg _space_group_table['C2:c2'] = sg _space_group_table['5:c2'] = sg _space_group_table['C2^3'] = sg _space_group_table['I 2'] = sg _space_group_table['I112'] = sg _space_group_table['C2:c3'] = sg _space_group_table['5:c3'] = sg _space_group_table['C2^3'] = sg _space_group_table['B 2x'] = sg _space_group_table['B211'] = sg _space_group_table['C2:a1'] = sg _space_group_table['5:a1'] = sg _space_group_table['C2^3'] = sg _space_group_table['C 2x'] = sg _space_group_table['C211'] = sg _space_group_table['C2:a2'] = sg _space_group_table['5:a2'] = sg _space_group_table['C2^3'] = sg _space_group_table['I 2x'] = sg _space_group_table['I211'] = sg _space_group_table['C2:a3'] = sg _space_group_table['5:a3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(16, ['D2^1', '16', 'P 2 2', 'P222'], transformations) _space_group_table[16] = sg _space_group_table['D2^1'] = sg _space_group_table['16'] = sg _space_group_table['P 2 2'] = sg _space_group_table['P222'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(17, ['D2^2', '17', 'P 2c 2', 'P2221', 'D2^2', 'P 2a 2a', 'P2122', '17:cab', 'D2^2', 'P 2 2b', 'P2212', '17:bca'], transformations) _space_group_table[17] = sg _space_group_table['D2^2'] = sg _space_group_table['17'] = sg _space_group_table['P 2c 2'] = sg _space_group_table['P2221'] = sg _space_group_table['D2^2'] = sg _space_group_table['P 2a 2a'] = sg _space_group_table['P2122'] = sg _space_group_table['17:cab'] = sg _space_group_table['D2^2'] = sg _space_group_table['P 2 2b'] = sg _space_group_table['P2212'] = sg _space_group_table['17:bca'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(18, ['D2^3', '18', 'P 2 2ab', 'P21212', 'D2^3', 'P 2bc 2', 'P22121', '18:cab', 'D2^3', 'P 2ac 2ac', 'P21221', '18:bca'], transformations) _space_group_table[18] = sg _space_group_table['D2^3'] = sg _space_group_table['18'] = sg _space_group_table['P 2 2ab'] = sg _space_group_table['P21212'] = sg _space_group_table['D2^3'] = sg _space_group_table['P 2bc 2'] = sg _space_group_table['P22121'] = sg _space_group_table['18:cab'] = sg _space_group_table['D2^3'] = sg _space_group_table['P 2ac 2ac'] = sg _space_group_table['P21221'] = sg _space_group_table['18:bca'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(19, ['D2^4', '19', 'P 2ac 2ab', 'P212121'], transformations) _space_group_table[19] = sg _space_group_table['D2^4'] = sg _space_group_table['19'] = sg _space_group_table['P 2ac 2ab'] = sg _space_group_table['P212121'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(20, ['D2^5', '20', 'C 2c 2', 'C2221', 'D2^5', 'A 2a 2a', 'A2122', '20:cab', 'D2^5', 'B 2 2b', 'B2212', '20:bca'], transformations) _space_group_table[20] = sg _space_group_table['D2^5'] = sg _space_group_table['20'] = sg _space_group_table['C 2c 2'] = sg _space_group_table['C2221'] = sg _space_group_table['D2^5'] = sg _space_group_table['A 2a 2a'] = sg _space_group_table['A2122'] = sg _space_group_table['20:cab'] = sg _space_group_table['D2^5'] = sg _space_group_table['B 2 2b'] = sg _space_group_table['B2212'] = sg _space_group_table['20:bca'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) sg = SpaceGroup(21, ['D2^6', '21', 'C 2 2', 'C222', 'D2^6', 'A 2 2', 'A222', '21:cab', 'D2^6', 'B 2 2', 'B222', '21:bca'], transformations) _space_group_table[21] = sg _space_group_table['D2^6'] = sg _space_group_table['21'] = sg _space_group_table['C 2 2'] = sg _space_group_table['C222'] = sg _space_group_table['D2^6'] = sg _space_group_table['A 2 2'] = sg _space_group_table['A222'] = sg _space_group_table['21:cab'] = sg _space_group_table['D2^6'] = sg _space_group_table['B 2 2'] = sg _space_group_table['B222'] = sg _space_group_table['21:bca'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) sg = SpaceGroup(22, ['D2^7', '22', 'F 2 2', 'F222'], transformations) _space_group_table[22] = sg _space_group_table['D2^7'] = sg _space_group_table['22'] = sg _space_group_table['F 2 2'] = sg _space_group_table['F222'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(23, ['D2^8', '23', 'I 2 2', 'I222'], transformations) _space_group_table[23] = sg _space_group_table['D2^8'] = sg _space_group_table['23'] = sg _space_group_table['I 2 2'] = sg _space_group_table['I222'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(24, ['D2^9', '24', 'I 2b 2c', 'I212121'], transformations) _space_group_table[24] = sg _space_group_table['D2^9'] = sg _space_group_table['24'] = sg _space_group_table['I 2b 2c'] = sg _space_group_table['I212121'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(75, ['C4^1', '75', 'P 4', 'P4'], transformations) _space_group_table[75] = sg _space_group_table['C4^1'] = sg _space_group_table['75'] = sg _space_group_table['P 4'] = sg _space_group_table['P4'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(76, ['C4^2', '76', 'P 4w', 'P41'], transformations) _space_group_table[76] = sg _space_group_table['C4^2'] = sg _space_group_table['76'] = sg _space_group_table['P 4w'] = sg _space_group_table['P41'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(77, ['C4^3', '77', 'P 4c', 'P42'], transformations) _space_group_table[77] = sg _space_group_table['C4^3'] = sg _space_group_table['77'] = sg _space_group_table['P 4c'] = sg _space_group_table['P42'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,3./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(78, ['C4^4', '78', 'P 4cw', 'P43'], transformations) _space_group_table[78] = sg _space_group_table['C4^4'] = sg _space_group_table['78'] = sg _space_group_table['P 4cw'] = sg _space_group_table['P43'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(79, ['C4^5', '79', 'I 4', 'I4'], transformations) _space_group_table[79] = sg _space_group_table['C4^5'] = sg _space_group_table['79'] = sg _space_group_table['I 4'] = sg _space_group_table['I4'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,3./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1.,1./2.,5./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1.,1./2.,5./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(80, ['C4^6', '80', 'I 4bw', 'I41'], transformations) _space_group_table[80] = sg _space_group_table['C4^6'] = sg _space_group_table['80'] = sg _space_group_table['I 4bw'] = sg _space_group_table['I41'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(89, ['D4^1', '89', 'P 4 2', 'P422'], transformations) _space_group_table[89] = sg _space_group_table['D4^1'] = sg _space_group_table['89'] = sg _space_group_table['P 4 2'] = sg _space_group_table['P422'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(90, ['D4^2', '90', 'P 4ab 2ab', 'P4212'], transformations) _space_group_table[90] = sg _space_group_table['D4^2'] = sg _space_group_table['90'] = sg _space_group_table['P 4ab 2ab'] = sg _space_group_table['P4212'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,3./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,3./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./4.) transformations.append((rot, trans)) sg = SpaceGroup(91, ['D4^3', '91', 'P 4w 2c', 'P4122'], transformations) _space_group_table[91] = sg _space_group_table['D4^3'] = sg _space_group_table['91'] = sg _space_group_table['P 4w 2c'] = sg _space_group_table['P4122'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,3./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(92, ['D4^4', '92', 'P 4abw 2nw', 'P41212'], transformations) _space_group_table[92] = sg _space_group_table['D4^4'] = sg _space_group_table['92'] = sg _space_group_table['P 4abw 2nw'] = sg _space_group_table['P41212'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(93, ['D4^5', '93', 'P 4c 2', 'P4222'], transformations) _space_group_table[93] = sg _space_group_table['D4^5'] = sg _space_group_table['93'] = sg _space_group_table['P 4c 2'] = sg _space_group_table['P4222'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(94, ['D4^6', '94', 'P 4n 2n', 'P42212'], transformations) _space_group_table[94] = sg _space_group_table['D4^6'] = sg _space_group_table['94'] = sg _space_group_table['P 4n 2n'] = sg _space_group_table['P42212'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,3./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,3./4.) transformations.append((rot, trans)) sg = SpaceGroup(95, ['D4^7', '95', 'P 4cw 2c', 'P4322'], transformations) _space_group_table[95] = sg _space_group_table['D4^7'] = sg _space_group_table['95'] = sg _space_group_table['P 4cw 2c'] = sg _space_group_table['P4322'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,3./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(96, ['D4^8', '96', 'P 4nw 2abw', 'P43212'], transformations) _space_group_table[96] = sg _space_group_table['D4^8'] = sg _space_group_table['96'] = sg _space_group_table['P 4nw 2abw'] = sg _space_group_table['P43212'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(97, ['D4^9', '97', 'I 4 2', 'I422'], transformations) _space_group_table[97] = sg _space_group_table['D4^9'] = sg _space_group_table['97'] = sg _space_group_table['I 4 2'] = sg _space_group_table['I422'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,3./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,3./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1.,1./2.,5./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1.,1./2.,5./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1.,1./2.,5./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1.,1./2.,5./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(98, ['D4^10', '98', 'I 4bw 2bw', 'I4122'], transformations) _space_group_table[98] = sg _space_group_table['D4^10'] = sg _space_group_table['98'] = sg _space_group_table['I 4bw 2bw'] = sg _space_group_table['I4122'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(143, ['C3^1', '143', 'P 3', 'P3'], transformations) _space_group_table[143] = sg _space_group_table['C3^1'] = sg _space_group_table['143'] = sg _space_group_table['P 3'] = sg _space_group_table['P3'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) sg = SpaceGroup(144, ['C3^2', '144', 'P 31', 'P31'], transformations) _space_group_table[144] = sg _space_group_table['C3^2'] = sg _space_group_table['144'] = sg _space_group_table['P 31'] = sg _space_group_table['P31'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) sg = SpaceGroup(145, ['C3^3', '145', 'P 32', 'P32'], transformations) _space_group_table[145] = sg _space_group_table['C3^3'] = sg _space_group_table['145'] = sg _space_group_table['P 32'] = sg _space_group_table['P32'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./3.,2./3.,2./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./3.,2./3.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./3.,2./3.,2./3.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(2./3.,1./3.,1./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(2./3.,1./3.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(2./3.,1./3.,1./3.) transformations.append((rot, trans)) sg = SpaceGroup(146, ['C3^4', 'R 3', 'H 3', 'R3:H', '146:H', 'C3^4', 'P 3*', 'R3:R', '146:R'], transformations) _space_group_table[146] = sg _space_group_table['C3^4'] = sg _space_group_table['R 3'] = sg _space_group_table['H 3'] = sg _space_group_table['R3:H'] = sg _space_group_table['146:H'] = sg _space_group_table['C3^4'] = sg _space_group_table['P 3*'] = sg _space_group_table['R3:R'] = sg _space_group_table['146:R'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(149, ['D3^1', '149', 'P 3 2', 'P312'], transformations) _space_group_table[149] = sg _space_group_table['D3^1'] = sg _space_group_table['149'] = sg _space_group_table['P 3 2'] = sg _space_group_table['P312'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(150, ['D3^2', '150', 'P 3 2"', 'P321'], transformations) _space_group_table[150] = sg _space_group_table['D3^2'] = sg _space_group_table['150'] = sg _space_group_table['P 3 2"'] = sg _space_group_table['P321'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(151, ['D3^3', '151', 'P 31 2c (0 0 1)', 'P3112'], transformations) _space_group_table[151] = sg _space_group_table['D3^3'] = sg _space_group_table['151'] = sg _space_group_table['P 31 2c (0 0 1)'] = sg _space_group_table['P3112'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(152, ['D3^4', '152', 'P 31 2"', 'P3121'], transformations) _space_group_table[152] = sg _space_group_table['D3^4'] = sg _space_group_table['152'] = sg _space_group_table['P 31 2"'] = sg _space_group_table['P3121'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(153, ['D3^5', '153', 'P 32 2c (0 0 -1)', 'P3212'], transformations) _space_group_table[153] = sg _space_group_table['D3^5'] = sg _space_group_table['153'] = sg _space_group_table['P 32 2c (0 0 -1)'] = sg _space_group_table['P3212'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(154, ['D3^6', '154', 'P 32 2"', 'P3221'], transformations) _space_group_table[154] = sg _space_group_table['D3^6'] = sg _space_group_table['154'] = sg _space_group_table['P 32 2"'] = sg _space_group_table['P3221'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./3.,2./3.,2./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./3.,2./3.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./3.,2./3.,2./3.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./3.,2./3.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./3.,2./3.,2./3.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./3.,2./3.,2./3.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(2./3.,1./3.,1./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(2./3.,1./3.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(2./3.,1./3.,1./3.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(2./3.,1./3.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(2./3.,1./3.,1./3.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(2./3.,1./3.,1./3.) transformations.append((rot, trans)) sg = SpaceGroup(155, ['D3^7', 'R 3 2', 'H 3 2', 'R32:H', '155:H', 'D3^7', 'P 3* 2', 'R32:R', '155:R'], transformations) _space_group_table[155] = sg _space_group_table['D3^7'] = sg _space_group_table['R 3 2'] = sg _space_group_table['H 3 2'] = sg _space_group_table['R32:H'] = sg _space_group_table['155:H'] = sg _space_group_table['D3^7'] = sg _space_group_table['P 3* 2'] = sg _space_group_table['R32:R'] = sg _space_group_table['155:R'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(168, ['C6^1', '168', 'P 6', 'P6'], transformations) _space_group_table[168] = sg _space_group_table['C6^1'] = sg _space_group_table['168'] = sg _space_group_table['P 6'] = sg _space_group_table['P6'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./6.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,5./6.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(169, ['C6^2', '169', 'P 61', 'P61'], transformations) _space_group_table[169] = sg _space_group_table['C6^2'] = sg _space_group_table['169'] = sg _space_group_table['P 61'] = sg _space_group_table['P61'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,5./6.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./6.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(170, ['C6^3', '170', 'P 65', 'P65'], transformations) _space_group_table[170] = sg _space_group_table['C6^3'] = sg _space_group_table['170'] = sg _space_group_table['P 65'] = sg _space_group_table['P65'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(171, ['C6^4', '171', 'P 62', 'P62'], transformations) _space_group_table[171] = sg _space_group_table['C6^4'] = sg _space_group_table['171'] = sg _space_group_table['P 62'] = sg _space_group_table['P62'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(172, ['C6^5', '172', 'P 64', 'P64'], transformations) _space_group_table[172] = sg _space_group_table['C6^5'] = sg _space_group_table['172'] = sg _space_group_table['P 64'] = sg _space_group_table['P64'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(173, ['C6^6', '173', 'P 6c', 'P63'], transformations) _space_group_table[173] = sg _space_group_table['C6^6'] = sg _space_group_table['173'] = sg _space_group_table['P 6c'] = sg _space_group_table['P63'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(177, ['D6^1', '177', 'P 6 2', 'P622'], transformations) _space_group_table[177] = sg _space_group_table['D6^1'] = sg _space_group_table['177'] = sg _space_group_table['P 6 2'] = sg _space_group_table['P622'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./6.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,5./6.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,5./6.) transformations.append((rot, trans)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./6.) transformations.append((rot, trans)) sg = SpaceGroup(178, ['D6^2', '178', 'P 61 2 (0 0 -1)', 'P6122'], transformations) _space_group_table[178] = sg _space_group_table['D6^2'] = sg _space_group_table['178'] = sg _space_group_table['P 61 2 (0 0 -1)'] = sg _space_group_table['P6122'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,5./6.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./6.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./6.) transformations.append((rot, trans)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,5./6.) transformations.append((rot, trans)) sg = SpaceGroup(179, ['D6^3', '179', 'P 65 2 (0 0 1)', 'P6522'], transformations) _space_group_table[179] = sg _space_group_table['D6^3'] = sg _space_group_table['179'] = sg _space_group_table['P 65 2 (0 0 1)'] = sg _space_group_table['P6522'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) sg = SpaceGroup(180, ['D6^4', '180', 'P 62 2c (0 0 1)', 'P6222'], transformations) _space_group_table[180] = sg _space_group_table['D6^4'] = sg _space_group_table['180'] = sg _space_group_table['P 62 2c (0 0 1)'] = sg _space_group_table['P6222'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./3.) transformations.append((rot, trans)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,2./3.) transformations.append((rot, trans)) sg = SpaceGroup(181, ['D6^5', '181', 'P 64 2c (0 0 01)', 'P6422'], transformations) _space_group_table[181] = sg _space_group_table['D6^5'] = sg _space_group_table['181'] = sg _space_group_table['P 64 2c (0 0 01)'] = sg _space_group_table['P6422'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,1,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,1,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(182, ['D6^6', '182', 'P 6c 2c', 'P6322'], transformations) _space_group_table[182] = sg _space_group_table['D6^6'] = sg _space_group_table['182'] = sg _space_group_table['P 6c 2c'] = sg _space_group_table['P6322'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(195, ['T^1', '195', 'P 2 2 3', 'P23'], transformations) _space_group_table[195] = sg _space_group_table['T^1'] = sg _space_group_table['195'] = sg _space_group_table['P 2 2 3'] = sg _space_group_table['P23'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) sg = SpaceGroup(196, ['T^2', '196', 'F 2 2 3', 'F23'], transformations) _space_group_table[196] = sg _space_group_table['T^2'] = sg _space_group_table['196'] = sg _space_group_table['F 2 2 3'] = sg _space_group_table['F23'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(197, ['T^3', '197', 'I 2 2 3', 'I23'], transformations) _space_group_table[197] = sg _space_group_table['T^3'] = sg _space_group_table['197'] = sg _space_group_table['I 2 2 3'] = sg _space_group_table['I23'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(198, ['T^4', '198', 'P 2ac 2ab 3', 'P213'], transformations) _space_group_table[198] = sg _space_group_table['T^4'] = sg _space_group_table['198'] = sg _space_group_table['P 2ac 2ab 3'] = sg _space_group_table['P213'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(199, ['T^5', '199', 'I 2b 2c 3', 'I213'], transformations) _space_group_table[199] = sg _space_group_table['T^5'] = sg _space_group_table['199'] = sg _space_group_table['I 2b 2c 3'] = sg _space_group_table['I213'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) sg = SpaceGroup(207, ['O^1', '207', 'P 4 2 3', 'P432'], transformations) _space_group_table[207] = sg _space_group_table['O^1'] = sg _space_group_table['207'] = sg _space_group_table['P 4 2 3'] = sg _space_group_table['P432'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(208, ['O^2', '208', 'P 4n 2 3', 'P4232'], transformations) _space_group_table[208] = sg _space_group_table['O^2'] = sg _space_group_table['208'] = sg _space_group_table['P 4n 2 3'] = sg _space_group_table['P4232'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) sg = SpaceGroup(209, ['O^3', '209', 'F 4 2 3', 'F432'], transformations) _space_group_table[209] = sg _space_group_table['O^3'] = sg _space_group_table['209'] = sg _space_group_table['F 4 2 3'] = sg _space_group_table['F432'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) sg = SpaceGroup(210, ['O^4', '210', 'F 4d 2 3', 'F4132'], transformations) _space_group_table[210] = sg _space_group_table['O^4'] = sg _space_group_table['210'] = sg _space_group_table['F 4d 2 3'] = sg _space_group_table['F4132'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) sg = SpaceGroup(211, ['O^5', '211', 'I 4 2 3', 'I432'], transformations) _space_group_table[211] = sg _space_group_table['O^5'] = sg _space_group_table['211'] = sg _space_group_table['I 4 2 3'] = sg _space_group_table['I432'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) sg = SpaceGroup(212, ['O^6', '212', 'P 4acd 2ab 3', 'P4332'], transformations) _space_group_table[212] = sg _space_group_table['O^6'] = sg _space_group_table['212'] = sg _space_group_table['P 4acd 2ab 3'] = sg _space_group_table['P4332'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(3./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,3./4.) transformations.append((rot, trans)) sg = SpaceGroup(213, ['O^7', '213', 'P 4bd 2ab 3', 'P4132'], transformations) _space_group_table[213] = sg _space_group_table['O^7'] = sg _space_group_table['213'] = sg _space_group_table['P 4bd 2ab 3'] = sg _space_group_table['P4132'] = sg transformations = [] rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(0.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,0.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(0.,0.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,0.,0.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(0.,1./2.,0.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(1./4.,3./4.,1./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./4.,1./4.,1./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,-1,0,1,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,5./4.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,0,1,0,-1,0]) rot.shape = (3, 3) trans = Vector(3./4.,5./4.,5./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,5./4.,5./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,5./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(3./4.,5./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,1,0,-1,0,0,0,0,1]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,5./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,-1,1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,1,-1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1.) transformations.append((rot, trans)) rot = N.array([0,-1,0,0,0,1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,-1,0,0,0,1,0]) rot.shape = (3, 3) trans = Vector(1./2.,1.,1./2.) transformations.append((rot, trans)) rot = N.array([0,0,-1,1,0,0,0,-1,0]) rot.shape = (3, 3) trans = Vector(1.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,0,0,-1,-1,0,0]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1.) transformations.append((rot, trans)) rot = N.array([1,0,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1./2.,1./2.,1.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,1,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(1.,1./2.,1./2.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,-1,0,0,0,1]) rot.shape = (3, 3) trans = Vector(1./2.,1.,1./2.) transformations.append((rot, trans)) rot = N.array([0,1,0,1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(3./4.,5./4.,5./4.) transformations.append((rot, trans)) rot = N.array([0,-1,0,-1,0,0,0,0,-1]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([0,0,1,0,-1,0,1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,5./4.) transformations.append((rot, trans)) rot = N.array([0,0,-1,0,-1,0,-1,0,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,1,0,1,0]) rot.shape = (3, 3) trans = Vector(3./4.,5./4.,3./4.) transformations.append((rot, trans)) rot = N.array([-1,0,0,0,0,-1,0,-1,0]) rot.shape = (3, 3) trans = Vector(3./4.,3./4.,3./4.) transformations.append((rot, trans)) sg = SpaceGroup(214, ['O^8', '214', 'I 4bd 2c 3', 'I4132'], transformations) _space_group_table[214] = sg _space_group_table['O^8'] = sg _space_group_table['214'] = sg _space_group_table['I 4bd 2c 3'] = sg _space_group_table['I4132'] = sg del transformations del rot del trans ScientificPython-2.9.4/Scientific/IO/TextFile.py0000644000076600000240000001134011761113137022105 0ustar hinsenstaff00000000000000# Text files with automatic (un)compression and URL access. # # Written by: Konrad Hinsen # Last revision: 2012-5-29 # """ Text files with line iteration and transparent compression """ import os, string, sys # Use the gzip module for Python version 1.5.2 or higher gzip = None try: _version = map(string.atoi, string.split(string.split(sys.version)[0], '.')) if _version >= [1, 5, 2]: try: import gzip except ImportError: gzip = None except: pass class TextFile: """ Text files with line iteration and transparent compression TextFile instances can be used like normal file objects (i.e. by calling read(), readline(), readlines(), and write()), but can also be used as sequences of lines in for-loops. TextFile objects also handle compression transparently. i.e. it is possible to read lines from a compressed text file as if it were not compressed. Compression is deduced from the file name suffixes '.Z' (compress/uncompress), '.gz' (gzip/gunzip), and '.bz2' (bzip2). Finally, TextFile objects accept file names that start with '~' or '~user' to indicate a home directory, as well as URLs (for reading only). """ def __init__(self, filename, mode = 'r'): """ @param filename: file name or URL @type filename: C{str} @param mode: file access mode: 'r' (read), 'w' (write), or 'a' (append) @type mode: C{str} """ self.file = None if string.find(filename, ':/') > 1: # URL if mode != 'r': raise IOError("can't write to a URL") import urllib self.file = urllib.urlopen(filename) else: filename = os.path.expanduser(filename) if mode == 'r': if not os.path.exists(filename): raise IOError((2, 'No such file or directory: ' + filename)) if filename[-2:] == '.Z': self.file = os.popen("uncompress -c " + filename, mode) elif filename[-3:] == '.gz': if gzip is None: self.file = os.popen("gunzip -c " + filename, mode) else: self.file = gzip.GzipFile(filename, 'rb') elif filename[-4:] == '.bz2': self.file = os.popen("bzip2 -dc " + filename, mode) else: try: self.file = open(filename, mode) except IOError, details: if type(details) == type(()): details = details + (filename,) raise IOError(details) elif mode == 'w': if filename[-2:] == '.Z': self.file = os.popen("compress > " + filename, mode) elif filename[-3:] == '.gz': if gzip is None: self.file = os.popen("gzip > " + filename, mode) else: self.file = gzip.GzipFile(filename, 'wb') elif filename[-4:] == '.bz2': self.file = os.popen("bzip2 > " + filename, mode) else: try: self.file = open(filename, mode) except IOError, details: if type(details) == type(()): details = details + (filename,) raise IOError(details) elif mode == 'a': if filename[-2:] == '.Z': raise IOError((0, "Can't append to .Z files")) elif filename[-3:] == '.gz': if gzip is None: self.file = os.popen("gzip >> " + filename, "w") else: self.file = gzip.GzipFile(filename, 'ab') else: self.file = open(filename, mode) else: raise IOError((0, 'Illegal mode: ' + repr(mode))) def __del__(self): if self.file is not None: self.close() def __getitem__(self, item): line = self.file.readline() if not line: raise IndexError return line def read(self, size=-1): return self.file.read(size) def readline(self): return self.file.readline() def readlines(self): return self.file.readlines() def write(self, data): self.file.write(data) def writelines(self, list): for line in list: self.file.write(line) def close(self): self.file.close() def flush(self): self.file.flush() ScientificPython-2.9.4/Scientific/LA.py0000644000076600000240000000036412233714043020350 0ustar hinsenstaff00000000000000# This package exists for compatibility with previous releases # of ScientificPython that supported both NumPy and the old # Numeric package. Please don't use it in new code, use numpy # directly. from numpy.oldnumeric.linear_algebra import * ScientificPython-2.9.4/Scientific/Mathematica.py0000644000076600000240000001431611501734163022275 0ustar hinsenstaff00000000000000# Interface to Mathematica for plotting # # Written by Konrad Hinsen # last revision: 2006-11-23 # # Note: I haven't bee using this for ages. Perhaps it doesn't work with # current Mathematica versions any more. # import Scientific.N as Numeric import os, string, tempfile # Class representing a Mathematica process class Mathematica: def __init__(self, progname = 'math'): self.progname = progname self.script = '' self.font = "Courier" self.textsize = 10 def clear(self): self.script = '' def execute(self): scriptfile = tempfile.mktemp() file = open(scriptfile, 'w') file.write(self.script) file.write('Quit\n') file.close() #os.system('cat ' + scriptfile) #commandline = self.progname + (' -run \'<<"%s"\'' % scriptfile) commandline = self.progname + ' < ' + scriptfile + ' >/dev/null 2>&1' os.system(commandline) os.unlink(scriptfile) def command(self, command): self.script = self.script + command def backup(self, n): self.script = self.script[:-n] def defineVariable(self, name, array): self.command(name + ' = ') self.command(formatValue(array)) self.command('\n') def setFont(self, font, size): self.font = font self.textsize = size def displayOptions(self): s = 'DefaultFont->{"' + self.font + '",' + \ formatValue(self.textsize) + '}' return s def plot(self, data, display = 1): s = 'graph = Show[' i = 0 for dataset in data: s = s + 'ListPlot[' + formatValue(dataset) + \ ', PlotJoined->True, DisplayFunction->Identity, ' + \ 'PlotRange->All, PlotStyle->' + self.dash[i] + ', ' + \ self.displayOptions() + '], ' i = (i + 1) % len(self.dash) if display: s = s + 'DisplayFunction->$DisplayFunction]\n' else: s = s + 'DisplayFunction->Identity]\n' self.command(s) dash = ['Dashing[{0.1,0.0}]', 'Dashing[{0.03, 0.015}]', 'Dashing[{0.03, 0.03}]', 'Dashing[{0.015, 0.015}]', 'Dashing[{0.03, 0.015, 0.015, 0.015}]', 'Dashing[{0.015, 0.015}]', 'Dashing[{0.015, 0.03}]'] def contourPlot(self, xaxis, yaxis, data, contours=None, display=1): s = 'graph = Show[ContourGraphics[' \ + formatValue(Numeric.transpose(data)) \ + ', MeshRange->' \ + formatValue([[xaxis[0], xaxis[-1]], [yaxis[0], yaxis[-1]]]) \ + ', ContourShading->False' if contours is not None: s = s + ', Contours->' + formatValue(contours) s = s + ', ' + self.displayOptions() + '],' if display: s = s + 'DisplayFunction->$DisplayFunction]\n' else: s = s + 'DisplayFunction->Identity]\n' self.command(s) def surfacePlot(self, xaxis, yaxis, data, display=1): s = 'graph = Show[ListPlot3D[' \ + formatValue(Numeric.transpose(data)) \ + ', MeshRange->' \ + formatValue([[xaxis[0], xaxis[-1]], [yaxis[0], yaxis[-1]]]) s = s + ', ' + self.displayOptions() + '],' if display: s = s + 'DisplayFunction->$DisplayFunction]\n' else: s = s + 'DisplayFunction->Identity]\n' self.command(s) def printGraph(self, filename): self.command('Display["' + filename + '", graph, "EPS"]\n') # Format scalars, arrays, and nested lists for Mathematica def formatValue(x): is_sequence = 1 try: x[0] except: is_sequence = 0 if is_sequence: s = '{' for e in x: s = s + formatValue(e) + ', ' s = s[:-2] + '}' else: if type(x) == type(''): s = '"' + x + '"' elif type(x) == type(0): s = `x` elif type(x) == type(0.): s = string.replace(`x`, 'e','*10^') elif type(x) == type(0.j): s = '(' + string.replace(`x.real`, 'e','*10^') + \ '+' + string.replace(`x.imag`, 'e','*10^') + 'I)' else: raise TypeError('Unknown type ' + `type(x)`) return s # Simple plot functions def _output(m, options): if options.has_key('file'): m.printGraph(options['file']) m.execute() else: filename = tempfile.mktemp('.eps') m.printGraph(filename) m.execute() if os.fork() == 0: commandline = 'gv ' + filename + ' >/dev/null 2>&1' os.system(commandline) os.unlink(filename) os._exit(0) def plot(*data, **options): m = Mathematica() m.plot(data, display=0) _output(m, options) def contourPlot(xaxis, yaxis, data, contours=None, **options): m = Mathematica() m.contourPlot(xaxis, yaxis, data, contours, display=0) _output(m, options) def surfacePlot(xaxis, yaxis, data, **options): m = Mathematica() m.surfacePlot(xaxis, yaxis, data, display=0) _output(m, options) def multiplePlots(data, **options): m = Mathematica() i = 0 lines = [] for line in data: columns = [] for item in line: if type(item) != type(()): item = (item, ) name = 'plot'+`i` m.command(name + ' = ') m.plot(item, 0) columns.append(name) i = i + 1 lines.append(columns) m.command('\ngraph = Show[GraphicsArray[{') for line in lines: m.command('{') for item in line: m.command(item + ', ') m.backup(2) m.command('}, ') m.backup(2) m.command('}], Displayfunction->$DisplayFunction]\n') if options.has_key('file'): m.printGraph(options['file']) m.execute() # These examples are all the documentation you will get! if __name__ == '__main__': from Scientific.N import arange, sin, NewAxis # data1 = [4,6,5,3] # data2 = [4,6,5,3] # multiplePlots([[data1], [data2]]) # plot([4,6,5,3], file = 'junk.ps') # plot([(3,6.8),(4,4.2),(5,0.5)], [4,6,5,3]) x = arange(10) y = arange(15) data = x[:, NewAxis]*sin(y/2.) #contourPlot(x, y, data, arange(0.,10.,0.1)) surfacePlot(x, y, data) ScientificPython-2.9.4/Scientific/MPI/0000755000076600000240000000000012270505005020121 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/MPI/__init__.py0000644000076600000240000000106211501734231022232 0ustar hinsenstaff00000000000000from core import * from core import _C_API import sys if sys.modules.has_key('epydoc'): import core, types core_name = core.__name__ from core import __doc__ for name in dir(core): object = getattr(core, name) if type(object) == types.ClassType: setattr(object, '__module__', 'Scientific.MPI') elif type(object) == types.FunctionType: object.func_globals['__name__'] = 'Scientific.MPI' core.__name__ = core_name del core del core_name del object del name del types del sys ScientificPython-2.9.4/Scientific/MPI/core.py0000644000076600000240000004357612267720456021461 0ustar hinsenstaff00000000000000# The MPI Interface is written in C; this module only contains documentation # and imports objects from the C module. # # Written by Konrad Hinsen # and Jakob Schiotz # last revision: 2006-11-23 # """ Python interface to the Message Passing Interface (MPI) This module contains a Python interface to the Message Passing Interface (MPI), and standardized library for message-passing parallel computing. Please read an introduction to MPI before using this module; some terms in the documentation do not make much sense unless you understand the principles of MPI. This module contains an object, 'world', which represents the default communicator in MPI. This communicator can be used directly for sending and receiving data, or other communicators can be derived from it. A number of global constants are also defined (L{max}, L{min}, L{prod}, L{sum}, L{land}, L{lor}, L{lxor}, L{band}, L{bor}, L{bxor}, L{maxloc}), and L{minloc}). They are used to specify the desired operator in calls to the 'reduce' and 'allreduce' methods of the communicator objects. @undocumented: core* """ class MPIError(EnvironmentError): """ MPI call failed """ pass import sys if sys.modules.has_key('epydoc'): # Fake code just for the docstrings! class MPICommunicator: """ MPI Communicator There is no constructor for MPI Communicator objects. The default communicator is given by Scientific.MPI.world, and other communicators can only be created by methods on an existing communicator object. A communicator object has two read-only attributes: 'rank' is an integer which indicates the rank of the current process in the communicator, and 'size' is an integer equal to the number of processes that participate in the communicator. """ def duplicate(self): """ @returns: a new communicator with the same properties as the original one @rtype: L{MPICommunicator} """ pass def subset(self, ranks): """ Create a communicator for a subset of the processes The method should be called by all processes simultaneously. The return value will be the new communicator on those processes listed in C{ranks} and C{None} for the rest. @param ranks: a list of ranks, one for each process that should belong to the new communicator @type ranks: C{list} of C{int} @returns: a new communicator containing a subset of the processes participating in the original one """ pass def send(self, data, destination, tag): """ Send data to another process (blocking) @param data: the data to be sent @type data: C{str} or C{Numeric.array}. Array arguments must have contiguous storage. General object arrays are not allowed. @param destination: the rank of the destination process @type destination: C{int} @param tag: Identifier @type tag: C{int} """ pass def nonblockingSend(self, data, destination, tag): """ Send data to another process (non-blocking) @param data: the data to be sent @type data: C{str} or C{Numeric.array}. Array arguments must have contiguous storage. General object arrays are not allowed. @param destination: the rank of the destination process @type destination: C{int} @param tag: Identifier @type tag: C{int} @returns: MPI request object (used to wait for completion) @rtype: L{MPIRequest} """ pass def receive(self, data, source=None, tag=None): """ Receive data from another process (blocking) @param data: either a contiguous array object, or a one-letter typecode (in practice, one would use Numeric.Int, Numeric.Float, etc.). If an array, the data is copied to the array, whic must have the right shape. If a typecode, an array of that type is created and used as the buffer for incoming data. @type data: C{Numeric.array} or C{str} @param source: the rank of the process from which data is accepted. C{None} means data is accepted from any process. @type source: C{int} or C{NoneType} @param tag: Identifier that acts as a filter; only messages with a matching tag are received. A value of C{None} means that any tag will match. @type tag: C{int} or C{NoneType} @returns: a tuple containing four elements: the array containing the data, the source process rank (an C{int}), the message tag (an C{int}), and the number of elements that were received (an C{int}). @rtype: C{tuple} """ pass def receiveString(self, source=None, tag=None): """ Receive string data from another process (blocking) @param source: the rank of the process from which data is accepted. C{None} means data is accepted from any process. @type source: C{int} or C{NoneType} @param tag: Identifier that acts as a filter; only messages with a matching tag are received. A value of C{None} means that any tag will match. @type tag: C{int} or C{NoneType} @returns: a tuple containing three elements: the string containing the data, the source process rank (an C{int}), the message tag (an C{int}). @rtype: C{tuple} """ pass def nonblockingReceive(self, data, source=None, tag=None): """ Receive data from another process (non-blocking) @param data: a contiguous array object to which the incoming data is copied. It must have the right shape. @type data: C{Numeric.array} @param source: the rank of the process from which data is accepted. C{None} means data is accepted from any process. @type source: C{int} or C{NoneType} @param tag: Identifier that acts as a filter; only messages with a matching tag are received. A value of C{None} means that any tag will match. @type tag: C{int} or C{NoneType} @returns: MPI request object (used to wait for completion and obtain the received data) @rtype: L{MPIRequest} """ pass def nonblockingProbe(self, source=None, tag=None): """ Check for incoming messages @param source: the rank of the process from which messages are accepted. C{None} means data is accepted from any process. @type source: C{int} or C{NoneType} @param tag: Identifier that acts as a filter; only messages with a matching tag are considered. A value of C{None} means that any tag will match. @type tag: C{int} or C{NoneType} @returns: C{None} if no messages are available, otherwise a tuple containing the source rank and the tag @rtype: C{NoneType} or C{tuple} """ pass def broadcast(self, array, root): """ Send data to all processes @param array: an array containing the data to be sent on the sending process and serving as a buffer for the incoming data on all processes. The shape and type of the array must be the same on all processes. @type array: Numeric.array @param root: the rank of the sending process @type root: C{int} @note: The data is sent to all processes, including the sending one. """ pass def share(self, send, receive): """ Distribute data from each processpr to all other processesors @param send: an array of identical shape and type on all processes. It contains on each process the data that is sent. @type send: C{Numeric.array} @param receive: an array whose type is the same as for the send array and which has an additional dimension (the first one) whose length is the number of processes. After the call, the value of receive[i] is equal to the contents of the array send in process i. @type receive: C{Numeric.array} """ pass def barrier(self): """ Wait until all processes in the communicator have called the same method, then all processes continue. """ pass def abort(self, error_code): """ Abort all processes associated with the communicator. For emergency use only. @param error_code: error code passed back to the calling program (usually a shell) under most Unix implementations of MPI @type error_code: C{int} """ pass def reduce(self, sendbuffer, receivebuffer, operation, root): """ Combine data from all processes and send result to one @param sendbuffer: an array holding the data that each process contributes @type sendbuffer: C{Numeric.array} @param receivebuffer: an array acting as a buffer for the result of the reduction. Used only by the process whose rank is root @type receivebuffer: C{Numeric.array} @param operation: one of the operation objects: L{max}, L{min}, L{prod}, L{sum}, L{land}, L{lor}, L{lxor}, L{band}, L{bor}, L{bxor}, L{maxloc} and L{minloc} @type operation: MPIOperationObject @param root: the rank of the process that received the result @type root: C{int} """ pass def allreduce(self, sendbuffer, receivebuffer, operation): """ Combine data from all processes and send result to all @param sendbuffer: an array holding the data that each process contributes @type sendbuffer: C{Numeric.array} @param receivebuffer: an array acting as a buffer for the result of the reduction @type receivebuffer: C{Numeric.array} @param operation: one of the operation objects: L{max}, L{min}, L{prod}, L{sum}, L{land}, L{lor}, L{lxor}, L{band}, L{bor}, L{bxor}, L{maxloc} and L{minloc} @type operation: MPIOperationObject """ pass class MPIRequest: """ MPI Request There is no constructor for MPI Request objects. They are returned by nonblocking send and receives, and are used to query the status of the message. """ def wait(self): """ Wait till the communication has completed. If the operation was a nonblocking send, there is no return value. If the operation was a nonblocking receive, the return value is a tuple containing four elements: the array containing the data, the source process rank (an integer), the message tag (an integer), and the number of elements that were received (an integer). """ pass def test(self): """ Test if communications have completed. If the operation was a nonblocking send, it returns 0 if the operation has not completed, and 1 if it has. If the operation was a nonblocking receive, 0 is returned if the operation was not completed, and a tuple containing four elements if it was completed. The four elements are: the array containing the data, the source process rank (an integer), the message tag (an integer), and the number of elements that were received (an integer). Once a test has been successful (i.e. the operation has completed), it is no longer possible to call wait() or test() on the MPI Request object. """ pass world = MPICommunicator() world.rank = 0 world.size = 1 if 1: class MPIOperationObject: pass class max(MPIOperationObject): """The 'maximum' operation in reduce/allreduce communications.""" pass class min(MPIOperationObject): """The 'minimum' operation in reduce/allreduce communications.""" pass class prod(MPIOperationObject): """The 'product' operation in reduce/allreduce communications.""" pass class sum(MPIOperationObject): """The 'sum' operation in reduce/allreduce communications.""" pass class land(MPIOperationObject): """The 'logical and' operation in reduce/allreduce communications.""" pass class lor(MPIOperationObject): """The 'logical or' operation in reduce/allreduce communications.""" pass class lxor(MPIOperationObject): """The 'logical exclusive-or' operation.""" pass class band(MPIOperationObject): """The 'bitwise and' operation in reduce/allreduce communications.""" pass class bor(MPIOperationObject): """The 'bitwise or' operation in reduce/allreduce communications.""" pass class bxor(MPIOperationObject): """The 'bitwise exclusive-or' operation.""" pass class maxloc(MPIOperationObject): """The 'location of the maximum' operation.""" pass class minloc(MPIOperationObject): """The 'location of the minimum' operation.""" pass class replace(MPIOperationObject): """The 'replace' operation. (MPI 2.0)""" pass _C_API = None else: try: from Scientific_mpi import * from Scientific_mpi import _C_API, _registerErrorObject _registerErrorObject(MPIError) del _registerErrorObject except ImportError: import Scientific.N as Numeric _C_API = None class DummyCommunicator: def __init__(self): self.size = 1 self.rank = 0 self.messages = [] def duplicate(self): return DummyCommunicator() def send(self, data, destination, tag): if destination != 0: raise MPIError("invalid MPI destination") self.messages.append((tag, Numeric.array(data, copy=1).ravel())) def nonblockingSend(self, data, destination, tag): self.send(data, destination, tag) return DummyRequest(None) def receive(self, array, source=None, tag=None): if source != 0 and source != None: raise MPIError("invalid MPI source") for i in range(len(self.messages)): data_tag, data = self.messages[i] if tag is None or tag == data_tag: del self.messages[i] return data, 0, data_tag, len(data) raise MPIError("no message received") def receiveString(self, source=None, tag=None): array, source, tag, length = self.receive(source, tag) return array.tostring(), source, tag def nonblockingReceive(self, array, source=None, tag=None): return DummyRequest(self.receive(array, source, tag)) def nonblockingProbe(self, source=None, tag=None): if source != 0 and source != None: raise MPIError, "invalid MPI source" for i in range(len(self.messages)): data_tag, data = self.messages[i] if tag is None or tag == data_tag: return 0, data_tag return None def broadcast(self, array, root): if root != 0: raise MPIError("invalid MPI rank") return array def share(self, send, receive): receive[0] = send def barrier(self): pass def abort(self): raise MPIError("abort") class DummyRequest: def __init__(self, arg): self.arg = arg def wait(self): return self.arg world = DummyCommunicator() del sys ScientificPython-2.9.4/Scientific/MPI/IO.py0000644000076600000240000000560011501734231021004 0ustar hinsenstaff00000000000000# Coordinated I/O for parallel systems # # Written by Konrad Hinsen # last revision: 2006-6-23 # """ I/O utilities for use with MPI programs """ class LogFile: """ File for logging events from all processes The purpose of LogFile objects is to collect short text output from all processors into a single file. All processes can write whatever they want at any time; the date is simply stored locally. After the file has been closed by all processes, the data is sent to process 0, which then writes everything to one text file, neatly separated by process rank number. Note that due to the intermediate storage of the data, LogFile objects should not be used for large amounts of data. Also note that all data is lost if a process crashes before closing the file. """ def __init__(self, filename, communicator = None): """ @param filename: the name of the log file @type filename: C{str} @param communicator: the communicator in which the file is accessible. The default value of C{None} means to use the global world communicator, i.e. all possible processes. @type communicator: L{Scientific.MPI.MPICommunicator} """ self.filename = filename if communicator is None: from Scientific.MPI import world self.communicator = world else: self.communicator = communicator self.data = '' self.first_chunk = 1 def write(self, string): """ Write a string to the file @param string: the string data @type string: C{str} """ self.data = self.data + string def flush(self): """ Write buffered data to the text file """ if self.communicator.rank == 0: if self.filename is None: import sys file = sys.stdout else: if self.first_chunk: file = open(self.filename, 'w') else: file = open(self.filename, 'a') if not self.first_chunk: file.write(75*'='+'\n') file.write("Rank 0:\n\n") file.write(self.data) file.write("\n\n") for i in range(1, self.communicator.size): file.write("Rank %d:\n\n" % i) data = self.communicator.receiveString(i, 0)[0] file.write(data) file.write("\n\n") if self.filename is not None: file.close() else: self.communicator.send(self.data, 0, 0) self.data = '' self.first_chunk = 0 def close(self): """ Close the file, causing the real text file to be written """ self.flush() ScientificPython-2.9.4/Scientific/N.py0000644000076600000240000000063512236150554020256 0ustar hinsenstaff00000000000000# This package exists for compatibility with previous releases # of ScientificPython that supported both NumPy and the old # Numeric package. Please don't use it in new code, use numpy # directly. from numpy.oldnumeric import * def int_sum(a, axis=0): return add.reduce(a, axis) def zeros_st(shape, other): return zeros(shape, dtype=other.dtype) from numpy import ndarray as array_type package = "NumPy" ScientificPython-2.9.4/Scientific/NRNG.py0000644000076600000240000000035112233714025020614 0ustar hinsenstaff00000000000000# This package exists for compatibility with previous releases # of ScientificPython that supported both NumPy and the old # Numeric package. Please don't use it in new code, use numpy # directly. from numpy.oldnumeric.rng import * ScientificPython-2.9.4/Scientific/NumberDict.py0000644000076600000240000000354612132557055022123 0ustar hinsenstaff00000000000000# Dictionary containing numbers # # These objects are meant to be used like arrays with generalized # indices. Non-existent elements default to zero. Global operations # are addition, subtraction, and multiplication/division by a scalar. # # Written by Konrad Hinsen # last revision: 2006-10-16 # """ Dictionary storing numerical values """ class NumberDict(dict): """ Dictionary storing numerical values Constructor: NumberDict() An instance of this class acts like an array of number with generalized (non-integer) indices. A value of zero is assumed for undefined entries. NumberDict instances support addition, and subtraction with other NumberDict instances, and multiplication and division by scalars. """ def __getitem__(self, item): try: return dict.__getitem__(self, item) except KeyError: return 0 def __coerce__(self, other): if type(other) == type({}): other = NumberDict(other) return self, other def __add__(self, other): sum_dict = NumberDict() for key in self.keys(): sum_dict[key] = self[key] for key in other.keys(): sum_dict[key] = sum_dict[key] + other[key] return sum_dict def __sub__(self, other): sum_dict = NumberDict() for key in self.keys(): sum_dict[key] = self[key] for key in other.keys(): sum_dict[key] = sum_dict[key] - other[key] return sum_dict def __mul__(self, other): new = NumberDict() for key in self.keys(): new[key] = other*self[key] return new __rmul__ = __mul__ def __div__(self, other): new = NumberDict() for key in self.keys(): new[key] = self[key]/other return new __truediv__ = __div__ ScientificPython-2.9.4/Scientific/Physics/0000755000076600000240000000000012270505005021116 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/Physics/__init__.py0000644000076600000240000000001511501734232023225 0ustar hinsenstaff00000000000000# Empty file ScientificPython-2.9.4/Scientific/Physics/PhysicalQuantities.py0000644000076600000240000006676512270502661025344 0ustar hinsenstaff00000000000000# Physical quantities with units # # Written by Konrad Hinsen # with contributions from Greg Ward # last revision: 2007-5-25 # """ Physical quantities with units. This module provides a data type that represents a physical quantity together with its unit. It is possible to add and subtract these quantities if the units are compatible, and a quantity can be converted to another compatible unit. Multiplication, subtraction, and raising to integer powers is allowed without restriction, and the result will have the correct unit. A quantity can be raised to a non-integer power only if the result can be represented by integer powers of the base units. The values of physical constants are taken from the 1986 recommended values from CODATA. Other conversion factors (e.g. for British units) come from various sources. I can't guarantee for the correctness of all entries in the unit table, so use this at your own risk. """ from Scientific.NumberDict import NumberDict from Scientific import N import re, string # Class definitions class PhysicalQuantity: """ Physical quantity with units PhysicalQuantity instances allow addition, subtraction, multiplication, and division with each other as well as multiplication, division, and exponentiation with numbers. Addition and subtraction check that the units of the two operands are compatible and return the result in the units of the first operand. A limited set of mathematical functions (from module Numeric) is applicable as well: - sqrt: equivalent to exponentiation with 0.5. - sin, cos, tan: applicable only to objects whose unit is compatible with 'rad'. See the documentation of the PhysicalQuantities module for a list of the available units. Here is an example on usage: >>> from PhysicalQuantities import PhysicalQuantity as p # short hand >>> distance1 = p('10 m') >>> distance2 = p('10 km') >>> total = distance1 + distance2 >>> total PhysicalQuantity(10010.0,'m') >>> total.convertToUnit('km') >>> total.getValue() 10.01 >>> total.getUnitName() 'km' >>> total = total.inBaseUnits() >>> total PhysicalQuantity(10010.0,'m') >>> >>> t = p(314159., 's') >>> # convert to days, hours, minutes, and second: >>> t2 = t.inUnitsOf('d','h','min','s') >>> t2_print = ' '.join([str(i) for i in t2]) >>> t2_print '3.0 d 15.0 h 15.0 min 59.0 s' >>> >>> e = p('2.7 Hartree*Nav') >>> e.convertToUnit('kcal/mol') >>> e PhysicalQuantity(1694.2757596034764,'kcal/mol') >>> e = e.inBaseUnits() >>> str(e) '7088849.77818 kg*m**2/s**2/mol' >>> >>> freeze = p('0 degC') >>> freeze = freeze.inUnitsOf ('degF') >>> str(freeze) '32.0 degF' >>> """ def __init__(self, *args): """ There are two constructor calling patterns: 1. PhysicalQuantity(value, unit), where value is any number and unit is a string defining the unit 2. PhysicalQuantity(value_with_unit), where value_with_unit is a string that contains both the value and the unit, i.e. '1.5 m/s'. This form is provided for more convenient interactive use. @param args: either (value, unit) or (value_with_unit,) @type args: (number, C{str}) or (C{str},) """ if len(args) == 2: self.value = args[0] self.unit = _findUnit(args[1]) else: s = string.strip(args[0]) match = PhysicalQuantity._number.match(s) if match is None: raise TypeError('No number found') self.value = string.atof(match.group(0)) self.unit = _findUnit(s[len(match.group(0)):]) _number = re.compile('[+-]?[0-9]+(\\.[0-9]*)?([eE][+-]?[0-9]+)?') def __str__(self): return str(self.value) + ' ' + self.unit.name() def __repr__(self): return (self.__class__.__name__ + '(' + `self.value` + ',' + `self.unit.name()` + ')') def _sum(self, other, sign1, sign2): if not isPhysicalQuantity(other): raise TypeError('Incompatible types') new_value = sign1*self.value + \ sign2*other.value*other.unit.conversionFactorTo(self.unit) return self.__class__(new_value, self.unit) def __add__(self, other): return self._sum(other, 1, 1) __radd__ = __add__ def __sub__(self, other): return self._sum(other, 1, -1) def __rsub__(self, other): return self._sum(other, -1, 1) def __cmp__(self, other): diff = self._sum(other, 1, -1) return cmp(diff.value, 0) def __mul__(self, other): if not isPhysicalQuantity(other): return self.__class__(self.value*other, self.unit) value = self.value*other.value unit = self.unit*other.unit if unit.isDimensionless(): return value*unit.factor else: return self.__class__(value, unit) __rmul__ = __mul__ def __div__(self, other): if not isPhysicalQuantity(other): return self.__class__(self.value/other, self.unit) value = self.value/other.value unit = self.unit/other.unit if unit.isDimensionless(): return value*unit.factor else: return self.__class__(value, unit) __truediv__ = __div__ def __rdiv__(self, other): if not isPhysicalQuantity(other): return self.__class__(other/self.value, pow(self.unit, -1)) value = other.value/self.value unit = other.unit/self.unit if unit.isDimensionless(): return value*unit.factor else: return self.__class__(value, unit) def __pow__(self, other): if isPhysicalQuantity(other): raise TypeError('Exponents must be dimensionless') return self.__class__(pow(self.value, other), pow(self.unit, other)) def __rpow__(self, other): raise TypeError('Exponents must be dimensionless') def __abs__(self): return self.__class__(abs(self.value), self.unit) def __pos__(self): return self def __neg__(self): return self.__class__(-self.value, self.unit) def __nonzero__(self): return self.value != 0 def convertToUnit(self, unit): """ Change the unit and adjust the value such that the combination is equivalent to the original one. The new unit must be compatible with the previous unit of the object. @param unit: a unit @type unit: C{str} @raise TypeError: if the unit string is not a know unit or a unit incompatible with the current one """ unit = _findUnit(unit) self.value = _convertValue (self.value, self.unit, unit) self.unit = unit def inUnitsOf(self, *units): """ Express the quantity in different units. If one unit is specified, a new PhysicalQuantity object is returned that expresses the quantity in that unit. If several units are specified, the return value is a tuple of PhysicalObject instances with with one element per unit such that the sum of all quantities in the tuple equals the the original quantity and all the values except for the last one are integers. This is used to convert to irregular unit systems like hour/minute/second. @param units: one or several units @type units: C{str} or sequence of C{str} @returns: one or more physical quantities @rtype: L{PhysicalQuantity} or C{tuple} of L{PhysicalQuantity} @raises TypeError: if any of the specified units are not compatible with the original unit """ units = map(_findUnit, units) if len(units) == 1: unit = units[0] value = _convertValue (self.value, self.unit, unit) return self.__class__(value, unit) else: units.sort() result = [] value = self.value unit = self.unit for i in range(len(units)-1,-1,-1): value = value*unit.conversionFactorTo(units[i]) if i == 0: rounded = value else: rounded = _round(value) result.append(self.__class__(rounded, units[i])) value = value - rounded unit = units[i] return tuple(result) # Contributed by Berthold Hoellmann def inBaseUnits(self): """ @returns: the same quantity converted to base units, i.e. SI units in most cases @rtype: L{PhysicalQuantity} """ new_value = self.value * self.unit.factor num = '' denom = '' for i in xrange(9): unit = _base_names[i] power = self.unit.powers[i] if power < 0: denom = denom + '/' + unit if power < -1: denom = denom + '**' + str(-power) elif power > 0: num = num + '*' + unit if power > 1: num = num + '**' + str(power) if len(num) == 0: num = '1' else: num = num[1:] return self.__class__(new_value, num + denom) def isCompatible (self, unit): """ @param unit: a unit @type unit: C{str} @returns: C{True} if the specified unit is compatible with the one of the quantity @rtype: C{bool} """ unit = _findUnit (unit) return self.unit.isCompatible (unit) def getValue(self): """Return value (float) of physical quantity (no unit).""" return self.value def getUnitName(self): """Return unit (string) of physical quantity.""" return self.unit.name() def sqrt(self): return pow(self, 0.5) def sin(self): if self.unit.isAngle(): return N.sin(self.value * \ self.unit.conversionFactorTo(_unit_table['rad'])) else: raise TypeError('Argument of sin must be an angle') def cos(self): if self.unit.isAngle(): return N.cos(self.value * \ self.unit.conversionFactorTo(_unit_table['rad'])) else: raise TypeError('Argument of cos must be an angle') def tan(self): if self.unit.isAngle(): return N.tan(self.value * \ self.unit.conversionFactorTo(_unit_table['rad'])) else: raise TypeError('Argument of tan must be an angle') class PhysicalUnit: """ Physical unit A physical unit is defined by a name (possibly composite), a scaling factor, and the exponentials of each of the SI base units that enter into it. Units can be multiplied, divided, and raised to integer powers. """ def __init__(self, names, factor, powers, offset=0): """ @param names: a dictionary mapping each name component to its associated integer power (e.g. C{{'m': 1, 's': -1}}) for M{m/s}). As a shorthand, a string may be passed which is assigned an implicit power 1. @type names: C{dict} or C{str} @param factor: a scaling factor @type factor: C{float} @param powers: the integer powers for each of the nine base units @type powers: C{list} of C{int} @param offset: an additive offset to the base unit (used only for temperatures) @type offset: C{float} """ if type(names) == type(''): self.names = NumberDict() self.names[names] = 1 else: self.names = names self.factor = factor self.offset = offset self.powers = powers def __repr__(self): return '' __str__ = __repr__ def __cmp__(self, other): if self.powers != other.powers: raise TypeError('Incompatible units') return cmp(self.factor, other.factor) def __mul__(self, other): if self.offset != 0 or (isPhysicalUnit (other) and other.offset != 0): raise TypeError("cannot multiply units with non-zero offset") if isPhysicalUnit(other): return PhysicalUnit(self.names+other.names, self.factor*other.factor, map(lambda a,b: a+b, self.powers, other.powers)) else: return PhysicalUnit(self.names+{str(other): 1}, self.factor*other, self.powers, self.offset * other) __rmul__ = __mul__ def __div__(self, other): if self.offset != 0 or (isPhysicalUnit (other) and other.offset != 0): raise TypeError("cannot divide units with non-zero offset") if isPhysicalUnit(other): return PhysicalUnit(self.names-other.names, self.factor/other.factor, map(lambda a,b: a-b, self.powers, other.powers)) else: return PhysicalUnit(self.names+{str(other): -1}, self.factor/other, self.powers) __truediv__ = __div__ def __rdiv__(self, other): if self.offset != 0 or (isPhysicalUnit (other) and other.offset != 0): raise TypeError("cannot divide units with non-zero offset") if isPhysicalUnit(other): return PhysicalUnit(other.names-self.names, other.factor/self.factor, map(lambda a,b: a-b, other.powers, self.powers)) else: return PhysicalUnit({str(other): 1}-self.names, other/self.factor, map(lambda x: -x, self.powers)) def __pow__(self, other): if self.offset != 0: raise TypeError("cannot exponentiate units with non-zero offset") if isinstance(other, int): return PhysicalUnit(other*self.names, pow(self.factor, other), map(lambda x,p=other: x*p, self.powers)) if isinstance(other, float): inv_exp = 1./other rounded = int(N.floor(inv_exp+0.5)) if abs(inv_exp-rounded) < 1.e-10: if reduce(lambda a, b: a and b, map(lambda x, e=rounded: x%e == 0, self.powers)): f = pow(self.factor, other) p = map(lambda x,p=rounded: x/p, self.powers) if reduce(lambda a, b: a and b, map(lambda x, e=rounded: x%e == 0, self.names.values())): names = self.names/rounded else: names = NumberDict() if f != 1.: names[str(f)] = 1 for i in range(len(p)): names[_base_names[i]] = p[i] return PhysicalUnit(names, f, p) else: raise TypeError('Illegal exponent') raise TypeError('Only integer and inverse integer exponents allowed') def conversionFactorTo(self, other): """ @param other: another unit @type other: L{PhysicalUnit} @returns: the conversion factor from this unit to another unit @rtype: C{float} @raises TypeError: if the units are not compatible """ if self.powers != other.powers: raise TypeError('Incompatible units') if self.offset != other.offset and self.factor != other.factor: raise TypeError(('Unit conversion (%s to %s) cannot be expressed ' + 'as a simple multiplicative factor') % \ (self.name(), other.name())) return self.factor/other.factor def conversionTupleTo(self, other): # added 1998/09/29 GPW """ @param other: another unit @type other: L{PhysicalUnit} @returns: the conversion factor and offset from this unit to another unit @rtype: (C{float}, C{float}) @raises TypeError: if the units are not compatible """ if self.powers != other.powers: raise TypeError('Incompatible units') # let (s1,d1) be the conversion tuple from 'self' to base units # (ie. (x+d1)*s1 converts a value x from 'self' to base units, # and (x/s1)-d1 converts x from base to 'self' units) # and (s2,d2) be the conversion tuple from 'other' to base units # then we want to compute the conversion tuple (S,D) from # 'self' to 'other' such that (x+D)*S converts x from 'self' # units to 'other' units # the formula to convert x from 'self' to 'other' units via the # base units is (by definition of the conversion tuples): # ( ((x+d1)*s1) / s2 ) - d2 # = ( (x+d1) * s1/s2) - d2 # = ( (x+d1) * s1/s2 ) - (d2*s2/s1) * s1/s2 # = ( (x+d1) - (d1*s2/s1) ) * s1/s2 # = (x + d1 - d2*s2/s1) * s1/s2 # thus, D = d1 - d2*s2/s1 and S = s1/s2 factor = self.factor / other.factor offset = self.offset - (other.offset * other.factor / self.factor) return (factor, offset) def isCompatible (self, other): # added 1998/10/01 GPW """ @param other: another unit @type other: L{PhysicalUnit} @returns: C{True} if the units are compatible, i.e. if the powers of the base units are the same @rtype: C{bool} """ return self.powers == other.powers def isDimensionless(self): return not reduce(lambda a,b: a or b, self.powers) def isAngle(self): return self.powers[7] == 1 and \ reduce(lambda a,b: a + b, self.powers) == 1 def setName(self, name): self.names = NumberDict() self.names[name] = 1 def name(self): num = '' denom = '' for unit in self.names.keys(): power = self.names[unit] if power < 0: denom = denom + '/' + unit if power < -1: denom = denom + '**' + str(-power) elif power > 0: num = num + '*' + unit if power > 1: num = num + '**' + str(power) if len(num) == 0: num = '1' else: num = num[1:] return num + denom # Type checks def isPhysicalUnit(x): """ @param x: an object @type x: any @returns: C{True} if x is a L{PhysicalUnit} @rtype: C{bool} """ return hasattr(x, 'factor') and hasattr(x, 'powers') def isPhysicalQuantity(x): """ @param x: an object @type x: any @returns: C{True} if x is a L{PhysicalQuantity} @rtype: C{bool} """ return hasattr(x, 'value') and hasattr(x, 'unit') # Helper functions def _findUnit(unit): if type(unit) == type(''): name = string.strip(unit) unit = eval(name, _unit_table) for cruft in ['__builtins__', '__args__']: try: del _unit_table[cruft] except: pass if not isPhysicalUnit(unit): raise TypeError(str(unit) + ' is not a unit') return unit def _round(x): if N.greater(x, 0.): return N.floor(x) else: return N.ceil(x) def _convertValue (value, src_unit, target_unit): (factor, offset) = src_unit.conversionTupleTo(target_unit) return (value + offset) * factor # SI unit definitions _base_names = ['m', 'kg', 's', 'A', 'K', 'mol', 'cd', 'rad', 'sr'] _base_units = [('m', PhysicalUnit('m', 1., [1,0,0,0,0,0,0,0,0])), ('g', PhysicalUnit('g', 0.001, [0,1,0,0,0,0,0,0,0])), ('s', PhysicalUnit('s', 1., [0,0,1,0,0,0,0,0,0])), ('A', PhysicalUnit('A', 1., [0,0,0,1,0,0,0,0,0])), ('K', PhysicalUnit('K', 1., [0,0,0,0,1,0,0,0,0])), ('mol', PhysicalUnit('mol', 1., [0,0,0,0,0,1,0,0,0])), ('cd', PhysicalUnit('cd', 1., [0,0,0,0,0,0,1,0,0])), ('rad', PhysicalUnit('rad', 1., [0,0,0,0,0,0,0,1,0])), ('sr', PhysicalUnit('sr', 1., [0,0,0,0,0,0,0,0,1])), ] _prefixes = [('Y', 1.e24), ('Z', 1.e21), ('E', 1.e18), ('P', 1.e15), ('T', 1.e12), ('G', 1.e9), ('M', 1.e6), ('k', 1.e3), ('h', 1.e2), ('da', 1.e1), ('d', 1.e-1), ('c', 1.e-2), ('m', 1.e-3), ('mu', 1.e-6), ('n', 1.e-9), ('p', 1.e-12), ('f', 1.e-15), ('a', 1.e-18), ('z', 1.e-21), ('y', 1.e-24), ] _unit_table = {} for unit in _base_units: _unit_table[unit[0]] = unit[1] _help = [] def _addUnit(name, unit, comment=''): if _unit_table.has_key(name): raise KeyError, 'Unit ' + name + ' already defined' if comment: _help.append((name, comment, unit)) if type(unit) == type(''): unit = eval(unit, _unit_table) for cruft in ['__builtins__', '__args__']: try: del _unit_table[cruft] except: pass unit.setName(name) _unit_table[name] = unit def _addPrefixed(unit): _help.append('Prefixed units for %s:' % unit) _prefixed_names = [] for prefix in _prefixes: name = prefix[0] + unit _addUnit(name, prefix[1]*_unit_table[unit]) _prefixed_names.append(name) _help.append(', '.join(_prefixed_names)) # SI derived units; these automatically get prefixes _help.append('SI derived units; these automatically get prefixes:\n' + \ ', '.join([prefix + ' (%.0E)' % value for prefix, value in _prefixes]) + \ '\n') _unit_table['kg'] = PhysicalUnit('kg', 1., [0,1,0,0,0,0,0,0,0]) _addUnit('Hz', '1/s', 'Hertz') _addUnit('N', 'm*kg/s**2', 'Newton') _addUnit('Pa', 'N/m**2', 'Pascal') _addUnit('J', 'N*m', 'Joule') _addUnit('W', 'J/s', 'Watt') _addUnit('C', 's*A', 'Coulomb') _addUnit('V', 'W/A', 'Volt') _addUnit('F', 'C/V', 'Farad') _addUnit('ohm', 'V/A', 'Ohm') _addUnit('S', 'A/V', 'Siemens') _addUnit('Wb', 'V*s', 'Weber') _addUnit('T', 'Wb/m**2', 'Tesla') _addUnit('H', 'Wb/A', 'Henry') _addUnit('lm', 'cd*sr', 'Lumen') _addUnit('lx', 'lm/m**2', 'Lux') _addUnit('Bq', '1/s', 'Becquerel') _addUnit('Gy', 'J/kg', 'Gray') _addUnit('Sv', 'J/kg', 'Sievert') del _unit_table['kg'] for unit in _unit_table.keys(): _addPrefixed(unit) # Fundamental constants _help.append('Fundamental constants:') _unit_table['pi'] = N.pi _addUnit('c', '299792458.*m/s', 'speed of light') _addUnit('mu0', '4.e-7*pi*N/A**2', 'permeability of vacuum') _addUnit('eps0', '1/mu0/c**2', 'permittivity of vacuum') _addUnit('Grav', '6.67259e-11*m**3/kg/s**2', 'gravitational constant') _addUnit('hplanck', '6.6260755e-34*J*s', 'Planck constant') _addUnit('hbar', 'hplanck/(2*pi)', 'Planck constant / 2pi') _addUnit('e', '1.60217733e-19*C', 'elementary charge') _addUnit('me', '9.1093897e-31*kg', 'electron mass') _addUnit('mp', '1.6726231e-27*kg', 'proton mass') _addUnit('Nav', '6.0221367e23/mol', 'Avogadro number') _addUnit('k', '1.380658e-23*J/K', 'Boltzmann constant') # Time units _help.append('Time units:') _addUnit('min', '60*s', 'minute') _addUnit('h', '60*min', 'hour') _addUnit('d', '24*h', 'day') _addUnit('wk', '7*d', 'week') _addUnit('yr', '365.25*d', 'year') # Length units _help.append('Length units:') _addUnit('inch', '2.54*cm', 'inch') _addUnit('ft', '12*inch', 'foot') _addUnit('yd', '3*ft', 'yard') _addUnit('mi', '5280.*ft', '(British) mile') _addUnit('nmi', '1852.*m', 'Nautical mile') _addUnit('Ang', '1.e-10*m', 'Angstrom') _addUnit('lyr', 'c*yr', 'light year') _addUnit('Bohr', '4*pi*eps0*hbar**2/me/e**2', 'Bohr radius') # Area units _help.append('Area units:') _addUnit('ha', '10000*m**2', 'hectare') _addUnit('acres', 'mi**2/640', 'acre') _addUnit('b', '1.e-28*m**2', 'barn') # Volume units _help.append('Volume units:') _addUnit('l', 'dm**3', 'liter') _addUnit('dl', '0.1*l', 'deci liter') _addUnit('cl', '0.01*l', 'centi liter') _addUnit('ml', '0.001*l', 'milli liter') _addUnit('tsp', '4.92892159375*ml', 'teaspoon') _addUnit('tbsp', '3*tsp', 'tablespoon') _addUnit('floz', '2*tbsp', 'fluid ounce') _addUnit('cup', '8*floz', 'cup') _addUnit('pt', '16*floz', 'pint') _addUnit('qt', '2*pt', 'quart') _addUnit('galUS', '4*qt', 'US gallon') _addUnit('galUK', '4.54609*l', 'British gallon') # Mass units _help.append('Mass units:') _addUnit('amu', '1.6605402e-27*kg', 'atomic mass units') _addUnit('oz', '28.349523125*g', 'ounce') _addUnit('lb', '16*oz', 'pound') _addUnit('ton', '2000*lb', 'ton') # Force units _help.append('Force units:') _addUnit('dyn', '1.e-5*N', 'dyne (cgs unit)') # Energy units _help.append('Energy units:') _addUnit('erg', '1.e-7*J', 'erg (cgs unit)') _addUnit('eV', 'e*V', 'electron volt') _addUnit('Hartree', 'me*e**4/16/pi**2/eps0**2/hbar**2', 'Wavenumbers/inverse cm') _addUnit('Ken', 'k*K', 'Kelvin as energy unit') _addUnit('cal', '4.184*J', 'thermochemical calorie') _addUnit('kcal', '1000*cal', 'thermochemical kilocalorie') _addUnit('cali', '4.1868*J', 'international calorie') _addUnit('kcali', '1000*cali', 'international kilocalorie') _addUnit('Btu', '1055.05585262*J', 'British thermal unit') _addPrefixed('eV') # Power units _help.append('Power units:') _addUnit('hp', '745.7*W', 'horsepower') # Pressure units _help.append('Pressure units:') _addUnit('bar', '1.e5*Pa', 'bar (cgs unit)') _addUnit('atm', '101325.*Pa', 'standard atmosphere') _addUnit('torr', 'atm/760', 'torr = mm of mercury') _addUnit('psi', '6894.75729317*Pa', 'pounds per square inch') # Angle units _help.append('Angle units:') _addUnit('deg', 'pi*rad/180', 'degrees') _help.append('Temperature units:') # Temperature units -- can't use the 'eval' trick that _addUnit provides # for degC and degF because you can't add units kelvin = _findUnit ('K') _addUnit ('degR', '(5./9.)*K', 'degrees Rankine') _addUnit ('degC', PhysicalUnit (None, 1.0, kelvin.powers, 273.15), 'degrees Celcius') _addUnit ('degF', PhysicalUnit (None, 5./9., kelvin.powers, 459.67), 'degree Fahrenheit') del kelvin def description(): """Return a string describing all available units.""" s = '' # collector for description text for entry in _help: if isinstance(entry, basestring): # headline for new section s += '\n' + entry + '\n' elif isinstance(entry, tuple): name, comment, unit = entry s += '%-8s %-26s %s\n' % (name, comment, unit) else: # impossible raise TypeError, 'wrong construction of _help list' return s # add the description of the units to the module's doc string: __doc__ += '\n' + description() # Some demonstration code. Run with "python -i PhysicalQuantities.py" # to have this available. if __name__ == '__main__': from Scientific.N import * l = PhysicalQuantity(10., 'm') big_l = PhysicalQuantity(10., 'km') print big_l + l t = PhysicalQuantity(314159., 's') print t.inUnitsOf('d','h','min','s') p = PhysicalQuantity # just a shorthand... e = p('2.7 Hartree*Nav') e.convertToUnit('kcal/mol') print e print e.inBaseUnits() freeze = p('0 degC') print freeze.inUnitsOf ('degF') ScientificPython-2.9.4/Scientific/Physics/Potential.py0000644000076600000240000001061711501734231023435 0ustar hinsenstaff00000000000000# Definitions to help evaluating potentials and their # gradients using DerivVars and DerivVectors. # # Written by: Konrad Hinsen # Last revision: 2006-6-12 # """ Potential energy functions with automatic gradient evaluation This module offers two strategies for automagically calculating the gradients (and optionally force constants) of a potential energy function (or any other function of vectors, for that matter). The more convenient strategy is to create an object of the class PotentialWithGradients. It takes a regular Python function object defining the potential energy and is itself a callable object returning the energy and its gradients with respect to all arguments that are vectors. Example:: >>>def _harmonic(k,r1,r2): >>> dr = r2-r1 >>> return k*dr*dr >>>harmonic = PotentialWithGradients(_harmonic) >>>energy, gradients = harmonic(1., Vector(0,3,1), Vector(1,2,0)) >>>print energy, gradients prints:: >>>3.0 >>>[Vector(-2.0,2.0,2.0), Vector(2.0,-2.0,-2.0)] The disadvantage of this procedure is that if one of the arguments is a vector parameter, rather than a position, an unnecessary gradient will be calculated. A more flexible method is to insert calls to two function from this module into the definition of the energy function. The first, DerivVectors(), is called to indicate which vectors correspond to gradients, and the second, EnergyGradients(), extracts energy and gradients from the result of the calculation. The above example is therefore equivalent to:: >>>def harmonic(k, r1, r2): >>> r1, r2 = DerivVectors(r1, r2) >>> dr = r2-r1 >>> e = k*dr*dr >>> return EnergyGradients(e,2) To include the force constant matrix, the above example has to be modified as follows:: >>>def _harmonic(k,r1,r2): >>> dr = r2-r1 >>> return k*dr*dr >>>harmonic = PotentialWithGradientsAndForceConstants(_harmonic) >>>energy, gradients, force_constants = harmonic(1.,Vector(0,3,1),Vector(1,2,0)) >>>print energy >>>print gradients >>>print force_constants The force constants are returned as a nested list representing a matrix. This can easily be converted to an array for further processing if the numerical extensions to Python are available. """ from Scientific import N; Numeric = N from Scientific.Geometry import Vector, isVector from Scientific.Functions import FirstDerivatives, Derivatives def DerivVectors(*args): index = 0 list = [] for a in args: list.append(FirstDerivatives.DerivVector(a.x(),a.y(),a.z(),index)) index = index + 3 return tuple(list) def EnergyGradients(e, n): energy = e[0] deriv = e[1] deriv = deriv + (3*n-len(deriv))*[0] gradients = [] i = 0 for j in range(n): gradients.append(Vector(deriv[i],deriv[i+1],deriv[i+2])) i = i+3 return (energy, gradients) def EnergyGradientsForceConstants(e, n): energy = e[0] deriv = e[1] deriv = deriv + (3*n-len(deriv))*[0] gradients = [] i = 0 for j in range(n): gradients.append(Vector(deriv[i],deriv[i+1],deriv[i+2])) i = i+3 return (energy, gradients, Numeric.array(e[2])) # Potential function class with gradients class PotentialWithGradients: def __init__(self, func): self.func = func def __call__(self, *args): arglist = [] nvector = 0 index = 0 for a in args: if isVector(a): arglist.append(FirstDerivatives.DerivVector(a.x(),a.y(),a.z(), index)) nvector = nvector + 1 index = index + 3 else: arglist.append(a) e = apply(self.func, tuple(arglist)) return EnergyGradients(e,nvector) # Potential function class with gradients and force constants class PotentialWithGradientsAndForceConstants: def __init__(self, func): self.func = func def __call__(self, *args): arglist = [] nvector = 0 index = 0 for a in args: if isVector(a): arglist.append(Derivatives.DerivVector(a.x(),a.y(),a.z(), index, 2)) nvector = nvector + 1 index = index + 3 else: arglist.append(a) e = apply(self.func, tuple(arglist)) return EnergyGradientsForceConstants(e, nvector) ScientificPython-2.9.4/Scientific/QtWidgets/0000755000076600000240000000000012270505005021407 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/QtWidgets/__init__.py0000640000076600000240000000007711501734231023521 0ustar hinsenstaff00000000000000# Package Scientific.QtWidgets """ @undocumented: qt_fake """ ScientificPython-2.9.4/Scientific/QtWidgets/qt_fake.py0000644000076600000240000000044511501734231023377 0ustar hinsenstaff00000000000000# Dummy module to make epydoc generate documentation even though # Qt is not installed. import sys if sys.modules.has_key('epydoc'): class Qt: SolidLine=None SolidPattern=None class QWidget: pass else: raise ImportError, "Please install PyQt" del sys ScientificPython-2.9.4/Scientific/QtWidgets/QtPlotCanvas.py0000640000076600000240000006003711501734232024344 0ustar hinsenstaff00000000000000# This module defines a plot widget for Qt user interfaces. # It supports only elementary line plots at the moment. # See the example at the end for documentation... # # Written by Konrad Hinsen # Last revision: 2008-8-18 # """ Plot widget for Qt user interfaces A plot widget acts like a canvas for special graphics objects that represent curves shown by lines or markers. Note that this module is not meant to replace a full-featured plot program. It was designed to permit the simple integration of plots into Qt-based user interfaces. """ try: from qt import * except ImportError: from qt_fake import * from Scientific import N import string, os # This must be 0 on the Zaurus colors_by_name = not os.environ.has_key('QPEDIR') class PolyPoints: def __init__(self, points, attr): self.points = N.array(points) self.scaled = self.points self.attributes = {} for name, value in self._attributes.items(): try: value = attr[name] except KeyError: pass self.attributes[name] = value def boundingBox(self): return N.minimum.reduce(self.points), \ N.maximum.reduce(self.points) def scaleAndShift(self, scale=1, shift=0): self.scaled = scale*self.points+shift def writeToFile(self, file, separator): if self.points: for p in self.points: file.write(`p[0]` + ' ' + `p[1]` + '\n') return 1 else: return 0 class PolyLine(PolyPoints): """ Multiple connected lines @undocumented: draw """ def __init__(self, points, **attr): """ @param points: any sequence of (x, y) number pairs @param attr: line attributes @keyword width: the line width (default: 1) @keyword color: a string whose value is one of the color names defined by X-Windows (default: C{"black"}) @keyword style: a Qt pen style object (default: Qt.SolidLine) """ PolyPoints.__init__(self, points, attr) _attributes = {'color': 'black', 'width': 1, 'style': Qt.SolidLine} def draw(self, painter, bbox): if len(self.points) > 1: color = self.attributes['color'] width = self.attributes['width'] style = self.attributes['style'] points = QPointArray(len(self.points)) for i in range(len(self.points)): x, y = self.scaled[i] points.setPoint(i, x, y) if colors_by_name: painter.setPen(QPen(QColor(color), width, style)) else: painter.setPen(QPen(getattr(Qt, color), width, style)) painter.drawPolyline(points) class VerticalLine(PolyLine): """ A vertical line """ def __init__(self, xpos, **attr): """ @param xpos: the x coordinate of the line @type xpos: C{float} @param attr: line attributes @keyword width: the line width (default: 1) @keyword color: a string whose value is one of the color names defined by X-Windows (default: C{"black"}) @keyword style: a Qt pen style object (default: Qt.SolidLine) """ apply(PolyLine.__init__, (self, 2*[(xpos, 0.)]), attr) def draw(self, canvas, bbox): self.scaled[0, 1] = bbox[0][1] self.scaled[1, 1] = bbox[1][1] PolyLine.draw(self, canvas, bbox) def writeToFile(self, file, separator): return 0 class HorizontalLine(PolyLine): """ A horizontal line """ def __init__(self, ypos, **attr): """ @param ypos: the y coordinate of the line @type ypos: C{float} @param attr: line attributes @keyword width: the line width (default: 1) @keyword color: a string whose value is one of the color names defined by X-Windows (default: C{"black"}) @keyword style: a Qt pen style object (default: Qt.SolidLine) """ print ypos apply(PolyLine.__init__, (self, 2*[(0., ypos)]), attr) def draw(self, canvas, bbox): self.scaled[0, 0] = bbox[0][0] self.scaled[1, 0] = bbox[1][0] PolyLine.draw(self, canvas, bbox) def writeToFile(self, file, separator): return 0 class PolyMarker(PolyPoints): """ Series of markers """ def __init__(self, points, **attr): """ @param points: any sequence of (x, y) number pairs @param attr: marker attributes @keyword width: the line width for drawing the marker (default: 1) @keyword color: a string whose value is one of the color names defined by X-Windows (default: C{"black"}) @keyword fillcolor: a string whose value is one of the color names defined in X-Windows, defines the color of the interior of the marker (default: C{"black"}) @keyword fillstyle: a Qt BrushStyle object (default: Qt.SolidPattern) @keyword marker: one of C{'circle'} (default), C{'dot'}, C{'square'}, C{'triangle'}, C{'triangle_down'}, C{'cross'}, C{'plus'} """ PolyPoints.__init__(self, points, attr) _attributes = {'color': 'black', 'width': 1, 'fillcolor': 'black', 'size': 2, 'fillstyle': Qt.SolidPattern, 'marker': 'circle'} def draw(self, painter, bbox): color = self.attributes['color'] size = self.attributes['size'] fillcolor = self.attributes['fillcolor'] marker = self.attributes['marker'] fillstyle = self.attributes['fillstyle'] if colors_by_name: painter.setPen(QPen(QColor(color), 1, Qt.SolidLine)) painter.setBrush(QBrush(QColor(fillcolor), fillstyle)) else: painter.setPen(QPen(getattr(Qt, color), 1, Qt.SolidLine)) painter.setBrush(QBrush(getattr(Qt, fillcolor), fillstyle)) f = getattr(self, '_' + marker) for xc, yc in self.scaled: f(painter, xc, yc, size) def _circle(self, painter, xc, yc, size): size *= 5 painter.drawEllipse(xc-0.5*size, yc-0.5*size, size, size) def _dot(self, painter, xc, yc, size=1): painter.drawEllipse(xc-0.5*size, yc-0.5*size, size, size) def _square(self, painter, xc, yc, size): size *= 5 painter.drawRect(xc-0.5*size, yc-0.5*size, size, size) def _triangle(self, painter, xc, yc, size): size *= 5 points = QPointArray(3) points.setPoint(0, xc-0.5*size, yc+0.288675134595*size) points.setPoint(1, xc+0.5*size, yc+0.288675134595*size) points.setPoint(2, xc, yc-0.577350269189*size) painter.drawPolygon(points) def _triangle_down(self, painter, xc, yc, size): size *= 5 points = QPointArray(3) points.setPoint(0, xc-0.5*size, yc-0.288675134595*size) points.setPoint(1, xc+0.5*size, yc-0.288675134595*size) points.setPoint(2, xc, yc+0.577350269189*size) painter.drawPolygon(points) def _cross(self, painter, xc, yc, size): size *= 3 painter.drawLine(xc-size+1, yc-size+1, xc+size, yc+size) painter.drawLine(xc-size+1, yc+size-1, xc+size, yc-size) def _plus(self, painter, xc, yc, size): size *= 3 painter.drawLine(xc-size+1, yc, xc+size, yc) painter.drawLine(xc, yc+size, xc, yc-size+1) class PlotGraphics: """ Compound graphics object @undocumented: boundingBox @undocumented: scaleAndShift @undocumented: draw @undocumented: writeToFile """ def __init__(self, objects): """ @param objects: a list of graphics objects (L{PolyLine}, L{PolyMarker}, L{PlotGraphics}) @type objects: C{list} """ self.objects = objects def boundingBox(self): p1, p2 = self.objects[0].boundingBox() for o in self.objects[1:]: p1o, p2o = o.boundingBox() p1 = N.minimum(p1, p1o) p2 = N.maximum(p2, p2o) return p1, p2 def scaleAndShift(self, scale=1, shift=0): for o in self.objects: o.scaleAndShift(scale, shift) def draw(self, painter, bbox): for o in self.objects: o.draw(painter, bbox) def __len__(self): return len(self.objects) def __getitem__(self, item): return self.objects[item] def writeToFile(self, file, separator): data = 0 for o in self.objects: if data: file.write(separator) data = o.writeToFile(file, separator) class PlotCanvas(QWidget): """ Qt plot widget PlotCanvas objects support all operations of Qt widgets. """ def __init__(self, parent=None, background='white', font=None, zoom=False, select=None): """ @param parent: the parent widget @param background: the background color @type background: C{str} @param font: the font for axis labels, default: 10 point Helevetica @type font: QFont @keyword zoom: a flag that indicates whether interactive zooming (using the left mouse button) is enabled; the default is C{False} (no zoom) @type zoom: C{bool} @keyword select: enables the user to select a range along the x axis by dragging the mouse (with the left button pressed) in the area B{under} the x axis. If select is 0, no selection is possible. Otherwise the value of select must be a callable object that is called whenever the selection changes, with a single argument that can be C{None} (no selection) or a tuple containing two x values. """ self.zoom = zoom self.selectfn = select if font is None: font = QFont('Helvetica', 10) QWidget.__init__(self, parent) if colors_by_name: self.background_color = QColor(background) else: self.background_color = getattr(Qt, background) self.setFont(font) self.border = (1, 1) self.mouse_state = 0 self.value_label = QLabel(self) self.value_label.hide() self.popup_menu = QPopupMenu(self) self.popup_menu.insertItem('Auto Scale', self._autoScale) self.popup_menu.insertItem('Run Xmgrace', self._xmgr) self._setsize() self.current_plot = None self.selected_range = None def resizeEvent(self, event): self._setsize() self.update() def _setsize(self): self.plotbox_size = 0.97*N.array([self.width(), -self.height()]) xo = 0.5*(self.width()-self.plotbox_size[0]) yo = self.height()-0.5*(self.height()+self.plotbox_size[1]) self.plotbox_origin = N.array([xo, yo]) def draw(self, graphics, xaxis = None, yaxis = None): """ Draw something on the canvas @param graphics: the graphics object (L{PolyLine}, L{PolyMarker}, or L{PlotGraphics}) to be drawn @param xaxis: C{None} (no x-axis), C{"automatic"} (automatic scaling), or a pair (x1, x2) defining the range of the x-axis @param yaxis: C{None} (no y-axis), C{"automatic"} (automatic scaling), or a pair (y1, y2) defining the range of the y-axis """ self.current_plot = (graphics, xaxis, yaxis) self.update() def paintEvent(self, event): p = QPainter() p.begin(self) p.fillRect(self.rect(), QBrush(self.background_color)) graphics, xaxis, yaxis = self.current_plot p1, p2 = graphics.boundingBox() xaxis = self._axisInterval(xaxis, p1[0], p2[0]) yaxis = self._axisInterval(yaxis, p1[1], p2[1]) text_width = [0., 0.] text_height = [0., 0.] if xaxis is not None: p1[0] = xaxis[0] p2[0] = xaxis[1] xticks = self._ticks(xaxis[0], xaxis[1]) w, h = self._textBoundingBox(p, xticks[0][1]) text_height[1] = h+2 text_width[0] = 0.5*w w, h = self._textBoundingBox(p, xticks[-1][1]) text_width[1] = 0.5*w else: xticks = None if yaxis is not None: p1[1] = yaxis[0] p2[1] = yaxis[1] yticks = self._ticks(yaxis[0], yaxis[1]) for y in yticks: w, h = self._textBoundingBox(p, y[1]) text_width[0] = max(text_width[0], w+2) h = 0.5*h text_height[0] = h text_height[1] = max(text_height[1], h) else: yticks = None text1 = N.array([text_width[0], -text_height[1]]) text2 = N.array([text_width[1], -text_height[0]]) scale = (self.plotbox_size-text1-text2) / (p2-p1) shift = -p1*scale + self.plotbox_origin + text1 self.transformation = (scale, shift) self.bbox = (p1, p2) if self.selected_range is not None: x1 = scale[0]*self.selected_range[0]+shift[0] x2 = scale[0]*self.selected_range[1]+shift[0] p.setPen(QPen(Qt.NoPen)) p.setBrush(QBrush(Qt.gray, Qt.Dense5Pattern)) p.drawRect(x1, 0, x2-x1, self.height()) self._drawAxes(p, xaxis, yaxis, p1, p2, scale, shift, xticks, yticks) graphics.scaleAndShift(scale, shift) graphics.draw(p, (scale*p1+shift, scale*p2+shift)) p.end() def _axisInterval(self, spec, lower, upper): if spec is None: return None if spec == 'minimal': if lower == upper: return lower-0.5, upper+0.5 else: return lower, upper if spec == 'automatic': range = upper-lower if range == 0.: return lower-0.5, upper+0.5 log = N.log10(range) power = N.floor(log) fraction = log-power if fraction <= 0.05: power = power-1 grid = 10.**power lower = lower - lower % grid mod = upper % grid if mod != 0: upper = upper - mod + grid return lower, upper if type(spec) == type(()): lower, upper = spec if lower <= upper: return lower, upper else: return upper, lower raise ValueError(str(spec) + ': illegal axis specification') def _drawAxes(self, painter, xaxis, yaxis, bb1, bb2, scale, shift, xticks, yticks): painter.setPen(QPen(Qt.black, 1, Qt.SolidLine)) ww = self.width() wh = self.height() if xaxis is not None: lower, upper = xaxis text = 1 for y, d in [(bb1[1], -4), (bb2[1], 4)]: p1 = scale*N.array([lower, y])+shift p2 = scale*N.array([upper, y])+shift painter.drawLine(p1[0], p1[1], p2[0], p2[1]) for x, label in xticks: p = scale*N.array([x, y])+shift painter.drawLine(p[0], p[1], p[0], p[1]+d) if text: rect = painter.boundingRect(0, wh, ww, wh, Qt.AlignLeft|Qt.AlignBottom, label) w = rect.width() h = rect.height() painter.drawText(p[0]-w/2, p[1]+2, w, h, Qt.AlignLeft|Qt.AlignBottom, label) text = 0 if yaxis is not None: lower, upper = yaxis text = 1 for x, d in [(bb1[0], -4), (bb2[0], 4)]: p1 = scale*N.array([x, lower])+shift p2 = scale*N.array([x, upper])+shift painter.drawLine(p1[0], p1[1], p2[0], p2[1]) for y, label in yticks: p = scale*N.array([x, y])+shift painter.drawLine(p[0], p[1], p[0]-d, p[1]) if text: rect = painter.boundingRect(0, wh, ww, wh, Qt.AlignLeft|Qt.AlignBottom, label) w = rect.width() h = rect.height() painter.drawText(p[0]-w-2, p[1]-h/2, w, h, Qt.AlignLeft|Qt.AlignBottom, label) text = 0 def _ticks(self, lower, upper): ideal = (upper-lower)/7. if ideal == 0.: ideal = 1./7. log = N.log10(ideal) power = N.floor(log) fraction = log-power factor = 1. error = fraction for f, lf in self._multiples: e = N.fabs(fraction-lf) if e < error: error = e factor = f grid = factor * 10.**power if power > 3 or power < -3: format = '%+7.0e' elif power >= 0: digits = max(1, int(power)) format = '%' + `digits`+'.0f' else: digits = -int(power) format = '%'+`digits+2`+'.'+`digits`+'f' ticks = [] t = -grid*N.floor(-lower/grid) while t <= upper and len(ticks) < 200: ticks.append((t, format % (t,))) t = t + grid return ticks _multiples = [(2., N.log10(2.)), (5., N.log10(5.))] def _textBoundingBox(self, painter, text): w = self.width() h = self.height() rect = painter.boundingRect(0, h, w, h, Qt.AlignLeft|Qt.AlignBottom, text) return rect.width(), rect.height() def clear(self): """ Clear the canvas """ self.current_plot = None self.selected_range = None self.update() def redraw(self): """ Redraw the most recent canvas contents """ self.update() def mousePressEvent(self, event): button = event.button() if button == Qt.LeftButton: self.startx = event.x() self.starty = event.y() self.painter = QPainter() self.painter.begin(self) self.painter.setRasterOp(Qt.XorROP) self.mouse_state = 0 elif button == Qt.MidButton: self._showValue(event.x(), event.y()) self.mouse_state = 3 else: self.popup_menu.move(event.x(), event.y()) self.popup_menu.show() def mouseMoveEvent(self, event): x = event.x() y = event.y() if self.mouse_state == 0: scale, shift = self.transformation p = (N.array([self.startx, self.starty])-shift)/scale bb1, bb2 = self.bbox if self.selectfn is not None and p[1] < bb1[1]: self.painter.setPen(QPen(Qt.NoPen)) self.painter.setBrush(QBrush(Qt.blue, Qt.Dense5Pattern)) self.rectangle = (self.startx, 0, x-self.startx, self.height()) self.painter.drawRect(*self.rectangle) self.mouse_state = 2 elif self.zoom: self.painter.setPen(QPen(Qt.white, 1, Qt.DotLine)) self.painter.setBrush(QBrush(Qt.NoBrush)) self.rectangle = (self.startx, self.starty, x-self.startx, y-self.starty) self.painter.drawRect(*self.rectangle) self.mouse_state = 1 elif self.mouse_state == 1 or self.mouse_state == 2: self.painter.drawRect(*self.rectangle) if self.mouse_state == 1: self.rectangle = (self.startx, self.starty, x-self.startx, y-self.starty) elif self.mouse_state == 2: self.rectangle = (self.startx, 0, x-self.startx, self.height()) self.painter.drawRect(*self.rectangle) elif self.mouse_state == 3: scale, shift = self.transformation point = N.array([x, y]) point = (point-shift)/scale self.value_label.setText(" x = %f\n y = %f" % tuple(point)) def mouseReleaseEvent(self, event): button = event.button() if button == Qt.LeftButton: if self.mouse_state != 0: self.painter.drawRect(*self.rectangle) self.painter.end() if self.mouse_state == 1: x = event.x() y = event.y() p1 = N.array([self.startx, self.starty]) p2 = N.array([event.x(), event.y()]) if N.minimum.reduce(N.fabs(p1-p2)) > 5: scale, shift = self.transformation p1 = (p1-shift)/scale p2 = (p2-shift)/scale graphics, xaxis, yaxis = self.current_plot if xaxis is not None: xaxis = (p1[0], p2[0]) if yaxis is not None: yaxis = (p2[1], p1[1]) self.clear() self.draw(graphics, xaxis, yaxis) elif self.mouse_state == 2: scale, shift = self.transformation x1 = (self.startx-shift[0])/scale[0] x2 = (event.x()-shift[0])/scale[0] if x1 < x2: self.selected_range = (x1, x2) else: self.selected_range = (x2, x1) if self.selectfn is not None: self.selectfn(self.selected_range) self.mouse_state = 0 elif button == Qt.MidButton: self._hideValue() else: pass def select(self, range): """ Highlight a range on the x-axis @param range: the range on the x-axis to be highlighted. It can be C{None} (no selection) or a sequence of two values on the x-axis. """ if range is None: self.selected_range = None else: self.selected_range = range self.update() def _popupMenu(self, event): self.popup_menu.post(event.x_root, event.y_root) def _autoScale(self): if self.current_plot is not None: graphics, xaxis, yaxis = self.current_plot if xaxis is not None: xaxis = 'automatic' if yaxis is not None: yaxis = 'automatic' self.clear() self.draw(graphics, xaxis, yaxis) def _xmgr(self): if self.current_plot is not None: import os, tempfile filename = tempfile.mktemp() file = open(filename, 'w') graphics, xaxis, yaxis = self.current_plot graphics.writeToFile(file, '!\n') file.close() os.system('xmgrace ' + filename + ' &') os.unlink(filename) def _showValue(self, x, y): scale, shift = self.transformation point = N.array([x, y]) point = (point-shift)/scale self.value_label.setText(" x = %f\n y = %f" % tuple(point)) self.value_label.show() def _hideValue(self): self.value_label.hide() if __name__ == '__main__': data1 = 2.*N.pi*N.arange(200)/200. data1.shape = (100, 2) data1[:,1] = N.sin(data1[:,0]) lines1 = PolyLine(data1, color='green') pi = N.pi lines2 = PolyLine([(0., 0.), (pi/2., 1.), (pi, 0.), (3.*pi/2., -1), (2.*pi, 0.)], color='red') markers = PolyMarker([(0., 0.), (pi/2., 1.), (pi, 0.), (3.*pi/2., -1), (2.*pi, 0.)], color='blue', fillcolor='blue', marker='plus') object = PlotGraphics([lines1, lines2, markers]) def display(value): c.select(value) print value import sys app = QApplication(sys.argv) c = PlotCanvas(zoom=1, select=display) c.draw(object, 'automatic', 'automatic') app.setMainWidget(c) c.show() app.exec_loop() ScientificPython-2.9.4/Scientific/QtWidgets/QtVisualizationCanvas.py0000640000076600000240000002627011501734232026270 0ustar hinsenstaff00000000000000# This module defines a 3D wireframe visualization widget # for Qt user interfaces. # # Written by Konrad Hinsen # Last revision: 2006-5-31 # """ 3D wireframe canvas widget for Qt This module provides a special widget for Qt user interfaces which permits the display of 3D wireframe structures with interactive manipulation. Note that this widget can become sluggish if two many lines are to be displayed. An OpenGL widget should be used for serious visualization needs. The advantage of this module is that it requires no special graphics libraries in addition to Qt. @undocumented: PolyPoints3D """ try: from qt import * except ImportError: from qt_fake import * import string, os from Scientific import N from Scientific.Geometry import Vector from Scientific.Geometry.Transformation import Rotation # This must be 0 on the Zaurus colors_by_name = not os.environ.has_key('QPEDIR') class PolyPoints3D: def __init__(self, points, attr): self.points = N.array(points) self.scaled = self.points self.attributes = {} for name, value in self._attributes.items(): try: value = attr[name] except KeyError: pass self.attributes[name] = value def boundingBox(self): return N.minimum.reduce(self.points), \ N.maximum.reduce(self.points) def project(self, axis, plane): self.depth = N.dot(self.points, axis) self.projection = N.dot(self.points, plane) def boundingBoxPlane(self): return N.minimum.reduce(self.projection), \ N.maximum.reduce(self.projection) def scaleAndShift(self, scale=1, shift=0): self.scaled = scale*self.projection+shift class PolyLine3D(PolyPoints3D): """ Multiple connected lines """ def __init__(self, points, **attr): """ @param points: any sequence of (x, y, z) coordinate triples @param attr: line attributes @keyword width: line width (default: 1) @type width: C{int} @keyword color: a Qt color name (default: C{"black"}) @type color: C{str} """ PolyPoints3D.__init__(self, points, attr) _attributes = {'color': 'black', 'width': 1} def lines(self): color = self.attributes['color'] width = self.attributes['width'] lines = [] depths = [] for i in range(len(self.scaled)-1): x1, y1 = self.scaled[i] x2, y2 = self.scaled[i+1] lines.append((x1, y1, x2, y2, color, width)) depths.append(min(self.depth[i], self.depth[i+1])) return lines, depths class VisualizationGraphics: """ Compound graphics object @undocumented: boundingBox @undocumented: boundingBoxPlane @undocumented: project @undocumented: scaleAndShift @undocumented: lines """ def __init__(self, objects): """ @param objects: a list of graphics objects (L{PolyLine3D}, L{VisualizationGraphics}) """ self.objects = objects def boundingBox(self): p1, p2 = self.objects[0].boundingBox() for o in self.objects[1:]: p1o, p2o = o.boundingBox() p1 = N.minimum(p1, p1o) p2 = N.maximum(p2, p2o) return p1, p2 def project(self, axis, plane): for o in self.objects: o.project(axis, plane) def boundingBoxPlane(self): p1, p2 = self.objects[0].boundingBoxPlane() for o in self.objects[1:]: p1o, p2o = o.boundingBoxPlane() p1 = N.minimum(p1, p1o) p2 = N.maximum(p2, p2o) return p1, p2 def scaleAndShift(self, scale=1, shift=0): for o in self.objects: o.scaleAndShift(scale, shift) def lines(self): items = [] depths = [] for o in self.objects: i, d = o.lines() items = items + i depths = depths + d return items, depths def __len__(self): return len(self.objects) def __getitem__(self, item): return self.objects[item] class VisualizationCanvas(QWidget): """ Qt visualization widget VisualizationCanvas objects support all operations of Qt widgets. Interactive manipulation of the display is possible with click-and-drag operations. The left mouse button rotates the objects, the middle button translates it, and the right button scales it up or down. """ def __init__(self, parent=None, background='white'): """ @param parent: the parent widget @param background: the background color @type background: C{str} """ QWidget.__init__(self, parent) if colors_by_name: self.background_color = QColor(background) else: self.background_color = getattr(Qt, background) self.border = (1, 1) self._setsize() self.scale = None self.translate = N.array([0., 0.]) self.last_draw = None self.axis = N.array([0.,0.,1.]) self.plane = N.array([[1.,0.], [0.,1.], [0.,0.]]) def resizeEvent(self, event): self._setsize() self.update() def _setsize(self): width = self.width() height = self.height() self.plotbox_size = 0.97*N.array([width, -height]) xo = 0.5*(width-self.plotbox_size[0]) yo = height-0.5*(height+self.plotbox_size[1]) self.plotbox_origin = N.array([xo, yo]) def copyViewpointFrom(self, other): self.axis = other.axis self.plane = other.plane self.scale = other.scale self.translate = other.translate def setViewpoint(self, axis, plane, scale=None, translate=None): self.axis = axis self.plane = plane if scale is not None: self.scale = scale if translate is not None: self.translate = translate def draw(self, graphics): """ Draw something on the canvas @param graphics: the graphics object (L{PolyLine3D}, or L{VisualizationGraphics}) to be drawn """ self.last_draw = (graphics, ) self.update() def paintEvent(self, event): graphics = self.last_draw[0] if graphics is None: return graphics.project(self.axis, self.plane) p1, p2 = graphics.boundingBoxPlane() center = 0.5*(p1+p2) scale = self.plotbox_size / (p2-p1) sign = scale/N.fabs(scale) if self.scale is None: minscale = N.minimum.reduce(N.fabs(scale)) self.scale = 0.9*minscale scale = sign*self.scale box_center = self.plotbox_origin + 0.5*self.plotbox_size shift = -center*scale + box_center + self.translate graphics.scaleAndShift(scale, shift) items, depths = graphics.lines() sort = N.argsort(depths) painter = QPainter() painter.begin(self) painter.fillRect(self.rect(), QBrush(self.background_color)) if colors_by_name: for index in sort: x1, y1, x2, y2, color, width = items[index] painter.setPen(QPen(QColor(color), width, Qt.SolidLine)) painter.drawLine(x1, y1, x2, y2) else: for index in sort: x1, y1, x2, y2, color, width = items[index] painter.setPen(QPen(getattr(Qt, color), width, Qt.SolidLine)) painter.drawLine(x1, y1, x2, y2) painter.end() def redraw(self): self.update() def clear(self, keepscale = 0): """ Clear the canvas """ self.last_draw = None if not keepscale: self.scale = None self.update() def mousePressEvent(self, event): button = event.button() x = event.x() y = event.y() if button == Qt.LeftButton: self.click1x = x self.click1y = y self.setCursor(Qt.arrowCursor) elif button == Qt.MidButton: self.click2x = x self.click2y = y self.setCursor(Qt.sizeAllCursor) else: self.click3x = x self.click3y = y self.setCursor(Qt.sizeFDiagCursor) def mouseReleaseEvent(self, event): button = event.button() self.setCursor(Qt.arrowCursor) if button == Qt.LeftButton: try: dx = event.x() - self.click1x dy = event.y() - self.click1y except AttributeError: return if dx != 0 or dy != 0: normal = Vector(self.axis) move = Vector(-dx*self.plane[:,0]+dy*self.plane[:,1]) axis = normal.cross(move) / \ N.minimum.reduce(N.fabs(self.plotbox_size)) rot = Rotation(axis.normal(), axis.length()) self.axis = rot(normal).array self.plane[:,0] = rot(Vector(self.plane[:,0])).array self.plane[:,1] = rot(Vector(self.plane[:,1])).array elif button == Qt.MidButton: try: dx = event.x() - self.click2x dy = event.y() - self.click2y except AttributeError: return if dx != 0 or dy != 0: self.translate = self.translate + N.array([dx, dy]) else: try: dy = event.y() - self.click3y except AttributeError: return if dy != 0: ratio = -dy/self.plotbox_size[1] self.scale = self.scale * (1.+ratio) self.update() if __name__ == '__main__': from Scientific.IO.TextFile import TextFile from Scientific.IO.FortranFormat import FortranFormat, FortranLine import string generic_format = FortranFormat('A6') atom_format = FortranFormat('A6,I5,1X,A4,A1,A3,1X,A1,I4,A1,' + '3X,3F8.3,2F6.2,7X,A4,2A2') # Read the PDB file and make a list of all C-alpha positions def readCAlphaPositions(filename): positions = [] chains = [positions] for line in TextFile(filename): record_type = FortranLine(line, generic_format)[0] if record_type == 'ATOM ' or record_type == 'HETATM': data = FortranLine(line, atom_format) atom_name = string.strip(data[2]) position = N.array(data[8:11]) if atom_name == 'CA': positions.append(position) elif atom_name == 'OXT': positions = [] chains.append(positions) if len(chains[-1]) == 0: del chains[-1] return chains conf = readCAlphaPositions('~/mmtk2/MMTK/Database/PDB/insulin.pdb') colors = ['black', 'red', 'green', 'blue', 'yellow'] colors = (len(conf)*colors)[:len(conf)] objects = [] for chain, color in map(None, conf, colors): objects.append(PolyLine3D(chain, color=color)) graphics = VisualizationGraphics(objects) import sys app = QApplication(sys.argv) c = VisualizationCanvas() c.draw(graphics) app.setMainWidget(c) c.show() app.exec_loop() ScientificPython-2.9.4/Scientific/Signals/0000755000076600000240000000000012270505005021074 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/Signals/__init__.py0000644000076600000240000000002111501734231023177 0ustar hinsenstaff00000000000000# Module Signals ScientificPython-2.9.4/Scientific/Signals/Models.py0000644000076600000240000003055211501734231022677 0ustar hinsenstaff00000000000000# Autoregressive Model for stochastic processes # # Written by Konrad Hinsen # last revision: 2006-11-24 # """ Auto-regressive model for stochastic processes """ from Scientific.Functions.Interpolation import InterpolatingFunction from Scientific.Functions.Polynomial import Polynomial from Scientific.Functions.Rational import RationalFunction from Scientific import N import copy class AutoRegressiveModel: """Auto-regressive model for stochastic process This implementation uses the Burg algorithm to obtain the coefficients of the AR model. """ def __init__(self, order, data, delta_t=1): """ @param order: the order of the model @type order: C{int} @param data: the time series @type data: sequence of C{float} or C{complex} @param delta_t: the sampling interval for the time series @type delta_t: C{float} """ self.order = order self.delta_t = delta_t self._poles = None self._findCoefficients(data) self._setTrajectory(data) def _findCoefficients(self, data): e = data b = data a = N.array([1.]) parcor = [] sigsq = N.add.reduce(abs(data)**2)/len(data) self.variance = sigsq for r in range(self.order): er = e[1:] br = b[:-1] g = 2.*N.add.reduce(er*N.conjugate(br)) / \ N.add.reduce(er*N.conjugate(er)+br*N.conjugate(br)) parcor.append(g) e = er-g*br b = br-N.conjugate(g)*er a = N.concatenate((a, [0.])) a = a - g*N.conjugate(a[::-1]) sigsq = sigsq*(1-abs(g)**2) self.coeff = -a[self.order:0:-1] self.parcor = N.array(parcor) self.sigsq = sigsq self.sigma = N.sqrt(sigsq) def _setTrajectory(self, data): self.trajectory = copy.copy(data[-self.order:]) def predictStep(self): """ Calculates the linear prediction of the next step in the series. This step is appended internally to the current trajectory, making it possible to call this method repeatedly in order to obtain a sequence of predicted steps. @returns: the predicted step @rtype: C{float} or C{complex} """ next = N.add.reduce(self.coeff*self.trajectory) self.trajectory[:-1] = self.trajectory[1:] self.trajectory[-1] = next return next def spectrum(self, omega): """ @param omega: the angular frequencies at which the spectrum is to be evaluated @type omega: C{Numeric.array} of C{float} @returns: the frequency spectrum of the process @rtype: C{Numeric.array} of C{float} """ sum = 1. for i in range(1, len(self.coeff)+1): sum = sum - self.coeff[-i]*N.exp(-1j*i*self.delta_t*omega) s = 0.5*self.delta_t*self.sigsq/(sum*N.conjugate(sum)).real return InterpolatingFunction((omega,), s) def poles(self): """ @returns: the poles of the model in the complex M{z}-plane @rtype: C{Numeric.array} of C{complex} """ if self._poles is None: from Scientific.LA import eigenvalues n = len(self.coeff) if n == 1: self._poles = self.coeff else: a = N.zeros_st((n, n), self.coeff) a[1:, :-1] = N.identity(n-1) a[:, -1] = self.coeff self._poles = eigenvalues(a) return self._poles def correlation(self, nsteps): """ @param nsteps: the number of time steps for which the autocorrelation function is to be evaluated @type nsteps: C{int} @returns: the autocorrelation function of the process as estimated from the AR model @rtype: L{Scientific.Functions.Interpolation.InterpolatingFunction} """ poles = self.poles() cpoles = N.conjugate(poles) x = 0. exponents = N.arange(self.order-1, nsteps+self.order-1) for i in range(len(poles)): pole = poles[i] factor = N.multiply.reduce((pole-poles)[:i]) * \ N.multiply.reduce((pole-poles)[i+1:]) * \ N.multiply.reduce((pole-1./cpoles)) try: x = x + pole**exponents / factor except OverflowError: # happens with some Python versions on some systems power = N.zeros(exponents.shape, N.Complex) for i in range(len(exponents)): try: power[i] = pole**exponents[i] except ValueError: pass x = x + power/factor cf = -self.sigsq*x/N.conjugate(self.coeff[0]) if not _isComplex(self.coeff): cf = _realPart(cf) return InterpolatingFunction((self.delta_t*N.arange(nsteps),), cf) def memoryFunctionZ(self): """ @returns: the M{z}-transform of the process' memory function @rtype: L{Scientific.Function.Rational.RationalFunction} """ poles = self.poles() cpoles = N.conjugate(poles) coeff0 = N.conjugate(self.coeff[0]) beta = N.zeros((self.order,), N.Complex) for i in range(self.order): pole = poles[i] beta[i] = -(self.sigsq*pole**(self.order-1)/coeff0) / \ (N.multiply.reduce((pole-poles)[:i]) * N.multiply.reduce((pole-poles)[i+1:]) * N.multiply.reduce(pole-1./cpoles) * self.variance) beta = beta/N.sum(beta) sum = 0. for i in range(self.order): sum = sum + RationalFunction([beta[i]], [-poles[i], 1.]) mz = (1./sum+Polynomial([1., -1.]))/self.delta_t**2 if not _isComplex(self.coeff): mz.numerator.coeff = _realPart(mz.numerator.coeff) mz.denominator.coeff = _realPart(mz.denominator.coeff) return mz def memoryFunctionZapprox(self, den_order): """ @param den_order: @type den_order: C{int} @returns: an approximation to the M{z}-transform of the process' memory function that correponds to an expansion of the denominator up to order den_order @rtype: L{Scientific.Function.Rational.RationalFunction} """ poles = self.poles() cpoles = N.conjugate(poles) coeff0 = N.conjugate(self.coeff[0]) beta = N.zeros((self.order,), N.Complex) for i in range(self.order): pole = poles[i] beta[i] = -(self.sigsq*pole**(self.order-1)/coeff0) / \ (N.multiply.reduce((pole-poles)[:i]) * N.multiply.reduce((pole-poles)[i+1:]) * N.multiply.reduce(pole-1./cpoles) * self.variance) beta = beta/N.sum(beta) den_coeff = [] for i in range(den_order): sum = 0. for j in range(self.order): sum += beta[j]*poles[j]**i den_coeff.append(sum) den_coeff.reverse() mz = (RationalFunction(den_order*[0.] + [1.], den_coeff) + Polynomial([1., -1.]))/self.delta_t**2 if not _isComplex(self.coeff): mz.numerator.coeff = _realPart(mz.numerator.coeff) mz.denominator.coeff = _realPart(mz.denominator.coeff) return mz def memoryFunction(self, nsteps): """ @param nsteps: the number of time steps for which the memory function is to be evaluated @type nsteps: C{int} @returns: the memory function of the process as estimated from the AR model @rtype: L{Scientific.Functions.Interpolation.InterpolatingFunction} """ mz = self.memoryFunctionZapprox(nsteps+self.order) mem = mz.divide(nsteps-1)[0].coeff[::-1] if len(mem) == nsteps+1: mem = mem[1:] mem[0] = 2.*_realPart(mem[0]) time = self.delta_t*N.arange(nsteps) return InterpolatingFunction((time,), mem) def frictionConstant(self): """ @returns: the friction constant of the process, i.e. the integral over the memory function """ poles = self.poles() cpoles = N.conjugate(poles) coeff0 = N.conjugate(self.coeff[0]) beta = N.zeros((self.order,), N.Complex) for i in range(self.order): pole = poles[i] beta[i] = -(self.sigsq*pole**(self.order-1)/coeff0) / \ (N.multiply.reduce((pole-poles)[:i]) * N.multiply.reduce((pole-poles)[i+1:]) * N.multiply.reduce(pole-1./cpoles) * self.variance) beta = beta/N.sum(beta) sum = 0. for i in range(self.order): sum = sum + beta[i]/(1.-poles[i]) if not _isComplex(self.coeff): sum = _realPart(sum) return 1./(sum*self.delta_t) class AveragedAutoRegressiveModel(AutoRegressiveModel): """Averaged auto-regressive model for stochastic process An averaged model is constructed by averaging the model coefficients of several auto-regressive models of the same order. An averaged model is created empty, then individual models are added. """ def __init__(self, order, delta_t): """ @param order: the order of the model @type order: C{int} @param delta_t: the sampling interval for the time series @type delta_t: C{float} """ self.order = order self.delta_t = delta_t self.weight = 0. self.coeff = N.zeros((order,), N.Float) self.sigsq = 0. self.variance = 0. self.sigma = 0. self._poles = None def add(self, model, weight=1): """ Adds the coefficients of an autoregressive model to the average. @param model: an autoregressive model @type model: L{AutoRegressiveModel} @param weight: the weight of the model in the average @type weight: C{float} @raise ValueError: if the order of the model does not match the order of the average model """ if self.order != model.order: raise ValueError("model orders not equal") nw = self.weight + weight self.coeff = (self.weight*self.coeff + weight*model.coeff)/nw self.sigsq = (self.weight*self.sigsq + weight*model.sigsq)/nw self.sigma = N.sqrt(self.sigsq) self.variance = (self.weight*self.variance + weight*model.variance)/nw self.weight = nw self._poles = None # Check if data is complex def _isComplex(x): try: x.imag return 1 except (AttributeError, ValueError): return 0 # Return real part def _realPart(x): try: return x.real except (AttributeError, ValueError): return x if __name__ == '__main__': import FFT def AutoCorrelationFunction(series): n = 2*len(series) FFTSeries = FFT.fft(series,n,0) FFTSeries = FFTSeries*N.conjugate(FFTSeries) FFTSeries = FFT.inverse_fft(FFTSeries,len(FFTSeries),0) return FFTSeries[:len(series)]/(len(series)-N.arange(len(series))) from MMTK.Random import gaussian from Scientific.Statistics import mean from Scientific.IO.ArrayIO import readArray from Gnuplot import plot from RandomArray import random dt = 1. t = dt*N.arange(500) if 1: data = N.sin(t) + N.cos(3.*t) + 0.1*(random(len(t))-0.5) data = data + 0.1j*(random(len(t))-0.5) if 0: data = [0.] for i in range(500+len(t)-1): data.append(mean(data[-500:]) + gaussian(0., 0.1)) data = N.exp(1j*N.array(data[500:])) if 0: #data = readArray('~/scientific/Test/data') string = open('/users1/hinsen/scientific/Test/data').read()[4:] data = N.array(eval(string)) data = data[:,0] model = AutoRegressiveModel(20, data, dt) print model.coeff print model.poles() c = model.correlation(200) cref = InterpolatingFunction((t,), AutoCorrelationFunction(data))[:200] m = model.memoryFunction(200) s = model.spectrum(N.arange(0., 5., 0.01)) #plot(c.real, cref.real); plot(c.imag, cref.imag) print model.frictionConstant(), model.memoryFunctionZ()(1.), m.definiteIntegral() #plot(m.real, m.imag) plot(m) ScientificPython-2.9.4/Scientific/Statistics/0000755000076600000240000000000012270505005021626 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/Statistics/__init__.py0000644000076600000240000001210011501734231023732 0ustar hinsenstaff00000000000000# Basic statistics functions. # # Written by Konrad Hinsen # With contributions from Moshe Zadka # last revision: 2006-5-28 # """ Basic monovariate statistics """ from Scientific import N # # Univariate statistics functions # def moment(data, order, about=None, theoretical=1): """ Calculate the moments of the distribution corresponding to a set of data @param data: a sequence of data points @type data: C{Numeric.array} of numbers @param order: the order of the moment to be calculated @type order: C{int} @param about: the center of the distribution. If C{None}, use the mean value as the center. @type about: number @param theoretical: for internal use @returns: the moment of the given order about the specified center @rtype: number """ data = 1.*N.array(data) if about is None: about = mean(data) theoretical = 0 ln = len(data)-(1-theoretical) return 1.*N.add.reduce((data-about)**order)/ln def mean(data): """ Mean (average value, first moment) @param data: a sequence of numbers @type data: C{list} or C{Numeric.array} @returns: the mean of the number sequence @rtype: number """ return moment(data, 1, 0) average = mean def weightedMean(data, sigma): """ Weighted mean of a sequence of numbers with given standard deviations @param data: a sequence of measurements @type data: C{list} or C{Numeric.array} @param sigma: a sequence of corresponding standard deviations @type sigma: C{list} or C{Numeric.array} @returns: the weighted mean and corresponding standard deviation @rtype: C{tuple} of two elements """ if len(data) != len(sigma): raise ValueError data = 1.*N.array(data) sigma = 1.*N.array(sigma) nom = N.sum(data/sigma**2) denom = N.sum(1./sigma**2) mean = nom / denom sig = N.sqrt(1./denom) return mean, sig def variance(data): """ Variance (second moment) @param data: a sequence of numbers @type data: C{list} or C{Numeric.array} @returns: the variance of the number sequence @rtype: number """ return moment(data, 2) def standardDeviation(data): """ Standard deviation @param data: a sequence of numbers @type data: C{list} or C{Numeric.array} @returns: the standard deviation of the number sequence @rtype: number """ return N.sqrt(variance(data)) def median(data): """ Median @param data: a sequence of numbers @type data: C{list} or C{Numeric.array} @returns: the median of the number sequence @rtype: number """ data = N.sort(N.array(data)) l = (len(data)-1)/2. return (data[int(N.floor(l))]+data[int(N.ceil(l))])/2. def mode(data): h = {} for n in data: try: h[n] = h[n]+1 except KeyError: h[n] = 1 a = map(lambda x: (x[1], x[0]), h.items()) return max(a)[1] def normalizedMoment(data, order): """ Calculate the normalized moments of the distribution corresponding to a set of data. Normalization means division by the n-th power of the standard deviation. @param data: a sequence of data points @type data: C{Numeric.array} of numbers @param order: the order of the moment to be calculated @type order: C{int} @returns: the normalized moment of the given order @rtype: number """ mn = mean(data) return moment(data, order, mn)/N.sqrt(moment(data, 2, mn)**order) def skewness(data): """ Skewness (third normalized moment) @param data: a sequence of numbers @type data: C{list} or C{Numeric.array} @returns: the skewness of the number sequence @rtype: number """ return normalizedMoment(data, 3) def kurtosis(data): """ Kurtosis (fourth normalized moment) @param data: a sequence of numbers @type data: C{list} or C{Numeric.array} @returns: the kurtosis of the number sequence @rtype: number """ return normalizedMoment(data, 4) ## def chiSquare(data): ## h = {} ## for n in data: ## try: h[n] = h[n]+1 ## except KeyError: h[n] = 1 ## h = N.array(h.values()) ## h = h/N.add.reduce(h) ## return moment(h, 2, 1./len(h)) def correlation(data1, data2): """ Calculates the correlation coefficient between two data sequences @param data1: first data sequence @type data1: C{Numeric.array} or C{list} @param data2: second data sequence of length identical to data1 @type data2: C{Numeric.array} or C{list} @returns: the correlation coefficient between data1 and data2 @rtype: number @raises ValueError: if data1 and data2 have different lengths """ if len(data1) != len(data2): raise ValueError("data series must have equal length") data1 = N.array(data1) data2 = N.array(data2) data1 = data1 - N.add.reduce(data1)/len(data1) data2 = data2 - N.add.reduce(data2)/len(data2) return N.add.reduce(data1*data2) / \ N.sqrt(N.add.reduce(data1*data1) \ * N.add.reduce(data2*data2)) ScientificPython-2.9.4/Scientific/Statistics/Histogram.py0000644000076600000240000002226511501734231024145 0ustar hinsenstaff00000000000000# Histograms. # # Written by Konrad Hinsen # Contributions by Hans-Petter Langtangen # last revision: 2008-8-20 # """ Standard and weighted histograms """ from Scientific import N class Histogram: """ Histogram in one variable The bin index and the number of points in a bin can be obtained by indexing the histogram with the bin number. Application of len() yields the number of bins. A histogram thus behaves like a sequence of bin index - bin count pairs. Here is an example on usage: >>> nsamples = 1000 >>> from numpy import random >>> data = random.normal(1.0, 0.5, nsamples) >>> import Scientific.Statistics as S >>> S.mean(data) 0.9607056871982641 >>> S.standardDeviation(data) 0.50251811830486681 >>> S.median(data) 0.94853870756924152 >>> S.skewness(data) # should be 0 0.038940041870334556 >>> S.kurtosis(data) # should be 3 2.865582791273765 >>> >>> from Scientific.Statistics.Histogram import Histogram >>> h = Histogram(data, 50) # use 50 bins between min & max samples >>> h.normalizeArea() # make probabilities in histogram >>> h[3] # bin index and frequency in the 4th bin array([-0.45791018, 0.01553658]) >>> x = h.getBinIndices() >>> y = h.getBinCounts() >>> # can plot the y vector against the x vector (see below) >>> >>> # add many more samples: >>> nsamples2 = nsamples*100 >>> data = random.normal(1.0, 0.5, nsamples2) >>> h.addData(data) >>> h.normalizeArea() >>> x2 = h.getBinIndices() >>> y2 = h.getBinCounts() >>> plot (x,y) and (x2,y2): >>> import Gnuplot >>> g = Gnuplot.Gnuplot(persist=1) >>> g.xlabel('sample value'); g.ylabel('probability') >>> d1 = Gnuplot.Data(x, y, with='lines', ... title='%d samples' % nsamples) >>> d2 = Gnuplot.Data(x2, y2, with='lines', ... title='%d samples' % nsamples2) >>> g.plot(d1,d2) """ def __init__(self, data, nbins, range=None): """ @param data: a sequence of data points @type data: C{Numeric.array} of C{float} or C{int} @param nbins: the number of bins into which the data is to be sorted @type nbins: C{int} @param range: a tuple of two values, specifying the lower and the upper end of the interval spanned by the bins. Any data point outside this interval will be ignored. If no range is given, the smallest and largest data values are used to define the interval. @type range: C{tuple} or C{NoneType} """ self._setup(data, nbins, range) self.addData(data) def _setup(self, data, nbins, range): if range is None: self.min = N.minimum.reduce(data) self.max = N.maximum.reduce(data) else: self.min, self.max = range self.min = self.min+0. self.max = self.max+0. self.bin_width = (self.max-self.min)/nbins self.array = N.zeros((nbins, 2), N.Float) self.array[:, 0] = self.min + self.bin_width*(N.arange(nbins)+0.5) def __len__(self): """ @returns: the number of bins @rtype: C{int} """ return self.array.shape[0] def __getitem__(self, index): """ @param index: a bin index @type index: C{int} @returns: an array of shape (2,) containing the bin value and the bin count """ return self.array[index] def __getslice__(self, first, last): return self.array[first:last] def getBinIndices(self): """Return an array of all the bin indices.""" return self.array[:,0].copy() def getBinCounts(self): """Return an array of all the bin counts.""" return self.array[:,1].copy() def addData(self, data): """ Add values to the originally supplied data sequence. Use this method to feed long data sequences in multiple parts to avoid memory shortages. @param data: a sequence of data points @type data: C{Numeric.array} @Note: this does not affect the default range of the histogram, which is fixed when the histogram is created. """ n = (len(data)+999)/1000 for i in range(n): self._addData(data[1000*i:1000*(i+1)]) def _addData(self, data): data = N.array(data, N.Float) data = N.repeat(data, N.logical_and(N.less_equal(data, self.max), N.greater_equal(data, self.min))) data = N.floor((data - self.min)/self.bin_width).astype(N.Int) nbins = self.array.shape[0] histo = N.int_sum(N.equal(N.arange(nbins)[:,N.NewAxis], data), -1) histo[-1] = histo[-1] + N.int_sum(N.equal(nbins, data)) self.array[:, 1] = self.array[:, 1] + histo def normalize(self, norm=1.): """ Scale all bin counts by the same factor @param norm: the sum of all bin counts after the rescaling @type norm: C{float} or C{int} """ self.array[:, 1] = norm*self.array[:, 1]/N.add.reduce(self.array[:, 1]) def normalizeArea(self, norm=1.): """ Scale all bin counts by the same factor @param norm: the area under the histogram after the rescaling @type norm: C{float} or C{int} """ self.normalize(norm/self.bin_width) class WeightedHistogram(Histogram): """ Weighted histogram in one variable Constructor: WeightedHistogram(|data|, |weights|, |bins|, |range|=None) Arguments: In a weighted histogram, each point has a specific weight. If all weights are one, the result is equivalent to a standard histogram. The bin index and the number of points in a bin can be obtained by indexing the histogram with the bin number. Application of len() yields the number of bins. A histogram thus behaves like a sequence of bin index - bin count pairs. """ def __init__(self, data, weights, nbins, range=None): """ @param data: a sequence of data points @type data: C{Numeric.array} @param weights: a sequence of weights, same length as data @type weights: C{Numeric.array} @param nbins: the number of bins into which the data is to be sorted @type nbins: C{int} @param range: a tuple of two values, specifying the lower and the upper end of the interval spanned by the bins. Any data point outside this interval will be ignored. If no range is given, the smallest and largest data values are used to define the interval. @type range: C{tuple} or C{NoneType} """ if len(data) != len(weights): raise ValueError("wrong number of weights") self._setup(data, nbins, range) self.addData(data, weights) def addData(self, data, weights): """ Add values to the originally supplied data sequence. Use this method to feed long data sequences in multiple parts to avoid memory shortages. @param data: a sequence of data points @type data: C{Numeric.array} @Note: this does not affect the default range of the histogram, which is fixed when the histogram is created. """ if len(data) != len(weights): raise ValueError("wrong number of weights") n = (len(data)+999)/1000 for i in range(n): self._addData(data[1000*i:1000*(i+1)], weights[1000*i:1000*(i+1)]) def _addData(self, data, weights): data = N.array(data, N.Float) weights = N.array(weights, N.Float) mask = N.logical_and(N.less_equal(data, self.max), N.greater_equal(data, self.min)) data = N.repeat(data, mask) weights = N.repeat(weights, mask) data = N.floor((data - self.min)/self.bin_width).astype(N.Int) nbins = self.array.shape[0] histo = N.add.reduce(weights*N.equal(N.arange(nbins)[:,N.NewAxis], data), -1) histo[-1] = histo[-1] + N.add.reduce(N.repeat(weights, N.equal(nbins, data))) self.array[:, 1] = self.array[:, 1] + histo if __name__ == '__main__': if N.package == 'Numeric': import RandomArray as random elif N.package == 'NumPy': from numpy import random nsamples = 1000 random.seed(12,13) data = random.normal(1.0, 0.5, nsamples) h = Histogram(data, 50) # use 50 bins between min & max samples h.normalizeArea() # make probabilities in histogram x = h.getBinIndices() y = h.getBinCounts() # add many more samples: nsamples2 = nsamples*100 data = random.normal(1.0, 0.5, nsamples2) h.addData(data) h.normalizeArea() x2 = h.getBinIndices() y2 = h.getBinCounts() # and more: nsamples3 = nsamples*1000 data = random.normal(1.0, 0.5, nsamples3) h.addData(data) h.normalizeArea() x3 = h.getBinIndices() y3 = h.getBinCounts() ScientificPython-2.9.4/Scientific/Threading/0000755000076600000240000000000012270505005021401 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/Threading/__init__.py0000644000076600000240000000001511501734231023507 0ustar hinsenstaff00000000000000# Empty file ScientificPython-2.9.4/Scientific/Threading/TaskManager.py0000644000076600000240000001167311501734231024161 0ustar hinsenstaff00000000000000# This module provides a simple task manager for running parallel # calculations on shared-memory machines. # # Written by Konrad Hinsen # last revision: 2006-6-12 # """ Parallel task manager for shared-memory multiprocessor machines @undocumented: Task """ import threading class TaskManager: """ Parallel task manager for shared-memory multiprocessor machines This class provides a rather simple way to profit from shared-memory multiprocessor machines by running several tasks in parallel. The calling program decides how many execution threads should run at any given time, and then feeds compute tasks to the task manager, who runs them as soon as possible without exceeding the maximum number of threads. The major limitation of this approach lies in Python's Global Interpreter Lock. This effectively means that no more than one Python thread can run at the same time. Consequently, parallelization can only be achieved if the tasks to be parallelized spend significant time in C extension modules that release the Global Interpreter Lock. """ def __init__(self, nthreads): """ @param nthreads: the maximum number of compute threads that should run in parallel. Note: This does not include the main thread which generated and feeds the task manager! @type nthreads: C{int} """ self.nthreads = nthreads self.waiting_tasks = [] self.running_tasks = [] self.lock = threading.Lock() self.data_lock = threading.Lock() self.can_run = threading.Condition(self.lock) self.can_submit = threading.Condition(self.lock) self.task_available = threading.Condition(self.lock) self.scheduler = threading.Thread(target=self._scheduler) self.scheduler.start() def runTask(self, function, args): """ Run a task as soon as processing capacity becomes available @param function: the function that will be executed as the body of the task @type function: callable @param args: the arguments that will be passed to function when it is called. An additional argument will be added at the end: a lock object that the task can use to get temporarily exclusive access to data shared with other tasks. @type args: C{tuple} """ self.can_submit.acquire() if len(self.waiting_tasks) >= self.nthreads: self.can_submit.wait() self.can_submit.release() task = Task(self, function, args + (self.data_lock,)) self.task_available.acquire() self.waiting_tasks.append(task) self.task_available.notify() self.task_available.release() def terminate(self): """ Wait until all tasks have finished """ self.task_available.acquire() self.waiting_tasks.append(None) self.task_available.notify() self.task_available.release() self.scheduler.join() done = 0 while not done: self.can_run.acquire() if self.running_tasks: self.can_run.wait() done = len(self.running_tasks) == 0 self.can_run.release() def _removeTask(self, task): self.can_run.acquire() self.running_tasks.remove(task) self.can_run.notifyAll() self.can_run.release() def _scheduler(self): while 1: self.task_available.acquire() if not self.waiting_tasks: self.task_available.wait() self.task_available.release() self.can_run.acquire() while len(self.running_tasks) >= self.nthreads: self.can_run.wait() task = self.waiting_tasks[0] del self.waiting_tasks[0] if task is not None: self.running_tasks.append(task) task.start() self.can_submit.notify() self.can_run.release() if task is None: break class Task(threading.Thread): def __init__(self, manager, function, args): self.__task_manager = manager self.__function = function self.__args = args threading.Thread.__init__(self) def run(self): apply(self.__function, self.__args) self.__task_manager._removeTask(self) # Test code if __name__ == '__main__': import time from random import randint def dummy(n, results, lock): print n, "running" time.sleep(randint(1, 5)) lock.acquire() results.append(n) lock.release() print n, "finished" m = TaskManager(2) results = [] for i in range(5): m.runTask(dummy, (i, results)) m.terminate() print "All finished" print results ScientificPython-2.9.4/Scientific/TkWidgets/0000755000076600000240000000000012270505005021401 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/TkWidgets/__init__.py0000644000076600000240000000122611501734232023515 0ustar hinsenstaff00000000000000# Package Scientific.TkWidgets """ @undocumented: Utility """ from Utility import FilenameEntry, FloatEntry, IntEntry, ButtonBar, StatusBar from Utility import ModalDialog import sys if sys.modules.has_key('epydoc'): import Utility utility_name = Utility.__name__ FilenameEntry.__module__ = 'Scientific.TkWidgets' FloatEntry.__module__ = 'Scientific.TkWidgets' IntEntry.__module__ = 'Scientific.TkWidgets' ButtonBar.__module__ = 'Scientific.TkWidgets' StatusBar.__module__ = 'Scientific.TkWidgets' ModalDialog.__module__ = 'Scientific.TkWidgets' Utility.__name__ = utility_name del Utility del utility_name del sys ScientificPython-2.9.4/Scientific/TkWidgets/TkPlotCanvas.py0000644000076600000240000007047412270504100024333 0ustar hinsenstaff00000000000000# This module defines a plot widget for Tk user interfaces. # It supports only elementary line plots at the moment. # See the example at the end for documentation... # # Written by Konrad Hinsen # With contributions from RajGopal Srinivasan # Last revision: 2006-6-12 # """ Plot widget for Tk user interfaces A plot widget acts like a canvas for special graphics objects that represent curves shown by lines or markers. Note that this module is not meant to replace a full-featured plot program. It was designed to permit the simple integration of plots into Tk-based user interfaces. """ import Tkinter from Scientific import N from Canvas import Line, CanvasText import string class PolyPoints: def __init__(self, points, attr): self.points = N.array(points) self.scaled = self.points self.attributes = {} for name, value in self._attributes.items(): try: value = attr[name] except KeyError: pass self.attributes[name] = value def boundingBox(self): return N.minimum.reduce(self.points), \ N.maximum.reduce(self.points) def scaleAndShift(self, scale=1, shift=0): self.scaled = scale*self.points+shift def writeToFile(self, file, separator): if self.points: for p in self.points: file.write(`p[0]` + ' ' + `p[1]` + '\n') return 1 else: return 0 class PolyLine(PolyPoints): """ Multiple connected lines @undocumented: draw """ def __init__(self, points, **attr): """ @param points: any sequence of (x, y) number pairs @param attr: line attributes @keyword width: the line width (default: 1) @keyword color: a string whose value is one of the color names defined in Tk (default: C{"black"}) @keyword stipple: a string whose value is the name of a bitmap defined in Tk, or C{None} for no bitmap (default: C{None}) """ PolyPoints.__init__(self, points, attr) _attributes = {'color': 'black', 'width': 1, 'stipple': None} def draw(self, canvas, bbox): if len(self.points) > 1: color = self.attributes['color'] width = self.attributes['width'] stipple = self.attributes['stipple'] arguments = (canvas,) options = {'fill': color, 'width': width} if stipple: options['stipple'] = stipple for i in range(len(self.points)-1): x1, y1 = self.scaled[i] x2, y2 = self.scaled[i+1] arguments = arguments + (x1, y1, x2, y2) apply(Line, arguments, options) class VerticalLine(PolyLine): """ A vertical line """ def __init__(self, xpos, **attr): """ @param xpos: the x coordinate of the line @type xpos: C{float} @param attr: line attributes @keyword width: the line width (default: 1) @keyword color: a string whose value is one of the color names defined in Tk (default: C{"black"}) @keyword stipple: a string whose value is the name of a bitmap defined in Tk, or C{None} for no bitmap (default: C{None}) """ apply(PolyLine.__init__, (self, 2*[(xpos, 0.)]), attr) def draw(self, canvas, bbox): self.scaled[0, 1] = bbox[0][1] self.scaled[1, 1] = bbox[1][1] PolyLine.draw(self, canvas, bbox) def writeToFile(self, file, separator): return 0 class HorizontalLine(PolyLine): """ A horizontal line """ def __init__(self, ypos, **attr): """ @param ypos: the y coordinate of the line @type ypos: C{float} @param attr: line attributes @keyword width: the line width (default: 1) @keyword color: a string whose value is one of the color names defined in Tk (default: C{"black"}) @keyword stipple: a string whose value is the name of a bitmap defined in Tk, or C{None} for no bitmap (default: C{None}) """ apply(PolyLine.__init__, (self, 2*[(0., ypos)]), attr) def draw(self, canvas, bbox): self.scaled[0, 0] = bbox[0][0] self.scaled[1, 0] = bbox[1][0] PolyLine.draw(self, canvas, bbox) def writeToFile(self, file, separator): return 0 class PolyMarker(PolyPoints): """ Series of markers """ def __init__(self, points, **attr): """ @param points: any sequence of (x, y) number pairs @param attr: marker attributes @keyword width: the line width for drawing the marker (default: 1) @keyword color: a string whose value is one of the color names defined in Tk, defines the color of the line forming the marker (default: C{"black"}) @keyword fillcolor: a string whose value is one of the color names defined in Tk, defines the color of the interior of the marker (default: C{"black"}) @keyword marker: one of C{'circle'} (default), C{'dot'}, C{'square'}, C{'triangle'}, C{'triangle_down'}, C{'cross'}, C{'plus'} """ PolyPoints.__init__(self, points, attr) _attributes = {'color': 'black', 'width': 1, 'fillcolor': 'black', 'size': 2, 'fillstyle': '', # need to make this a meaningful option. 'marker': 'circle'} def draw(self, canvas, bbox): color = self.attributes['color'] size = self.attributes['size'] fillcolor = self.attributes['fillcolor'] marker = self.attributes['marker'] fillstyle = self.attributes['fillstyle'] self._drawmarkers(canvas, self.scaled, marker, color, fillstyle, fillcolor, size) def _drawmarkers(self, c, coords, marker='circle', color='black', fillstyle='', fillcolor='', size=2): l = [] f = getattr(self, '_' + marker) for xc, yc in coords: id = f(c, xc, yc, outline=color, size=size, fill=fillcolor, fillstyle=fillstyle) if type(id) is type(()): for item in id: l.append(item) else: l.append(id) return l def _circle(self, c, xc, yc, size=1, fill='', outline='black', fillstyle=''): id = c.create_oval(xc-0.5, yc-0.5, xc+0.5, yc+0.5, fill=fill, outline=outline, stipple=fillstyle) c.scale(id, xc, yc, size*5, size*5) return id def _dot(self, c, xc, yc, size=1, fill='', outline='black', fillstyle=''): id = c.create_oval(xc-0.5, yc-0.5, xc+0.5, yc+0.5, fill=fill, outline=outline, stipple=fillstyle) c.scale(id, xc, yc, size*2.5, size*2.5) return id def _square(self, c, xc, yc, size=1, fill='', outline='black', fillstyle=''): id = c.create_rectangle(xc-0.5, yc-0.5, xc+0.5, yc+0.5, fill=fill, outline=outline, stipple=fillstyle) c.scale(id, xc, yc, size*5, size*5) return id def _triangle(self, c, xc, yc, size=1, fill='', outline='black', fillstyle=''): id = c.create_polygon(-0.5, 0.288675134595, 0.5, 0.288675134595, 0.0, -0.577350269189, fill=fill, outline=outline, stipple=fillstyle) c.move(id, xc, yc) c.scale(id, xc, yc, size*5, size*5) return id def _triangle_down(self, c, xc, yc, size=1, fill='', outline='black', fillstyle=''): id = c.create_polygon(-0.5, -0.288675134595, 0.5, -0.288675134595, 0.0, 0.577350269189, fill=fill, outline=outline, stipple=fillstyle) c.move(id, xc, yc) c.scale(id, xc, yc, size*5, size*5) return id def _cross(self, c, xc, yc, size=1, fill='black', outline=None, fillstyle=''): if outline: fill=outline id1 = c.create_line(xc-0.5, yc-0.5, xc+0.5, yc+0.5, fill=fill) id2 = c.create_line(xc-0.5, yc+0.5, xc+0.5, yc-0.5, fill=fill) c.scale(id1, xc, yc, size*5, size*5) c.scale(id2, xc, yc, size*5, size*5) return id1, id2 def _plus(self, c, xc, yc, size=1, fill='black', outline=None, fillstyle=''): if outline: fill=outline id1 = c.create_line(xc-0.5, yc, xc+0.5, yc, fill=fill) id2 = c.create_line(xc, yc+0.5, xc, yc-0.5, fill=fill) c.scale(id1, xc, yc, size*5, size*5) c.scale(id2, xc, yc, size*5, size*5) return id1, id2 class PlotGraphics: """ Compound graphics object @undocumented: boundingBox @undocumented: scaleAndShift @undocumented: draw @undocumented: writeToFile """ def __init__(self, objects): """ @param objects: a list of graphics objects (L{PolyLine}, L{PolyMarker}, L{PlotGraphics}) @type objects: C{list} """ self.objects = objects def boundingBox(self): p1, p2 = self.objects[0].boundingBox() for o in self.objects[1:]: p1o, p2o = o.boundingBox() p1 = N.minimum(p1, p1o) p2 = N.maximum(p2, p2o) return p1, p2 def scaleAndShift(self, scale=1, shift=0): for o in self.objects: o.scaleAndShift(scale, shift) def draw(self, canvas, bbox): for o in self.objects: o.draw(canvas, bbox) def __len__(self): return len(self.objects) def __getitem__(self, item): return self.objects[item] def writeToFile(self, file, separator): data = 0 for o in self.objects: if data: file.write(separator) data = o.writeToFile(file, separator) class PlotCanvas(Tkinter.Frame): """ Tk plot widget PlotCanvas objects support all operations of Tk widgets. """ def __init__(self, master, width, height, background='white', font="-*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*", **attr): """ @param master: the parent widget @param width: the initial width of the canvas @type width: C{int} @param height: the initial height of the canvas @type height: C{int} @param background: the background color @type background: C{str} @param font: the font used for the axis labels @type font: C{str} @param attr: widget attributes @keyword zoom: a flag that indicates whether interactive zooming (using the left mouse button) is enabled; the default is C{False} (no zoom) @type zoom: C{bool} @keyword select: enables the user to select a range along the x axis by dragging the mouse (with the left button pressed) in the area B{under} the x axis. If select is 0, no selection is possible. Otherwise the value of select must be a callable object that is called whenever the selection changes, with a single argument that can be C{None} (no selection) or a tuple containing two x values. """ self.zoom = 0 if attr.has_key('zoom'): self.zoom = attr['zoom'] del attr['zoom'] self.selectfn = None if attr.has_key('select'): self.selectfn = attr['select'] del attr['select'] apply(Tkinter.Frame.__init__, (self, master), attr) self.canvas = Tkinter.Canvas(self, width=width, height=height, background=background) self.canvas.pack(fill=Tkinter.BOTH, expand=Tkinter.YES) border_w = self.canvas.winfo_reqwidth() - \ string.atoi(self.canvas.cget('width')) border_h = self.canvas.winfo_reqheight() - \ string.atoi(self.canvas.cget('height')) self.border = (border_w, border_h) self.canvas.bind('', self.reconfigure) if self.zoom or self.selectfn is not None: self.mouse_state = 0 self.canvas.bind('', self._mousePressed) self.canvas.bind('', self._mouseMotion) self.canvas.bind('', self._mouseRelease) self.popup_menu = Tkinter.Menu(self.canvas, tearoff=0) self.label = None self.canvas.bind('', self._showValue) self.canvas.bind('', self._hideValue) self.popup_menu.add_command(label='Auto Scale', command=self._autoScale) self.popup_menu.add_command(label='Run Xmgrace', command=self._xmgr) self.canvas.bind('', self._popupMenu) self._setsize() self.last_draw = None self.font = self._testFont(font) self.rubberband = None self.rectangle = None self.selected_range = None def reconfigure(self, event): new_width = event.width-self.border[0] new_height = event.height-self.border[1] width = string.atoi(self.canvas.cget('width')) height = string.atoi(self.canvas.cget('height')) if new_width == width and new_height == height: return self.canvas.configure(width=new_width, height=new_height) self._setsize() self.clear() self.redraw() def bind(self, *args): apply(self.canvas.bind, args) def _testFont(self, font): if font is not None: bg = self.canvas.cget('background') try: item = CanvasText(self.canvas, 0, 0, anchor=Tkinter.NW, text='0', fill=bg, font=font) self.canvas.delete(item) except Tkinter.TclError: font = None return font def _setsize(self): self.width = string.atoi(self.canvas.cget('width')) self.height = string.atoi(self.canvas.cget('height')) self.plotbox_size = 0.97*N.array([self.width, -self.height]) xo = 0.5*(self.width-self.plotbox_size[0]) yo = self.height-0.5*(self.height+self.plotbox_size[1]) self.plotbox_origin = N.array([xo, yo]) def draw(self, graphics, xaxis = None, yaxis = None): """ Draw something on the canvas @param graphics: the graphics object (L{PolyLine}, L{PolyMarker}, or L{PlotGraphics}) to be drawn @param xaxis: C{None} (no x-axis), C{"automatic"} (automatic scaling), or a pair (x1, x2) defining the range of the x-axis @param yaxis: C{None} (no y-axis), C{"automatic"} (automatic scaling), or a pair (y1, y2) defining the range of the y-axis """ self.last_draw = (graphics, xaxis, yaxis) p1, p2 = graphics.boundingBox() xaxis = self._axisInterval(xaxis, p1[0], p2[0]) yaxis = self._axisInterval(yaxis, p1[1], p2[1]) text_width = [0., 0.] text_height = [0., 0.] if xaxis is not None: p1[0] = xaxis[0] p2[0] = xaxis[1] xticks = self._ticks(xaxis[0], xaxis[1]) bb = self._textBoundingBox(xticks[0][1]) text_height[1] = bb[3]-bb[1] text_width[0] = 0.5*(bb[2]-bb[0]) bb = self._textBoundingBox(xticks[-1][1]) text_width[1] = 0.5*(bb[2]-bb[0]) else: xticks = None if yaxis is not None: p1[1] = yaxis[0] p2[1] = yaxis[1] yticks = self._ticks(yaxis[0], yaxis[1]) for y in yticks: bb = self._textBoundingBox(y[1]) w = bb[2]-bb[0] text_width[0] = max(text_width[0], w) h = 0.5*(bb[3]-bb[1]) text_height[0] = h text_height[1] = max(text_height[1], h) else: yticks = None text1 = N.array([text_width[0], -text_height[1]]) text2 = N.array([text_width[1], -text_height[0]]) scale = (self.plotbox_size-text1-text2) / (p2-p1) shift = -p1*scale + self.plotbox_origin + text1 self.transformation = (scale, shift) self.bbox = (p1, p2) self._drawAxes(self.canvas, xaxis, yaxis, p1, p2, scale, shift, xticks, yticks) graphics.scaleAndShift(scale, shift) graphics.draw(self.canvas, (scale*p1+shift, scale*p2+shift)) def _axisInterval(self, spec, lower, upper): if spec is None: return None if spec == 'minimal': if lower == upper: return lower-0.5, upper+0.5 else: return lower, upper if spec == 'automatic': range = upper-lower if range == 0.: return lower-0.5, upper+0.5 log = N.log10(range) power = N.floor(log) fraction = log-power if fraction <= 0.05: power = power-1 grid = 10.**power lower = lower - lower % grid mod = upper % grid if mod != 0: upper = upper - mod + grid return lower, upper if type(spec) == type(()): lower, upper = spec if lower <= upper: return lower, upper else: return upper, lower raise ValueError(str(spec) + ': illegal axis specification') def _drawAxes(self, canvas, xaxis, yaxis, bb1, bb2, scale, shift, xticks, yticks): dict = {'anchor': Tkinter.N, 'fill': 'black'} if self.font is not None: dict['font'] = self.font if xaxis is not None: lower, upper = xaxis text = 1 for y, d in [(bb1[1], -3), (bb2[1], 3)]: p1 = scale*N.array([lower, y])+shift p2 = scale*N.array([upper, y])+shift Line(self.canvas, p1[0], p1[1], p2[0], p2[1], fill = 'black', width = 1) for x, label in xticks: p = scale*N.array([x, y])+shift Line(self.canvas, p[0], p[1], p[0], p[1]+d, fill = 'black', width = 1) if text: dict['text'] = label apply(CanvasText, (self.canvas, p[0], p[1]), dict) text = 0 dict['anchor'] = Tkinter.E if yaxis is not None: lower, upper = yaxis text = 1 for x, d in [(bb1[0], -3), (bb2[0], 3)]: p1 = scale*N.array([x, lower])+shift p2 = scale*N.array([x, upper])+shift Line(self.canvas, p1[0], p1[1], p2[0], p2[1], fill = 'black', width = 1) for y, label in yticks: p = scale*N.array([x, y])+shift Line(self.canvas, p[0], p[1], p[0]-d, p[1], fill = 'black', width = 1) if text: dict['text'] = label apply(CanvasText, (self.canvas, p[0], p[1]), dict) text = 0 def _ticks(self, lower, upper): ideal = (upper-lower)/7. if ideal == 0.: ideal = 1./7. log = N.log10(ideal) power = N.floor(log) fraction = log-power factor = 1. error = fraction for f, lf in self._multiples: e = N.fabs(fraction-lf) if e < error: error = e factor = f grid = factor * 10.**power if power > 3 or power < -3: format = '%+7.0e' elif power >= 0: digits = max(1, int(power)) format = '%' + `digits`+'.0f' else: digits = -int(power) format = '%'+`digits+2`+'.'+`digits`+'f' ticks = [] t = -grid*N.floor(-lower/grid) while t <= upper and len(ticks) < 200: ticks.append((t, format % (t,))) t = t + grid return ticks _multiples = [(2., N.log10(2.)), (5., N.log10(5.))] def _textBoundingBox(self, text): bg = self.canvas.cget('background') dict = {'anchor': Tkinter.NW, 'text': text, 'fill': bg} if self.font is not None: dict['font'] = self.font item = apply(CanvasText, (self.canvas, 0., 0.), dict) bb = self.canvas.bbox(item) self.canvas.delete(item) return bb def clear(self): """ Clear the canvas """ self.canvas.delete('all') self.rectangle = None self.rubberband = None self.selected_range = None def redraw(self): """ Redraw the most recent canvas contents """ if self.last_draw is not None: apply(self.draw, self.last_draw) def _mousePressed(self, event): self.startx = self.canvas.canvasx(event.x) self.starty = self.canvas.canvasy(event.y) def _mouseMotion(self, event): if self.mouse_state == 0: scale, shift = self.transformation p = (N.array([self.startx, self.starty])-shift)/scale bb1, bb2 = self.bbox if self.selectfn is not None and p[1] < bb1[1]: self.mouse_state = 2 self.canvas.delete(self.rectangle) self.rectangle = \ self.canvas.create_rectangle(self.startx, self.starty, self.startx, self.starty, fill='yellow', outline='', stipple='gray50', width=0) self.canvas.lower(self.rectangle) elif self.zoom: self.mouse_state = 1 if self.mouse_state == 1: x = self.canvas.canvasx(event.x) y = self.canvas.canvasy(event.y) if (self.startx != event.x) and (self.starty != event.y) : self.canvas.delete(self.rubberband) self.rubberband = self.canvas.create_rectangle(self.startx, self.starty, x, y) self.update_idletasks() elif self.mouse_state == 2: self.canvas.coords(self.rectangle, self.startx, 1., self.canvas.canvasx(event.x), self.height) self.update_idletasks() def _mouseRelease(self, event): if self.mouse_state == 1: self.canvas.delete(self.rubberband) self.rubberband = None p1 = N.array([self.startx, self.starty]) p2 = N.array([self.canvas.canvasx(event.x), self.canvas.canvasy(event.y)]) if N.minimum.reduce(N.fabs(p1-p2)) > 5: scale, shift = self.transformation p1 = (p1-shift)/scale p2 = (p2-shift)/scale graphics, xaxis, yaxis = self.last_draw if xaxis is not None: xaxis = (p1[0], p2[0]) if yaxis is not None: yaxis = (p2[1], p1[1]) self.clear() self.draw(graphics, xaxis, yaxis) elif self.mouse_state == 2: scale, shift = self.transformation x1 = (self.startx-shift[0])/scale[0] x2 = (self.canvas.canvasx(event.x)-shift[0])/scale[0] if x1 < x2: self.selected_range = (x1, x2) else: self.selected_range = (x2, x1) if self.selectfn is not None: self.selectfn(self.selected_range) else: self.canvas.delete(self.rectangle) self.rectangle = None self.selected_range = None if self.selectfn is not None: self.selectfn(self.selected_range) self.mouse_state = 0 def select(self, range): """ Highlight a range on the x-axis @param range: the range on the x-axis to be highlighted. It can be C{None} (no selection) or a sequence of two values on the x-axis. """ if range is None: if self.selected_range is not None: self.canvas.delete(self.rectangle) self.rectangle = None self.selected_range = None else: scale, shift = self.transformation x1 = scale[0]*range[0]+shift[0] x2 = scale[0]*range[1]+shift[0] if self.rectangle is None: self.rectangle = \ self.canvas.create_rectangle(x1, 1., x2, self.height, fill='yellow', outline='', stipple='gray50', width=0) self.canvas.lower(self.rectangle) else: self.canvas.coords(self.rectangle, x1, 1., x2, self.height) self.selected_range = range self.update_idletasks() def _popupMenu(self, event): self.popup_menu.post(event.x_root, event.y_root) def _autoScale(self): if self.last_draw is not None: graphics, xaxis, yaxis = self.last_draw if xaxis is not None: xaxis = 'automatic' if yaxis is not None: yaxis = 'automatic' self.clear() self.draw(graphics, xaxis, yaxis) def _xmgr(self): if self.last_draw is not None: import os, tempfile filename = tempfile.mktemp() file = open(filename, 'w') graphics, xaxis, yaxis = self.last_draw graphics.writeToFile(file, '!\n') file.close() os.system('(xmgrace %s ; rm %s ) &' % (filename, filename)) def _showValue(self, event): scale, shift = self.transformation x = self.canvas.canvasx(event.x) y = self.canvas.canvasy(event.y) point = N.array([x, y]) point = (point-shift)/scale text = "x = %f\ny = %f" % tuple(point) self.label = self.canvas.create_window(x, y, window=Tkinter.Label(self.canvas, text=text)) def _hideValue(self, event): if self.label is not None: self.canvas.delete(self.label) self.label = None if __name__ == '__main__': window = Tkinter.Frame() window.pack(fill=Tkinter.BOTH, expand=Tkinter.YES) data1 = 2.*N.pi*N.arange(200)/200. data1.shape = (100, 2) data1[:,1] = N.sin(data1[:,0]) lines1 = PolyLine(data1, color='green') pi = N.pi lines2 = PolyLine([(0., 0.), (pi/2., 1.), (pi, 0.), (3.*pi/2., -1), (2.*pi, 0.)], color='red') markers = PolyMarker([(0., 0.), (pi/2., 1.), (pi, 0.), (3.*pi/2., -1), (2.*pi, 0.)], color='blue', fillcolor='blue', marker='triangle') object = PlotGraphics([lines1, lines2, markers]) def display(value): select(value) print value c = PlotCanvas(window, "300", "200", relief=Tkinter.SUNKEN, border=2, zoom = 1, select = display) c.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=Tkinter.YES) def select(value): c.select(value) Tkinter.Button(window, text='Draw', command=lambda o=object: c.draw(o, 'automatic', 'automatic')).pack(side=Tkinter.LEFT) Tkinter.Button(window, text='Clear', command=c.clear).pack(side=Tkinter.LEFT) Tkinter.Button(window, text='Redraw', command=c.redraw).pack(side=Tkinter.LEFT) Tkinter.Button(window, text='Quit', command=window.quit).pack(side=Tkinter.RIGHT) window.mainloop() ScientificPython-2.9.4/Scientific/TkWidgets/TkVisualizationCanvas.py0000644000076600000240000003141111501734232026251 0ustar hinsenstaff00000000000000# This module defines a 3D wireframe visualization widget # for Tk user interfaces. # # Written by Konrad Hinsen # Last revision: 2008-4-29 # """ 3D wireframe canvas widget for Tk This module provides a special widget for Tk user interfaces which permits the display of 3D wireframe structures with interactive manipulation. Note that this widget can become sluggish if two many lines are to be displayed. An OpenGL widget should be used for serious visualization needs. The advantage of this module is that it requires no special graphics libraries in addition to Tk. @undocumented: PolyPoints3D """ import Tkinter from Canvas import Line import string from Scientific import N from Scientific.Geometry import Vector from Scientific.Geometry.Transformation import Rotation class PolyPoints3D: def __init__(self, points, attr): self.points = N.array(points) self.scaled = self.points self.attributes = {} for name, value in self._attributes.items(): try: value = attr[name] except KeyError: pass self.attributes[name] = value def boundingBox(self): return N.minimum.reduce(self.points), \ N.maximum.reduce(self.points) def project(self, axis, plane): self.depth = N.dot(self.points, axis) self.projection = N.dot(self.points, plane) def boundingBoxPlane(self): return N.minimum.reduce(self.projection), \ N.maximum.reduce(self.projection) def scaleAndShift(self, scale=1, shift=0): self.scaled = scale*self.projection+shift class PolyLine3D(PolyPoints3D): """ Multiple connected lines """ def __init__(self, points, **attr): """ @param points: any sequence of (x, y, z) coordinate triples @param attr: line attributes @keyword width: line width (default: 1) @type width: C{int} @keyword color: a Tk color name (default: C{"black"}) @type color: C{str} """ PolyPoints3D.__init__(self, points, attr) _attributes = {'color': 'black', 'width': 1} def lines(self): color = self.attributes['color'] width = self.attributes['width'] lines = [] depths = [] for i in range(len(self.scaled)-1): x1, y1 = self.scaled[i] x2, y2 = self.scaled[i+1] lines.append((x1, y1, x2, y2, color, width)) depths.append(min(self.depth[i], self.depth[i+1])) return lines, depths class VisualizationGraphics: """ Compound graphics object @undocumented: boundingBox @undocumented: boundingBoxPlane @undocumented: project @undocumented: scaleAndShift @undocumented: lines """ def __init__(self, objects): """ @param objects: a list of graphics objects (L{PolyLine3D}, L{VisualizationGraphics}) """ self.objects = objects def boundingBox(self): p1, p2 = self.objects[0].boundingBox() for o in self.objects[1:]: p1o, p2o = o.boundingBox() p1 = N.minimum(p1, p1o) p2 = N.maximum(p2, p2o) return p1, p2 def project(self, axis, plane): for o in self.objects: o.project(axis, plane) def boundingBoxPlane(self): p1, p2 = self.objects[0].boundingBoxPlane() for o in self.objects[1:]: p1o, p2o = o.boundingBoxPlane() p1 = N.minimum(p1, p1o) p2 = N.maximum(p2, p2o) return p1, p2 def scaleAndShift(self, scale=1, shift=0): for o in self.objects: o.scaleAndShift(scale, shift) def lines(self): items = [] depths = [] for o in self.objects: i, d = o.lines() items = items + i depths = depths + d return items, depths def __len__(self): return len(self.objects) def __getitem__(self, item): return self.objects[item] class VisualizationCanvas(Tkinter.Frame): """ Tk visualization widget VisualizationCanvas objects support all operations of Tk widgets. Interactive manipulation of the display is possible with click-and-drag operations. The left mouse button rotates the objects, the middle button translates it, and the right button scales it up or down. """ def __init__(self, master, width, height, background='white', **attr): """ @param master: the parent widget @param width: the initial width of the canvas @type width: C{int} @param height: the initial height of the canvas @type height: C{int} @param background: the background color @type background: C{str} @param attr: widget attributes """ apply(Tkinter.Frame.__init__, (self, master), attr) self.canvas = Tkinter.Canvas(self, width=width, height=height, background=background) self.canvas.pack(fill=Tkinter.BOTH, expand=Tkinter.YES) border_w = self.canvas.winfo_reqwidth() - \ string.atoi(self.canvas.cget('width')) border_h = self.canvas.winfo_reqheight() - \ string.atoi(self.canvas.cget('height')) self.border = (border_w, border_h) self.canvas.bind('', self.reconfigure) self.canvas.bind('<1>', self.clickhandler1) self.canvas.bind('', self.releasehandler1) self.canvas.bind('<2>', self.clickhandler2) self.canvas.bind('', self.releasehandler2) self.canvas.bind('<3>', self.clickhandler3) self.canvas.bind('', self.releasehandler3) self._setsize() self.scale = None self.translate = N.array([0., 0.]) self.last_draw = None self.axis = N.array([0.,0.,1.]) self.plane = N.array([[1.,0.], [0.,1.], [0.,0.]]) def reconfigure(self, event): new_width = event.width-self.border[0] new_height = event.height-self.border[1] width = string.atoi(self.canvas.cget('width')) height = string.atoi(self.canvas.cget('height')) if new_width == width and new_height == height: return self.canvas.configure(width=new_width, height=new_height) self._setsize() self.clear(1) self.redraw() def _setsize(self): self.width = string.atoi(self.canvas.cget('width')) self.height = string.atoi(self.canvas.cget('height')) self.plotbox_size = 0.97*N.array([self.width, -self.height]) xo = 0.5*(self.width-self.plotbox_size[0]) yo = self.height-0.5*(self.height+self.plotbox_size[1]) self.plotbox_origin = N.array([xo, yo]) def copyViewpointFrom(self, other): self.axis = other.axis self.plane = other.plane self.scale = other.scale self.translate = other.translate def setViewpoint(self, axis, plane, scale=None, translate=None): self.axis = axis self.plane = plane if scale is not None: self.scale = scale if translate is not None: self.translate = translate def draw(self, graphics): """ Draw something on the canvas @param graphics: the graphics object (L{PolyLine3D}, or L{VisualizationGraphics}) to be drawn """ self.last_draw = (graphics, ) self.configure(cursor='watch') self.update_idletasks() graphics.project(self.axis, self.plane) p1, p2 = graphics.boundingBoxPlane() center = 0.5*(p1+p2) scale = self.plotbox_size / (p2-p1) sign = scale/N.fabs(scale) if self.scale is None: minscale = N.minimum.reduce(N.fabs(scale)) self.scale = 0.9*minscale scale = sign*self.scale box_center = self.plotbox_origin + 0.5*self.plotbox_size shift = -center*scale + box_center + self.translate graphics.scaleAndShift(scale, shift) items, depths = graphics.lines() sort = N.argsort(depths) for index in sort: x1, y1, x2, y2, color, width = items[index] Line(self.canvas, x1, y1, x2, y2, fill=color, width=width) self.configure(cursor='top_left_arrow') self.update_idletasks() def redraw(self): if self.last_draw is not None: apply(self.draw, self.last_draw) def clear(self, keepscale = 0): """ Clear the canvas """ self.canvas.delete('all') if not keepscale: self.scale = None def clickhandler1(self, event): self.click1x = event.x self.click1y = event.y self.configure(cursor='exchange') self.update_idletasks() def clickhandler2(self, event): self.click2x = event.x self.click2y = event.y self.configure(cursor='fleur') self.update_idletasks() def clickhandler3(self, event): self.click3x = event.x self.click3y = event.y self.configure(cursor='sizing') self.update_idletasks() def releasehandler1(self, event): self.configure(cursor='top_left_arrow') self.update_idletasks() try: dx = event.x - self.click1x dy = event.y - self.click1y except AttributeError: return if dx != 0 or dy != 0: normal = Vector(self.axis) move = Vector(-dx*self.plane[:,0]+dy*self.plane[:,1]) axis = normal.cross(move) / \ N.minimum.reduce(N.fabs(self.plotbox_size)) rot = Rotation(axis.normal(), axis.length()) self.axis = rot(normal).array self.plane[:,0] = rot(Vector(self.plane[:,0])).array self.plane[:,1] = rot(Vector(self.plane[:,1])).array self.clear(1) self.redraw() def releasehandler2(self, event): self.configure(cursor='top_left_arrow') self.update_idletasks() try: dx = event.x - self.click2x dy = event.y - self.click2y except AttributeError: return if dx != 0 or dy != 0: self.translate = self.translate + N.array([dx, dy]) self.clear(1) self.redraw() def releasehandler3(self, event): self.configure(cursor='top_left_arrow') self.update_idletasks() try: dy = event.y - self.click3y except AttributeError: return if dy != 0: ratio = -dy/self.plotbox_size[1] self.scale = self.scale * (1.+ratio) self.clear(1) self.redraw() if __name__ == '__main__': from Scientific.IO.TextFile import TextFile from Scientific.IO.FortranFormat import FortranFormat, FortranLine import string generic_format = FortranFormat('A6') atom_format = FortranFormat('A6,I5,1X,A4,A1,A3,1X,A1,I4,A1,' + '3X,3F8.3,2F6.2,7X,A4,2A2') # Read the PDB file and make a list of all C-alpha positions def readCAlphaPositions(filename): positions = [] chains = [positions] for line in TextFile(filename): record_type = FortranLine(line, generic_format)[0] if record_type == 'ATOM ' or record_type == 'HETATM': data = FortranLine(line, atom_format) atom_name = string.strip(data[2]) position = N.array(data[8:11]) if atom_name == 'CA': positions.append(position) elif atom_name == 'OXT': positions = [] chains.append(positions) if len(chains[-1]) == 0: del chains[-1] return chains conf = readCAlphaPositions('/Users/hinsen/Desktop/5CYT.pdb') colors = ['black', 'red', 'green', 'blue', 'yellow'] colors = (len(conf)*colors)[:len(conf)] objects = [] for chain, color in map(None, conf, colors): objects.append(PolyLine3D(chain, color=color)) graphics = VisualizationGraphics(objects) window = Tkinter.Frame() window.pack(fill=Tkinter.BOTH, expand=Tkinter.YES) c = VisualizationCanvas(window, "100m", "100m", relief=Tkinter.SUNKEN, border=2) c.pack(side=Tkinter.TOP, fill=Tkinter.BOTH, expand=Tkinter.YES) c.draw(graphics) Tkinter.Button(window, text='Draw', command=lambda o=graphics: c.draw(o)).pack(side=Tkinter.LEFT) Tkinter.Button(window, text='Clear', command=c.clear).pack(side=Tkinter.LEFT) Tkinter.Button(window, text='Redraw', command=c.redraw).pack(side=Tkinter.LEFT) Tkinter.Button(window, text='Quit', command=window.quit).pack(side=Tkinter.RIGHT) window.mainloop() ScientificPython-2.9.4/Scientific/TkWidgets/Utility.py0000644000076600000240000002660111501734231023424 0ustar hinsenstaff00000000000000# Various useful small widgets # # Written by Konrad Hinsen # Last revision: 2008-8-18 # import Tkinter, Dialog, FileDialog import copy, os, string class FilenameEntry(Tkinter.Frame): """ Filename entry widget A FilenameEntry widget consists of three parts: an identifying label, a text entry field for the filename, and a button labelled 'browse' which call a file selection dialog box for picking a file name. """ def __init__(self, master, text, pattern = '*', must_exist = True, **attr): """ @param master: the parent widget @param text: the label in front of the filename box @type text: C{str} @param pattern: the filename matching pattern that determines the file list in the file selection dialog @type pattern: C{str} @param must_exist: if C{True}, allow only names of existing files @type must_exist: C{bool} """ self.pattern = pattern self.must_exist = must_exist newattr = copy.copy(attr) newattr['text'] = text Tkinter.Frame.__init__(self, master) apply(Tkinter.Label, (self,), newattr).pack(side=Tkinter.LEFT) self.filename = Tkinter.StringVar() Tkinter.Button(self, text="Browse...", command=self.browse).pack(side=Tkinter.RIGHT) newattr = copy.copy(attr) newattr['textvariable'] = self.filename entry = apply(Tkinter.Entry, (self,), newattr) entry.pack(side=Tkinter.RIGHT, expand=1, fill=Tkinter.X) entry.icursor("end") def browse(self): if self.must_exist: file = FileDialog.LoadFileDialog(self).go(pattern=self.pattern) else: file = FileDialog.SaveFileDialog(self).go(pattern=self.pattern) if file: self.filename.set(file) def get(self): """ @returns: the current filename @rtype: C{str} @raises ValueError: if must_exist is C{True} and the name does not refer to an existing file """ filename = self.filename.get() if self.must_exist and not os.path.exists(filename): Dialog.Dialog(self, title='File not found', text='The file "' + filename + '" does not exist.', bitmap='warning', default=0, strings = ('Cancel',)) raise ValueError return filename class FloatEntry(Tkinter.Frame): """ Entry field for float numbers A FloatEntry widget consists of a label followed by a text entry field. """ def __init__(self, master, text, init = None, lower=None, upper=None, name = None, **attr): """ @param master: the parent widget @param text: the label in front of the entry field @type text: C{str} @param init: an optional initial value (default: blank field) @type init: number @param upper: an optional upper limit for the value @type upper: number @param lower: an optional lower limit for the value @type lower: number """ self.text = text self.lower = lower self.upper = upper if name is None: name = text self.name = name newattr = copy.copy(attr) newattr['text'] = text Tkinter.Frame.__init__(self, master) apply(Tkinter.Label, (self,), newattr).pack(side=Tkinter.LEFT) self.value = Tkinter.DoubleVar() if init is not None: self.value.set(init) newattr = copy.copy(attr) newattr['textvariable'] = self.value self.entry = apply(Tkinter.Entry, (self,), newattr) self.entry.pack(side=Tkinter.RIGHT, anchor=Tkinter.E, expand=1, fill=Tkinter.X) self.entry.icursor("end") def bind(self, sequence=None, func=None, add=None): self.entry.bind(sequence, func, add) def set(self, value): """ Set the value displayed in the field @param value: the new value @type value: C{float} """ return self.value.set(value) def get(self): """ @returns: the current value displayed in the field @rtype: C{float} @raises ValueError: if the current value is not a valid number or is not within the specified limits """ try: value = self.value.get() except (Tkinter.TclError, ValueError): Dialog.Dialog(self, title='Illegal value', text='The value of "' + self.name + '" must be a number.', bitmap='warning', default=0, strings = ('Cancel',)) raise ValueError range_check = 0 if self.lower is not None and value < self.lower: range_check = -1 if self.upper is not None and value > self.upper: range_check = 1 if range_check != 0: text = 'The value of "' + self.name + '" must not be ' if range_check < 0: text = text + 'smaller than ' + `self.lower` + '.' else: text = text + 'larger than ' + `self.upper` + '.' Dialog.Dialog(self, title='Value out of range', text=text, bitmap='warning', default=0, strings = ('Cancel',)) raise ValueError return value class IntEntry(FloatEntry): """ Entry field for integer numbers A IntEntry widget consists of a label followed by a text entry field. """ def get(self): """ @returns: the current value displayed in the field @rtype: C{int} @raises ValueError: if the current value is not a valid number or is not within the specified limits """ value = FloatEntry.get(self) ivalue = int(value) if ivalue != value: Dialog.Dialog(self, title='Illegal value', text='The value of "' + self.name + '" must be an integer.', bitmap='warning', default=0, strings = ('Cancel',)) raise ValueError return ivalue class ButtonBar(Tkinter.Frame): """ Horizontal array of buttons """ def __init__(self, master, left_button_list, right_button_list): """ @param master: the parent widget @param left_button_list: a list of (text, action) tuples specifying the buttons on the left-hand side of the button bar @param right_button_list: a list of (text, action) tuples specifying the buttons on the right-hand side of the button bar """ Tkinter.Frame.__init__(self, master, bd=2, relief=Tkinter.SUNKEN) for button, action in left_button_list: Tkinter.Button(self, text=button, command=action).pack(side=Tkinter.LEFT) for button, action in right_button_list: Tkinter.Button(self, text=button, command=action).pack(side=Tkinter.RIGHT) class StatusBar(Tkinter.Frame): """ Status bar A status bar can be used to inform the user about the status of an ongoing calculation. A message can be displayed with set() and removed with clear(). In both cases, the StatusBar object makes sure that the change takes place immediately. While a message is being displayed, the cursor form is changed to a watch. """ def __init__(self, master): """ @param master: the parent widget """ Tkinter.Frame.__init__(self, master, bd=2, relief=Tkinter.RAISED) self.text = Tkinter.Label(self, text='') self.text.pack(side=Tkinter.LEFT, expand=Tkinter.YES) def set(self, text): """ Set a message to be displayed in the status bar @param text: the text of the message """ self.text.configure(text = text) self.text.update_idletasks() self.master.configure(cursor='watch') self.update() self.update_idletasks() def clear(self): """ Clear any message displayed in the status bar """ self.text.configure(text = '') self.text.update_idletasks() self.master.configure(cursor='top_left_arrow') self.update_idletasks() # # The following class was taken from the Pythonware Tkinter introduction # class ModalDialog(Tkinter.Toplevel): def __init__(self, parent, title = None): Tkinter.Toplevel.__init__(self, parent) self.transient(parent) if title: self.title(title) self.parent = parent self.result = None body = Tkinter.Frame(self) self.initial_focus = self.body(body) body.pack(padx=5, pady=5) self.buttonbox() self.grab_set() if not self.initial_focus: self.initial_focus = self self.protocol("WM_DELETE_WINDOW", self.cancel) self.geometry("+%d+%d" % (parent.winfo_rootx()+50, parent.winfo_rooty()+50)) self.initial_focus.focus_set() self.wait_window(self) # # construction hooks def body(self, master): # create dialog body. return widget that should have # initial focus. this method should be overridden pass def buttonbox(self): # add standard button box. override if you don't want the # standard buttons box = Tkinter.Frame(self) w = Tkinter.Button(box, text="OK", width=10, command=self.ok, default=Tkinter.ACTIVE) w.pack(side=Tkinter.LEFT, padx=5, pady=5) w = Tkinter.Button(box, text="Cancel", width=10, command=self.cancel) w.pack(side=Tkinter.LEFT, padx=5, pady=5) self.bind("", self.ok) self.bind("", self.cancel) box.pack() # # standard button semantics def ok(self, event=None): if not self.validate(): self.initial_focus.focus_set() # put focus back return self.withdraw() self.update_idletasks() self.apply() self.cancel() def cancel(self, event=None): # put focus back to the parent window self.parent.focus_set() self.destroy() # # command hooks def validate(self): return 1 # override def apply(self): pass # override if __name__ == '__main__': class MyDialog(ModalDialog): def body(self, master): Tkinter.Label(master, text="First:").grid(row=0) Tkinter.Label(master, text="Second:").grid(row=1) self.e1 = IntEntry(master, '', 0, 0, 10, fg='red') self.e2 = Tkinter.Entry(master) self.e1.grid(row=0, column=1) self.e2.grid(row=1, column=1) return self.e1 # initial focus def apply(self): first = string.atoi(self.e1.get()) second = string.atoi(self.e2.get()) self.result = first, second root = Tkinter.Tk() Tkinter.Button(root, text="Hello!").pack() root.update() d = MyDialog(root) print d.result ScientificPython-2.9.4/Scientific/Visualization/0000755000076600000240000000000012270505005022335 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Scientific/Visualization/__init__.py0000644000076600000240000000075411501734230024454 0ustar hinsenstaff00000000000000 """ Scientific visualization The modules in this subpackage provide visualization of 3D objects using different backends (VRML, VMD, VPython), but with an almost identical interface. It is thus possible to write generic 3D graphics code in which the backend can be changed by modifying a single line of code. The intended application of these modules is scientific visualization. Many sophisticated 3D objects are therefore absent, as are complex surface definitions such as textures. """ ScientificPython-2.9.4/Scientific/Visualization/Chimera.py0000644000076600000240000004127211513373225024273 0ustar hinsenstaff00000000000000# This module provides classes that represent graphics objects to be # output to Chimera. This module is as compatible as possible with module # VRML. Important differences: # - No general polygon objects. # - Only the 'diffuse color' attribute of materials is used for rendering. # # Written by: Konrad Hinsen # Last revision: 2010-1-11 # """ Definitions of simple 3D graphics objects and scenes containing them, in a form that can be fed to the molecular visualization program Chimera Scenes can either be written as Chimea BILD files, or visualized directly when the code is run from inside Chimera This module is almost compatible with the modules VRML and VRML2, which provide visualization by VRML browsers. There is no Polygon class, and the only material attribute supported is diffuse_color. Example:: >>> from Scientific.Visualization.Chimera import * >>> scene = Scene([]) >>> scale = ColorScale(10.) >>> for x in range(11): >>> color = scale(x) >>> scene.addObject(Cube(Vector(x, 0., 0.), 0.2, >>> material=Material(diffuse_color = color))) >>> scene.view() """ from Scientific.IO.TextFile import TextFile from Scientific.Geometry import Transformation, Vector, ex, ey, ez from cStringIO import StringIO import os, sys from Scientific.Visualization.Color import * # # BILD file # class SceneFile(object): def __init__(self, filename, mode = 'r', scale = 1.): if mode == 'r': raise TypeError('Not yet implemented.') self.file = TextFile(filename, 'w') self.filename = filename self._init(scale) def _init(self, scale): self.memo = {} self.scale = scale def __del__(self): self.close() def writeString(self, data): self.file.write(data) def writeVector(self, v): self.writeString(" %g %g %g " % tuple(v)) def close(self): self.file.close() def write(self, object): object.writeToFile(self) class InternalSceneFile(SceneFile): def __init__(self, scale=1.): self.file = StringIO() self._init(scale) def close(self): return def __str__(self): return self.file.getvalue() # # Scene # class Scene(object): """ Chimera scene A Chimera scene is a collection of graphics objects that can be loaded into Chimera """ def __init__(self, objects=None, **options): """ @param objects: a list of graphics objects, or C{None} for an empty scene @type objects: C{list} or C{NoneType} @param options: options as keyword arguments @keyword scale: a scale factor applied to all coordinates of geometrical objects B{except} for molecule objects, which cannot be scaled @type scale: positive number """ if objects is None: self.objects = [] elif type(objects) == type([]): self.objects = objects else: self.objects = [objects] try: self.scale = options['scale'] except KeyError: self.scale = 1. try: self.name = options['name'] except KeyError: self.name = 'ScientificPython graphics' def __len__(self): """ @returns: the number of graphics objects in the scene @rtype: C{int} """ return len(self.objects) def __getitem__(self, item): """ @param item: an index @type item: C{int} @returns: the graphics object at the index position @rtype: L{ChimeraObject} """ return self.object[item] def addObject(self, object): """ @param object: a graphics object to be added to the scene @type object: L{ChimeraObject} """ self.objects.append(object) def writeToFile(self, filename): """ Write the scene to a Cimera script file @param filename: the name of the script @type filename: C{str} """ file = SceneFile(filename, 'w', self.scale) for o in self.objects: o.writeToFile(file) file.close() def view(self, *args): """ Load the scene into Chimera @param args: not used, for compatibility with VRML modules only @returns: the Chimera VRML model that was created. """ f = InternalSceneFile(self.scale) for o in self.objects: o.writeToFile(f) f.close() import chimera return chimera.openModels.open(StringIO(str(f)), type="Bild", identifyAs=self.name)[0] def __str__(self): f = InternalSceneFile(self.scale) for o in self.objects: o.writeToFile(f) f.close() return str(f) # # Base class for everything that produces graphic objects # class ChimeraObject: """ Graphics object for Chimera This is an abstract base class. Use one of the subclasses to generate graphics. """ def __init__(self, attr): """ @param attr: graphics attributes specified by keywords @keyword material: color and surface properties @type material: L{Material} @keyword comment: a comment that is written to the script file @type comment: C{str} """ self.attr = {} for key, value in attr.items(): if key in self.attribute_names: self.attr[key] = value else: raise AttributeError('illegal attribute: ' + str(key)) attribute_names = ['comment'] def __getitem__(self, attr): """ @param attr: the name of a graphics attribute @type attr: C{str} @returns: the value of the attribute, or C{None} if the attribute is undefined """ try: return self.attr[attr] except KeyError: return None def __setitem__(self, attr, value): """ @param attr: the name of a graphics attribute @type attr: C{str} @param value: a new value for the attribute """ self.attr[attr] = value def __copy__(self): return copy.deepcopy(self) def writeToFile(self, file): raise AttributeError('Class ' + self.__class__.__name__ + ' does not implement file output.') # # Shapes # class ShapeObject(ChimeraObject): """ Graphics objects representing geometrical shapes This is an abstract base class. Use one of the subclasses to generate graphics. """ def __init__(self, attr): ChimeraObject.__init__(self, attr) attribute_names = ChimeraObject.attribute_names + ['material'] def __add__(self, other): return Group([self]) + Group([other]) def writeToFile(self, file): comment = self['comment'] if comment is not None: file.writeString('.comment ' + comment + '\n') material = self['material'] if material is not None: material.writeToFile(file) self.writeSpecification(file) def use(self, file): pass class Sphere(ShapeObject): """ Sphere """ def __init__(self, center, radius, **attr): """ @param center: the center of the sphere @type center: L{Scientific.Geometry.Vector} @param radius: the sphere radius @type radius: positive number @param attr: graphics attributes as keyword parameters """ self.radius = radius self.center = center ShapeObject.__init__(self, attr) def writeSpecification(self, file): file.writeString('.sphere') file.writeVector(self.center*file.scale) file.writeString(' ' + `self.radius*file.scale` + '\n') class Cube(ShapeObject): """ Cube The edges of a cube are always parallel to the coordinate axes. """ def __init__(self, center, edge, **attr): """ @param center: the center of the cube @type center: L{Scientific.Geometry.Vector} @param edge: the length of an edge @type edge: positive number @param attr: graphics attributes as keyword parameters """ self.edge = edge self.center = center ShapeObject.__init__(self, attr) def writeSpecification(self, file): d = 0.5*self.edge semi_diag = Vector(d, d, d) file.writeString('.box') file.writeVector((self.center-semi_diag)*file.scale) file.writeVector((self.center+semi_diag)*file.scale) file.writeString('\n') class Cylinder(ShapeObject): """ Cylinder """ def __init__(self, point1, point2, radius, faces = (1, 1, 1), **attr): """ @param point1: first end point of the cylinder axis @type point1: L{Scientific.Geometry.Vector} @param point2: second end point of the cylinder axis @type point2: L{Scientific.Geometry.Vector} @param radius: the cylinder radius @type radius: positive number @param faces: a sequence of three boolean flags, corresponding to the cylinder hull and the two circular end pieces, specifying for each of these parts whether it is visible or not @param attr: graphics attributes as keyword parameters """ self.faces = faces self.radius = radius self.point1 = point1 self.point2 = point2 ShapeObject.__init__(self, attr) def writeSpecification(self, file): file.writeString('.cylinder') file.writeVector(self.point1*file.scale) file.writeVector(self.point2*file.scale) file.writeString(' ' + `self.radius*file.scale`) if self.faces[:2] == (0, 0): file.writeString(' open') file.writeString('\n') class Cone(ShapeObject): """ Cone """ def __init__(self, point1, point2, radius, face = 1, **attr): """ @param point1: the tip of the cone @type point1: L{Scientific.Geometry.Vector} @param point2: end point of the cone axis @type point2: L{Scientific.Geometry.Vector} @param radius: the radius at the base @type radius: positive number @param face: a boolean flag, specifying if the circular bottom is visible @type face: C{bool} @param attr: graphics attributes as keyword parameters """ self.face = face self.radius = radius self.point1 = point1 self.point2 = point2 ShapeObject.__init__(self, attr) def writeSpecification(self, file): file.writeString('.cone') file.writeVector(self.point2*file.scale) file.writeVector(self.point1*file.scale) file.writeString(' ' + `self.radius*file.scale`) if not self.face: file.writeString(' open') file.writeString('\n') class Line(ShapeObject): """ Line """ def __init__(self, point1, point2, **attr): """ @param point1: first end point @type point1: L{Scientific.Geometry.Vector} @param point2: second end point @type point2: L{Scientific.Geometry.Vector} @param attr: graphics attributes as keyword parameters """ self.point1 = point1 self.point2 = point2 ShapeObject.__init__(self, attr) def writeSpecification(self, file): file.writeString('.move') file.writeVector(self.point1*file.scale) file.writeString('\n') file.writeString('.draw') file.writeVector(self.point2*file.scale) file.writeString('\n') # # Groups # class Group: """ Base class for composite objects """ def __init__(self, objects, **attr): self.objects = [] for o in objects: if isGroup(o): self.objects = self.objects + o.objects else: self.objects.append(o) for key, value in attr.items(): for o in self.objects: o[key] = value is_group = 1 def __len__(self): return len(self.objects) def __getitem__(self, item): return self.object[item] def __coerce__(self, other): if not isGroup(other): other = Group([other]) return (self, other) def __add__(self, other): return Group(self.objects + other.objects) def writeToFile(self, file): for o in self.objects: o.writeToFile(file) def isGroup(x): return hasattr(x, 'is_group') # # Composite Objects # class Arrow(Group): """ Arrow An arrow consists of a cylinder and a cone. """ def __init__(self, point1, point2, radius, **attr): """ @param point1: starting point of the arrow @type point1: L{Scientific.Geometry.Vector} @param point2: the tip of the arrow @type point2: L{Scientific.Geometry.Vector} @param radius: the radius of the shaft @type radius: positive number @param attr: graphics attributes as keyword parameters """ axis = point2-point1 height = axis.length() axis = axis/height cone_height = min(height, 4.*radius) cylinder_height = height - cone_height junction = point2-axis*cone_height cone = apply(Cone, (point2, junction, 0.75*cone_height), attr) objects = [cone] if cylinder_height > 0.005*radius: cylinder = apply(Cylinder, (point1, junction, radius), attr) objects.append(cylinder) Group.__init__(self, objects) # # Materials # class Material(ChimeraObject): """ Material specification for graphics objects A material defines the color and surface properties of an object. For compatibility with the module L{Scientific.Visualization.VRML}, many material attributes are accepted but not used in any way. """ def __init__(self, **attr): """ @param attr: material attributes as keyword arguments @keyword diffuse_color: the color of a diffusely reflecting surface @type diffuse_color: L{Color} @keyword emissive_color: not used @keyword ambient_color: not used @keyword specular_color: not used @keyword shininess: not used @keyword transparency: not used """ ChimeraObject.__init__(self, attr) attribute_names = ChimeraObject.attribute_names + \ ['ambient_color', 'diffuse_color', 'specular_color', 'emissive_color', 'shininess', 'transparency'] def writeToFile(self, file): try: last = file.memo['material'] if last == self: return except KeyError: pass try: color = self.attr['diffuse_color'] except KeyError: color = Color((1., 1., 1.)) file.writeString('.color ' + str(color) + '\n') file.memo['material'] = self # # Predefined materials # def DiffuseMaterial(color): """ @param color: a color object or a predefined color name @type color: L{Color} or C{str} @returns: a material with the 'diffuse color' attribute set to color @rtype: L{Material} """ if type(color) is type(''): color = ColorByName(color) try: return _diffuse_material_dict[color] except KeyError: m = Material(diffuse_color = color) _diffuse_material_dict[color] = m return m _diffuse_material_dict = {} EmissiveMaterial = DiffuseMaterial # # Test code # if __name__ == '__main__': if 0: from Scientific.Geometry import ex, ey, ez spheres = DiffuseMaterial('green') links = DiffuseMaterial('red') origin = Vector(0., 0., 0.) s1 = Sphere(origin, 0.05, material = spheres) s2 = Sphere(ex, 0.05, material = spheres) s3 = Sphere(ey, 0.05, material = spheres) s4 = Sphere(ez, 0.05, material = spheres) a1 = Arrow(origin, ex, 0.01, material = links) a2 = Arrow(origin, ey, 0.01, material = links) a3 = Arrow(origin, ez, 0.01, material = links) scene = Scene([s1, s2, s3, s4, a1, a2, a3]) print str(scene) if 0: scene = Scene([]) scale = SymmetricColorScale(10., 10) for x in range(-10, 11): color = scale(x) m = Material(diffuse_color = color) scene.addObject(Cube(Vector(x,0.,0.), 0.2, material=m)) print str(scene) if 1: scene = Scene([]) scale = ColorScale(10.) for x in range(11): color = scale(x) m = Material(diffuse_color = color) scene.addObject(Cube(Vector(x,0.,0.), 0.2, material=m)) print str(scene) ScientificPython-2.9.4/Scientific/Visualization/Color.py0000644000076600000240000001333511501734231023773 0ustar hinsenstaff00000000000000# This module provides color definitions for use in Visualization. # # Written by: Konrad Hinsen # Last revision: 2009-6-10 # """ Color definitions for use in the modules VRML, VRML2, VMD, and PyMOL. """ from Scientific import N import string # # Colors # class Color: """ RGB Color specification Color objects can be added and multiplied with scalars. """ def __init__(self, rgb): """ @param rgb: a sequence of three numbers between zero and one, specifying the intensities of red, green, and blue. @type rgb: C{int} or C{float} """ self.rgb = (min(1.,max(0.,rgb[0])), min(1.,max(0.,rgb[1])), min(1.,max(0.,rgb[2]))) def __mul__(self, scale): return Color(map(lambda i, s=scale: s*i, self.rgb)) __rmul__ = __mul__ def __add__(self, other): return Color(map(lambda a, b: a+b, self.rgb, other.rgb)) def __cmp__(self, other): if not isinstance(other, Color): return NotImplemented return cmp(self.rgb, other.rgb) def __hash__(self): return hash(self.rgb) def __str__(self): return str(self.rgb[0])+' '+str(self.rgb[1])+' '+str(self.rgb[2]) def __repr__(self): return 'Color(' + repr(self.rgb) + ')' # # Color scales # class ColorScale: """ Mapping from a number interval to a color range The color scale is blue - green - yellow - orange - red. """ def __init__(self, range): """ @param range: a tuple of two numbers (the lower and upper limits of the interval), or a single number specifying the upper limit for a default lower limit of zero @type range: C{float} or C{tuple} """ if isinstance(range, tuple): self.zero, self.range = range self.range = self.range-self.zero else: self.range = range self.zero = 0. def __call__(self, value): """ @param value: the value within the range for which the color is requested. If the value is outside of the specified range, the edge of the range is used instead. @type value: C{float} @returns: the color corresponding to value @rtype: L{Color} """ value = (value-self.zero)/self.range value = max(min(value, 1.), 0.) if value <= 0.25: red = 0. green = 4.*value blue = 1. elif value <= 0.5: red = 0. green = 1. blue = 1.-4.*(value-0.25) elif value <= 0.75: red = 4.*(value-0.5) green = 1. blue = 0. else: red = 1. green = 1.-4.*(value-0.75) blue = 0. return Color((red, green, blue)) class SymmetricColorScale: """ Mapping of a symmetric number interval to a color range The colors are red for negative numbers and green for positive numbers, with a color intensity proportional to the absolute value of the argument. Zero is mapped to white. """ def __init__(self, max, n = 20): """ @param max: a positive number defining the range, which is from -max to +max. @type max: C{float} """ self.range = max self.n = n self.colors = {} def __call__(self, value): """ @param value: the value within the range for which the color is requested. If the value is outside of the specified range, the edge of the range is used instead. @type value: C{float} @returns: the color corresponding to value @rtype: L{Color} """ negative = value < 0. index = N.floor(abs(value)*self.n/self.range) if index > self.n: raise ValueError('Value outside range') try: return self.colors[(negative, index)] except KeyError: white = 1.*(self.n-index)/self.n if negative: color = Color((1., white, white)) else: color = Color((white, 1., white)) self.colors[(negative, index)] = color return color # # Predefined colors # _full_colors = { 'black': Color((0.,0.,0.)), 'white': Color((1.,1.,1.)), 'grey': Color((0.5,0.5,0.5)), 'red': Color((1.,0.,0.)), 'green': Color((0.,1.,0.)), 'blue': Color((0.,0.,1.)), 'yellow': Color((1.,1.,0.)), 'magenta': Color((1.,0.,1.)), 'cyan': Color((0.,1.,1.)), 'orange': Color((1.,0.5,0.)), 'violet': Color((1.,0.,0.5)), 'olive': Color((0.1,0.6,0.2)), 'brown': Color((0.6,0.4,0.)), } _dark_colors = {} for name, value in _full_colors.items(): _dark_colors[name] = 0.3*value _light_colors = {} for name, value in _full_colors.items(): _light_colors[name] = 0.7*value + 0.3*_full_colors['white'] del name del value def ColorByName(name): """ @param name: one of the predefined color names: black, white, grey, red, green, blue, yellow, magenta, cyan, orange, violet, olive, and brown. Any color can be prefixed by "light " or "dark " to yield a variant. The prefix must be separated from the color name by white space, e.g. "light green". @type name: C{str} @returns: the color associated with name @rtype: L{Color} @raises KeyError: if the color name is not defined """ name = string.split(string.lower(name)) dict = _full_colors if len(name) == 2: if name[0] == 'light': dict = _light_colors elif name[0] == 'dark': dict = _dark_colors return dict[name[-1]] ScientificPython-2.9.4/Scientific/Visualization/PyMOL.py0000644000076600000240000003573211501734232023663 0ustar hinsenstaff00000000000000# This module provides classes that represent graphics objects to be # output to PyMOL. This module is as compatible as possible with module # VRML. Important differences: # - No general polygon objects (yet) # - Only the 'diffuse color' attribute of materials is used for rendering. # # Written by: Konrad Hinsen # Last revision: 2006-6-12 # """ Definitions of simple 3D graphics objects and scenes containing them, in a form that can be fed to the molecular visualization program PyMOL Scripts that use this module, directly or indirectly, must be run from inside PyMOL, otherwise they will terminate with an error message. This module is almost compatible with the modules VRML and VRML2, which provide visualization by VRML browsers. There are no Polygon objects, and the only material attribute supported is diffuse_color. Example:: >>> from Scientific.Visualization.PyMOL import * >>> scene = Scene([]) >>> scale = ColorScale(10.) >>> for x in range(11): >>> color = scale(x) >>> scene.addObject(Cube(Vector(x, 0., 0.), 0.2, >>> material=Material(diffuse_color = color))) >>> scene.view() """ import sys if not sys.modules.has_key('pymol') and not sys.modules.has_key('epydoc'): raise SystemExit("You have to run this script from inside PyMOL!") del sys from Scientific.IO.TextFile import TextFile from Scientific.Geometry import Transformation, Vector import os, string, sys, tempfile from Color import * if not sys.modules.has_key('epydoc'): from pymol import cmd, cgo # # Scene # class Scene: """ PyMOL scene A PyMOL scene is a collection of graphics objects that can be loaded into PyMOL. """ def __init__(self, objects=None, **options): """ @param objects: a list of graphics objects, or C{None} for an empty scene @type objects: C{list} or C{NoneType} @param options: options as keyword arguments. This is provided for compatibility only, no options have any effect for PyMOL graphics. """ if objects is None: self.objects = [] elif type(objects) == type([]): self.objects = objects else: self.objects = [objects] def __len__(self): """ @returns: the number of graphics objects in the scene @rtype: C{int} """ return len(self.objects) def __getitem__(self, item): """ @param item: an index @type item: C{int} @returns: the graphics object at the index position @rtype: L{PyMOLObject} """ return self.object[item] def addObject(self, object): """ @param object: a graphics object to be added to the scene @type object: L{PyMOLObject} """ self.objects.append(object) def writeToFile(self, filename, delete = 0): """ File I/O is not supported for PyMOL @raises ValueError: always """ raise ValueError("no file support for PyMOL graphics") def view(self, name="external graphics"): """ Load the scene into PyMOL @param name: the name of the PyMOL object corresponding to the scene """ pymol_objects = [] for o in self.objects: pymol_objects.extend(o.getPymolObjects()) cmd.load_cgo(pymol_objects, name) # # Base class for everything that produces graphic objects # class PyMOLObject: """ Graphics object for PyMOL This is an abstract base class. Use one of the subclasses to generate graphics. """ def __init__(self, attr): """ @param attr: graphics attributes specified by keywords @keyword material: color and surface properties @type material: L{Material} """ self.attr = {} for key, value in attr.items(): if key in self.attribute_names: self.attr[key] = value else: raise AttributeError('illegal attribute: ' + str(key)) attribute_names = ['comment'] def __getitem__(self, attr): """ @param attr: the name of a graphics attribute @type attr: C{str} @returns: the value of the attribute, or C{None} if the attribute is undefined """ try: return self.attr[attr] except KeyError: return None def __setitem__(self, attr, value): """ @param attr: the name of a graphics attribute @type attr: C{str} @param value: a new value for the attribute """ self.attr[attr] = value def __copy__(self): return copy.deepcopy(self) def writeToFile(self, file): raise AttributeError('Class ' + self.__class__.__name__ + ' does not implement file output.') def getPymolObjects(self): """ @returns: a list of C{pymol.cgo} objects """ raise AttributeError("to be implemented in subclasses") # # Molecules (via PDB) # class Molecules(PyMOLObject): """ Molecules from a PDB file """ def __init__(self, filename, **attr): """ @param filename: the name of a PDB file @type filename: C{str} @param attr: keyword attributes """ PyMOLObject.__init__(self, attr) self.object = filename def getPymolObjects(self): cmd.load_pdb(self.object) return [] # # Shapes # class ShapeObject(PyMOLObject): """ Graphics objects representing geometrical shapes This is an abstract base class. Use one of the subclasses to generate graphics. """ attribute_names = PyMOLObject.attribute_names + ['material'] def __add__(self, other): return Group([self]) + Group([other]) def use(self, file): pass def getPymolObjects(self): material = self['material'] if material is None: material = DiffuseMaterial('white') return self.cgoObjects(material) class Sphere(ShapeObject): """ Sphere """ def __init__(self, center, radius, **attr): """ @param center: the center of the sphere @type center: L{Scientific.Geometry.Vector} @param radius: the sphere radius @type radius: positive number @param attr: graphics attributes as keyword parameters """ self.radius = radius self.center = center ShapeObject.__init__(self, attr) def cgoObjects(self, material): rgb = material.getRGB() return [cgo.COLOR] + rgb \ + [cgo.SPHERE] + list(10.*self.center) + [10.*self.radius] class Cube(ShapeObject): """ Cube The edges of a cube are always parallel to the coordinate axes. """ def __init__(self, center, edge, **attr): """ @param center: the center of the sphere @type center: L{Scientific.Geometry.Vector} @param edge: the length of an edge @type edge: positive number @param attr: graphics attributes as keyword parameters """ self.edge = edge self.center = center ShapeObject.__init__(self, attr) def cgoObjects(self, material): raise ValueError("cubes not implemented yet") class Cylinder(ShapeObject): """ Cylinder """ def __init__(self, point1, point2, radius, faces = (True, True, True), **attr): """ @param point1: first end point of the cylinder axis @type point1: L{Scientific.Geometry.Vector} @param point2: second end point of the cylinder axis @type point2: L{Scientific.Geometry.Vector} @param radius: the cylinder radius @type radius: positive number @param faces: a sequence of three boolean flags, corresponding to the cylinder hull and the two circular end pieces, specifying for each of these parts whether it is visible or not @param attr: graphics attributes as keyword parameters """ self.faces = faces self.radius = radius self.point1 = point1 self.point2 = point2 ShapeObject.__init__(self, attr) def cgoObjects(self, material): rgb = material.getRGB() return [cgo.CYLINDER] \ + list(10.*self.point1) \ + list(10.*self.point2) \ + [10.*self.radius] \ + 2*rgb class Cone(ShapeObject): """ Cone """ def __init__(self, point1, point2, radius, face = True, **attr): """ @param point1: the tip of the cone @type point1: L{Scientific.Geometry.Vector} @param point2: end point of the cone axis @type point2: L{Scientific.Geometry.Vector} @param radius: the radius at the base @type radius: positive number @param face: a boolean flag, specifying if the circular bottom is visible @type face: C{bool} @param attr: graphics attributes as keyword parameters """ self.face = face self.radius = radius self.point1 = point1 self.point2 = point2 ShapeObject.__init__(self, attr) def cgoObjects(self, material): raise ValueError("cones not implemented yet") class Line(ShapeObject): """ Line """ def __init__(self, point1, point2, **attr): """ @param point1: first end point @type point1: L{Scientific.Geometry.Vector} @param point2: second end point @type point2: L{Scientific.Geometry.Vector} @param attr: graphics attributes as keyword parameters """ self.point1 = point1 self.point2 = point2 ShapeObject.__init__(self, attr) def cgoObjects(self, material): rgb = material.getRGB() return [cgo.COLOR] + rgb \ + [cgo.BEGIN, cgo.LINES, cgo.VERTEX, self.point1[0], self.point1[1], self.point1[2], cgo.VERTEX, self.point2[0], self.point2[1], self.point2[2], cgo.END] # # Groups # class Group: """ Base class for composite objects """ def __init__(self, objects, **attr): self.objects = [] for o in objects: if isGroup(o): self.objects = self.objects + o.objects else: self.objects.append(o) for key, value in attr.items(): for o in self.objects: o[key] = value is_group = 1 def __len__(self): return len(self.objects) def __getitem__(self, item): return self.object[item] def __coerce__(self, other): if not isGroup(other): other = Group([other]) return (self, other) def __add__(self, other): return Group(self.objects + other.objects) def getPymolObjects(self): objects = [] for o in self.objects: objects.extend(o.getPymolObjects()) return objects def isGroup(x): return hasattr(x, 'is_group') # # Composite Objects # class Arrow(Group): """ Arrow An arrow consists of a cylinder and a cone. """ def __init__(self, point1, point2, radius, **attr): """ @param point1: starting point of the arrow @type point1: L{Scientific.Geometry.Vector} @param point2: the tip of the arrow @type point2: L{Scientific.Geometry.Vector} @param radius: the radius of the shaft @type radius: positive number @param attr: graphics attributes as keyword parameters """ axis = point2-point1 height = axis.length() axis = axis/height cone_height = min(height, 4.*radius) cylinder_height = height - cone_height junction = point2-axis*cone_height cone = apply(Cone, (point2, junction, 0.75*cone_height), attr) objects = [cone] if cylinder_height > 0.005*radius: cylinder = apply(Cylinder, (point1, junction, radius), attr) objects.append(cylinder) Group.__init__(self, objects) # # Materials # class Material(PyMOLObject): """ Material specification for graphics objects A material defines the color and surface properties of an object. For compatibility with the module L{Scientific.Visualization.VRML}, many material attributes are accepted but not used in any way. """ def __init__(self, **attr): """ @param attr: material attributes as keyword arguments @keyword diffuse_color: the color of a diffusely reflecting surface @type diffuse_color: L{Color} @keyword emissive_color: not used @keyword ambient_color: not used @keyword specular_color: not used @keyword shininess: not used @keyword transparency: not used """ PyMOLObject.__init__(self, attr) attribute_names = PyMOLObject.attribute_names + \ ['ambient_color', 'diffuse_color', 'specular_color', 'emissive_color', 'shininess', 'transparency'] def getRGB(self): try: color = self.attr['diffuse_color'] except KeyError: color = Color((1., 1., 1.)) return [color.rgb[0], color.rgb[1], color.rgb[2]] # # Predefined materials # def DiffuseMaterial(color): """ @param color: a color object or a predefined color name @type color: L{Color} or C{str} @returns: a material with the 'diffuse color' attribute set to color @rtype: L{Material} """ if type(color) is type(''): color = ColorByName(color) try: return _diffuse_material_dict[color] except KeyError: m = Material(diffuse_color = color) _diffuse_material_dict[color] = m return m _diffuse_material_dict = {} EmissiveMaterial = DiffuseMaterial # # Test code # if __name__ == '__main__': if 0: from Scientific.Geometry import null, ex, ey, ez spheres = DiffuseMaterial('green') links = DiffuseMaterial('red') s1 = Sphere(null, 0.05, material = spheres) s2 = Sphere(ex, 0.05, material = spheres) s3 = Sphere(ey, 0.05, material = spheres) s4 = Sphere(ez, 0.05, material = spheres) a1 = Arrow(null, ex, 0.01, material = links) a2 = Arrow(null, ey, 0.01, material = links) a3 = Arrow(null, ez, 0.01, material = links) scene = Scene([s1, s2, s3, s4, a1, a2, a3]) scene.view() if 0: scene = Scene([]) scale = SymmetricColorScale(10., 10) for x in range(-10, 11): color = scale(x) m = Material(diffuse_color = color) scene.addObject(Cube(Vector(x,0.,0.), 0.2, material=m)) scene.view() if 1: scene = Scene([]) scale = ColorScale(10.) for x in range(11): color = scale(x) m = Material(diffuse_color = color) scene.addObject(Cube(Vector(x,0.,0.), 0.2, material=m)) scene.view() ScientificPython-2.9.4/Scientific/Visualization/VMD.py0000644000076600000240000005022711501734232023345 0ustar hinsenstaff00000000000000# This module provides classes that represent graphics objects to be # output to VMD. This module is as compatible as possible with module # VRML. Important differences: # - No general polygon objects. # - Only the 'diffuse color' attribute of materials is used for rendering. # Warning: loading cubes into VMD is very slow, as each cube is represented # by 12 individual triangles. # # Written by: Konrad Hinsen # Last revision: 2008-8-18 # """ Definitions of simple 3D graphics objects and scenes containing them, in a form that can be fed to the molecular visualization program VMD Scenes can either be written as VMD script files, or visualized directly by running VMD. This module is almost compatible with the modules VRML and VRML2, which provide visualization by VRML browsers. There is no Polygon class, and the only material attribute supported is diffuse_color. Note also that loading a scene with many cubes into VMD is very slow, because each cube is represented by 12 individual triangles. Example:: >>> from VMD import * >>> scene = Scene([]) >>> scale = ColorScale(10.) >>> for x in range(11): >>> color = scale(x) >>> scene.addObject(Cube(Vector(x, 0., 0.), 0.2, >>> material=Material(diffuse_color = color))) >>> scene.view() """ from Scientific.IO.TextFile import TextFile from Scientific.Geometry import Transformation, Vector, ex, ey, ez import os, string, sys, tempfile from Color import * # # VMD file # class SceneFile: def __init__(self, filename, mode = 'r', scale = 1., delete = False): if mode == 'r': raise TypeError('Not yet implemented.') self.file = TextFile(filename, 'w') self.memo = {} self.delete = delete self.scale = scale self.filename = filename self.writeString('proc python_graphics {} {\n') self.writeString('mol new\n') self.writeString('graphics 0 color 35\n') def __del__(self): self.close() def writeString(self, data): self.file.write(data) def writeVector(self, v): self.writeString(" {%g %g %g}" % tuple(v)) def close(self): if self.file is not None: self.writeString('}\npython_graphics\n') self.writeString('display resetview\n') if self.delete: self.writeString('file delete ' + self.filename) self.file.close() self.file = None def write(self, object): object.writeToFile(self) # # Scene # class Scene: """ VMD scene A VMD scene is a collection of graphics objects that can be loaded into VMD. """ def __init__(self, objects=None, **options): """ @param objects: a list of graphics objects, or C{None} for an empty scene @type objects: C{list} or C{NoneType} @param options: options as keyword arguments @keyword scale: a scale factor applied to all coordinates of geometrical objects B{except} for molecule objects, which cannot be scaled @type scale: positive number """ if objects is None: self.objects = [] elif type(objects) == type([]): self.objects = objects else: self.objects = [objects] try: self.scale = options['scale'] except KeyError: self.scale = 1. def __len__(self): """ @returns: the number of graphics objects in the scene @rtype: C{int} """ return len(self.objects) def __getitem__(self, item): """ @param item: an index @type item: C{int} @returns: the graphics object at the index position @rtype: L{VMDObject} """ return self.object[item] def addObject(self, object): """ @param object: a graphics object to be added to the scene @type object: L{VMDObject} """ self.objects.append(object) def writeToFile(self, filename, delete = False): """ Write the scene to a VMD script file @param filename: the name of the script @type filename: C{str} @param delete: flag that indicates whether the script should delete itself as its last action; used for temporary files @type delete: C{bool} """ file = SceneFile(filename, 'w', self.scale, delete) for o in self.objects: o.writeToFile(file) file.close() def view(self, *args): """ Start VMD and load the scene @param args: not used, for compatibility with VRML modules only """ filename = tempfile.mktemp() self.writeToFile(filename, 1) if sys.platform == 'win32': #Unless VMD (or a batch file for it) is on the path #which is not done by their default install) we must #specify the path in full, which by default is #C:\Program Files\University of Illinois\VMD\vmd.exe # #Note that on non-English versions of Windows, #the name "Program Files" does change. I believe #there is an API call to ask for it, but #there is also an Environment Variable: program_files = 'C:\\Program Files' if os.environ.has_key('PROGRAMFILES') : program_files = os.environ['PROGRAMFILES'] vmd_exe = os.path.join(program_files, 'University of Illinois', 'VMD','vmd.exe') #Check that vmd.exe does exist at this point, otherwise #will get a path not found error if os.path.exists(vmd_exe) : #Because the program path has spaces, it must be quoted. #The filename MAY have spaces, so quote that too. # #Is the pipe stuff ( 1> /dev/null 2>&1 ) doing anything #important? Leaving it off makes it work... # #os.system('"' + vmd_exe + '" -nt -e "' + filename + '"') #os.system can work, but there are two problems: # * it gives me grief with spaces in filenames # (even if they are quoted) # * its a blocking function, unlike the VRML, VRML2 # and VPython visualisations which don't pause Python import win32api win32api.WinExec('"' + vmd_exe + '" -nt -e "' + filename + '"') else : print "Error - could not find VMD, tried:" print vmd_exe else: os.system('vmd -e ' + filename + ' 1> /dev/null 2>&1') # # Base class for everything that produces graphic objects # class VMDObject: """ Graphics object for VMD This is an abstract base class. Use one of the subclasses to generate graphics. """ def __init__(self, attr): """ @param attr: graphics attributes specified by keywords @keyword material: color and surface properties @type material: L{Material} @keyword comment: a comment that is written to the script file @type comment: C{str} """ self.attr = {} for key, value in attr.items(): if key in self.attribute_names: self.attr[key] = value else: raise AttributeError('illegal attribute: ' + str(key)) attribute_names = ['comment'] def __getitem__(self, attr): """ @param attr: the name of a graphics attribute @type attr: C{str} @returns: the value of the attribute, or C{None} if the attribute is undefined """ try: return self.attr[attr] except KeyError: return None def __setitem__(self, attr, value): """ @param attr: the name of a graphics attribute @type attr: C{str} @param value: a new value for the attribute """ self.attr[attr] = value def __copy__(self): return copy.deepcopy(self) def writeToFile(self, file): raise AttributeError('Class ' + self.__class__.__name__ + ' does not implement file output.') # # Molecules (via PDB) # class Molecules(VMDObject): """ Molecules from a PDB file """ def __init__(self, object, **attr): """ @param object: the name of a PDB file or an MMTK object @type object: C{str} or MMTK.ChemicalObject @param attr: keyword attributes """ VMDObject.__init__(self, attr) self.object = object def writeToFile(self, file): comment = self['comment'] if comment is not None: file.writeString('# ' + comment + '\n') if type(self.object) == type(''): file.writeString('mol load pdb ' + self.object + '\n') else: tempdir = tempfile.tempdir tempfile.tempdir = os.path.split(file.filename)[0] filename = tempfile.mktemp()+'.pdb' tempfile.tempdir = tempdir self.object.writeToFile(filename) file.writeString('mol load pdb ' + filename + '\n') if file.delete: file.writeString('file delete ' + filename + '\n') # # Shapes # class ShapeObject(VMDObject): """ Graphics objects representing geometrical shapes This is an abstract base class. Use one of the subclasses to generate graphics. """ def __init__(self, attr): VMDObject.__init__(self, attr) attribute_names = VMDObject.attribute_names + ['material'] def __add__(self, other): return Group([self]) + Group([other]) def writeToFile(self, file): comment = self['comment'] if comment is not None: file.writeString('# ' + comment + '\n') material = self['material'] if material is not None: material.writeToFile(file) self.writeSpecification(file) def use(self, file): pass class Sphere(ShapeObject): """ Sphere """ def __init__(self, center, radius, **attr): """ @param center: the center of the sphere @type center: L{Scientific.Geometry.Vector} @param radius: the sphere radius @type radius: positive number @param attr: graphics attributes as keyword parameters """ self.radius = radius self.center = center ShapeObject.__init__(self, attr) def writeSpecification(self, file): file.writeString('graphics 0 sphere') file.writeVector(self.center*file.scale) file.writeString(' radius ' + `self.radius*file.scale` + '\n') class Cube(ShapeObject): """ Cube The edges of a cube are always parallel to the coordinate axes. """ def __init__(self, center, edge, **attr): """ @param center: the center of the sphere @type center: L{Scientific.Geometry.Vector} @param edge: the length of an edge @type edge: positive number @param attr: graphics attributes as keyword parameters """ self.edge = edge self.center = center ShapeObject.__init__(self, attr) def writeSpecification(self, file): d = 0.5*self.edge for ext1, ext2 in [(ex, ey), (ey, ez), (ez, ex)]: norm = ext1.cross(ext2) for offset in [-1, 1]: p1 = d*(offset*norm-ext1-ext2)+self.center p2 = d*(offset*norm-ext1+ext2)+self.center p3 = d*(offset*norm+ext1-ext2)+self.center p4 = d*(offset*norm+ext1+ext2)+self.center file.writeString('graphics 0 triangle') file.writeVector(p1*file.scale) file.writeVector(p2*file.scale) file.writeVector(p3*file.scale) file.writeString('\n') file.writeString('graphics 0 triangle') file.writeVector(p2*file.scale) file.writeVector(p3*file.scale) file.writeVector(p4*file.scale) file.writeString('\n') class Cylinder(ShapeObject): """ Cylinder """ def __init__(self, point1, point2, radius, faces = (1, 1, 1), **attr): """ @param point1: first end point of the cylinder axis @type point1: L{Scientific.Geometry.Vector} @param point2: second end point of the cylinder axis @type point2: L{Scientific.Geometry.Vector} @param radius: the cylinder radius @type radius: positive number @param faces: a sequence of three boolean flags, corresponding to the cylinder hull and the two circular end pieces, specifying for each of these parts whether it is visible or not @param attr: graphics attributes as keyword parameters """ self.faces = faces self.radius = radius self.point1 = point1 self.point2 = point2 ShapeObject.__init__(self, attr) def writeSpecification(self, file): file.writeString('graphics 0 cylinder') file.writeVector(self.point1*file.scale) file.writeVector(self.point2*file.scale) file.writeString(' radius ' + `self.radius*file.scale`) if self.faces[:2] == (1, 1): file.writeString(' filled yes') file.writeString('\n') class Cone(ShapeObject): """ Cone """ def __init__(self, point1, point2, radius, face = 1, **attr): """ @param point1: the tip of the cone @type point1: L{Scientific.Geometry.Vector} @param point2: end point of the cone axis @type point2: L{Scientific.Geometry.Vector} @param radius: the radius at the base @type radius: positive number @param face: a boolean flag, specifying if the circular bottom is visible @type face: C{bool} @param attr: graphics attributes as keyword parameters """ self.face = face self.radius = radius self.point1 = point1 self.point2 = point2 ShapeObject.__init__(self, attr) def writeSpecification(self, file): file.writeString('graphics 0 cone') file.writeVector(self.point2*file.scale) file.writeVector(self.point1*file.scale) file.writeString(' radius ' + `self.radius*file.scale` + ' resolution 12\n') class Line(ShapeObject): """ Line """ def __init__(self, point1, point2, **attr): """ @param point1: first end point @type point1: L{Scientific.Geometry.Vector} @param point2: second end point @type point2: L{Scientific.Geometry.Vector} @param attr: graphics attributes as keyword parameters """ self.point1 = point1 self.point2 = point2 ShapeObject.__init__(self, attr) def writeSpecification(self, file): file.writeString('graphics 0 line') file.writeVector(self.point1*file.scale) file.writeVector(self.point2*file.scale) file.writeString('\n') # # Groups # class Group: """ Base class for composite objects """ def __init__(self, objects, **attr): self.objects = [] for o in objects: if isGroup(o): self.objects = self.objects + o.objects else: self.objects.append(o) for key, value in attr.items(): for o in self.objects: o[key] = value is_group = 1 def __len__(self): return len(self.objects) def __getitem__(self, item): return self.object[item] def __coerce__(self, other): if not isGroup(other): other = Group([other]) return (self, other) def __add__(self, other): return Group(self.objects + other.objects) def writeToFile(self, file): for o in self.objects: o.writeToFile(file) def isGroup(x): return hasattr(x, 'is_group') # # Composite Objects # class Arrow(Group): """ Arrow An arrow consists of a cylinder and a cone. """ def __init__(self, point1, point2, radius, **attr): """ @param point1: starting point of the arrow @type point1: L{Scientific.Geometry.Vector} @param point2: the tip of the arrow @type point2: L{Scientific.Geometry.Vector} @param radius: the radius of the shaft @type radius: positive number @param attr: graphics attributes as keyword parameters """ axis = point2-point1 height = axis.length() axis = axis/height cone_height = min(height, 4.*radius) cylinder_height = height - cone_height junction = point2-axis*cone_height cone = apply(Cone, (point2, junction, 0.75*cone_height), attr) objects = [cone] if cylinder_height > 0.005*radius: cylinder = apply(Cylinder, (point1, junction, radius), attr) objects.append(cylinder) Group.__init__(self, objects) # # Materials # class Material(VMDObject): """ Material specification for graphics objects A material defines the color and surface properties of an object. For compatibility with the module L{Scientific.Visualization.VRML}, many material attributes are accepted but not used in any way. """ def __init__(self, **attr): """ @param attr: material attributes as keyword arguments @keyword diffuse_color: the color of a diffusely reflecting surface @type diffuse_color: L{Color} @keyword emissive_color: not used @keyword ambient_color: not used @keyword specular_color: not used @keyword shininess: not used @keyword transparency: not used """ VMDObject.__init__(self, attr) attribute_names = VMDObject.attribute_names + \ ['ambient_color', 'diffuse_color', 'specular_color', 'emissive_color', 'shininess', 'transparency'] def writeToFile(self, file): try: last = file.memo['material'] if last == self: return except KeyError: pass try: color = self.attr['diffuse_color'] except KeyError: color = Color((1., 1., 1.)) file.writeString('color change rgb 35 ' + str(color) + '\n') file.memo['material'] = self # # Predefined materials # def DiffuseMaterial(color): """ @param color: a color object or a predefined color name @type color: L{Color} or C{str} @returns: a material with the 'diffuse color' attribute set to color @rtype: L{Material} """ if type(color) is type(''): color = ColorByName(color) try: return _diffuse_material_dict[color] except KeyError: m = Material(diffuse_color = color) _diffuse_material_dict[color] = m return m _diffuse_material_dict = {} EmissiveMaterial = DiffuseMaterial # # Test code # if __name__ == '__main__': if 0: from Scientific.Geometry import null, ex, ey, ez spheres = DiffuseMaterial('green') links = DiffuseMaterial('red') s1 = Sphere(null, 0.05, material = spheres) s2 = Sphere(ex, 0.05, material = spheres) s3 = Sphere(ey, 0.05, material = spheres) s4 = Sphere(ez, 0.05, material = spheres) a1 = Arrow(null, ex, 0.01, material = links) a2 = Arrow(null, ey, 0.01, material = links) a3 = Arrow(null, ez, 0.01, material = links) scene = Scene([s1, s2, s3, s4, a1, a2, a3]) scene.view() if 0: scene = Scene([]) scale = SymmetricColorScale(10., 10) for x in range(-10, 11): color = scale(x) m = Material(diffuse_color = color) scene.addObject(Cube(Vector(x,0.,0.), 0.2, material=m)) scene.view() if 1: scene = Scene([]) scale = ColorScale(10.) for x in range(11): color = scale(x) m = Material(diffuse_color = color) scene.addObject(Cube(Vector(x,0.,0.), 0.2, material=m)) scene.writeToFile('~/triangle.vmd') ScientificPython-2.9.4/Scientific/Visualization/VPython.py0000644000076600000240000003667711501734232024343 0ustar hinsenstaff00000000000000# VPython interface # # Written by: Konrad Hinsen # Last revision: 2006-6-12 # """ Definitions of simple 3D graphics objects and scenes containing them, to be rendered using VPython """ from Scientific.Geometry import Transformation, Vector import os, string, sys, tempfile if not sys.modules.has_key('epydoc'): import visual from Color import * # # Scene # class Scene: """ VPython scene A VPython scene is a collection of graphics objects that can be shown in a VPython window. When the "view" method is called, a new window is created and the graphics objects are displayed in it. """ def __init__(self, objects = None, **options): """ @param objects: a list of graphics objects, or C{None} for an empty scene @type objects: C{list} or C{NoneType} @param options: options as keyword arguments @keyword title: the window title (default: "VPython scene") @type title: C{str} @keyword width: the window width in pixels (default: 300) @type width: C{int} @keyword height: the window height in pixels (default: 300) @type height: C{int} @keyword background: the background color (default: "black") @type background: C{str} """ if objects is None: self.objects = [] elif type(objects) == type([]): self.objects = objects else: self.objects = [objects] self.options = {"title": "VPython Scene", "width": 300, "height": 300, "background": "black"} for key, value in options.items(): if self.options.has_key(key): self.options[key] = value else: raise ValueError("undefined option: " + repr(key)) def __len__(self): """ @returns: the number of graphics objects in the scene @rtype: C{int} """ return len(self.objects) def __getitem__(self, item): """ @param item: an index @type item: C{int} @returns: the graphics object at the index position @rtype: L{GraphicsObject} """ return self.object[item] def addObject(self, object): """ @param object: a graphics object to be added to the scene @type object: L{GraphicsObject} """ self.objects.append(object) def view(self): """ Open a VPython window for the scene """ color = self.options["background"] if type(color) == type(''): color = ColorByName(color) self.window = visual.display(title = self.options["title"], width = self.options["width"], height = self.options["height"], background = color.rgb, exit = 0) for o in self.objects: o.display(self.window) # # Base classes for graphics objects # class GraphicsObject: """ Graphics object for VPython This is an abstract base class. Use one of the subclasses to generate graphics. """ def __init__(self, attr): """ @param attr: graphics attributes specified by keywords @keyword material: color and surface properties @type material: L{Material} """ self.attr = {} for key, value in attr.items(): if key in self.attribute_names: self.attr[key] = value else: raise AttributeError('illegal attribute: ' + str(key)) attribute_names = ['comment'] def __getitem__(self, attr): """ @param attr: the name of a graphics attribute @type attr: C{str} @returns: the value of the attribute, or C{None} if the attribute is undefined """ try: return self.attr[attr] except KeyError: return None def __setitem__(self, attr, value): """ @param attr: the name of a graphics attribute @type attr: C{str} @param value: a new value for the attribute """ self.attr[attr] = value def __copy__(self): return copy.deepcopy(self) class ShapeObject(GraphicsObject): """ Graphics objects representing geometrical shapes This is an abstract base class. Use one of the subclasses to generate graphics. """ attribute_names = ['comment', 'material'] def __add__(self, other): return Group([self]) + Group([other]) def display(self, window): material = self.attr.get('material', None) if material is None: color = ColorByName('white') else: color = material.attr.get('emissive_color', None) if color is None: color = material.attr.get('diffuse_color', None) if color is None: color = ColorByName('white') window.foreground = color.rgb self.show(window) # # Specific shape objects # class Sphere(ShapeObject): """ Sphere """ def __init__(self, center, radius, **attr): """ @param center: the center of the sphere @type center: L{Scientific.Geometry.Vector} @param radius: the sphere radius @type radius: positive number @param attr: graphics attributes as keyword parameters """ self.center = center self.radius = radius ShapeObject.__init__(self, attr) def show(self, window): self.object = visual.sphere(pos=tuple(self.center), radius=self.radius) class Cube(ShapeObject): """ Cube The edges of a cube are always parallel to the coordinate axes. """ def __init__(self, center, edge, **attr): """ @param center: the center of the sphere @type center: L{Scientific.Geometry.Vector} @param edge: the length of an edge @type edge: positive number @param attr: graphics attributes as keyword parameters """ self.center = center self.edge = edge ShapeObject.__init__(self, attr) def show(self, window): self.object = visual.box(pos = tuple(self.center), length = self.edge, height = self.edge, width = self.edge) class Cylinder(ShapeObject): """ Cylinder """ def __init__(self, point1, point2, radius, **attr): """ @param point1: first end point of the cylinder axis @type point1: L{Scientific.Geometry.Vector} @param point2: second end point of the cylinder axis @type point2: L{Scientific.Geometry.Vector} @param radius: the cylinder radius @type radius: positive number @param attr: graphics attributes as keyword parameters """ self.point1 = point1 self.point2 = point2 self.radius = radius ShapeObject.__init__(self, attr) # accept "faces" for compatibility with VRML module attribute_names = ShapeObject.attribute_names + ['faces'] def show(self, window): self.object = visual.cylinder(pos = tuple(self.point1), axis = tuple(self.point2-self.point1), radius = self.radius) class Arrow(ShapeObject): """ Arrow """ def __init__(self, point1, point2, radius, **attr): """ @param point1: starting point of the arrow @type point1: L{Scientific.Geometry.Vector} @param point2: the tip of the arrow @type point2: L{Scientific.Geometry.Vector} @param radius: the radius of the shaft @type radius: positive number @param attr: graphics attributes as keyword parameters """ self.point1 = point1 self.point2 = point2 self.radius = radius ShapeObject.__init__(self, attr) def show(self, window): self.object = visual.arrow(pos = tuple(self.point1), axis = tuple(self.point2-self.point1), shaftwidth = self.radius) class Cone(ShapeObject): """ Cone """ def __init__(self, point1, point2, radius, face = 1, **attr): """ @param point1: the tip of the cone @type point1: L{Scientific.Geometry.Vector} @param point2: end point of the cone axis @type point2: L{Scientific.Geometry.Vector} @param radius: the radius at the base @type radius: positive number @param face: a boolean flag, specifying if the circular bottom is visible @type face: C{bool} @param attr: graphics attributes as keyword parameters """ self.point1 = point1 self.point2 = point2 self.radius = radius ShapeObject.__init__(self, attr) # accept "face" for compatibility with VRML module attribute_names = ShapeObject.attribute_names + ['face'] def show(self, window): self.object = visual.cone(pos = tuple(self.point2), axis = tuple(self.point1-self.point2), radius = self.radius) class PolyLines(ShapeObject): """ Multiple connected lines """ def __init__(self, points, **attr): """ @param points: a sequence of points to be connected by lines @type points: sequence of L{Scientific.Geometry.Vector} @param attr: graphics attributes as keyword parameters """ self.points = points ShapeObject.__init__(self, attr) def show(self, window): self.object = visual.curve(pos = map(tuple, self.points), color = window.foreground) class Line(PolyLines): """ Line """ def __init__(self, point1, point2, **attr): """ @param point1: first end point @type point1: L{Scientific.Geometry.Vector} @param point2: second end point @type point2: L{Scientific.Geometry.Vector} @param attr: graphics attributes as keyword parameters """ apply(PolyLines.__init__, (self, [point1, point2]), attr) class Polygons(ShapeObject): """ Polygons """ def __init__(self, points, index_lists, **attr): """ @param points: a sequence of points @type points: sequence of L{Scientific.Geometry.Vector} @param index_lists: a sequence of index lists, one for each polygon. The index list for a polygon defines which points are vertices of the polygon. @type index_lists: sequence of C{list} @param attr: graphics attributes as keyword parameters """ self.points = points self.index_lists = index_lists ShapeObject.__init__(self, attr) def show(self, window): for indices in self.index_lists: points = [] for index in indices: points.append(tuple(self.points[index])) visual.convex(pos = points, color = window.foreground) # # Groups # class Group: """ Base class for composite objects """ def __init__(self, objects, **attr): self.objects = [] for o in objects: if isGroup(o): self.objects = self.objects + o.objects else: self.objects.append(o) for key, value in attr.items(): for o in self.objects: o[key] = value is_group = 1 def __len__(self): return len(self.objects) def __getitem__(self, item): return self.object[item] def __coerce__(self, other): if not isGroup(other): other = Group([other]) return (self, other) def __add__(self, other): return Group(self.objects + other.objects) def show(self, window): for o in self.objects: o.show(window) def isGroup(x): return hasattr(x, 'is_group') # # Materials # class Material(GraphicsObject): """ Material specification for graphics objects A material defines the color and surface properties of an object. """ def __init__(self, **attr): """ @param attr: material attributes as keyword arguments @keyword diffuse_color: the color of a diffusely reflecting surface @type diffuse_color: L{Color} @keyword emissive_color: the color of emitted light @type emissive_color: L{Color} """ GraphicsObject.__init__(self, attr) attribute_names = GraphicsObject.attribute_names + \ ['ambient_color', 'diffuse_color', 'specular_color', 'emissive_color', 'shininess', 'transparency'] # # Predefined materials # def DiffuseMaterial(color): """ @param color: a color object or a predefined color name @type color: L{Color} or C{str} @returns: a material with the 'diffuse color' attribute set to color @rtype: L{Material} """ if type(color) is type(''): color = ColorByName(color) try: return _diffuse_material_dict[color] except KeyError: m = Material(diffuse_color = color) _diffuse_material_dict[color] = m return m _diffuse_material_dict = {} def EmissiveMaterial(color): """ @param color: a color object or a predefined color name @type color: L{Color} or C{str} @returns: a material with the 'emissive color' attribute set to color @rtype: L{Material} """ if type(color) is type(''): color = ColorByName(color) try: return _emissive_material_dict[color] except KeyError: m = Material(emissive_color = color) _emissive_material_dict[color] = m return m _emissive_material_dict = {} # # Test code # if __name__ == '__main__': if 0: from Scientific.Geometry import null, ex, ey, ez spheres = EmissiveMaterial('blue') links = EmissiveMaterial('orange') s1 = Sphere(null, 0.05, material = spheres) s2 = Sphere(ex, 0.05, material = spheres) s3 = Sphere(ey, 0.05, material = spheres) s4 = Sphere(ez, 0.05, material = spheres) a1 = Arrow(null, ex, 0.01, material = links) a2 = Arrow(null, ey, 0.01, material = links) a3 = Arrow(null, ez, 0.01, material = links) scene = Scene([s1, s2, s3, s4, a1, a2, a3]) scene.view() if 0: scene = Scene([]) scale = ColorScale(10.) for x in range(11): color = scale(x) m = Material(diffuse_color = color) scene.addObject(Cube(Vector(x,0.,0.), 0.2, material=m)) scene.view() if 1: points = [Vector(0., 0., 0.), Vector(0., 1., 0.), Vector(1., 1., 0.), Vector(1., 0., 0.), Vector(1., 0., 1.), Vector(1., 1., 1.)] indices = [[0, 1, 2, 3, 0], [3, 4, 5, 2, 3]] scene = Scene(Polygons(points, indices, material=EmissiveMaterial('blue'))) scene.view() if 0: points = [Vector(0., 0., 0.), Vector(0., 1., 0.), Vector(1., 1., 0.), Vector(1., 0., 0.), Vector(1., 0., 1.), Vector(1., 1., 1.)] scene = Scene(PolyLines(points, material = EmissiveMaterial('green'))) scene.view() ScientificPython-2.9.4/Scientific/Visualization/VRML.py0000644000076600000240000006002411501734232023473 0ustar hinsenstaff00000000000000# This module provides classes that represent VRML objects for use # in data visualization applications. # # Written by: Konrad Hinsen # Last revision: 2006-6-9 # """ Definitions of simple 3D graphics objects and VRML scenes containing them The objects are appropriate for data visualization, not for virtual reality modelling. Scenes can be written to VRML files or visualized immediately using a VRML browser, whose name is taken from the environment variable VRMLVIEWER (under Unix). This module used the original VRML definition, version 1.0. For the newer VRML 2 or VRML97, use the module VRML2, which uses exactly the same interface. Example:: >>> from Scientific.Visualization.VRML import * >>> scene = Scene([]) >>> scale = ColorScale(10.) >>> for x in range(11): >>> color = scale(x) >>> scene.addObject(Cube(Vector(x, 0., 0.), 0.2, >>> material=Material(diffuse_color = color))) >>> scene.view() """ from Scientific.IO.TextFile import TextFile from Scientific.Geometry import Transformation, Vector, ex, ey, ez from Scientific import N import os, string, tempfile from Color import * # # VRML file # class SceneFile: def __init__(self, filename, mode = 'r'): if mode == 'r': raise TypeError('Not yet implemented.') self.file = TextFile(filename, 'w') self.file.write('#VRML V1.0 ascii\n') self.file.write('Separator {\n') self.memo = {} self.name_counter = 0 def __del__(self): self.close() def writeString(self, data): self.file.write(data) def close(self): if self.file is not None: self.file.write('}\n') self.file.close() self.file = None def write(self, object): object.writeToFile(self) def uniqueName(self): self.name_counter = self.name_counter + 1 return 'i' + `self.name_counter` VRMLFile = SceneFile # # Scene # class Scene: """ VRML scene A VRML scene is a collection of graphics objects that can be written to a VRML file or fed directly to a VRML browser. """ def __init__(self, objects = None, cameras = None, **options): """ @param objects: a list of graphics objects, or C{None} for an empty scene @type objects: C{list} or C{NoneType} @param cameras: a list of cameras, or C{None} for no cameras B{(not yet implemented)} @param options: options as keyword arguments (none defined) """ if objects is None: self.objects = [] elif type(objects) == type([]): self.objects = objects else: self.objects = [objects] if cameras is None: self.cameras = [] else: self.cameras = cameras def __len__(self): """ @returns: the number of graphics objects in the scene @rtype: C{int} """ return len(self.objects) def __getitem__(self, item): """ @param item: an index @type item: C{int} @returns: the graphics object at the index position @rtype: L{VRMLObject} """ return self.object[item] def addObject(self, object): """ @param object: a graphics object to be added to the scene @type object: L{VRMLObject} """ self.objects.append(object) def addCamera(self, camera): """ Add a camera to the list of cameras @param camera: the camera to be adde """ self.cameras.append(camera) def writeToFile(self, filename): """ Write the scene to a VRML file @param filename: the name of the script @type filename: C{str} """ file = VRMLFile(filename, 'w') if self.cameras: self.cameras[0].writeToFile(file) for o in self.objects: o.writeToFile(file) file.close() def view(self, *args): """ Start a VRML browser and load the scene @param args: not used, for compatibility only """ import sys filename = tempfile.mktemp()+'.wrl' if sys.platform == 'win32': import win32api self.writeToFile(filename) win32api.ShellExecute(0, "open", filename, None, "", 1) elif os.environ.has_key('VRMLVIEWER'): self.writeToFile(filename) if os.fork() == 0: os.system(os.environ['VRMLVIEWER'] + ' ' + filename + ' 1> /dev/null 2>&1') os.unlink(filename) os._exit(0) else: print 'No VRML viewer defined' # # Base class for everything that produces nodes # class VRMLObject: """ Graphics object for VRML This is an abstract base class. Use one of the subclasses to generate graphics. """ def __init__(self, attr): """ @param attr: graphics attributes specified by keywords @keyword material: color and surface properties @type material: L{Material} @keyword comment: a comment that is written to the script file @type comment: C{str} @keyword reuse: a flag defaulting to C{False}. If set to C{True}, the object may share its VRML definition with other objects. This reduces the size of the VRML file, but can yield surprising side effects in some cases. @type reuse: C{bool} """ self.attr = {} for key, value in attr.items(): if key in self.attribute_names: self.attr[key] = value else: raise AttributeError('illegal attribute: ' + str(key)) attribute_names = ['comment'] def __getitem__(self, attr): """ @param attr: the name of a graphics attribute @type attr: C{str} @returns: the value of the attribute, or C{None} if the attribute is undefined """ try: return self.attr[attr] except KeyError: return None def __setitem__(self, attr, value): """ @param attr: the name of a graphics attribute @type attr: C{str} @param value: a new value for the attribute """ self.attr[attr] = value def __copy__(self): return copy.deepcopy(self) def writeToFile(self, file): raise AttributeError('Class ' + self.__class__.__name__ + ' does not implement file output.') # # Shapes # class ShapeObject(VRMLObject): """ Graphics objects representing geometrical shapes This is an abstract base class. Use one of the subclasses to generate graphics. """ def __init__(self, attr, rotation, translation, reference_point): VRMLObject.__init__(self, attr) if rotation is None: rotation = Transformation.Rotation(ez, 0.) else: rotation = apply(Transformation.Rotation, rotation) if translation is None: translation = Transformation.Translation(Vector(0.,0.,0.)) else: translation = Transformation.Translation(translation) self.transformation = translation*rotation self.reference_point = reference_point attribute_names = VRMLObject.attribute_names + ['material', 'reuse'] def __add__(self, other): return Group([self]) + Group([other]) def writeToFile(self, file): comment = self['comment'] if comment is not None: file.writeString('# ' + comment + '\n') file.writeString('TransformSeparator {\n') vector = self.transformation.translation().displacement() axis, angle = self.transformation.rotation().axisAndAngle() trans_flag = vector.length() > 1.e-4 rot_flag = abs(angle) > 1.e-4 if trans_flag and rot_flag: file.writeString('Transform{translation ' + `vector[0]` + ' ' + \ `vector[1]` + ' ' + `vector[2]` + \ ' rotation ' + `axis[0]` + ' ' + `axis[1]` + ' ' + `axis[2]` + ' ' + `angle` + '}\n') elif trans_flag: file.writeString('Translation{translation ' + `vector[0]` + ' ' + \ `vector[1]` + ' ' + `vector[2]` + '}\n') elif rot_flag: file.writeString('Rotation{rotation ' + `axis[0]` + ' ' + \ `axis[1]` + ' ' + `axis[2]` + ' ' + \ `angle` + '}\n') material = self['material'] reuse = self['reuse'] if reuse: key = self.memoKey() + (material, self.__class__) if file.memo.has_key(key): file.writeString('USE ' + file.memo[key] + '\n') self.use(file) if material is not None: material.use(file) else: name = file.uniqueName() file.memo[key] = name file.writeString('DEF ' + name + ' Group{\n') if material is not None: material.writeToFile(file) self.writeSpecification(file) file.writeString('}\n') else: if material is not None: material.writeToFile(file) self.writeSpecification(file) file.writeString('}\n') def use(self, file): pass class Sphere(ShapeObject): """ Sphere """ def __init__(self, center, radius, **attr): """ @param center: the center of the sphere @type center: L{Scientific.Geometry.Vector} @param radius: the sphere radius @type radius: positive number @param attr: graphics attributes as keyword parameters """ self.radius = radius ShapeObject.__init__(self, attr, None, center, center) def writeSpecification(self, file): file.writeString('Sphere{radius ' + `self.radius` + '}\n') def memoKey(self): return (self.radius, ) class Cube(ShapeObject): """ Cube The edges of a cube are always parallel to the coordinate axes. """ def __init__(self, center, edge, **attr): """ @param center: the center of the sphere @type center: L{Scientific.Geometry.Vector} @param edge: the length of an edge @type edge: positive number @param attr: graphics attributes as keyword parameters """ self.edge = edge ShapeObject.__init__(self, attr, None, center, center) def writeSpecification(self, file): file.writeString('Cube{width ' + `self.edge` + \ ' height ' + `self.edge` + \ ' depth ' + `self.edge` + '}\n') def memoKey(self): return (self.edge, ) class LinearOrientedObject(ShapeObject): def __init__(self, attr, point1, point2): center = 0.5*(point1+point2) axis = point2-point1 self.height = axis.length() if self.height > 0: axis = axis/self.height rot_axis = ey.cross(axis) sine = rot_axis.length() cosine = ey*axis angle = Transformation.angleFromSineAndCosine(sine, cosine) if abs(angle) < 1.e-4 or abs(angle-2.*N.pi) < 1.e-4: rotation = None else: if abs(sine) < 1.e-4: rot_axis = ex rotation = (rot_axis, angle) else: rotation = None ShapeObject.__init__(self, attr, rotation, center, center) class Cylinder(LinearOrientedObject): """ Cylinder """ def __init__(self, point1, point2, radius, faces = (True, True, True), **attr): """ @param point1: first end point of the cylinder axis @type point1: L{Scientific.Geometry.Vector} @param point2: second end point of the cylinder axis @type point2: L{Scientific.Geometry.Vector} @param radius: the cylinder radius @type radius: positive number @param faces: a sequence of three boolean flags, corresponding to the cylinder hull and the two circular end pieces, specifying for each of these parts whether it is visible or not @param attr: graphics attributes as keyword parameters """ self.faces = faces self.radius = radius LinearOrientedObject.__init__(self, attr, point1, point2) def writeSpecification(self, file): file.writeString('Cylinder{parts ') if self.faces == (1,1,1): file.writeString('ALL') else: plist=[] if self.faces[0]: plist.append('SIDES') if self.faces[1]: plist.append('BOTTOM') if self.faces[2]: plist.append('TOP') if plist: file.writeString( '(' + string.join(plist,'|') + ')' ) file.writeString(' radius ' + `self.radius` + \ ' height ' + `self.height` + '}\n') def memoKey(self): return (self.radius, self.height, self.faces) class Cone(LinearOrientedObject): """ Cone """ def __init__(self, point1, point2, radius, face = True, **attr): """ @param point1: the tip of the cone @type point1: L{Scientific.Geometry.Vector} @param point2: end point of the cone axis @type point2: L{Scientific.Geometry.Vector} @param radius: the radius at the base @type radius: positive number @param face: a boolean flag, specifying if the circular bottom is visible @type face: C{bool} @param attr: graphics attributes as keyword parameters """ self.face = face self.radius = radius LinearOrientedObject.__init__(self, attr, point2, point1) def writeSpecification(self, file): file.writeString('Cone{parts ') if self.face: file.writeString('ALL') else: file.writeString('SIDES') file.writeString(' bottomRadius ' + `self.radius` + \ ' height ' + `self.height` + '}\n') def memoKey(self): return (self.radius, self.height, self.face) class Line(ShapeObject): """ Line """ def __init__(self, point1, point2, **attr): """ @param point1: first end point @type point1: L{Scientific.Geometry.Vector} @param point2: second end point @type point2: L{Scientific.Geometry.Vector} @param attr: graphics attributes as keyword parameters """ self.points = (point1, point2) center = 0.5*(point1+point2) ShapeObject.__init__(self, attr, None, None, center) def writeSpecification(self, file): file.writeString('Coordinate3{point [' + \ `self.points[0][0]` + ' ' + `self.points[0][1]` + \ ' ' + `self.points[0][2]` + ',' + \ `self.points[1][0]` + ' ' + `self.points[1][1]` + \ ' ' + `self.points[1][2]` + \ ']}IndexedLineSet{coordIndex[0,1,-1]}\n') def memoKey(self): return tuple(self.points[0]) + tuple(self.points[1]) class PolyLines(ShapeObject): """ Multiple connected lines """ def __init__(self, points, **attr): """ @param points: a sequence of points to be connected by lines @type points: sequence of L{Scientific.Geometry.Vector} @param attr: graphics attributes as keyword parameters """ self.points = points ShapeObject.__init__(self, attr, None, None, Vector(0., 0., 0.)) def writeSpecification(self, file): s = 'Coordinate3{point [' for p in self.points: s = s + `p[0]` + ' ' + `p[1]` + ' ' + `p[2]` + ',' file.writeString(s[:-1] + ']}IndexedLineSet{coordIndex') file.writeString(`range(len(self.points))+[-1]` + '}\n') def memoKey(self): return tuple(map(tuple, self.points)) class Polygons(ShapeObject): """ Polygons """ def __init__(self, points, index_lists, **attr): """ @param points: a sequence of points @type points: sequence of L{Scientific.Geometry.Vector} @param index_lists: a sequence of index lists, one for each polygon. The index list for a polygon defines which points are vertices of the polygon. @type index_lists: sequence of C{list} @param attr: graphics attributes as keyword parameters """ self.points = points self.index_lists = index_lists ShapeObject.__init__(self, attr, None, None, Vector(0.,0.,0.)) def writeSpecification(self, file): file.writeString('Coordinate3{point [') for v in self.points[:-1]: file.writeString(`v[0]` + ' ' + `v[1]` + ' ' + `v[2]` + ',') v = self.points[-1] file.writeString(`v[0]` + ' ' + `v[1]` + ' ' + `v[2]` + \ ']}IndexedFaceSet{coordIndex[') for polygon in self.index_lists: for index in polygon: file.writeString(`index`+',') file.writeString('-1,') file.writeString(']}\n') def memoKey(self): return (tuple(map(tuple, self.points)), tuple(map(tuple, self.index_lists))) # # Groups # class Group: """ Base class for composite objects """ def __init__(self, objects, **attr): self.objects = [] for o in objects: if isGroup(o): self.objects = self.objects + o.objects else: self.objects.append(o) for key, value in attr.items(): for o in self.objects: o[key] = value is_group = 1 def __len__(self): return len(self.objects) def __getitem__(self, item): return self.object[item] def __coerce__(self, other): if not isGroup(other): other = Group([other]) return (self, other) def __add__(self, other): return Group(self.objects + other.objects) def writeToFile(self, file): for o in self.objects: o.writeToFile(file) def isGroup(x): return hasattr(x, 'is_group') # # Composite Objects # class Arrow(Group): """ Arrow An arrow consists of a cylinder and a cone. """ def __init__(self, point1, point2, radius, **attr): """ @param point1: starting point of the arrow @type point1: L{Scientific.Geometry.Vector} @param point2: the tip of the arrow @type point2: L{Scientific.Geometry.Vector} @param radius: the radius of the shaft @type radius: positive number @param attr: graphics attributes as keyword parameters """ axis = point2-point1 height = axis.length() axis = axis/height cone_height = min(height, 4.*radius) cylinder_height = height - cone_height junction = point2-axis*cone_height cone = apply(Cone, (point2, junction, 0.75*cone_height), attr) objects = [cone] if cylinder_height > 0.005*radius: cylinder = apply(Cylinder, (point1, junction, radius), attr) objects.append(cylinder) Group.__init__(self, objects) # # Materials # class Material(VRMLObject): """ Material specification for graphics objects A material defines the color and surface properties of an object. """ def __init__(self, **attr): """ @param attr: material attributes as keyword arguments @keyword diffuse_color: the color of a diffusely reflecting surface @type diffuse_color: L{Color} @keyword emissive_color: the color of emitted light @type emissive_color: L{Color} @keyword ambient_color: @type ambient_color: L{Color} @keyword specular_color: @type specular_color: L{Color} @keyword shininess: @type shininess: C{float} @keyword transparency: @type transparency: C{float} """ VRMLObject.__init__(self, attr) attribute_names = VRMLObject.attribute_names + \ ['ambient_color', 'diffuse_color', 'specular_color', 'emissive_color', 'shininess', 'transparency'] attribute_conversion = {'ambient_color': 'ambientColor', 'diffuse_color': 'diffuseColor', 'specular_color': 'specularColor', 'emissive_color': 'emissiveColor', 'shininess': 'shininess', 'transparency': 'transparency'} def writeToFile(self, file): try: last = file.memo['material'] if last == self: return except KeyError: pass if file.memo.has_key(self): file.writeString('USE ' + file.memo[self] + '\n') else: name = file.uniqueName() file.memo[self] = name file.writeString('DEF ' + name + ' Material{\n') for key, value in self.attr.items(): file.writeString(self.attribute_conversion[key] + ' ' + \ str(value) + '\n') file.writeString('}\n') file.memo['material'] = self def use(self, file): file.memo['material'] = self # # Predefined materials # def DiffuseMaterial(color): """ @param color: a color object or a predefined color name @type color: L{Color} or C{str} @returns: a material with the 'diffuse color' attribute set to color @rtype: L{Material} """ if type(color) is type(''): color = ColorByName(color) try: return _diffuse_material_dict[color] except KeyError: m = Material(diffuse_color = color) _diffuse_material_dict[color] = m return m _diffuse_material_dict = {} def EmissiveMaterial(color): """ @param color: a color object or a predefined color name @type color: L{Color} or C{str} @returns: a material with the 'emissive color' attribute set to color @rtype: L{Material} """ if type(color) is type(''): color = ColorByName(color) try: return _emissive_material_dict[color] except KeyError: m = Material(emissive_color = color) _emissive_material_dict[color] = m return m _emissive_material_dict = {} # # Test code # if __name__ == '__main__': if 1: from Scientific.Geometry import null, ex, ey, ez spheres = DiffuseMaterial('brown') links = DiffuseMaterial('orange') s1 = Sphere(null, 0.05, material = spheres, reuse = 1) s2 = Sphere(ex, 0.05, material = spheres, reuse = 1) s3 = Sphere(ey, 0.05, material = spheres, reuse = 1) s4 = Sphere(ez, 0.05, material = spheres, reuse = 1) a1 = Arrow(null, ex, 0.01, material = links) a2 = Arrow(null, ey, 0.01, material = links) a3 = Arrow(null, ez, 0.01, material = links) scene = Scene([s1, s2, s3, s4, a1, a2, a3]) scene.view() if 0: scene = Scene([]) scale = ColorScale(10.) for x in range(11): color = scale(x) m = Material(diffuse_color = color) scene.addObject(Cube(Vector(x,0.,0.), 0.2, material=m)) scene.view() if 0: points = [Vector(0., 0., 0.), Vector(0., 1., 0.), Vector(1., 1., 0.), Vector(1., 0., 0.), Vector(1., 0., 1.), Vector(1., 1., 1.)] indices = [[0, 1, 2, 3, 0], [3, 4, 5, 2, 3]] scene = Scene(Polygons(points, indices, material=DiffuseMaterial('blue'))) scene.view() if 0: points = [Vector(0., 0., 0.), Vector(0., 1., 0.), Vector(1., 1., 0.), Vector(1., 0., 0.), Vector(1., 0., 1.), Vector(1., 1., 1.)] scene = Scene(PolyLines(points, material = DiffuseMaterial('black'))) scene.view() ScientificPython-2.9.4/Scientific/Visualization/VRML2.py0000644000076600000240000006345311501734232023566 0ustar hinsenstaff00000000000000# This module provides classes that represent VRML objects for use # in data visualization applications. # # Written by: Konrad Hinsen # With contributions from Frank Horowitz # and Matteo Bertini # Last revision: 2006-9-12 # """ Definitions of simple 3D graphics objects and VRML scenes containing them The objects are appropriate for data visualization, not for virtual reality modelling. Scenes can be written to VRML files or visualized immediately using a VRML browser, whose name is taken from the environment variable VRML2VIEWER (under Unix). This module uses the VRML 2.0 definition, also known as VRML97. For the original VRML 1, use the module VRML, which uses exactly the same interface. Example:: >>> from Scientific.Visualization.VRML import * >>> scene = Scene([]) >>> scale = ColorScale(10.) >>> for x in range(11): >>> color = scale(x) >>> scene.addObject(Cube(Vector(x, 0., 0.), 0.2, >>> material=Material(diffuse_color = color))) >>> scene.view() """ from Scientific.IO.TextFile import TextFile from Scientific.Geometry import Transformation, Vector, ex, ey, ez from Scientific import N import os, string, tempfile from Color import * # # VRML file # class SceneFile: def __init__(self, filename, mode = 'r'): if mode == 'r': raise TypeError, 'Not implemented.' self.file = TextFile(filename, 'w') self.file.write('#VRML V2.0 utf8\n') self.file.write('Transform { children [\n') self.memo = {} self.name_counter = 0 def __del__(self): self.close() def writeString(self, data): self.file.write(data) def close(self): if self.file is not None: self.file.write(']}\n') self.file.close() self.file = None def write(self, object): object.writeToFile(self) def uniqueName(self): self.name_counter = self.name_counter + 1 return 'i' + `self.name_counter` VRMLFile = SceneFile # # Scene # class Scene: """ VRML scene A VRML scene is a collection of graphics objects that can be written to a VRML file or fed directly to a VRML browser. """ def __init__(self, objects = None, cameras = None, **options): """ @param objects: a list of graphics objects, or C{None} for an empty scene @type objects: C{list} or C{NoneType} @param cameras: a list of cameras, or C{None} for no cameras @param options: options as keyword arguments (none defined) """ if objects is None: self.objects = [] elif type(objects) == type([]): self.objects = objects else: self.objects = [objects] if cameras is None: self.cameras = [] else: self.cameras = cameras def __len__(self): """ @returns: the number of graphics objects in the scene @rtype: C{int} """ return len(self.objects) def __getitem__(self, item): """ @param item: an index @type item: C{int} @returns: the graphics object at the index position @rtype: L{VRMLObject} """ return self.object[item] def addObject(self, object): """ @param object: a graphics object to be added to the scene @type object: L{VRMLObject} """ self.objects.append(object) def addCamera(self, camera): """ Add a camera to the list of cameras @param camera: the camera to be adde """ self.cameras.append(camera) def writeToFile(self, filename): """ Write the scene to a VRML file @param filename: the name of the script @type filename: C{str} """ file = VRMLFile(filename, 'w') if self.cameras: for camera in self.cameras: camera.writeToFile(file) for o in self.objects: o.writeToFile(file) file.close() def view(self, *args): """ Start a VRML browser and load the scene @param args: not used, for compatibility only """ import sys filename = tempfile.mktemp()+'.wrl' if sys.platform == 'win32': import win32api self.writeToFile(filename) win32api.ShellExecute(0, "open", filename, None, "", 1) elif os.environ.has_key('VRML2VIEWER'): self.writeToFile(filename) if os.fork() == 0: os.system(os.environ['VRML2VIEWER'] + ' ' + filename + ' 1> /dev/null 2>&1') os.unlink(filename) os._exit(0) else: print 'No VRML2 viewer defined' # # Camera class # class Camera: """ Camera/viewpoint for a scene """ def __init__(self, position=None, orientation=None, description=None, field_of_view=None): """ @param position: the location of the camera @type position: L{Scientific.Geometry.Vector} @param orientation: an (axis, angle) tuple in which the axis is a vector and the angle a number in radians; axis and angle specify a rotation with respect to the standard orientation along the negative z axis @param description: a label for the viewpoint @type description: C{str} @param field_of_view: the field of view @type field_of_view: positive number """ self.field_of_view = field_of_view self.orientation = orientation self.position = position self.description = description def writeToFile(self, file): file.writeString('Viewpoint {\n') if self.field_of_view != None: file.writeString('fieldOfView %f\n' % self.field_of_view) if self.orientation != None: axis, angle = self.orientation axis = axis.normal() file.writeString('orientation %f %f %f %f\n' % \ (axis[0], axis[1], axis[2], angle)) if self.position != None: file.writeString('position %f %f %f\n' % \ (self.position[0], \ self.position[1], \ self.position[2])) if self.description != None: file.writeString('description "%s"' % \ self.description) file.writeString('}\n') # # Navigation Info # class NavigationInfo: """ Navigation information """ def __init__(self, speed=100.0, type="EXAMINE"): """ @param speed: walking speed in length units per second @type speed: number @param type: one of 'WALK', 'EXAMINE', 'FLY', 'NONE', 'ANY' """ self.speed = speed self.type = type def writeToFile(self, file): file.writeString('NavigationInfo {\n') file.writeString('speed %f\n' % self.speed ) file.writeString('type [ ') if self.type != "ANY": file.writeString('"%s", ' % self.type) file.writeString('"ANY" ]\n') file.writeString('}\n') # # Base class for everything that produces nodes # class VRMLObject: """ Graphics object for VRML This is an abstract base class. Use one of the subclasses to generate graphics. """ def __init__(self, attr): """ @param attr: graphics attributes specified by keywords @keyword material: color and surface properties @type material: L{Material} @keyword comment: a comment that is written to the script file @type comment: C{str} @keyword reuse: a flag defaulting to C{False}. If set to C{True}, the object may share its VRML definition with other objects. This reduces the size of the VRML file, but can yield surprising side effects in some cases. @type reuse: C{bool} """ self.attr = {} for key, value in attr.items(): if key in self.attribute_names: self.attr[key] = value else: raise AttributeError, 'illegal attribute: ' + str(key) attribute_names = ['comment'] def __getitem__(self, attr): """ @param attr: the name of a graphics attribute @type attr: C{str} @returns: the value of the attribute, or C{None} if the attribute is undefined """ try: return self.attr[attr] except KeyError: return None def __setitem__(self, attr, value): """ @param attr: the name of a graphics attribute @type attr: C{str} @param value: a new value for the attribute """ self.attr[attr] = value def __copy__(self): return copy.deepcopy(self) def writeToFile(self, file): raise AttributeError, 'Class ' + self.__class__.__name__ + \ ' does not implement file output.' # # Shapes # class ShapeObject(VRMLObject): """ Graphics objects representing geometrical shapes This is an abstract base class. Use one of the subclasses to generate graphics. """ def __init__(self, attr, rotation, translation, reference_point): VRMLObject.__init__(self, attr) if rotation is None: rotation = Transformation.Rotation(ez, 0.) else: rotation = apply(Transformation.Rotation, rotation) if translation is None: translation = Transformation.Translation(Vector(0.,0.,0.)) else: translation = Transformation.Translation(translation) self.transformation = translation*rotation self.reference_point = reference_point attribute_names = VRMLObject.attribute_names + ['material', 'reuse'] def __add__(self, other): return Group([self]) + Group([other]) def writeToFile(self, file): comment = self['comment'] if comment is not None: file.writeString('# ' + comment + '\n') file.writeString('Transform{\n') vector = self.transformation.translation().displacement() axis, angle = self.transformation.rotation().axisAndAngle() trans_flag = vector.length() > 1.e-4 rot_flag = abs(angle) > 1.e-4 if trans_flag: file.writeString('translation %f %f %f\n' % (vector[0], vector[1], vector[2])) if rot_flag: file.writeString('rotation %f %f %f %f\n' % (axis[0], axis[1], axis[2], angle)) material = self['material'] reuse = self['reuse'] file.writeString('children [\n') if reuse: key = self.memoKey() + (material, self.__class__) if file.memo.has_key(key): file.writeString('USE ' + file.memo[key] + '\n') self.use(file) if material is not None: material.use(file) else: name = file.uniqueName() file.memo[key] = name file.writeString('DEF ' + name + ' Shape{\n') if material is not None: file.writeString('appearance ') material.writeToFile(file) file.writeString('geometry ') self.writeSpecification(file) file.writeString('}\n') else: file.writeString('Shape{') if material is not None: file.writeString('appearance ') material.writeToFile(file) file.writeString('geometry ') self.writeSpecification(file) file.writeString('}\n') file.writeString(']}\n') def use(self, file): pass class Sphere(ShapeObject): """ Sphere """ def __init__(self, center, radius, **attr): """ @param center: the center of the sphere @type center: L{Scientific.Geometry.Vector} @param radius: the sphere radius @type radius: positive number @param attr: graphics attributes as keyword parameters """ self.radius = radius ShapeObject.__init__(self, attr, None, center, center) def writeSpecification(self, file): file.writeString('Sphere{radius ' + `self.radius` + '}\n') def memoKey(self): return (self.radius, ) class Cube(ShapeObject): """ Cube The edges of a cube are always parallel to the coordinate axes. """ def __init__(self, center, edge, **attr): """ @param center: the center of the sphere @type center: L{Scientific.Geometry.Vector} @param edge: the length of an edge @type edge: positive number @param attr: graphics attributes as keyword parameters """ self.edge = edge ShapeObject.__init__(self, attr, None, center, center) def writeSpecification(self, file): file.writeString('Box{size' + 3*(' ' + `self.edge`) + '}\n') def memoKey(self): return (self.edge, ) class LinearOrientedObject(ShapeObject): def __init__(self, attr, point1, point2): center = 0.5*(point1+point2) axis = point2-point1 self.height = axis.length() if self.height > 0: axis = axis/self.height rot_axis = ey.cross(axis) sine = rot_axis.length() cosine = ey*axis angle = Transformation.angleFromSineAndCosine(sine, cosine) if abs(angle) < 1.e-4 or abs(angle-2.*N.pi) < 1.e-4: rotation = None else: if abs(sine) < 1.e-4: rot_axis = ex rotation = (rot_axis, angle) else: rotation = None ShapeObject.__init__(self, attr, rotation, center, center) class Cylinder(LinearOrientedObject): """ Cylinder """ def __init__(self, point1, point2, radius, faces = (True, True, True), **attr): """ @param point1: first end point of the cylinder axis @type point1: L{Scientific.Geometry.Vector} @param point2: second end point of the cylinder axis @type point2: L{Scientific.Geometry.Vector} @param radius: the cylinder radius @type radius: positive number @param faces: a sequence of three boolean flags, corresponding to the cylinder hull and the two circular end pieces, specifying for each of these parts whether it is visible or not @param attr: graphics attributes as keyword parameters """ self.faces = faces self.radius = radius LinearOrientedObject.__init__(self, attr, point1, point2) def writeSpecification(self, file): file.writeString('Cylinder{') if not self.faces[0]: file.writeString('side FALSE ') if not self.faces[1]: file.writeString('bottom FALSE ') if not self.faces[2]: file.writeString('top FALSE ') file.writeString('radius ' + `self.radius` + \ ' height ' + `self.height` + '}\n') def memoKey(self): return (self.radius, self.height, self.faces) class Cone(LinearOrientedObject): """ Cone """ def __init__(self, point1, point2, radius, face = True, **attr): """ @param point1: the tip of the cone @type point1: L{Scientific.Geometry.Vector} @param point2: end point of the cone axis @type point2: L{Scientific.Geometry.Vector} @param radius: the radius at the base @type radius: positive number @param face: a boolean flag, specifying if the circular bottom is visible @type face: C{bool} @param attr: graphics attributes as keyword parameters """ self.face = face self.radius = radius LinearOrientedObject.__init__(self, attr, point2, point1) def writeSpecification(self, file): file.writeString('Cone{') if not self.face: file.writeString('bottom FALSE ') file.writeString('bottomRadius ' + `self.radius` + \ ' height ' + `self.height` + '}\n') def memoKey(self): return (self.radius, self.height, self.face) class Line(ShapeObject): """ Line """ def __init__(self, point1, point2, **attr): """ @param point1: first end point @type point1: L{Scientific.Geometry.Vector} @param point2: second end point @type point2: L{Scientific.Geometry.Vector} @param attr: graphics attributes as keyword parameters """ self.points = (point1, point2) center = 0.5*(point1+point2) ShapeObject.__init__(self, attr, None, None, center) def writeSpecification(self, file): p0 = "%f %f %f" % tuple(self.points[0]) p1 = "%f %f %f" % tuple(self.points[1]) file.writeString('IndexedLineSet{coord Coordinate{point ') file.writeString('[%s,\n%s]} coordIndex[0,1,-1]}\n' % (p0, p1)) def memoKey(self): return tuple(self.points[0]) + tuple(self.points[1]) class PolyLines(ShapeObject): """ Multiple connected lines """ def __init__(self, points, **attr): """ @param points: a sequence of points to be connected by lines @type points: sequence of L{Scientific.Geometry.Vector} @param attr: graphics attributes as keyword parameters """ self.points = points ShapeObject.__init__(self, attr, None, None, Vector(0., 0., 0.)) def writeSpecification(self, file): s = ['IndexedLineSet{coord Coordinate{point [',] for p in self.points: s.append('%f %f %f,' % (p[0], p[1], p[2])) s[-1] = s[-1][:-1] + ']} coordIndex' file.writeString("\n".join(s)) file.writeString(`range(len(self.points))+[-1]` + '}\n') def memoKey(self): return tuple(map(tuple, self.points)) class Polygons(ShapeObject): """ Polygons """ def __init__(self, points, index_lists, **attr): """ @param points: a sequence of points @type points: sequence of L{Scientific.Geometry.Vector} @param index_lists: a sequence of index lists, one for each polygon. The index list for a polygon defines which points are vertices of the polygon. @type index_lists: sequence of C{list} @param attr: graphics attributes as keyword parameters """ self.points = points self.index_lists = index_lists ShapeObject.__init__(self, attr, None, None, Vector(0.,0.,0.)) def writeSpecification(self, file): s = ['IndexedFaceSet{coord Coordinate{point [',] for v in self.points[:-1]: s.append('%f %f %f,' % (v[0], v[1], v[2])) v = self.points[-1] s.append('%f %f %f\n]} coordIndex[' % (v[0], v[1], v[2])) for polygon in self.index_lists: s.append(",".join(map(str, polygon) + ["-1,"])) s.append(']}\n') file.writeString("\n".join(s)) def memoKey(self): return (tuple(map(tuple, self.points)), tuple(map(tuple, self.index_lists))) # # Groups # class Group: """ Base class for composite objects """ def __init__(self, objects, **attr): self.objects = [] for o in objects: if isGroup(o): self.objects = self.objects + o.objects else: self.objects.append(o) for key, value in attr.items(): for o in self.objects: o[key] = value is_group = 1 def __len__(self): return len(self.objects) def __getitem__(self, item): return self.object[item] def __coerce__(self, other): if not isGroup(other): other = Group([other]) return (self, other) def __add__(self, other): return Group(self.objects + other.objects) def writeToFile(self, file): for o in self.objects: o.writeToFile(file) def isGroup(x): return hasattr(x, 'is_group') # # Composite Objects # class Arrow(Group): """ Arrow An arrow consists of a cylinder and a cone. """ def __init__(self, point1, point2, radius, **attr): """ @param point1: starting point of the arrow @type point1: L{Scientific.Geometry.Vector} @param point2: the tip of the arrow @type point2: L{Scientific.Geometry.Vector} @param radius: the radius of the shaft @type radius: positive number @param attr: graphics attributes as keyword parameters """ axis = point2-point1 height = axis.length() axis = axis/height cone_height = min(height, 4.*radius) cylinder_height = height - cone_height junction = point2-axis*cone_height cone = apply(Cone, (point2, junction, 0.75*cone_height), attr) objects = [cone] if cylinder_height > 0.005*radius: cylinder = apply(Cylinder, (point1, junction, radius), attr) objects.append(cylinder) Group.__init__(self, objects) # # Materials # class Material(VRMLObject): """ Material specification for graphics objects A material defines the color and surface properties of an object. """ def __init__(self, **attr): """ @param attr: material attributes as keyword arguments @keyword diffuse_color: the color of a diffusely reflecting surface @type diffuse_color: L{Color} @keyword emissive_color: the color of emitted light @type emissive_color: L{Color} @keyword ambient_color: @type ambient_color: L{Color} @keyword specular_color: @type specular_color: L{Color} @keyword shininess: @type shininess: C{float} @keyword transparency: @type transparency: C{float} """ VRMLObject.__init__(self, attr) attribute_names = VRMLObject.attribute_names + \ ['ambient_color', 'diffuse_color', 'specular_color', 'emissive_color', 'shininess', 'transparency'] attribute_conversion = {'ambient_color': 'ambientColor', 'diffuse_color': 'diffuseColor', 'specular_color': 'specularColor', 'emissive_color': 'emissiveColor', 'shininess': 'shininess', 'transparency': 'transparency'} def writeToFile(self, file): if file.memo.has_key(self): file.writeString('USE ' + file.memo[self] + '\n') else: name = file.uniqueName() file.memo[self] = name file.writeString('DEF '+name+' Appearance{material Material{\n') for key, value in self.attr.items(): file.writeString(self.attribute_conversion[key] + ' ' + \ str(value) + '\n') file.writeString('}}\n') def use(self, file): pass # # Predefined materials # def DiffuseMaterial(color): """ @param color: a color object or a predefined color name @type color: L{Color} or C{str} @returns: a material with the 'diffuse color' attribute set to color @rtype: L{Material} """ if type(color) is type(''): color = ColorByName(color) try: return _diffuse_material_dict[color] except KeyError: m = Material(diffuse_color = color) _diffuse_material_dict[color] = m return m _diffuse_material_dict = {} def EmissiveMaterial(color): """ @param color: a color object or a predefined color name @type color: L{Color} or C{str} @returns: a material with the 'emissive color' attribute set to color @rtype: L{Material} """ if type(color) is type(''): color = ColorByName(color) try: return _emissive_material_dict[color] except KeyError: m = Material(emissive_color = color) _emissive_material_dict[color] = m return m _emissive_material_dict = {} # # Test code # if __name__ == '__main__': if 1: from Scientific.Geometry import null, ex, ey, ez spheres = DiffuseMaterial('green') links = DiffuseMaterial('red') s1 = Sphere(null, 0.05, material = spheres, reuse = 1) s2 = Sphere(ex, 0.05, material = spheres, reuse = 1) s3 = Sphere(ey, 0.05, material = spheres, reuse = 1) s4 = Sphere(ez, 0.05, material = spheres, reuse = 1) a1 = Arrow(null, ex, 0.01, material = links) a2 = Arrow(null, ey, 0.01, material = links) a3 = Arrow(null, ez, 0.01, material = links) scene = Scene([a1, a2, a3, s1, s2, s3, s4]) scene.view() if 0: scene = Scene([]) scale = ColorScale(10.) for x in range(11): color = scale(x) m = Material(diffuse_color = color) scene.addObject(Cube(Vector(x,0.,0.), 0.2, material=m)) scene.view() if 0: points = [Vector(0., 0., 0.), Vector(0., 1., 0.), Vector(1., 1., 0.), Vector(1., 0., 0.), Vector(1., 0., 1.), Vector(1., 1., 1.)] indices = [[0, 1, 2, 3, 0], [3, 4, 5, 2, 3]] scene = Scene(Polygons(points, indices, material=DiffuseMaterial('yellow'))) scene.view() if 0: points = [Vector(0., 0., 0.), Vector(0., 1., 0.), Vector(1., 1., 0.), Vector(1., 0., 0.), Vector(1., 0., 1.), Vector(1., 1., 1.)] scene = Scene(PolyLines(points, material = EmissiveMaterial('yellow'))) scene.view() ScientificPython-2.9.4/scientific_win32_postinstall.py0000644000076600000240000000261011501734142023565 0ustar hinsenstaff00000000000000# Add Python DLL directory to PATH from _winreg import * import os import sys def install(): dll_path = os.path.join(sys.prefix, 'DLLs') try: path = r'SYSTEM\CurrentControlSet\Control\Session Manager\Environment' reg = ConnectRegistry(None, HKEY_LOCAL_MACHINE) key = OpenKey(reg, path, 0, KEY_ALL_ACCESS) current_path, type_id = QueryValueEx(key, "PATH") if not dll_path.upper() in current_path.upper().split(";"): new_path = current_path + ';' + dll_path SetValueEx(key, "PATH", 0, REG_EXPAND_SZ, new_path) CloseKey(key) CloseKey(reg) except WindowsError: path = r'Environment' reg = ConnectRegistry(None, HKEY_CURRENT_USER) key = OpenKey(reg, path, 0, KEY_ALL_ACCESS) try: current_path, type_id = QueryValueEx(key, "PATH") if not dll_path.upper() in current_path.upper().split(";"): new_path = current_path + ';' + dll_path SetValueEx(key, "PATH", 0, REG_EXPAND_SZ, new_path) CloseKey(key) CloseKey(reg) except WindowsError: CreateKey(HKEY_CURRENT_USER, path) SetValueEx(key, "PATH", 0, REG_EXPAND_SZ, dll_path) CloseKey(key) CloseKey(reg) if __name__=='__main__': if len(sys.argv) == 2 and sys.argv[1] == '-install': install() ScientificPython-2.9.4/setup.cfg0000644000076600000240000000032311501734140017233 0ustar hinsenstaff00000000000000[bdist_rpm] release = 1 packager = Konrad Hinsen group = Libraries/Python doc_files = README README.MPI README.BSP README.BSPlib Doc/Reference Doc/BSP_Tutorial.pdf use-rpm-opt-flags = 0 ScientificPython-2.9.4/setup.py0000644000076600000240000001603312233721302017130 0ustar hinsenstaff00000000000000#!/usr/bin/env python from distutils.core import setup, Extension from distutils.command.install_headers import install_headers import os, sys, platform from glob import glob class Dummy: pass pkginfo = Dummy() execfile('Scientific/__pkginfo__.py', pkginfo.__dict__) # Check for Cython and use it if the environment variable # COMPILE_CYTHON is set to a non-zero value. use_cython = int(os.environ.get('COMPILE_CYTHON', '0')) != 0 if use_cython: try: from Cython.Build import cythonize use_cython = True except ImportError: use_cython = False src_ext = 'pyx' if use_cython else 'c' cmdclass = {} extra_compile_args = ["-DNUMPY=1"] numpy_include = [] data_files = [] scripts = [] options = {} import numpy.distutils.misc_util numpy_include = numpy.distutils.misc_util.get_numpy_include_dirs() math_libraries = [] if sys.platform != 'win32': math_libraries.append('m') # # Locate netCDF library # netcdf_prefix = None for arg in sys.argv[1:]: if arg[:16] == "--netcdf_prefix=": netcdf_prefix = arg[16:] sys.argv.remove(arg) break if sys.platform == 'win32': netcdf_dll = None for arg in sys.argv[1:]: if arg[:13] == "--netcdf_dll=": netcdf_dll = arg[13:] sys.argv.remove(arg) break if netcdf_prefix is None: try: netcdf_prefix=os.environ['NETCDF_PREFIX'] except KeyError: pass if netcdf_prefix is None: for netcdf_prefix in ['/usr/local', '/usr', '/sw']: netcdf_include = os.path.join(netcdf_prefix, 'include') netcdf_lib = os.path.join(netcdf_prefix, 'lib') if os.path.exists(os.path.join(netcdf_include, 'netcdf.h')): break else: netcdf_prefix = None if netcdf_prefix is None: print "netCDF not found, the netCDF module will not be built!" if sys.platform != 'win32': print "If netCDF is installed somewhere on this computer," print "please set NETCDF_PREFIX to the path where" print "include/netcdf.h and lib/netcdf.a are located" print "and re-run the build procedure." ext_modules = [] else: if sys.platform == 'win32': if netcdf_dll is None: print "Option --netcdf_dll is missing" raise SystemExit netcdf_include = netcdf_prefix netcdf_h_file = os.path.join(netcdf_prefix, 'netcdf.h') netcdf_lib = netcdf_dll data_files.append(('DLLs', [os.path.join(netcdf_dll, 'netcdf.dll')])) scripts.append('scientific_win32_postinstall.py') options['bdist_wininst'] = {'install_script': "scientific_win32_postinstall.py"} else: print "Using netCDF installation in ", netcdf_prefix netcdf_include = os.path.join(netcdf_prefix, 'include') netcdf_h_file = os.path.join(netcdf_prefix, 'include', 'netcdf.h') netcdf_lib = os.path.join(netcdf_prefix, 'lib') ext_modules = [Extension('Scientific._netcdf', ['Scientific/_netcdf.c'], include_dirs=['Include', netcdf_include] + numpy_include, library_dirs=[netcdf_lib], libraries = ['netcdf'], extra_compile_args=extra_compile_args)] try: # Add code for including documentation in Mac packages import bdist_mpkg from distutils.command.bdist_mpkg import bdist_mpkg as bdist_mpkg class my_bdist_mpkg(bdist_mpkg): def initialize_options(self): bdist_mpkg.initialize_options(self) self.scheme_descriptions['examples'] = u'(Optional) ScientificPython example code' self.scheme_map['examples'] = '/Developer/Python/ScientificPython/Examples' self.scheme_copy['examples'] = 'Examples' self.scheme_descriptions['doc'] = u'(Optional) ScientificPython documentation' self.scheme_map['doc'] = '/Developer/Python/ScientificPython/Documentation' self.scheme_copy['doc'] = 'Doc' cmdclass['bdist_mpkg'] = my_bdist_mpkg except ImportError: pass packages = ['Scientific', 'Scientific.Clustering', 'Scientific.Functions', 'Scientific.Geometry', 'Scientific.IO', 'Scientific.Physics', 'Scientific.QtWidgets', 'Scientific.Statistics', 'Scientific.Signals', 'Scientific.Threading', 'Scientific.TkWidgets', 'Scientific.Visualization', 'Scientific.MPI', 'Scientific.DistributedComputing'] ext_modules.append(Extension('Scientific._vector', ['Scientific/_vector.%s' % src_ext], include_dirs=['Include']+numpy_include, libraries=math_libraries, extra_compile_args=extra_compile_args)) ext_modules.append(Extension('Scientific._affinitypropagation', ['Scientific/_affinitypropagation.%s' % src_ext], include_dirs=['Include']+numpy_include, libraries=math_libraries, extra_compile_args=extra_compile_args)) ext_modules.append(Extension('Scientific._interpolation', ['Scientific/_interpolation.%s' % src_ext], include_dirs=['Include']+numpy_include, libraries=math_libraries, extra_compile_args=extra_compile_args)) if use_cython: ext_modules = cythonize(ext_modules) scripts.append('task_manager') if sys.version[:3] >= '2.1': packages.append('Scientific.BSP') scripts.append('bsp_virtual') class modified_install_headers(install_headers): def finalize_options(self): install_headers.finalize_options(self) self.install_dir = \ os.path.join(os.path.split(self.install_dir)[0], 'Scientific') cmdclass['install_headers'] = modified_install_headers headers = glob(os.path.join ("Include","Scientific","*.h")) if netcdf_prefix is not None: headers.append(netcdf_h_file) setup (name = "ScientificPython", version = pkginfo.__version__, description = "Various Python modules for scientific computing", long_description = """ScientificPython is a collection of Python modules that are useful for scientific computing. In this collection you will find modules that cover basic geometry (vectors, tensors, transformations, vector and tensor fields), quaternions, automatic derivatives, (linear) interpolation, polynomials, elementary statistics, nonlinear least-squares fits, unit calculations, Fortran-compatible text formatting, 3D visualization via VRML, and two Tk widgets for simple line plots and 3D wireframe models.""", author = "Konrad Hinsen", author_email = "hinsen@cnrs-orleans.fr", url = "http://dirac.cnrs-orleans.fr/ScientificPython/", license = "CeCILL-C", packages = packages, headers = headers, ext_modules = ext_modules, scripts = scripts, data_files = data_files, cmdclass = cmdclass, options = options, ) ScientificPython-2.9.4/Src/0000755000076600000240000000000012270505002016140 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Src/BSPlib/0000755000076600000240000000000012270505005017256 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Src/BSPlib/bsppython.c0000644000076600000240000000107411501734231021453 0ustar hinsenstaff00000000000000/* BSPlib version of python.c. BSPlib initialization must occur before Python starts up. */ #include "Python.h" #include "bsp.h" extern DL_EXPORT(int) Py_Main(int, char **); extern DL_EXPORT(void) initScientific_bsplib(void); static int _argc; static char **_argv; void spmd_main() { int return_code; bsp_begin(bsp_nprocs()); Py_Initialize(); initScientific_bsplib(); return_code = Py_Main(_argc, _argv); bsp_end(); } int main(int argc, char **argv) { bsp_init(&spmd_main, argc, argv); _argc = argc; _argv = argv; spmd_main(); return 0; } ScientificPython-2.9.4/Src/BSPlib/compile_bsponmpi.py0000644000076600000240000000303411501734231023170 0ustar hinsenstaff00000000000000# Compile the bsppython executable containing # the Scientific.BSPlib extension module # using the BSPonMPI library (http://bsponmpi.sourceforge.net/) # Normally nothing needs to be changed below import distutils import distutils.sysconfig import os, sys from Scientific import N cfgDict = distutils.sysconfig.get_config_vars() # Name of the MPI compilation script. mpicompiler = 'mpicc' sources='bsppython.c Scientific_bsplib.c' extra_compile_args = "" if N.package == "NumPy": arrayobject_h_include = os.path.join(sys.prefix, "lib/python%s.%s/site-packages/numpy/core/include" % sys.version_info [:2]) extra_compile_args = "-DNUMPY=1 -I"+arrayobject_h_include linkforshared = cfgDict['LINKFORSHARED'] if sys.platform == 'darwin': # Fix LINKFORSHARED for framework builds under MacOS items = linkforshared.split() frameworkdir = (sys.prefix, '') while frameworkdir[1] != 'Python.framework': frameworkdir = os.path.split(frameworkdir[0]) for i in range(len(items)): if 'Python.framework' in items[i] and not os.path.exists(items[i]): items[i] = os.path.join(frameworkdir[0], items[i]) linkforshared = ' '.join(items) cmd = '%s %s -o bsppython -I%s %s %s -L%s -lpython%s -lbsponmpi %s %s' % \ (mpicompiler, linkforshared, cfgDict['INCLUDEPY'], extra_compile_args, sources, cfgDict['LIBPL'], cfgDict['VERSION'], cfgDict['LIBS'], cfgDict['LIBM']) print 'cmd = ', cmd os.system(cmd) ScientificPython-2.9.4/Src/BSPlib/compile_oxford_toolset.py0000644000076600000240000000314111501734230024411 0ustar hinsenstaff00000000000000# Compile the bsppython executable containing # the Scientific.BSPlib extension module # this variable controls the level of sanity checking for the BSPlib # see bspcc -help bspLibLevel = 2 # Normally nothing needs to be changed below import distutils import distutils.sysconfig import os, sys from Scientific import N cfgDict = distutils.sysconfig.get_config_vars() # Name of the BSP compilation script. bspcompiler = 'bspcc' sources='bsppython.c Scientific_bsplib.c' extra_compile_args = "" if N.package == "NumPy": arrayobject_h_include = os.path.join(sys.prefix, "lib/python%s.%s/site-packages/numpy/core/include" % sys.version_info [:2]) extra_compile_args = "-DNUMPY=1 -I"+arrayobject_h_include linkforshared = cfgDict['LINKFORSHARED'] if sys.platform == 'darwin': # Fix LINKFORSHARED for framework builds under MacOS items = linkforshared.split() frameworkdir = (sys.prefix, '') while frameworkdir[1] != 'Python.framework': frameworkdir = os.path.split(frameworkdir[0]) for i in range(len(items)): if 'Python.framework' in items[i] and not os.path.exists(items[i]): items[i] = os.path.join(frameworkdir[0], items[i]) linkforshared = ' '.join(items) cmd = '%s %s -o bsppython -flibrary-level %d -I%s %s %s -L%s -lpython%s %s %s' % \ (bspcompiler, linkforshared, bspLibLevel, cfgDict['INCLUDEPY'], extra_compile_args, sources, cfgDict['LIBPL'], cfgDict['VERSION'], cfgDict['LIBS'], cfgDict['LIBM']) print 'cmd = ', cmd os.system(cmd) ScientificPython-2.9.4/Src/BSPlib/ibsppython0000755000076600000240000000014111501734230021377 0ustar hinsenstaff00000000000000#!/usr/bin/env bsppython from Scientific.BSP.Console import parallel_console parallel_console() ScientificPython-2.9.4/Src/BSPlib/Scientific_bsplib.c0000644000076600000240000002203611501734231023041 0ustar hinsenstaff00000000000000/* * Low-level BSPlib interface routines * * Written by Konrad Hinsen * last revision: 2002-3-22 */ #include "Python.h" #include "assert.h" #define _BSP_MODULE #include "Scientific/bspmodule.h" /* Global variables */ static int pid, nprocs, tagsize; static int array_counter; static PyBSP_Message *message_queue; static int nmessages, nobjects, current_message, array_data_pointer; /********************************************************/ /* Low-level access, for use by other extension modules */ /********************************************************/ static void PyBSP_Sync(void) { free(message_queue); message_queue = NULL; nmessages = nobjects = 0; bsp_sync(); array_counter = 0; } static void PyBSP_SetTagSize(int *tag_nbytes) { tagsize = *tag_nbytes; bsp_set_tagsize(tag_nbytes); } static void PyBSP_Send(int pid, const void *tag, const void *payload, int payload_nbytes) { bsp_send(pid, tag, payload, payload_nbytes); } static void PyBSP_QSize(int *nmessages, int *accum_nbytes) { bsp_qsize(nmessages, accum_nbytes); } static void PyBSP_GetTag(int *status, void *tag) { bsp_get_tag(status, tag); } static void PyBSP_Move(void *payload, int reception_nbytes) { bsp_move(payload, reception_nbytes); } static int PyBSP_HPMove(void **tag_ptr, void **payload_ptr) { return bsp_hpmove(tag_ptr, payload_ptr); } /*********************************/ /* Python object level functions */ /*********************************/ /* Send string object */ static int PyBSP_SendString(PyStringObject *string, int dest_pid) { PyBSP_Tag tag; int len = PyString_GET_SIZE(string); char *data = PyString_AS_STRING(string); if (dest_pid < 0 || dest_pid >= nprocs) { PyErr_SetString(PyExc_ValueError, "pid outside allowed range"); return -1; } if (tagsize != PyBSP_TAGSIZE) { int tagsize = PyBSP_TAGSIZE; PyBSP_SetTagSize(&tagsize); } tag.type = PyBSP_StringTag; tag.source_pid = pid; PyBSP_Send(dest_pid, (void *)&tag, (void *)data, len); return 0; } /* Send array object */ static int PyBSP_SendArray(PyArrayObject *array, int dest_pid) { PyBSP_Tag tag; int *typeinfo; if (dest_pid < 0 || dest_pid >= nprocs) { PyErr_SetString(PyExc_ValueError, "pid outside allowed range"); return -1; } if (PyArray_ISCONTIGUOUS(array)) Py_INCREF(array); else { array = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)array, PyArray_NOTYPE, 0, 0); if (array == NULL) return -1; } if (tagsize != PyBSP_TAGSIZE) { int tagsize = PyBSP_TAGSIZE; PyBSP_SetTagSize(&tagsize); } typeinfo = (int *)malloc((array->nd+1)*sizeof(int)); if (typeinfo == NULL) { PyErr_NoMemory(); Py_DECREF(array); return -1; } typeinfo[0] = array->descr->type_num; memcpy(typeinfo+1, array->dimensions, array->nd*sizeof(int)); tag.type = PyBSP_ArrayTypeTag; tag.number = array_counter; tag.source_pid = pid; PyBSP_Send(dest_pid, (void *)&tag, (void *)typeinfo, (array->nd+1)*sizeof(int)); free(typeinfo); tag.type = PyBSP_ArrayDataTag; tag.number = array_counter; tag.source_pid = pid; PyBSP_Send(dest_pid, (void *)&tag, (void *)array->data, PyArray_NBYTES(array)); array_counter++; Py_DECREF(array); return 0; } /* Collect incoming messages */ static int collect_messages(void) { int i, dummy; if (message_queue == NULL) { PyBSP_QSize(&nmessages, &dummy); message_queue = (PyBSP_Message *)malloc(nmessages*sizeof(PyBSP_Message)); if (message_queue == NULL) { PyErr_NoMemory(); return -1; } nobjects = 0; for (i = 0; i < nmessages; i++) { PyBSP_Message *msg = message_queue + i; msg->length = PyBSP_HPMove((void *)&msg->tag_ptr, &msg->payload_ptr); if (msg->tag_ptr->type == PyBSP_StringTag || msg->tag_ptr->type == PyBSP_ArrayTypeTag) nobjects++; } current_message = 0; array_data_pointer = 0; } return 0; } /* Return number of remaining objects */ static int PyBSP_NumberOfObjects(void) { collect_messages(); return nobjects; } /* Receive string or array object */ static PyObject * PyBSP_ReceiveObject(void) { PyBSP_Message *msg; PyObject *object; if (collect_messages() == -1) return NULL; if (current_message == nmessages) { Py_INCREF(Py_None); return Py_None; } while (1) { msg = message_queue + current_message; if (msg->tag_ptr->type == PyBSP_StringTag) { object = PyString_FromStringAndSize((char *)msg->payload_ptr, msg->length); current_message++; nobjects--; break; } else if (msg->tag_ptr->type == PyBSP_ArrayTypeTag) { int *typeinfo = (int *)msg->payload_ptr; int type = *typeinfo; int nd = msg->length/sizeof(int) - 1; int *dimensions = typeinfo + 1; int data_pointer; PyArrayObject *array = (PyArrayObject *)PyArray_FromDims(nd, dimensions, type); object = (PyObject *)array; if (array_data_pointer == 0) data_pointer = current_message+1; else data_pointer = array_data_pointer; for (; data_pointer < nmessages; data_pointer++) { PyBSP_Message *amsg = message_queue + data_pointer; if (amsg->tag_ptr->type == PyBSP_ArrayDataTag && amsg->tag_ptr->source_pid == msg->tag_ptr->source_pid && amsg->tag_ptr->number == msg->tag_ptr->number) { memcpy(array->data, amsg->payload_ptr, amsg->length); break; } } if (data_pointer == nmessages) { PyErr_SetString(PyExc_ValueError, "no array data found"); Py_XDECREF(object); object = NULL; } else if (data_pointer == current_message+1) current_message++; current_message++; nobjects--; break; } else if (msg->tag_ptr->type == PyBSP_ArrayDataTag) { if (array_data_pointer == 0) array_data_pointer = current_message; current_message++; } else { PyErr_SetString(PyExc_ValueError, "illegal tag value"); object = NULL; break; } } return object; } /********************/ /* Python functions */ /********************/ static PyObject * syncc(PyObject *dummy, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; if (tagsize != PyBSP_TAGSIZE) { int tagsize = PyBSP_TAGSIZE; PyBSP_SetTagSize(&tagsize); } PyBSP_Sync(); Py_INCREF(Py_None); return Py_None; } static PyObject * send(PyObject *dummy, PyObject *args) { PyObject *object; int dest_pid, ret; if (!PyArg_ParseTuple(args, "Oi", &object, &dest_pid)) return NULL; if (PyString_Check(object)) ret = PyBSP_SendString((PyStringObject *)object, dest_pid); else if (PyArray_Check(object)) ret = PyBSP_SendArray((PyArrayObject *)object, dest_pid); else { PyErr_SetString(PyExc_TypeError, "can send only strings and arrays"); ret = -1; } if (ret == 0) { Py_INCREF(Py_None); return Py_None; } else return NULL; } static PyObject * receive(PyObject *dummy, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; return PyBSP_ReceiveObject(); } static PyObject * receive_all(PyObject *dummy, PyObject *args) { PyObject *list; int i, n; if (!PyArg_ParseTuple(args, "")) return NULL; if (collect_messages() == -1) return NULL; n = nobjects; list = PyList_New(n); if (list == NULL) return NULL; for (i = 0; i < n; i++) { PyObject *object = PyBSP_ReceiveObject(); if (object == NULL) { Py_DECREF(list); return NULL; } PyList_SET_ITEM(list, i, object); } return list; } /********************************************/ /* Table of functions defined in the module */ /********************************************/ static PyMethodDef bsp_methods[] = { {"sync", syncc, 1}, {"send", send, 1}, {"receive", receive, 1}, {"receive_all", receive_all, 1}, {NULL, NULL} /* sentinel */ }; /*************************/ /* Module initialization */ /*************************/ DL_EXPORT(void) initScientific_bsplib(void) { PyObject *m, *d; static void *PyBSP_API[PyBSP_API_pointers]; m = Py_InitModule("Scientific_bsplib", bsp_methods); d = PyModule_GetDict(m); /* Initialize module variables */ pid = bsp_pid(); nprocs = bsp_nprocs(); tagsize = 0; nmessages = nobjects = 0; message_queue = NULL; array_counter = 0; /* Initialize C API pointer array and store in module */ set_PyBSP_API_pointers(); PyDict_SetItemString(d, "_C_API", PyCObject_FromVoidPtr(PyBSP_API, NULL)); /* Store pid and number of processors */ PyDict_SetItemString(d, "processorID", PyInt_FromLong((long)pid)); PyDict_SetItemString(d, "numberOfProcessors", PyInt_FromLong((long)nprocs)); /* Import the array module */ import_array(); if (PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "Can\'t import Numeric."); return; } /* Check for errors */ if (PyErr_Occurred()) PyErr_SetString(PyExc_ImportError, "Can\'t initialize module."); } /* Keep indentation style when using cc mode in (x)emacs. */ /* Local Variables: */ /* c-basic-offset: 2 */ /* c-hanging-braces-alist: ((brace-list-open) (substatement-open after) (class-open after) (class-close before) (block-close . c-snug-do-while)) */ /* End: */ ScientificPython-2.9.4/Src/BSPlib/Scientific_bsplib.export0000644000076600000240000000127311501734230024137 0ustar hinsenstaff00000000000000Scientific.BSPlib import_bsplib PyBSP _BSP_MODULE function void PyBSP_Sync (void) function void PyBSP_SetTagSize (int *tag_nbytes) function void PyBSP_Send (int pid, const void *tag, const void *payload, int payload_nbytes) function void PyBSP_QSize (int *nmessages, int *accum_nbytes) function void PyBSP_GetTag (int *status, void *tag) function void PyBSP_Move (void *payload, int reception_nbytes) function int PyBSP_HPMove (void **tag_ptr, void **payload_ptr) function int PyBSP_SendString (PyStringObject *string, int dest_pid) function int PyBSP_SendArray (PyArrayObject *array, int dest_pid) function int PyBSP_NumberOfObjects (void) function PyObject * PyBSP_ReceiveObject (void) ScientificPython-2.9.4/Src/MPI/0000755000076600000240000000000012270505006016571 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Src/MPI/compile.py0000644000076600000240000000267712137430114020606 0ustar hinsenstaff00000000000000# Compile the mpipython executable containing # the Scientific.MPI extension module # Normally nothing needs to be changed below import distutils import distutils.sysconfig import os, sys from Scientific import N cfgDict = distutils.sysconfig.get_config_vars() # Name of the MPI compilation script. mpicompiler = 'mpicc' sources='mpipython.c Scientific_mpi.c' extra_compile_args = "" if N.package == "NumPy": arrayobject_h_include = os.path.join(sys.prefix, "%s/numpy/core/include" % distutils.sysconfig.get_python_lib()) extra_compile_args = "-DNUMPY=1 -I"+arrayobject_h_include linkforshared = cfgDict['LINKFORSHARED'] if sys.platform == 'darwin': # Fix LINKFORSHARED for framework builds under MacOS items = linkforshared.split() frameworkdir = (sys.prefix, '') while frameworkdir[1] != 'Python.framework': frameworkdir = os.path.split(frameworkdir[0]) for i in range(len(items)): if 'Python.framework' in items[i] and not os.path.exists(items[i]): items[i] = os.path.join(frameworkdir[0], items[i]) linkforshared = ' '.join(items) cmd = '%s %s -o mpipython -I%s %s %s -L%s -lpython%s %s %s' % \ (mpicompiler, linkforshared, cfgDict['INCLUDEPY'], extra_compile_args, sources, cfgDict['LIBPL'], cfgDict['VERSION'], cfgDict['LIBS'], cfgDict['LIBM']) print 'cmd = ', cmd os.system(cmd) ScientificPython-2.9.4/Src/MPI/impipython0000755000076600000240000000015711501734230020721 0ustar hinsenstaff00000000000000#!/bin/csh mpirun -np 2 /usr/local/bin/mpipython /usr/lib/python2.1/site-packages/Scientific/BSP/Console.py $* ScientificPython-2.9.4/Src/MPI/mpipython.c0000644000076600000240000000074411501734230020770 0ustar hinsenstaff00000000000000/* MPI version of python.c. MPI initialization must occur before Python starts up. */ #include "Python.h" #include "mpi.h" extern DL_EXPORT(int) Py_Main(int, char **); extern DL_EXPORT(void) initScientific_mpi(void); int main(int argc, char **argv) { int return_code; MPI_Init(&argc, &argv); MPI_Errhandler_set(MPI_COMM_WORLD, MPI_ERRORS_RETURN); Py_Initialize(); initScientific_mpi(); return_code = Py_Main(argc, argv); MPI_Finalize(); return return_code; } ScientificPython-2.9.4/Src/MPI/Scientific_mpi.c0000644000076600000240000011315612137427013021674 0ustar hinsenstaff00000000000000/* * Low-level MPI interface routines * * Written by Konrad Hinsen * and Jakob Schiotz * and Ciro Cattuto * last revision: 2004-3-29 */ #include "Python.h" #include "assert.h" #define _MPI_MODULE #include "Scientific/mpimodule.h" #define PyMPI_TEST(rc, funcname) if ((rc) != MPI_SUCCESS) \ return PyMPI_SetError(rc, funcname) /* Global variables */ PyObject *PyExc_MPIError; const int max_tag = 32767; /* Minimal value required by MPI norm */ /* We need a few forward declarations */ staticforward PyMPIRequestObject * newPyMPIRequestObject(MPI_Request rq, PyObject *buffer, int operation, MPI_Datatype mpi_type); staticforward PyMPIOperationObject * newPyMPIOperationObject(MPI_Op mpi_op, char *op_name); /* Utility functions */ static MPI_Datatype mpi_type(int py_type) { switch(py_type) { case PyArray_CHAR: return MPI_CHAR; case PyArray_UBYTE: case PyArray_SBYTE: return MPI_BYTE; case PyArray_SHORT: return MPI_SHORT; case PyArray_INT: return MPI_INT; case PyArray_LONG: return MPI_LONG; case PyArray_FLOAT: case PyArray_CFLOAT: return MPI_FLOAT; case PyArray_DOUBLE: case PyArray_CDOUBLE: return MPI_DOUBLE; } return 0; } /* ...should probably be a macro */ static MPI_Op mpi_op(PyMPIOperationObject *op) { return op->mpi_op; } /* Doubles the count for sending/receiving complex numbers. */ static int mpi_count_factor(int py_type) { switch(py_type) { case PyArray_CFLOAT: case PyArray_CDOUBLE: return 2; default: return 1; } } static PyObject * PyMPI_SetError(int errcode, char *funcname) { char mpierr[MPI_MAX_ERROR_STRING]; int errlen; MPI_Error_string(errcode, mpierr, &errlen); PyErr_Format(PyExc_MPIError, "%s failed: %s", funcname, mpierr); return NULL; } /***************************************/ /* MPI Operation object implementation */ /***************************************/ staticforward PyTypeObject PyMPIOperation_Type; static PyMPIOperationObject * newPyMPIOperationObject(MPI_Op mpi_op, char *op_name) { PyMPIOperationObject *self; self = PyObject_New(PyMPIOperationObject, &PyMPIOperation_Type); if (self == NULL) return NULL; self->mpi_op = mpi_op; strcpy(self->op_name, op_name); return self; } /* Deallocate the object */ static void PyMPIOperation_dealloc(PyMPIOperationObject *self) { PyObject_FREE(self); } /* __repr__ */ /* should check for rbuffer overflow */ static PyObject * PyMPIOperation_repr(PyMPIOperationObject *self) { char rbuffer[256]; sprintf(rbuffer, "", (long)self, self->op_name); return PyString_FromString(rbuffer); } statichere PyTypeObject PyMPIOperation_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "PyMPIOperation", /*tp_name*/ sizeof(PyMPIOperationObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ (destructor) PyMPIOperation_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ (reprfunc) PyMPIOperation_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0 /*tp_str*/ }; /******************************************/ /* MPI communicator object implementation */ /******************************************/ staticforward PyTypeObject PyMPICommunicator_Type; static PyMPICommunicatorObject * newPyMPICommunicatorObject(MPI_Comm handle) { PyMPICommunicatorObject *self; self = PyObject_New(PyMPICommunicatorObject, &PyMPICommunicator_Type); if (self == NULL) return NULL; self->handle = handle; if (MPI_Comm_rank(handle, &self->rank) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "couldn't obtain communicator rank"); PyObject_FREE(self); return NULL; } if (MPI_Comm_size(handle, &self->size) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "couldn't obtain communicator size"); PyObject_FREE(self); return NULL; } return self; } /* * PyMPICommunicator methods */ static void PyMPICommunicator_dealloc(PyMPICommunicatorObject *self) { if (self->handle != MPI_COMM_WORLD) MPI_Comm_free(&self->handle); PyObject_FREE(self); } /* Duplicate */ static PyObject * PyMPI_DuplicateCommunicator(PyMPICommunicatorObject *comm) { MPI_Comm new; if (MPI_Comm_dup(comm->handle, &new) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Comm_dup failed"); return NULL; } return (PyObject *)newPyMPICommunicatorObject(new); } static PyObject * PyMPICommunicator_duplicate(PyMPICommunicatorObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; return PyMPI_DuplicateCommunicator(self); } /* Subset */ static PyObject * PyMPI_SubsetCommunicator(PyMPICommunicatorObject *comm, PyArrayObject *array) { MPI_Group group; MPI_Group newgroup; MPI_Comm new; int *ranks; int dimension, i1, i2; if (MPI_Comm_group(comm->handle, &group) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Comm_group failed"); return NULL; } dimension = array->dimensions[0]; ranks = (int*)(array->data); for (i1 = 0; i1 < dimension; i1++) { if (ranks[i1] < 0 || ranks[i1] >= comm->size) { PyErr_SetString(PyExc_MPIError, "invalid MPI rank"); return NULL; } for (i2 = 0; i2 < i1; i2++) if (ranks[i1] == ranks[i2]) { PyErr_SetString(PyExc_MPIError, "duplicated MPI rank"); return NULL; } } if (MPI_Group_incl(group, dimension, ranks, &newgroup) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Group_incl failed"); return NULL; } if (MPI_Comm_create(comm->handle, newgroup, &new) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Comm_create failed"); return NULL; } if (MPI_Group_free(&newgroup) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Group_free failed"); return NULL; } if (MPI_Group_free(&group) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Group_free failed"); return NULL; } if (new == MPI_COMM_NULL) { Py_INCREF(Py_None); return Py_None; } else return (PyObject *)newPyMPICommunicatorObject(new); } static PyObject * PyMPICommunicator_subset(PyMPICommunicatorObject *self, PyObject *args) { PyObject *ranks; PyObject *new; if (!PyArg_ParseTuple(args, "O", &ranks)) return NULL; ranks = PyArray_ContiguousFromObject(ranks, PyArray_INT, 1, 1); if (ranks == NULL) return NULL; new = PyMPI_SubsetCommunicator(self, (PyArrayObject *)ranks); Py_DECREF(ranks); return new; } /* Barrier */ static int PyMPI_Barrier(PyMPICommunicatorObject *comm) { return MPI_Barrier(comm->handle); } static PyObject * PyMPICommunicator_barrier(PyMPICommunicatorObject *self, PyObject *args) { if (!PyArg_ParseTuple(args, "")) return NULL; if (PyMPI_Barrier(self) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Barrier failed"); return NULL; } Py_INCREF(Py_None); return Py_None; } /* Send data */ static int PyMPI_Send(PyMPICommunicatorObject *comm, void *data, int type, int len, int dest, int tag) { return MPI_Send(data, len, mpi_type(type), dest, tag, comm->handle); } static int PyMPI_SendArray(PyMPICommunicatorObject *comm, PyArrayObject *array, int dest, int tag) { int count; int error; int i; if (tag < 0 || tag > max_tag) { PyErr_SetString(PyExc_MPIError, "invalid MPI tag"); return -1; } if (dest < 0 || dest >= comm->size) { PyErr_SetString(PyExc_MPIError, "invalid MPI destination"); return -1; } if (PyArray_ISCONTIGUOUS(array)) Py_INCREF(array); else { array = (PyArrayObject *)PyArray_ContiguousFromObject((PyObject *)array, PyArray_NOTYPE, 0, 0); if (array == NULL) return -1; } count = 1; for (i = 0; i < array->nd; i++) count *= array->dimensions[i]; count *= mpi_count_factor(array->descr->type_num); Py_BEGIN_ALLOW_THREADS; error = PyMPI_Send(comm, array->data, array->descr->type_num, count, dest, tag); Py_END_ALLOW_THREADS; Py_DECREF(array); if (error != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Send failed"); return -1; } return 0; } static int PyMPI_SendString(PyMPICommunicatorObject *comm, PyStringObject *string, int dest, int tag) { char *data; int error, count; if (tag < 0 || tag > max_tag) { PyErr_SetString(PyExc_MPIError, "invalid MPI tag"); return -1; } if (dest < 0 || dest >= comm->size) { PyErr_SetString(PyExc_MPIError, "invalid MPI destination"); return -1; } data = PyString_AsString((PyObject *)string); count = PyString_GET_SIZE(string); Py_BEGIN_ALLOW_THREADS; error = PyMPI_Send(comm, data, PyArray_CHAR, count, dest, tag); Py_END_ALLOW_THREADS; if (error != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Send failed"); return -1; } return 0; } static PyObject * PyMPICommunicator_send(PyMPICommunicatorObject *self, PyObject *args) { PyObject *data; int dest, tag; if (!PyArg_ParseTuple(args, "Oii", &data, &dest, &tag)) return NULL; /* #define PyArray_Check(op) PyObject_TypeCheck(op, &PyArray_Type) */ /* if (PyArray_Check(data)) { */ if (PyObject_TypeCheck(data, &PyArray_Type)) { if (PyMPI_SendArray(self, (PyArrayObject *)data, dest, tag) != 0) return NULL; } else if (PyString_Check(data)) { if (PyMPI_SendString(self, (PyStringObject *)data, dest, tag) != 0) return NULL; } else { PyErr_SetString(PyExc_MPIError, "can send only array or string"); return NULL; } Py_INCREF(Py_None); return Py_None; } /* Nonblocking send data */ static PyObject * PyMPI_SendNonBlocking(PyMPICommunicatorObject *comm, void *buffer, PyObject* buffer_owner, int type, int len, int dest, int tag) { MPI_Request rq; int rc; if (tag < 0 || tag > max_tag) { PyErr_SetString(PyExc_MPIError, "invalid MPI tag"); return NULL; } if (dest < 0 || dest >= comm->size) { PyErr_SetString(PyExc_MPIError, "invalid MPI destination"); return NULL; } Py_BEGIN_ALLOW_THREADS; rc = MPI_Isend(buffer, len, mpi_type(type), dest, tag, comm->handle, &rq); Py_END_ALLOW_THREADS; PyMPI_TEST(rc, "MPI_Isend"); return (PyObject *) newPyMPIRequestObject(rq, buffer_owner, PyMPIRequestSend, mpi_type(type)); } static PyObject * PyMPI_SendArrayNonBlocking(PyMPICommunicatorObject *comm, PyArrayObject *array, int dest, int tag) { PyObject *request; int count; int i; /* Make sure array is contiguous. Just increase refcount if it is */ array = (PyArrayObject *) PyArray_ContiguousFromObject((PyObject *) array, PyArray_NOTYPE, 0, 0); if (array == NULL) return NULL; count = 1; for (i = 0; i < array->nd; i++) count *= array->dimensions[i]; count *= mpi_count_factor(array->descr->type_num); request = PyMPI_SendNonBlocking(comm, array->data, (PyObject *) array, array->descr->type_num, count, dest, tag); Py_DECREF(array); return request; } static PyObject * PyMPI_SendStringNonBlocking(PyMPICommunicatorObject *comm, PyStringObject *string, int dest, int tag) { PyObject *request; char *data; int count; data = PyString_AS_STRING(string); count = PyString_GET_SIZE(string); request = PyMPI_SendNonBlocking(comm, data, (PyObject *) string, PyArray_CHAR, count, dest, tag); return request; } static PyObject * PyMPICommunicator_nonblocking_send(PyMPICommunicatorObject *self, PyObject *args) { PyObject *data; int dest, tag; if (!PyArg_ParseTuple(args, "Oii", &data, &dest, &tag)) return NULL; if (PyArray_Check(data)) return PyMPI_SendArrayNonBlocking(self, (PyArrayObject *) data, dest, tag); if (PyString_Check(data)) return PyMPI_SendStringNonBlocking(self, (PyStringObject *) data, dest, tag); PyErr_SetString(PyExc_MPIError, "can only send an array or a string"); return NULL; } /* Receive data */ static int PyMPI_Receive(PyMPICommunicatorObject *comm, void *buffer, int type, int len, int source, int tag, int *sourcep, int *tagp, int *lenp) { MPI_Status status; int error; error = MPI_Recv(buffer, len, mpi_type(type), source, tag, comm->handle, &status); if (error == MPI_SUCCESS) { if (sourcep != NULL) *sourcep = status.MPI_SOURCE; if (tagp != NULL) *tagp = status.MPI_TAG; if (lenp != NULL) error = MPI_Get_count(&status, mpi_type(type), lenp); } return error; } static int PyMPI_ReceiveArray(PyMPICommunicatorObject *comm, PyArrayObject *array, int source, int tag, int *sourcep, int *tagp, int *lenp) { int count, i; int error; count = 1; for (i = 0; i < array->nd; i++) count *= array->dimensions[i]; count *= mpi_count_factor(array->descr->type_num); Py_BEGIN_ALLOW_THREADS; error = PyMPI_Receive(comm, array->data, array->descr->type_num, count, source, tag, sourcep, tagp, lenp); Py_END_ALLOW_THREADS; if (error != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Recv failed"); return -1; } return 0; } static PyObject * PyMPI_ReceiveString(PyMPICommunicatorObject *comm, int source, int tag, int *sourcep, int *tagp) { MPI_Status status; PyStringObject *string; int count; int error; Py_BEGIN_ALLOW_THREADS; error = MPI_Probe(source, tag, comm->handle, &status); Py_END_ALLOW_THREADS; if (error != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Probe failed"); return NULL; } source = status.MPI_SOURCE; tag = status.MPI_TAG; if (MPI_Get_count(&status, MPI_CHAR, &count) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Get_count failed"); return NULL; } string = (PyStringObject *)PyString_FromStringAndSize(NULL, count); if (string == NULL) return NULL; Py_BEGIN_ALLOW_THREADS; error = PyMPI_Receive(comm, PyString_AsString((PyObject *)string), PyArray_CHAR, count, source, tag, sourcep, tagp, NULL); Py_END_ALLOW_THREADS; if (error != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Recv failed"); Py_DECREF(string); return NULL; } return (PyObject *)string; } static PyObject * PyMPICommunicator_receive(PyMPICommunicatorObject *self, PyObject *args) { PyArrayObject *array; PyObject *buffer_ob, *source_ob, *tag_ob, *return_ob; int source, tag, count; int error; source_ob = Py_None; tag_ob = Py_None; if (!PyArg_ParseTuple(args, "O|OO", &buffer_ob, &source_ob, &tag_ob)) return NULL; if (source_ob == Py_None) source = MPI_ANY_SOURCE; else if (!PyInt_Check(source_ob) || (source = PyInt_AsLong(source_ob)) < 0 || source >= self->size) { PyErr_SetString(PyExc_TypeError, "invalid MPI source"); return NULL; } if (tag_ob == Py_None) tag = MPI_ANY_TAG; else if (!PyInt_Check(tag_ob) || (tag = PyInt_AsLong(tag_ob)) < 0 || tag >= max_tag) { PyErr_SetString(PyExc_TypeError, "invalid MPI tag"); return NULL; } if (PyArray_Check(buffer_ob)) { array = (PyArrayObject *)buffer_ob; if (!PyArray_ISCONTIGUOUS(array)) { PyErr_SetString(PyExc_ValueError, "buffer must be contiguous"); return NULL; } Py_INCREF(array); } else if (PyString_Check(buffer_ob)) { MPI_Status status; char type_code = PyString_AsString(buffer_ob)[0]; int type = PyArray_DescrFromType(type_code)->type_num; int factor; Py_BEGIN_ALLOW_THREADS; error = MPI_Probe(source, tag, self->handle, &status); Py_END_ALLOW_THREADS; if (error != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Probe failed"); return NULL; } source = status.MPI_SOURCE; tag = status.MPI_TAG; if (MPI_Get_count(&status, mpi_type(type), &count) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Get_count failed"); return NULL; } factor = mpi_count_factor(type); if (count == MPI_UNDEFINED || count % factor != 0) { PyErr_SetString(PyExc_MPIError, "buffer data type incompatible with message"); return NULL; } count /= factor; array = (PyArrayObject *)PyArray_FromDims(1, &count, type); if (array == NULL) return NULL; } if (PyMPI_ReceiveArray(self, array, source, tag, &source, &tag, &count) != 0) { Py_DECREF(array); return NULL; } return_ob = Py_BuildValue("Oiii", array, source, tag, count); Py_DECREF(array); return return_ob; } static PyObject * PyMPICommunicator_receiveString(PyMPICommunicatorObject *self, PyObject *args) { PyObject *source_ob = Py_None, *tag_ob = Py_None, *return_ob; PyObject *string; int source, tag; if (!PyArg_ParseTuple(args, "|OO", &source_ob, &tag_ob)) return NULL; if (source_ob == Py_None) source = MPI_ANY_SOURCE; else if (!PyInt_Check(source_ob) || (source = PyInt_AsLong(source_ob)) < 0 || source >= self->size) { PyErr_SetString(PyExc_TypeError, "invalid MPI source"); return NULL; } if (tag_ob == Py_None) tag = MPI_ANY_TAG; else if (!PyInt_Check(tag_ob) || (tag = PyInt_AsLong(tag_ob)) < 0 || tag >= max_tag) { PyErr_SetString(PyExc_TypeError, "invalid MPI tag"); return NULL; } string = PyMPI_ReceiveString(self, source, tag, &source, &tag); if (string == NULL) return NULL; return_ob = Py_BuildValue("Oii", string, source, tag); Py_DECREF(string); return return_ob; } /* Nonblocking receive */ static PyObject * PyMPI_ReceiveArrayNonBlocking(PyMPICommunicatorObject *comm, PyArrayObject *array, int source, int tag) { int count, i; MPI_Request rq; int error; MPI_Datatype type; count = 1; for (i = 0; i < array->nd; i++) count *= array->dimensions[i]; count *= mpi_count_factor(array->descr->type_num); type = mpi_type(array->descr->type_num); Py_BEGIN_ALLOW_THREADS; error = MPI_Irecv(array->data, count, type, source, tag, comm->handle, &rq); Py_END_ALLOW_THREADS; if (error != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Irecv failed"); return NULL; } return (PyObject *) newPyMPIRequestObject(rq, (PyObject *) array, PyMPIRequestReceive, type); } static PyObject * PyMPICommunicator_nonblocking_receive(PyMPICommunicatorObject *self, PyObject *args) { PyArrayObject *array; PyObject *source_ob, *tag_ob; int source, tag; source_ob = Py_None; tag_ob = Py_None; if (!PyArg_ParseTuple(args, "O!|OO", &PyArray_Type, &array, &source_ob, &tag_ob)) return NULL; if (source_ob == Py_None) source = MPI_ANY_SOURCE; else if (!PyInt_Check(source_ob) || (source = PyInt_AsLong(source_ob)) < 0 || source >= self->size) { PyErr_SetString(PyExc_TypeError, "invalid MPI source"); return NULL; } if (tag_ob == Py_None) tag = MPI_ANY_TAG; else if (!PyInt_Check(tag_ob) || (tag = PyInt_AsLong(tag_ob)) < 0 || tag >= max_tag) { PyErr_SetString(PyExc_TypeError, "invalid MPI tag"); return NULL; } if (!PyArray_ISCONTIGUOUS(array)) { PyErr_SetString(PyExc_ValueError, "buffer must be contiguous"); return NULL; } return PyMPI_ReceiveArrayNonBlocking(self, array, source, tag); } /* Nonblocking Probe */ static int PyMPI_ProbeNonBlocking(PyMPICommunicatorObject *comm, int source, int tag, int *flagp, int *sourcep, int *tagp) { MPI_Status status; int error; error = MPI_Iprobe(source, tag, comm->handle, flagp, &status); if (error == MPI_SUCCESS) { if (sourcep != NULL) *sourcep = status.MPI_SOURCE; if (tagp != NULL) *tagp = status.MPI_TAG; } return error; } static PyObject * PyMPICommunicator_nonblocking_probe(PyMPICommunicatorObject *self, PyObject *args) { PyObject *source_ob, *tag_ob; int source, tag, available; int rc; source_ob = Py_None; tag_ob = Py_None; if (!PyArg_ParseTuple(args, "|OO", &source_ob, &tag_ob)) return NULL; if (source_ob == Py_None) source = MPI_ANY_SOURCE; else if (!PyInt_Check(source_ob) || (source = PyInt_AsLong(source_ob)) < 0 || source >= self->size) { PyErr_SetString(PyExc_TypeError, "invalid MPI source"); return NULL; } if (tag_ob == Py_None) tag = MPI_ANY_TAG; else if (!PyInt_Check(tag_ob) || (tag = PyInt_AsLong(tag_ob)) < 0 || tag >= max_tag) { PyErr_SetString(PyExc_TypeError, "invalid MPI tag"); return NULL; } Py_BEGIN_ALLOW_THREADS; rc = PyMPI_ProbeNonBlocking(self, source, tag, &available, &source, &tag); Py_END_ALLOW_THREADS; PyMPI_TEST(rc, "MPI_Iprobe"); if (available) return Py_BuildValue("ii", source, tag); else { Py_INCREF(Py_None); return Py_None; } } /* Broadcast */ static int PyMPI_Broadcast(PyMPICommunicatorObject *comm, void *buffer, int type, int count, int root) { return MPI_Bcast(buffer, count, mpi_type(type), root, comm->handle); } static int PyMPI_BroadcastArray(PyMPICommunicatorObject *comm, PyArrayObject *array, int root) { int count; int error; int i; if (root < 0 || root >= comm->size) { PyErr_SetString(PyExc_MPIError, "invalid MPI rank"); return -1; } if (!PyArray_ISCONTIGUOUS(array)) { PyErr_SetString(PyExc_ValueError, "array must be contiguous"); return -1; } count = 1; for (i = 0; i < array->nd; i++) count *= array->dimensions[i]; count *= mpi_count_factor(array->descr->type_num); Py_BEGIN_ALLOW_THREADS; error = PyMPI_Broadcast(comm, array->data, array->descr->type_num, count, root); Py_END_ALLOW_THREADS; if (error != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Bcast failed"); return -1; } return 0; } static PyObject * PyMPICommunicator_broadcast(PyMPICommunicatorObject *self, PyObject *args) { PyArrayObject *array; int root; if (!PyArg_ParseTuple(args, "O!i", &PyArray_Type, &array, &root)) return NULL; if (PyMPI_BroadcastArray(self, array, root) != 0) return NULL; Py_INCREF(Py_None); return Py_None; } /* Share data between all processes (Allgather) */ static int PyMPI_Share(PyMPICommunicatorObject *comm, void *send, void *receive, int type, int count) { return MPI_Allgather(send, count, mpi_type(type), receive, count, mpi_type(type), comm->handle); } static int PyMPI_ShareArray(PyMPICommunicatorObject *comm, PyArrayObject *send, PyArrayObject *receive) { int count, error, compatible; int i; compatible = (receive->nd == send->nd+1); compatible = compatible && (receive->dimensions[0] == comm->size); if (compatible) for (i = 0; i < send->nd; i++) if (send->dimensions[i] != receive->dimensions[i+1]) compatible = 0; compatible = compatible && (send->descr->type_num == receive->descr->type_num); if (!compatible) { PyErr_SetString(PyExc_MPIError, "send and receive arrays are not compatible"); return -1; } count = 1; for (i = 0; i < send->nd; i++) count *= send->dimensions[i]; count *= mpi_count_factor(send->descr->type_num); Py_BEGIN_ALLOW_THREADS; error = PyMPI_Share(comm, send->data, receive->data, send->descr->type_num, count); Py_END_ALLOW_THREADS; if (error != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Allgather failed"); return -1; } return 0; } static PyObject * PyMPICommunicator_share(PyMPICommunicatorObject *self, PyObject *args) { PyArrayObject *send, *receive; if (!PyArg_ParseTuple(args, "O!O!", &PyArray_Type, &send, &PyArray_Type, &receive)) return NULL; if (PyMPI_ShareArray(self, send, receive) != 0) return NULL; Py_INCREF(Py_None); return Py_None; } /* Abort - for emergency use only */ static int PyMPI_Abort(PyMPICommunicatorObject *comm, int err) { return MPI_Abort(comm->handle, err); } static PyObject * PyMPICommunicator_abort(PyMPICommunicatorObject *self, PyObject *args) { int errcode; if (!PyArg_ParseTuple(args, "i", &errcode)) return NULL; if (PyMPI_Abort(self, errcode) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Abort failed"); return NULL; } Py_INCREF(Py_None); return Py_None; } /* Reduce and Allreduce*/ static int PyMPI_Reduce(PyMPICommunicatorObject *comm, void *sendbuf, void *recvbuf, int count, int datatype, PyMPIOperationObject *op, int root) { return MPI_Reduce(sendbuf, recvbuf, count, mpi_type(datatype), mpi_op(op), root, comm->handle); } static int PyMPI_Allreduce(PyMPICommunicatorObject *comm, void *sendbuf, void *recvbuf, int count, int datatype, PyMPIOperationObject *op) { return MPI_Allreduce(sendbuf, recvbuf, count, mpi_type(datatype), mpi_op(op), comm->handle); } static int PyMPI_ReduceArray(PyMPICommunicatorObject *comm, PyArrayObject *send, PyArrayObject *receive, PyMPIOperationObject *op, int root) { int compatible, count, error; int i; compatible = (receive->nd == send->nd); count = 1; if (compatible) { for (i = 0; i < send->nd; i++) { compatible = compatible && (receive->dimensions[i] == send->dimensions[i]); count *= send->dimensions[i]; } } compatible = compatible && (receive->descr->type_num == send->descr->type_num); if (!compatible) { PyErr_SetString(PyExc_MPIError, "send and receive arrays are not compatible."); return -1; } count *= mpi_count_factor(send->descr->type_num); Py_BEGIN_ALLOW_THREADS; error = PyMPI_Reduce(comm, send->data, receive->data, count, send->descr->type_num, op, root); Py_END_ALLOW_THREADS; if (error != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Reduce failed"); return -1; } return 0; } static int PyMPI_AllreduceArray(PyMPICommunicatorObject *comm, PyArrayObject *send, PyArrayObject *receive, PyMPIOperationObject *op) { int compatible, count, error; int i; compatible = (receive->nd == send->nd); count = 1; if (compatible) { for (i = 0; i < send->nd; i++) { compatible = compatible && (receive->dimensions[i] == send->dimensions[i]); count *= send->dimensions[i]; } } compatible = compatible && (receive->descr->type_num == send->descr->type_num); if (!compatible) { PyErr_SetString(PyExc_MPIError, "send and receive arrays are not compatible."); return -1; } count *= mpi_count_factor(send->descr->type_num); Py_BEGIN_ALLOW_THREADS; error = PyMPI_Allreduce(comm, send->data, receive->data, count, send->descr->type_num, op); Py_END_ALLOW_THREADS; if (error != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Allreduce failed"); return -1; } return 0; } static PyObject * PyMPICommunicator_reduce(PyMPICommunicatorObject *self, PyObject *args) { PyArrayObject *send, *receive; PyMPIOperationObject *operation; int root; if (!PyArg_ParseTuple(args, "O!O!O!i", &PyArray_Type, &send, &PyArray_Type, &receive, &PyMPIOperation_Type, &operation, &root)) return NULL; if (PyMPI_ReduceArray(self, send, receive, operation, root) != 0) return NULL; Py_INCREF(Py_None); return Py_None; } static PyObject * PyMPICommunicator_allreduce(PyMPICommunicatorObject *self, PyObject *args) { PyArrayObject *send, *receive; PyMPIOperationObject *operation; if (!PyArg_ParseTuple(args, "O!O!O!", &PyArray_Type, &send, &PyArray_Type, &receive, &PyMPIOperation_Type, &operation)) return NULL; if (PyMPI_AllreduceArray(self, send, receive, operation) != 0) return NULL; Py_INCREF(Py_None); return Py_None; } /* Attribute access */ static PyMethodDef PyMPICommunicator_methods[] = { {"duplicate", (PyCFunction)PyMPICommunicator_duplicate, 1}, {"subset", (PyCFunction)PyMPICommunicator_subset, 1}, {"send", (PyCFunction)PyMPICommunicator_send, 1}, {"nonblocking_send", (PyCFunction)PyMPICommunicator_nonblocking_send, 1}, {"nonblockingSend", (PyCFunction)PyMPICommunicator_nonblocking_send, 1}, {"receive", (PyCFunction)PyMPICommunicator_receive, 1}, {"receiveString", (PyCFunction)PyMPICommunicator_receiveString, 1}, {"nonblocking_receive", (PyCFunction)PyMPICommunicator_nonblocking_receive, 1}, {"nonblockingReceive", (PyCFunction)PyMPICommunicator_nonblocking_receive, 1}, {"nonblockingProbe", (PyCFunction)PyMPICommunicator_nonblocking_probe, 1}, {"broadcast", (PyCFunction)PyMPICommunicator_broadcast, 1}, {"share", (PyCFunction)PyMPICommunicator_share, 1}, {"barrier", (PyCFunction)PyMPICommunicator_barrier, 1}, {"abort", (PyCFunction)PyMPICommunicator_abort, 1}, {"reduce", (PyCFunction)PyMPICommunicator_reduce, 1}, {"allreduce", (PyCFunction)PyMPICommunicator_allreduce, 1}, {NULL, NULL} }; static PyObject * PyMPICommunicator_getattr(PyMPICommunicatorObject *self, char *name) { if (strcmp(name, "rank") == 0) { return PyInt_FromLong((long)self->rank); } else if (strcmp(name, "size") == 0) { return PyInt_FromLong((long)self->size); } else return Py_FindMethod(PyMPICommunicator_methods, (PyObject *)self, name); } statichere PyTypeObject PyMPICommunicator_Type = { /* The ob_type field must be initialized in the module init function * to be portable to Windows without using C++. */ PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "PyMPICommunicator", /*tp_name*/ sizeof(PyMPICommunicatorObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ (destructor)PyMPICommunicator_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc)PyMPICommunicator_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ }; /*************************************/ /* MPI Request object implementation */ /*************************************/ staticforward PyTypeObject PyMPIRequest_Type; static PyMPIRequestObject * newPyMPIRequestObject(MPI_Request rq, PyObject *buffer, int operation, MPI_Datatype mpi_type) { PyMPIRequestObject *self; self = PyObject_New(PyMPIRequestObject, &PyMPIRequest_Type); if (self == NULL) return NULL; self->handle[0] = rq; self->operation = operation; Py_INCREF(buffer); self->buffer = buffer; self->mpi_type = mpi_type; self->active = 1; return self; } /* Deallocate the object */ static void PyMPIRequest_dealloc(PyMPIRequestObject *self) { Py_XDECREF(self->buffer); /* Release an eventual reference to the buffer */ PyObject_FREE(self); } /* __repr__ */ static PyObject * PyMPIRequest_repr(PyMPIRequestObject *self) { char rbuffer[256]; char opbuffer[50]; switch (self->operation) { case PyMPIRequestSend: strcpy(opbuffer, "send"); break; case PyMPIRequestReceive: strcpy(opbuffer, "receive"); break; default: sprintf(opbuffer, "*** INVALID (%d) ***", self->operation); } sprintf(rbuffer, "", (long)self, (long)self->handle, opbuffer, (self->active ? "active" : "expired")); return PyString_FromString(rbuffer); } /* Wait for a nonblocking operation */ /* The argument is void * to keep MPI_Status out of C API, where it caused trouble */ static int PyMPI_Wait(PyMPIRequestObject *self, void *s) { return MPI_Wait(self->handle, (MPI_Status *) s); } static PyObject * PyMPIRequest_wait(PyMPIRequestObject *self, PyObject *args) { PyObject *return_ob; MPI_Status stat; int source, tag, count; if (!PyArg_ParseTuple(args, "")) return NULL; if (!self->active) { PyErr_SetString(PyExc_MPIError, "Cannot wait on expired request"); return NULL; } if (PyMPI_Wait(self, &stat) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Wait failed"); return NULL; } assert(self->buffer->ob_refcnt > 0); /* fprintf(stderr, "REFCOUNT: %d\n", (int) self->buffer->ob_refcnt); */ switch (self->operation) { case PyMPIRequestSend: self->active = 0; /* The operation has completed */ Py_DECREF(self->buffer); /* Discard the buffer */ self->buffer = NULL; Py_INCREF(Py_None); return Py_None; case PyMPIRequestReceive: self->active = 0; /* The operation has completed */ source = stat.MPI_SOURCE; tag = stat.MPI_TAG; if (MPI_Get_count(&stat, self->mpi_type, &count) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Get_count failed"); return NULL; } return_ob = Py_BuildValue("Oiii", self->buffer, source, tag, count); Py_DECREF(self->buffer); self->buffer = NULL; return return_ob; } PyErr_SetString(PyExc_MPIError, "Invalid operation field in request object"); return NULL; } /* Test a nonblocking operation for completion */ /* The argument is void * to keep MPI_Status out of C API, where it caused trouble */ static int PyMPI_Test(PyMPIRequestObject *self, int *flag, void *s) { return MPI_Test(self->handle, flag, (MPI_Status *) s); } static PyObject * PyMPIRequest_test(PyMPIRequestObject *self, PyObject *args) { PyObject *return_ob; MPI_Status stat; int flag, source, tag, count; if (!PyArg_ParseTuple(args, "")) return NULL; if (!self->active) { PyErr_SetString(PyExc_MPIError, "Cannot test expired request."); return NULL; } if (PyMPI_Test(self, &flag, &stat) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Test failed."); return NULL; } if (!flag) { /* The operation has not completed. Return None */ Py_INCREF(Py_False); return Py_False; } /* The operation has completed. In case of a send operation, return true. In case of a receive operation, return the buffer, the source, the tag, and the count (from the MPI_Status object). In both cases, remove the buffer. */ switch (self->operation) { case PyMPIRequestSend: self->active = 0; /* The operation has completed */ Py_DECREF(self->buffer); /* Discard the buffer */ self->buffer = NULL; Py_INCREF(Py_True); return Py_True; case PyMPIRequestReceive: self->active = 0; /* The operation has completed */ source = stat.MPI_SOURCE; tag = stat.MPI_TAG; if (MPI_Get_count(&stat, self->mpi_type, &count) != MPI_SUCCESS) { PyErr_SetString(PyExc_MPIError, "MPI_Get_count failed"); return NULL; } return_ob = Py_BuildValue("Oiii", self->buffer, source, tag, count); Py_DECREF(self->buffer); self->buffer = NULL; return return_ob; } PyErr_SetString(PyExc_MPIError, "Invalid operation field in request object"); return NULL; } /* Attribute access */ static PyMethodDef PyMPIRequest_methods[] = { {"wait", (PyCFunction)PyMPIRequest_wait, METH_VARARGS}, {"test", (PyCFunction)PyMPIRequest_test, METH_VARARGS}, {NULL, NULL} }; static PyObject * PyMPIRequest_getattr(PyMPICommunicatorObject *self, char *name) { return Py_FindMethod(PyMPIRequest_methods, (PyObject *)self, name); } statichere PyTypeObject PyMPIRequest_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "PyMPIRequest", /*tp_name*/ sizeof(PyMPIRequestObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ (destructor) PyMPIRequest_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ (getattrfunc) PyMPIRequest_getattr, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ (reprfunc) PyMPIRequest_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0 /*tp_str*/ }; /*****************************/ /* Error object registration */ /*****************************/ static PyObject * register_error_object(PyObject *dummy, PyObject *args) { if (!PyArg_ParseTuple(args, "O", &PyExc_MPIError)) return NULL; Py_INCREF(PyExc_MPIError); Py_INCREF(Py_None); return Py_None; } /********************************************/ /* Table of functions defined in the module */ /********************************************/ static PyMethodDef mpi_methods[] = { {"_registerErrorObject", register_error_object, 1}, {NULL, NULL} /* sentinel */ }; /*************************/ /* Module initialization */ /*************************/ /* a handy macro to create/register PyMPIOperation objects */ #define NEW_OP(mpi_op,op_name) do { \ PyObject *op = (PyObject *) newPyMPIOperationObject(mpi_op,op_name); \ PyDict_SetItemString(d, op_name, op); \ } while (0) DL_EXPORT(void) initScientific_mpi(void) { PyObject *m, *d, *world; static void *PyMPI_API[PyMPI_API_pointers]; int mpi_init_flag; /* Set type of locally created static objects. */ PyMPIOperation_Type.ob_type = &PyType_Type; PyMPICommunicator_Type.ob_type = &PyType_Type; PyMPIRequest_Type.ob_type = &PyType_Type; /* Create the module */ m = Py_InitModule("Scientific_mpi", mpi_methods); d = PyModule_GetDict(m); /* Initialize C API pointer array and store in module */ set_PyMPI_API_pointers(); PyDict_SetItemString(d, "_C_API", PyCObject_FromVoidPtr(PyMPI_API, NULL)); /* Import the array module */ import_array(); if (PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "Can\'t import Numeric."); return; } /* Check that MPI has been initialized */ if (MPI_Initialized(&mpi_init_flag) != MPI_SUCCESS || !mpi_init_flag) { Py_INCREF(Py_None); PyDict_SetItemString(d, "world", Py_None); #if 0 fprintf(stderr, "Use mpipython to run this program!\n"); _exit(1); #endif } else { /* Create the world communicator object */ world = (PyObject *)newPyMPICommunicatorObject(MPI_COMM_WORLD); PyDict_SetItemString(d, "world", world); NEW_OP(MPI_MAX, "max"); NEW_OP(MPI_MIN, "min"); NEW_OP(MPI_SUM, "sum"); NEW_OP(MPI_PROD, "prod"); NEW_OP(MPI_LAND, "land"); NEW_OP(MPI_BAND, "band"); NEW_OP(MPI_LOR, "lor"); NEW_OP(MPI_BOR, "bor"); NEW_OP(MPI_LXOR, "lxor"); NEW_OP(MPI_BXOR, "bxor"); NEW_OP(MPI_MAXLOC, "maxloc"); NEW_OP(MPI_MINLOC, "minloc"); #if MPI_VERSION > 1 NEW_OP(MPI_REPLACE, "replace"); #endif } /* Check for errors */ if (PyErr_Occurred()) PyErr_SetString(PyExc_ImportError, "Can\'t initialize module."); } /* Keep Konrad Hinsens indentation style when using cc mode in (x)emacs. */ /* Local Variables: */ /* c-basic-offset: 2 */ /* c-hanging-braces-alist: ((brace-list-open) (substatement-open after) (class-open after) (class-close before) (block-close . c-snug-do-while)) */ /* End: */ ScientificPython-2.9.4/Src/MPI/Scientific_mpi.export0000644000076600000240000001710211501734231022762 0ustar hinsenstaff00000000000000Scientific.MPI import_mpi PyMPI _MPI_MODULE type PyMPICommunicator type PyMPIRequest function PyObject * PyMPI_DuplicateCommunicator (PyMPICommunicatorObject *comm) function PyObject * PyMPI_SubsetCommunicator (PyMPICommunicatorObject *comm, PyArrayObject *array) function int PyMPI_Barrier (PyMPICommunicatorObject *comm) function int PyMPI_Send (PyMPICommunicatorObject *comm, void *data, int mpi_type, int len, int dest, int tag) function int PyMPI_SendArray (PyMPICommunicatorObject *comm, PyArrayObject *array, int dest, int tag) function int PyMPI_SendString (PyMPICommunicatorObject *comm, PyStringObject *string, int dest, int tag) function PyObject * PyMPI_SendArrayNonBlocking (PyMPICommunicatorObject *comm, PyArrayObject *array, int dest, int tag) function PyObject * PyMPI_SendStringNonBlocking (PyMPICommunicatorObject *comm, PyStringObject *string, int dest, int tag) function int PyMPI_Receive (PyMPICommunicatorObject *comm, void *buffer, int mpi_type, int len, int source, int tag, int *sourcep, int *tagp, int *lenp) function int PyMPI_ReceiveArray (PyMPICommunicatorObject *comm, PyArrayObject *array, int source, int tag, int *sourcep, int *tagp, int *lenp) function PyObject * PyMPI_ReceiveString (PyMPICommunicatorObject *comm, int source, int tag, int *sourcep, int *tagp) function PyObject * PyMPI_ReceiveArrayNonBlocking (PyMPICommunicatorObject *comm, PyArrayObject *array, int source, int tag) function int PyMPI_ProbeNonBlocking (PyMPICommunicatorObject *comm, int source, int tag, int *flagp, int *sourcep, int *tagp) function int PyMPI_Broadcast (PyMPICommunicatorObject *comm, void *buffer, int mpi_type, int count, int root) function int PyMPI_BroadcastArray (PyMPICommunicatorObject *comm, PyArrayObject *array, int root) function int PyMPI_Share (PyMPICommunicatorObject *comm, void *send, void *receive, int mpi_type, int count) function int PyMPI_ShareArray (PyMPICommunicatorObject *comm, PyArrayObject *send, PyArrayObject *receive) function int PyMPI_Abort (PyMPICommunicatorObject *comm, int err) function int PyMPI_Reduce (PyMPICommunicatorObject *comm, void *sendbuf, void *recvbuf, int count, int datatype, PyMPIOperationObject *op, int root) function int PyMPI_Allreduce (PyMPICommunicatorObject *comm, void *sendbuf, void *recvbuf, int count, int datatype, PyMPIOperationObject *op) function int PyMPI_ReduceArray (PyMPICommunicatorObject *comm, PyArrayObject *send, PyArrayObject *receive, PyMPIOperationObject *op, int root) function int PyMPI_AllreduceArray (PyMPICommunicatorObject *comm, PyArrayObject *send, PyArrayObject *receive, PyMPIOperationObject *op) function int PyMPI_Wait (PyMPIRequestObject *comm, void *s) function int PyMPI_Test (PyMPIRequestObject *comm, int *flag, void *s) exportfunc int MPI_Abort (MPI_Comm comm, int errorcode) exportfunc int MPI_Allgather (void *sendbuffer, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) exportfunc int MPI_Allgatherv (void *sendbuffer, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcount, int *displs, MPI_Datatype recvtype, MPI_Comm comm) exportfunc int MPI_Allreduce (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) exportfunc int MPI_Alltoall (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm) exportfunc int MPI_Alltoallv (void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *rdispls, MPI_Datatype recvtype, MPI_Comm comm) exportfunc int MPI_Barrier (MPI_Comm comm) exportfunc int MPI_Bcast (void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm) exportfunc int MPI_Bsend (void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) exportfunc int MPI_Comm_dup (MPI_Comm comm, MPI_Comm *newcomm) exportfunc int MPI_Comm_group (MPI_Comm comm, MPI_Group *group) exportfunc int MPI_Group_incl (MPI_Group group, int n, int *ranks, MPI_Group *newgroup) exportfunc int MPI_Comm_create (MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm) exportfunc int MPI_Group_free (MPI_Group *group) exportfunc int MPI_Comm_free (MPI_Comm *comm) exportfunc int MPI_Comm_rank (MPI_Comm comm, int *rank) exportfunc int MPI_Comm_size (MPI_Comm comm, int *size) exportfunc int MPI_Error_string (int errorcode, char *string, int *resultlen) exportfunc int MPI_Finalize (void) exportfunc int MPI_Gather (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) exportfunc int MPI_Gatherv (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int *recvcounts, int *displs, MPI_Datatype recvtype, int root, MPI_Comm comm) exportfunc int MPI_Get_count (MPI_Status *status, MPI_Datatype datatype, int *count) exportfunc int MPI_Ibsend (void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) exportfunc int MPI_Init (int *argc, char ***argv) exportfunc int MPI_Initialized (int *flag) exportfunc int MPI_Iprobe (int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status) exportfunc int MPI_Irecv (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request) exportfunc int MPI_Irsend (void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) exportfunc int MPI_Isend (void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) exportfunc int MPI_Issend (void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) exportfunc int MPI_Probe (int source, int tag, MPI_Comm comm, MPI_Status *status) exportfunc int MPI_Recv (void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status) exportfunc int MPI_Reduce (void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm) exportfunc int MPI_Reduce_scatter (void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) exportfunc int MPI_Rsend (void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) exportfunc int MPI_Scatter (void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) exportfunc int MPI_Scatterv (void *sendbuf, int *sendcounts, int *displs, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm) exportfunc int MPI_Send (void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) exportfunc int MPI_Sendrecv (void *sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, MPI_Comm comm, MPI_Status *status) exportfunc int MPI_Ssend (void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) exportfunc int MPI_Test (MPI_Request *request, int *flag, MPI_Status *status) exportfunc int MPI_Testall (int count, MPI_Request *array_of_requests, int *flag, MPI_Status *array_of_statuses) exportfunc int MPI_Testany (int count, MPI_Request *array_of_requests, int *index, int *flag, MPI_Status *status) exportfunc int MPI_Wait (MPI_Request *request, MPI_Status *status) exportfunc int MPI_Waitall (int count, MPI_Request *array_of_requests, MPI_Status *array_of_statuses) exportfunc int MPI_Waitany (int count, MPI_Request *array_of_requests, int *index, MPI_Status *array_of_statuses) exportfunc double MPI_Wtick (void) exportfunc double MPI_Wtime (void) ScientificPython-2.9.4/task_manager0000644000076600000240000001126111502703116017774 0ustar hinsenstaff00000000000000#!python # # Send inquiries to an active task manager # (see Scientific.DistributedComputing) # Written by Konrad Hinsen # last revision: 2010-12-18 # from Scientific.DistributedComputing import TaskManager import Pyro.core import Pyro.naming import Pyro.errors from optparse import OptionParser import os, sys, time Pyro.core.initClient(banner=False) commands = {} arg_count = {} def getTaskManager(label): if options.master is None: if options.wait: while True: try: return Pyro.core.getProxyForURI("PYRONAME://TaskManager.%s" % label) except Pyro.errors.NamingError: time.sleep(1) else: try: return Pyro.core.getProxyForURI("PYRONAME://TaskManager.%s" % label) except Pyro.errors.NamingError: print "No name server or no task manager with label %s" % label raise SystemExit else: if options.wait: while True: try: uri = "PYROLOC://%s/TaskManager.%s" % (options.master, label) return Pyro.core.getProxyForURI(uri) except Pyro.errors.ProtocolError: time.sleep(1) except Pyro.errors.URIError: print "No host %s" % options.master raise SystemExit else: try: uri = "PYROLOC://%s/TaskManager.%s" % (options.master, label) return Pyro.core.getProxyForURI(uri) except Pyro.errors.URIError: print "No host %s" % options.master raise SystemExit except Pyro.errors.ProtocolError: print "No task manager with label %s" % label raise SystemExit def showInfo(label): task_manager = getTaskManager(label) active_processes = task_manager.numberOfActiveProcesses() waiting, running, finished = task_manager.numberOfTasks() print "%d active processe(s)" % active_processes if options.verbose: for i in range(active_processes): print " %d: %s" % (i, task_manager.activeProcessInfo(i)) print "%d waiting tasks" % sum(waiting.values()) if options.verbose: for tag, count in waiting.items(): print " %s: %d" % (tag, count) print "%d running tasks" % sum(running.values()) if options.verbose: for tag, count in running.items(): print " %s: %d" % (tag, count) print "%d results waiting to be retrieved" % sum(finished.values()) if options.verbose: for tag, count in finished.items(): print " %s: %d" % (tag, count) commands["show"] = showInfo arg_count["show"] = 2 def listTaskManagers(): if options.master is not None: print "Command 'list' requires a name server" raise SystemExit pyro_ns = Pyro.naming.NameServerLocator().getNS() for label, type in pyro_ns.list("TaskManager"): if type == 1: print label if options.verbose: task_manager = getTaskManager(label) active_processes = task_manager.numberOfActiveProcesses() print " %d active processe(s)" % active_processes commands["list"] = listTaskManagers arg_count["list"] = 1 def runSlave(label): task_manager = getTaskManager(label) try: slave_code = task_manager.retrieveData("slave_code") directory = task_manager.retrieveData("cwd") except KeyError: print "No slave code available for %s" % label raise SystemExit namespace = {} sys.modules["__main__"].SLAVE_PROCESS_LABEL = label sys.modules["__main__"].SLAVE_NAMESPACE = namespace os.chdir(directory) exec slave_code in namespace commands["slave"] = runSlave arg_count["slave"] = 2 # Parse command line and execute command parser = OptionParser(usage="Usage: %prog [options] command [label]") parser.add_option("-m", "--master", help="hostname of the machine running the master process") parser.add_option("-v", "--verbose", action="store_true", help="verbose output") parser.add_option("-w", "--wait", action="store_true", help="wait for master to be launched") options, args = parser.parse_args() if len(args) < 1: parser.error("incorrect number of arguments") try: command = commands[args[0]] except KeyError: parser.error("unknown command %s" % args[0]) if len(args) != arg_count[args[0]]: parser.error("incorrect number of arguments") command(*args[1:]) ScientificPython-2.9.4/Tests/0000755000076600000240000000000012270505006016517 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Tests/clustering_tests.py0000644000076600000240000000537111501734160022501 0ustar hinsenstaff00000000000000# # Tests for Scientific.Clustering.AffinityPropagation # # Written by Konrad Hinsen # last revision: 2007-3-13 # import unittest from Scientific.Clustering.AffinityPropagation import DataSet from Scientific import N class APTest(unittest.TestCase): """ Test AffinityPropagation """ def setUp(self): self.points = N.array([[-2.341500, 3.696800], [-1.109200, 3.111700], [-1.566900, 1.835100], [-2.658500, 0.664900], [-4.031700, 2.845700], [-3.081000, 2.101100], [2.588000, 1.781900], [3.292300, 3.058500], [4.031700, 1.622300], [3.081000, -0.611700], [0.264100, 0.398900], [1.320400, 2.207400], [0.193700, 3.643600], [1.954200, -0.505300], [1.637300, 1.409600], [-0.123200, -1.516000], [-1.355600, -3.058500], [0.017600, -4.016000], [1.003500, -3.590400], [0.017600, -2.420200], [-1.531700, -0.930900], [-1.144400, 0.505300], [0.616200, -1.516000], [1.707700, -2.207400], [2.095100, 3.430900]]) self.results = [(-50., N.array([ 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 2, 6, 2, 6, 6, 19, 19, 19, 19, 19, 19, 2, 19, 19, 6])), (-10., N.array([ 1, 1, 1, 5, 5, 5, 6, 6, 6, 13, 21, 6, 1, 13, 6, 19, 19, 19, 19, 19, 21, 21, 19, 19, 6])), ( -5., N.array([ 1, 1, 1, 5, 5, 5, 6, 6, 6, 13, 21, 6, 1, 13, 6, 22, 17, 17, 17, 22, 21, 21, 22, 22, 6]))] def simfunc(self, p1, p2): return -N.sum((p1-p2)**2) def testPoints2D(self): data = DataSet(self.points, self.simfunc, symmetric=True) self.assertAlmostEqual(data.median_similarity, -16.159450725, 10) for threshold, result in self.results: data.findClusters(threshold) self.assert_(N.logical_and.reduce(data.exemplar == result)) if __name__ == '__main__': unittest.main() ScientificPython-2.9.4/Tests/intepolation_tests.py0000644000076600000240000000237411527525142023035 0ustar hinsenstaff00000000000000# # Tests for Scientific.Functions.Interpolation # # Written by Konrad Hinsen # last revision: 2011-2-18 # import unittest import copy from Scientific.Functions.Interpolation import InterpolatingFunction as IF from Scientific import N class InterpolatingFunctionTest(unittest.TestCase): def testRetrieval(self): x = N.arange(0., 1., 0.1) y = N.arange(0., 2., 0.1) v = x[:, N.NewAxis]*y[N.NewAxis, :] f = IF((x, y), v) for ix, xp in enumerate(x): for iy, yp in enumerate(y): self.assertEqual(f(xp, yp), v[ix, iy]) def testAxes(self): x = N.arange(0., 1., 0.1) y = N.arange(0., 2., 0.1) v = x[:, N.NewAxis]*y[N.NewAxis, :] self.assertRaises(ValueError, lambda: IF((x[:-2], y), v)) self.assertRaises(ValueError, lambda: IF((x, y[1:]), v)) self.assertRaises(ValueError, lambda: IF((x[:, N.NewAxis], y), v)) self.assertRaises(ValueError, lambda: IF((x, y[::-1]), v)) self.assertRaises(ValueError, lambda: IF((x, 0*y), v)) if __name__ == '__main__': unittest.main() ScientificPython-2.9.4/Tests/signal_tests.py0000644000076600000240000000350611501734160021575 0ustar hinsenstaff00000000000000# # Tests for Scientific.Signals.Models # # Written by Konrad Hinsen # last revision: 2006-8-25 # import unittest from Scientific.Signals.Models import AutoRegressiveModel, \ AveragedAutoRegressiveModel from Scientific import N class ARModelTest(unittest.TestCase): """ Test AutoRegressiveModel """ def setUp(self): self.constant = N.zeros((5,), N.Float) + 1. def testExponential(self): signal = N.exp(-N.arange(10)) model = AutoRegressiveModel(5, signal) self.assertAlmostEqual(model.sigma, 0.248259203831, 10) self.assertAlmostEqual(model.coeff[0], 0.0134752822213, 10) self.assertAlmostEqual(N.sum(model.coeff), 0.589668004984, 10) spectrum = model.spectrum(N.array([0., 1., 10.])).values self.assertAlmostEqual(spectrum[0], 0.183024806929, 10) self.assertAlmostEqual(spectrum[1], 0.0728546620522, 10) self.assertAlmostEqual(spectrum[2], 0.00741215804406, 10) poles = model.poles() self.assertAlmostEqual(N.sum(poles).real, 0.8508408685, 10) self.assertEqual(N.sum(poles).imag, 0.) correlation = model.correlation(3).values self.assertAlmostEqual(correlation[0], 0.115651764037, 10) self.assertAlmostEqual(correlation[2], 0.0307404966495, 10) self.assertAlmostEqual(model.frictionConstant(), 0.48018033306, 10) memory = model.memoryFunction(4).values self.assertAlmostEqual(memory[0], 0.703891452672, 10) self.assertAlmostEqual(memory[1], 0.15417211278, 10) self.assertAlmostEqual(memory[2], -0.026985553641, 10) self.assertAlmostEqual(memory[3], 0.00425970654789, 10) self.assertAlmostEqual(model.predictStep(), 7.85423644046e-05, 10) if __name__ == '__main__': unittest.main() ScientificPython-2.9.4/Tests/vector_tests.py0000644000076600000240000000710712233720473021630 0ustar hinsenstaff00000000000000# # Tests for Scientific.Geometry.Vector # # Written by Konrad Hinsen # last revision: 2006-11-23 # import unittest import copy from Scientific import N from Scientific.Geometry import Tensor class VectorTest(unittest.TestCase): """ Test Vector """ def testVectorPython(self): from Scientific.Geometry.VectorModule import Vector, isVector self.shouldPass(Vector, isVector) self.shouldFail(Vector, isVector) def testVectorCython(self): from Scientific._vector import Vector, isVector self.shouldPass(Vector, isVector) self.shouldFail(Vector, isVector) def shouldPass(self, Vector, isVector): # Create vector objects v1 = Vector(1., -2., 3.) v2 = Vector([-2., 1., 0.]) # Check that vectors are not copied v1_copy = copy.copy(v1) self.assertTrue(v1 is v1_copy) v1_copy = copy.deepcopy(v1) self.assertTrue(v1 is v1_copy) # check len and element access self.assertEqual(len(v1), 3) self.assertEqual(v1[0], 1.) self.assertEqual(v1[1], -2.) self.assertEqual(v1[2], 3.) self.assertEqual(v1[-3], 1.) self.assertEqual(v1[-2], -2.) self.assertEqual(v1[-1], 3.) self.assertEqual(v1.x(), 1.) self.assertEqual(v1.y(), -2.) self.assertEqual(v1.z(), 3.) # Check arithmetic self.assertEqual(v1+v2, Vector(-1., -1., 3.)) self.assertEqual(v1-v2, Vector(3., -3., 3.)) self.assertEqual(-v1, Vector(-1., 2., -3.)) self.assertEqual(v1*v2, -4.) self.assertEqual(2.*v1, Vector(2., -4., 6.)) self.assertEqual(v1/0.5, Vector(2., -4., 6.)) # Check comparisons self.assertTrue(v1 == v1) self.assertFalse(v1 == v2) self.assertFalse(v1 == None) # Check methods self.assertAlmostEqual(v1.length(), N.sqrt(14.), 12) self.assertAlmostEqual(v1.normal()[0], v1[0]/N.sqrt(14.), 12) self.assertAlmostEqual(v1.normal()[1], v1[1]/N.sqrt(14.), 12) self.assertAlmostEqual(v1.normal()[2], v1[2]/N.sqrt(14.), 12) self.assertAlmostEqual(v1.cross(v1).length(), 0., 12) self.assertEqual(v1.cross(v2), Vector(-3., -6., -3.)) self.assertAlmostEqual(v1.angle(v1), 0., 12) self.assertAlmostEqual(v1.angle(v2), N.arccos(v1.normal()*v2.normal()), 12) dp = v1.dyadicProduct(v2) for i in range(3): for j in range(3): self.assertEqual(dp[i, j], v1[i]*v2[j]) self.assertTrue(N.logical_and.reduce(v1.asTensor().array == v1.array)) # Check isVector self.assertTrue(isVector(v1)) self.assertTrue(isVector(v2)) self.assertFalse(isVector(0.)) self.assertFalse(isVector("string")) def shouldFail(self, Vector, isVector): # Create vector objects v1 = Vector(1., -2., 3.) v2 = Vector([-2., 1., 0.]) # Check indices out of range for index in [3, 4, 100, -4, -5, -10]: self.assertRaises(IndexError, eval, "v1[index]", {}, locals()) # Check arithmetic self.assertRaises(TypeError, eval, "v1/v2", {}, locals()) self.assertRaises(TypeError, eval, "1./v2", {}, locals()) # Check methods self.assertRaises(ZeroDivisionError, Vector(0., 0., 0.).normal) self.assertRaises(TypeError, v1.angle, 0.) self.assertRaises(TypeError, v1.cross, 0.) self.assertRaises(TypeError, v1.dyadicProduct, 0.) if __name__ == '__main__': unittest.main() ScientificPython-2.9.4/Tools/0000755000076600000240000000000012270505006016515 5ustar hinsenstaff00000000000000ScientificPython-2.9.4/Tools/makeheader.py0000644000076600000240000001055311501734160021162 0ustar hinsenstaff00000000000000import sys import string exportfile = 'Scientific_mpi.export' exports = open(exportfile).readlines() exports = map(lambda s: s[:-1], exports) exports = filter(None, exports) modulename = exports[0] moduleimport = exports[1] prefix = exports[2] moduledef = exports[3] exports = exports[4:] header = open(prefix+'_API.h', 'w') header.write("/*\n * C API functions\n */\n\n") apicounter = 0 index = 0 while index < len(exports): if exports[index] == 'type': header.write("#define %s_Type_NUM %d\n\n" % (exports[index+1], apicounter)) apicounter = apicounter + 1 index = index + 2 elif exports[index] == 'function' or exports[index] == 'exportfunc': header.write("#define %s_RET %s\n" % (exports[index+2], exports[index+1])) header.write("#define %s_PROTO Py_PROTO(%s)\n" % (exports[index+2], exports[index+3])) header.write("#define %s_NUM %d\n\n" % (exports[index+2], apicounter)) apicounter = apicounter + 1 index = index + 4 elif exports[index] == 'typedef': index = index + 3 else: raise ValueError, "unknown export object " + exports[index] header.write("#define %s_API_pointers %d\n\n" % (prefix, apicounter)) header.write("#ifdef %s\n\n" % moduledef) index = 0 while index < len(exports): if exports[index] == 'type': header.write("statichere PyTypeObject %s_Type;\n" % exports[index+1]) header.write("#define %s_Check(op) ((op)->ob_type == &%s_Type)\n\n" % (exports[index+1], exports[index+1])) index = index + 2 elif exports[index] == 'function': header.write("static %s_RET %s %s_PROTO;\n\n" % (exports[index+2], exports[index+2], exports[index+2])) index = index + 4 elif exports[index] == 'exportfunc': index = index + 4 elif exports[index] == 'typedef': index = index + 3 else: raise ValueError, "unknown export object " + exports[index] header.write("#define set_%s_API_pointers(){ \\\n" % prefix) index = 0 while index < len(exports): if exports[index] == 'type': header.write(" %s_API[%s_Type_NUM] = (void *)&%s_Type; \\\n" % (prefix, exports[index+1], exports[index+1])) index = index + 2 elif exports[index] == 'function' or exports[index] == 'exportfunc': header.write(" %s_API[%s_NUM] = (void *)&%s; \\\n" % (prefix, exports[index+2], exports[index+2])) index = index + 4 elif exports[index] == 'typedef': index = index + 3 else: raise ValueError, "unknown export object " + exports[index] header.write("}\n\n") header.write("#else\n\n") linkage = "%s_API_LINKAGE" % (string.upper(prefix),) header.write("#ifndef %s\n" % linkage) header.write("#define %s static\n" % linkage) header.write("#endif\n\n") header.write("%s void **%s_API;\n\n" % (linkage, prefix)) index = 0 while index < len(exports): if exports[index] == 'type': header.write("#define %s_Check(op) \\\n" % exports[index+1]) header.write(" ((op)->ob_type == (PyTypePbject *)") header.write("%s_API[%s_Type_Num])\n\n" % (prefix, exports[index+1])) index = index + 2 elif exports[index] == 'function' or exports[index] == 'exportfunc': header.write("#define %s \\\n" % exports[index+2]) header.write(" (*(%s_RET (*)%s_PROTO) \\\n" % (exports[index+2], exports[index+2])) header.write(" %s_API[%s_NUM])\n\n" % (prefix, exports[index+2])) index = index + 4 elif exports[index] == 'typedef': header.write("typedef %s %s;\n\n" % (exports[index+1], exports[index+2])) index = index + 3 else: raise ValueError, "unknown export object " + exports[index] header.write('''\n #define %s() \\ { \\ PyObject *module = PyImport_ImportModule("%s"); \\ if (module != NULL) { \\ PyObject *module_dict = PyModule_GetDict(module); \\ PyObject *c_api_object = PyDict_GetItemString(module_dict, "_C_API"); \\ if (PyCObject_Check(c_api_object)) { \\ %s_API = (void **)PyCObject_AsVoidPtr(c_api_object); \\ } \\ } \\ } ''' % (moduleimport, modulename, prefix)) header.write("#endif\n"); header.close() ScientificPython-2.9.4/Tools/makePDBSpaceGroups.py0000644000076600000240000006311211501734160022512 0ustar hinsenstaff00000000000000# This script generates the module Scientific.IO.PDBSpaceGroups # # The space group information is taken from cctbx, which must be # available to run this script. # # Written by Konrad Hinsen # last revision: 2007-10-18 # from cctbx.sgtbx import space_group_info from Scientific import N def format_rational(r): s = str(r) if '/' in s: return './'.join(s.split('/')) + '.' else: return s + '.' def space_group_table_entry(number, labels, sgi): group = sgi.group() print "transformations = []" for symmetry_transformation in group: rot = symmetry_transformation.as_rational().r trans = symmetry_transformation.as_rational().t print 'rot = N.array([' + \ ','.join([str(x) for x in rot]) + '])' print 'rot.shape = (3, 3)' print 'trans = Vector(' + \ ','.join([format_rational(x) for x in trans]) + ')' print 'transformations.append((rot, trans))' print 'sg = SpaceGroup(%d, %s, transformations)' % (number, str(labels)) print "_space_group_table[%d] = sg" % number for l in labels: print "_space_group_table[%s] = sg" % repr(l) print # This list was obtained from the sginfo utility. Probably the list can # be obtained from cctbx as well somewhow, but I don't know how. space_group_labels = [ ['P1', 'P 1', '1', 'C1^1'], ['P-1', '-P 1', '2', 'Ci^1'], ['P2:b', 'P121', 'P 2y', '3:b', 'C2^1'], ['P2:c', 'P112', 'P 2', '3:c', 'C2^1'], ['P2:a', 'P211', 'P 2x', '3:a', 'C2^1'], ['P21:b', 'P1211', 'P 2yb', '4:b', 'C2^2'], ['P21:c', 'P1121', 'P 2c', '4:c', 'C2^2'], ['P21:a', 'P2111', 'P 2xa', '4:a', 'C2^2'], ['C2:b1', 'C121', 'C 2y', '5:b1', 'C2^3'], ['C2:b2', 'A121', 'A 2y', '5:b2', 'C2^3'], ['C2:b3', 'I121', 'I 2y', '5:b3', 'C2^3'], ['C2:c1', 'A112', 'A 2', '5:c1', 'C2^3'], ['C2:c2', 'B112', 'B2', 'B 2', '5:c2', 'C2^3'], ['C2:c3', 'I112', 'I 2', '5:c3', 'C2^3'], ['C2:a1', 'B211', 'B 2x', '5:a1', 'C2^3'], ['C2:a2', 'C211', 'C 2x', '5:a2', 'C2^3'], ['C2:a3', 'I211', 'I 2x', '5:a3', 'C2^3'], ['Pm:b', 'P1m1', 'P -2y', '6:b', 'Cs^1'], ['Pm:c', 'P11m', 'P -2', '6:c', 'Cs^1'], ['Pm:a', 'Pm11', 'P -2x', '6:a', 'Cs^1'], ['Pc:b1', 'P1c1', 'P -2yc', '7:b1', 'Cs^2'], ['Pc:b2', 'P1n1', 'P -2yac', '7:b2', 'Cs^2'], ['Pc:b3', 'P1a1', 'P -2ya', '7:b3', 'Cs^2'], ['Pc:c1', 'P11a', 'P -2a', '7:c1', 'Cs^2'], ['Pc:c2', 'P11n', 'P -2ab', '7:c2', 'Cs^2'], ['Pc:c3', 'P11b', 'Pb', 'P -2b', '7:c3', 'Cs^2'], ['Pc:a1', 'Pb11', 'P -2xb', '7:a1', 'Cs^2'], ['Pc:a2', 'Pn11', 'P -2xbc', '7:a2', 'Cs^2'], ['Pc:a3', 'Pc11', 'P -2xc', '7:a3', 'Cs^2'], ['Cm:b1', 'C1m1', 'C -2y', '8:b1', 'Cs^3'], ['Cm:b2', 'A1m1', 'A -2y', '8:b2', 'Cs^3'], ['Cm:b3', 'I1m1', 'I -2y', '8:b3', 'Cs^3'], ['Cm:c1', 'A11m', 'A -2', '8:c1', 'Cs^3'], ['Cm:c2', 'B11m', 'Bm', 'B -2', '8:c2', 'Cs^3'], ['Cm:c3', 'I11m', 'I -2', '8:c3', 'Cs^3'], ['Cm:a1', 'Bm11', 'B -2x', '8:a1', 'Cs^3'], ['Cm:a2', 'Cm11', 'C -2x', '8:a2', 'Cs^3'], ['Cm:a3', 'Im11', 'I -2x', '8:a3', 'Cs^3'], ['Cc:b1', 'C1c1', 'C -2yc', '9:b1', 'Cs^4'], ['Cc:b2', 'A1n1', 'A -2yac', '9:b2', 'Cs^4'], ['Cc:b3', 'I1a1', 'I -2ya', '9:b3', 'Cs^4'], ['Cc:-b1', 'A1a1', 'A -2ya', '9:-b1', 'Cs^4'], ['Cc:-b2', 'C1n1', 'C -2ybc', '9:-b2', 'Cs^4'], ['Cc:-b3', 'I1c1', 'I -2yc', '9:-b3', 'Cs^4'], ['Cc:c1', 'A11a', 'A -2a', '9:c1', 'Cs^4'], ['Cc:c2', 'B11n', 'B -2bc', '9:c2', 'Cs^4'], ['Cc:c3', 'I11b', 'I -2b', '9:c3', 'Cs^4'], ['Cc:-c1', 'B11b', 'Bb', 'B -2b', '9:-c1', 'Cs^4'], ['Cc:-c2', 'A11n', 'A -2ac', '9:-c2', 'Cs^4'], ['Cc:-c3', 'I11a', 'I -2a', '9:-c3', 'Cs^4'], ['Cc:a1', 'Bb11', 'B -2xb', '9:a1', 'Cs^4'], ['Cc:a2', 'Cn11', 'C -2xbc', '9:a2', 'Cs^4'], ['Cc:a3', 'Ic11', 'I -2xc', '9:a3', 'Cs^4'], ['Cc:-a1', 'Cc11', 'C -2xc', '9:-a1', 'Cs^4'], ['Cc:-a2', 'Bn11', 'B -2xbc', '9:-a2', 'Cs^4'], ['Cc:-a3', 'Ib11', 'I -2xb', '9:-a3', 'Cs^4'], ['P2/m:b', 'P12/m1', '-P 2y', '10:b', 'C2h^1'], ['P2/m:c', 'P112/m', '-P 2', '10:c', 'C2h^1'], ['P2/m:a', 'P2/m11', '-P 2x', '10:a', 'C2h^1'], ['P21/m:b', 'P121/m1', '-P 2yb', '11:b', 'C2h^2'], ['P21/m:c', 'P1121/m', '-P 2c', '11:c', 'C2h^2'], ['P21/m:a', 'P21/m11', '-P 2xa', '11:a', 'C2h^2'], ['C2/m:b1', 'C12/m1', '-C 2y', '12:b1', 'C2h^3'], ['C2/m:b2', 'A12/m1', '-A 2y', '12:b2', 'C2h^3'], ['C2/m:b3', 'I12/m1', '-I 2y', '12:b3', 'C2h^3'], ['C2/m:c1', 'A112/m', '-A 2', '12:c1', 'C2h^3'], ['C2/m:c2', 'B112/m', 'B2/m', '-B 2', '12:c2', 'C2h^3'], ['C2/m:c3', 'I112/m', '-I 2', '12:c3', 'C2h^3'], ['C2/m:a1', 'B2/m11', '-B 2x', '12:a1', 'C2h^3'], ['C2/m:a2', 'C2/m11', '-C 2x', '12:a2', 'C2h^3'], ['C2/m:a3', 'I2/m11', '-I 2x', '12:a3', 'C2h^3'], ['P2/c:b1', 'P12/c1', '-P 2yc', '13:b1', 'C2h^4'], ['P2/c:b2', 'P12/n1', '-P 2yac', '13:b2', 'C2h^4'], ['P2/c:b3', 'P12/a1', '-P 2ya', '13:b3', 'C2h^4'], ['P2/c:c1', 'P112/a', '-P 2a', '13:c1', 'C2h^4'], ['P2/c:c2', 'P112/n', '-P 2ab', '13:c2', 'C2h^4'], ['P2/c:c3', 'P112/b', 'P2/b', '-P 2b', '13:c3', 'C2h^4'], ['P2/c:a1', 'P2/b11', '-P 2xb', '13:a1', 'C2h^4'], ['P2/c:a2', 'P2/n11', '-P 2xbc', '13:a2', 'C2h^4'], ['P2/c:a3', 'P2/c11', '-P 2xc', '13:a3', 'C2h^4'], ['P21/c:b1', 'P121/c1', '-P 2ybc', '14:b1', 'C2h^5'], ['P21/c:b2', 'P121/n1', '-P 2yn', '14:b2', 'C2h^5'], ['P21/c:b3', 'P121/a1', '-P 2yab', '14:b3', 'C2h^5'], ['P21/c:c1', 'P1121/a', '-P 2ac', '14:c1', 'C2h^5'], ['P21/c:c2', 'P1121/n', '-P 2n', '14:c2', 'C2h^5'], ['P21/c:c3', 'P1121/b', 'P21/b', '-P 2bc', '14:c3', 'C2h^5'], ['P21/c:a1', 'P21/b11', '-P 2xab', '14:a1', 'C2h^5'], ['P21/c:a2', 'P21/n11', '-P 2xn', '14:a2', 'C2h^5'], ['P21/c:a3', 'P21/c11', '-P 2xac', '14:a3', 'C2h^5'], ['C2/c:b1', 'C12/c1', '-C 2yc', '15:b1', 'C2h^6'], ['C2/c:b2', 'A12/n1', '-A 2yac', '15:b2', 'C2h^6'], ['C2/c:b3', 'I12/a1', '-I 2ya', '15:b3', 'C2h^6'], ['C2/c:-b1', 'A12/a1', '-A 2ya', '15:-b1', 'C2h^6'], ['C2/c:-b2', 'C12/n1', '-C 2ybc', '15:-b2', 'C2h^6'], ['C2/c:-b3', 'I12/c1', '-I 2yc', '15:-b3', 'C2h^6'], ['C2/c:c1', 'A112/a', '-A 2a', '15:c1', 'C2h^6'], ['C2/c:c2', 'B112/n', '-B 2bc', '15:c2', 'C2h^6'], ['C2/c:c3', 'I112/b', '-I 2b', '15:c3', 'C2h^6'], ['C2/c:-c1', 'B112/b', 'B2/b', '-B 2b', '15:-c1', 'C2h^6'], ['C2/c:-c2', 'A112/n', '-A 2ac', '15:-c2', 'C2h^6'], ['C2/c:-c3', 'I112/a', '-I 2a', '15:-c3', 'C2h^6'], ['C2/c:a1', 'B2/b11', '-B 2xb', '15:a1', 'C2h^6'], ['C2/c:a2', 'C2/n11', '-C 2xbc', '15:a2', 'C2h^6'], ['C2/c:a3', 'I2/c11', '-I 2xc', '15:a3', 'C2h^6'], ['C2/c:-a1', 'C2/c11', '-C 2xc', '15:-a1', 'C2h^6'], ['C2/c:-a2', 'B2/n11', '-B 2xbc', '15:-a2', 'C2h^6'], ['C2/c:-a3', 'I2/b11', '-I 2xb', '15:-a3', 'C2h^6'], ['P222', 'P 2 2', '16', 'D2^1'], ['P2221', 'P 2c 2', '17', 'D2^2'], ['P2122', 'P 2a 2a', '17:cab', 'D2^2'], ['P2212', 'P 2 2b', '17:bca', 'D2^2'], ['P21212', 'P 2 2ab', '18', 'D2^3'], ['P22121', 'P 2bc 2', '18:cab', 'D2^3'], ['P21221', 'P 2ac 2ac', '18:bca', 'D2^3'], ['P212121', 'P 2ac 2ab', '19', 'D2^4'], ['C2221', 'C 2c 2', '20', 'D2^5'], ['A2122', 'A 2a 2a', '20:cab', 'D2^5'], ['B2212', 'B 2 2b', '20:bca', 'D2^5'], ['C222', 'C 2 2', '21', 'D2^6'], ['A222', 'A 2 2', '21:cab', 'D2^6'], ['B222', 'B 2 2', '21:bca', 'D2^6'], ['F222', 'F 2 2', '22', 'D2^7'], ['I222', 'I 2 2', '23', 'D2^8'], ['I212121', 'I 2b 2c', '24', 'D2^9'], ['Pmm2', 'P 2 -2', '25', 'C2v^1'], ['P2mm', 'P -2 2', '25:cab', 'C2v^1'], ['Pm2m', 'P -2 -2', '25:bca', 'C2v^1'], ['Pmc21', 'P 2c -2', '26', 'C2v^2'], ['Pcm21', 'P 2c -2c', '26:ba-c', 'C2v^2'], ['P21ma', 'P -2a 2a', '26:cab', 'C2v^2'], ['P21am', 'P -2 2a', '26:-cba', 'C2v^2'], ['Pb21m', 'P -2 -2b', '26:bca', 'C2v^2'], ['Pm21b', 'P -2b -2', '26:a-cb', 'C2v^2'], ['Pcc2', 'P 2 -2c', '27', 'C2v^3'], ['P2aa', 'P -2a 2', '27:cab', 'C2v^3'], ['Pb2b', 'P -2b -2b', '27:bca', 'C2v^3'], ['Pma2', 'P 2 -2a', '28', 'C2v^4'], ['Pbm2', 'P 2 -2b', '28:ba-c', 'C2v^4'], ['P2mb', 'P -2b 2', '28:cab', 'C2v^4'], ['P2cm', 'P -2c 2', '28:-cba', 'C2v^4'], ['Pc2m', 'P -2c -2c', '28:bca', 'C2v^4'], ['Pm2a', 'P -2a -2a', '28:a-cb', 'C2v^4'], ['Pca21', 'P 2c -2ac', '29', 'C2v^5'], ['Pbc21', 'P 2c -2b', '29:ba-c', 'C2v^5'], ['P21ab', 'P -2b 2a', '29:cab', 'C2v^5'], ['P21ca', 'P -2ac 2a', '29:-cba', 'C2v^5'], ['Pc21b', 'P -2bc -2c', '29:bca', 'C2v^5'], ['Pb21a', 'P -2a -2ab', '29:a-cb', 'C2v^5'], ['Pnc2', 'P 2 -2bc', '30', 'C2v^6'], ['Pcn2', 'P 2 -2ac', '30:ba-c', 'C2v^6'], ['P2na', 'P -2ac 2', '30:cab', 'C2v^6'], ['P2an', 'P -2ab 2', '30:-cba', 'C2v^6'], ['Pb2n', 'P -2ab -2ab', '30:bca', 'C2v^6'], ['Pn2b', 'P -2bc -2bc', '30:a-cb', 'C2v^6'], ['Pmn21', 'P 2ac -2', '31', 'C2v^7'], ['Pnm21', 'P 2bc -2bc', '31:ba-c', 'C2v^7'], ['P21mn', 'P -2ab 2ab', '31:cab', 'C2v^7'], ['P21nm', 'P -2 2ac', '31:-cba', 'C2v^7'], ['Pn21m', 'P -2 -2bc', '31:bca', 'C2v^7'], ['Pm21n', 'P -2ab -2', '31:a-cb', 'C2v^7'], ['Pba2', 'P 2 -2ab', '32', 'C2v^8'], ['P2cb', 'P -2bc 2', '32:cab', 'C2v^8'], ['Pc2a', 'P -2ac -2ac', '32:bca', 'C2v^8'], ['Pna21', 'P 2c -2n', '33', 'C2v^9'], ['Pbn21', 'P 2c -2ab', '33:ba-c', 'C2v^9'], ['P21nb', 'P -2bc 2a', '33:cab', 'C2v^9'], ['P21cn', 'P -2n 2a', '33:-cba', 'C2v^9'], ['Pc21n', 'P -2n -2ac', '33:bca', 'C2v^9'], ['Pn21a', 'P -2ac -2n', '33:a-cb', 'C2v^9'], ['Pnn2', 'P 2 -2n', '34', 'C2v^10'], ['P2nn', 'P -2n 2', '34:cab', 'C2v^10'], ['Pn2n', 'P -2n -2n', '34:bca', 'C2v^10'], ['Cmm2', 'C 2 -2', '35', 'C2v^11'], ['A2mm', 'A -2 2', '35:cab', 'C2v^11'], ['Bm2m', 'B -2 -2', '35:bca', 'C2v^11'], ['Cmc21', 'C 2c -2', '36', 'C2v^12'], ['Ccm21', 'C 2c -2c', '36:ba-c', 'C2v^12'], ['A21ma', 'A -2a 2a', '36:cab', 'C2v^12'], ['A21am', 'A -2 2a', '36:-cba', 'C2v^12'], ['Bb21m', 'B -2 -2b', '36:bca', 'C2v^12'], ['Bm21b', 'B -2b -2', '36:a-cb', 'C2v^12'], ['Ccc2', 'C 2 -2c', '37', 'C2v^13'], ['A2aa', 'A -2a 2', '37:cab', 'C2v^13'], ['Bb2b', 'B -2b -2b', '37:bca', 'C2v^13'], ['Amm2', 'A 2 -2', '38', 'C2v^14'], ['Bmm2', 'B 2 -2', '38:ba-c', 'C2v^14'], ['B2mm', 'B -2 2', '38:cab', 'C2v^14'], ['C2mm', 'C -2 2', '38:-cba', 'C2v^14'], ['Cm2m', 'C -2 -2', '38:bca', 'C2v^14'], ['Am2m', 'A -2 -2', '38:a-cb', 'C2v^14'], ['Abm2', 'A 2 -2c', '39', 'C2v^15'], ['Bma2', 'B 2 -2c', '39:ba-c', 'C2v^15'], ['B2cm', 'B -2c 2', '39:cab', 'C2v^15'], ['C2mb', 'C -2b 2', '39:-cba', 'C2v^15'], ['Cm2a', 'C -2b -2b', '39:bca', 'C2v^15'], ['Ac2m', 'A -2c -2c', '39:a-cb', 'C2v^15'], ['Ama2', 'A 2 -2a', '40', 'C2v^16'], ['Bbm2', 'B 2 -2b', '40:ba-c', 'C2v^16'], ['B2mb', 'B -2b 2', '40:cab', 'C2v^16'], ['C2cm', 'C -2c 2', '40:-cba', 'C2v^16'], ['Cc2m', 'C -2c -2c', '40:bca', 'C2v^16'], ['Am2a', 'A -2a -2a', '40:a-cb', 'C2v^16'], ['Aba2', 'A 2 -2ac', '41', 'C2v^17'], ['Bba2', 'B 2 -2bc', '41:ba-c', 'C2v^17'], ['B2cb', 'B -2bc 2', '41:cab', 'C2v^17'], ['C2cb', 'C -2bc 2', '41:-cba', 'C2v^17'], ['Cc2a', 'C -2bc -2bc', '41:bca', 'C2v^17'], ['Ac2a', 'A -2ac -2ac', '41:a-cb', 'C2v^17'], ['Fmm2', 'F 2 -2', '42', 'C2v^18'], ['F2mm', 'F -2 2', '42:cab', 'C2v^18'], ['Fm2m', 'F -2 -2', '42:bca', 'C2v^18'], ['Fdd2', 'F 2 -2d', '43', 'C2v^19'], ['F2dd', 'F -2d 2', '43:cab', 'C2v^19'], ['Fd2d', 'F -2d -2d', '43:bca', 'C2v^19'], ['Imm2', 'I 2 -2', '44', 'C2v^20'], ['I2mm', 'I -2 2', '44:cab', 'C2v^20'], ['Im2m', 'I -2 -2', '44:bca', 'C2v^20'], ['Iba2', 'I 2 -2c', '45', 'C2v^21'], ['I2cb', 'I -2a 2', '45:cab', 'C2v^21'], ['Ic2a', 'I -2b -2b', '45:bca', 'C2v^21'], ['Ima2', 'I 2 -2a', '46', 'C2v^22'], ['Ibm2', 'I 2 -2b', '46:ba-c', 'C2v^22'], ['I2mb', 'I -2b 2', '46:cab', 'C2v^22'], ['I2cm', 'I -2c 2', '46:-cba', 'C2v^22'], ['Ic2m', 'I -2c -2c', '46:bca', 'C2v^22'], ['Im2a', 'I -2a -2a', '46:a-cb', 'C2v^22'], ['Pmmm', '-P 2 2', '47', 'D2h^1'], ['Pnnn:1', 'P 2 2 -1n', '48:1', 'D2h^2'], ['Pnnn:2', '-P 2ab 2bc', '48:2', 'D2h^2'], ['Pccm', '-P 2 2c', '49', 'D2h^3'], ['Pmaa', '-P 2a 2', '49:cab', 'D2h^3'], ['Pbmb', '-P 2b 2b', '49:bca', 'D2h^3'], ['Pban:1', 'P 2 2 -1ab', '50:1', 'D2h^4'], ['Pban:2', '-P 2ab 2b', '50:2', 'D2h^4'], ['Pncb:1', 'P 2 2 -1bc', '50:1cab', 'D2h^4'], ['Pncb:2', '-P 2b 2bc', '50:2cab', 'D2h^4'], ['Pcna:1', 'P 2 2 -1ac', '50:1bca', 'D2h^4'], ['Pcna:2', '-P 2a 2c', '50:2bca', 'D2h^4'], ['Pmma', '-P 2a 2a', '51', 'D2h^5'], ['Pmmb', '-P 2b 2', '51:ba-c', 'D2h^5'], ['Pbmm', '-P 2 2b', '51:cab', 'D2h^5'], ['Pcmm', '-P 2c 2c', '51:-cba', 'D2h^5'], ['Pmcm', '-P 2c 2', '51:bca', 'D2h^5'], ['Pmam', '-P 2 2a', '51:a-cb', 'D2h^5'], ['Pnna', '-P 2a 2bc', '52', 'D2h^6'], ['Pnnb', '-P 2b 2n', '52:ba-c', 'D2h^6'], ['Pbnn', '-P 2n 2b', '52:cab', 'D2h^6'], ['Pcnn', '-P 2ab 2c', '52:-cba', 'D2h^6'], ['Pncn', '-P 2ab 2n', '52:bca', 'D2h^6'], ['Pnan', '-P 2n 2bc', '52:a-cb', 'D2h^6'], ['Pmna', '-P 2ac 2', '53', 'D2h^7'], ['Pnmb', '-P 2bc 2bc', '53:ba-c', 'D2h^7'], ['Pbmn', '-P 2ab 2ab', '53:cab', 'D2h^7'], ['Pcnm', '-P 2 2ac', '53:-cba', 'D2h^7'], ['Pncm', '-P 2 2bc', '53:bca', 'D2h^7'], ['Pman', '-P 2ab 2', '53:a-cb', 'D2h^7'], ['Pcca', '-P 2a 2ac', '54', 'D2h^8'], ['Pccb', '-P 2b 2c', '54:ba-c', 'D2h^8'], ['Pbaa', '-P 2a 2b', '54:cab', 'D2h^8'], ['Pcaa', '-P 2ac 2c', '54:-cba', 'D2h^8'], ['Pbcb', '-P 2bc 2b', '54:bca', 'D2h^8'], ['Pbab', '-P 2b 2ab', '54:a-cb', 'D2h^8'], ['Pbam', '-P 2 2ab', '55', 'D2h^9'], ['Pmcb', '-P 2bc 2', '55:cab', 'D2h^9'], ['Pcma', '-P 2ac 2ac', '55:bca', 'D2h^9'], ['Pccn', '-P 2ab 2ac', '56', 'D2h^10'], ['Pnaa', '-P 2ac 2bc', '56:cab', 'D2h^10'], ['Pbnb', '-P 2bc 2ab', '56:bca', 'D2h^10'], ['Pbcm', '-P 2c 2b', '57', 'D2h^11'], ['Pcam', '-P 2c 2ac', '57:ba-c', 'D2h^11'], ['Pmca', '-P 2ac 2a', '57:cab', 'D2h^11'], ['Pmab', '-P 2b 2a', '57:-cba', 'D2h^11'], ['Pbma', '-P 2a 2ab', '57:bca', 'D2h^11'], ['Pcmb', '-P 2bc 2c', '57:a-cb', 'D2h^11'], ['Pnnm', '-P 2 2n', '58', 'D2h^12'], ['Pmnn', '-P 2n 2', '58:cab', 'D2h^12'], ['Pnmn', '-P 2n 2n', '58:bca', 'D2h^12'], ['Pmmn:1', 'P 2 2ab -1ab', '59:1', 'D2h^13'], ['Pmmn:2', '-P 2ab 2a', '59:2', 'D2h^13'], ['Pnmm:1', 'P 2bc 2 -1bc', '59:1cab', 'D2h^13'], ['Pnmm:2', '-P 2c 2bc', '59:2cab', 'D2h^13'], ['Pmnm:1', 'P 2ac 2ac -1ac', '59:1bca', 'D2h^13'], ['Pmnm:2', '-P 2c 2a', '59:2bca', 'D2h^13'], ['Pbcn', '-P 2n 2ab', '60', 'D2h^14'], ['Pcan', '-P 2n 2c', '60:ba-c', 'D2h^14'], ['Pnca', '-P 2a 2n', '60:cab', 'D2h^14'], ['Pnab', '-P 2bc 2n', '60:-cba', 'D2h^14'], ['Pbna', '-P 2ac 2b', '60:bca', 'D2h^14'], ['Pcnb', '-P 2b 2ac', '60:a-cb', 'D2h^14'], ['Pbca', '-P 2ac 2ab', '61', 'D2h^15'], ['Pcab', '-P 2bc 2ac', '61:ba-c', 'D2h^15'], ['Pnma', '-P 2ac 2n', '62', 'D2h^16'], ['Pmnb', '-P 2bc 2a', '62:ba-c', 'D2h^16'], ['Pbnm', '-P 2c 2ab', '62:cab', 'D2h^16'], ['Pcmn', '-P 2n 2ac', '62:-cba', 'D2h^16'], ['Pmcn', '-P 2n 2a', '62:bca', 'D2h^16'], ['Pnam', '-P 2c 2n', '62:a-cb', 'D2h^16'], ['Cmcm', '-C 2c 2', '63', 'D2h^17'], ['Ccmm', '-C 2c 2c', '63:ba-c', 'D2h^17'], ['Amma', '-A 2a 2a', '63:cab', 'D2h^17'], ['Amam', '-A 2 2a', '63:-cba', 'D2h^17'], ['Bbmm', '-B 2 2b', '63:bca', 'D2h^17'], ['Bmmb', '-B 2b 2', '63:a-cb', 'D2h^17'], ['Cmca', '-C 2bc 2', '64', 'D2h^18'], ['Ccmb', '-C 2bc 2bc', '64:ba-c', 'D2h^18'], ['Abma', '-A 2ac 2ac', '64:cab', 'D2h^18'], ['Acam', '-A 2 2ac', '64:-cba', 'D2h^18'], ['Bbcm', '-B 2 2bc', '64:bca', 'D2h^18'], ['Bmab', '-B 2bc 2', '64:a-cb', 'D2h^18'], ['Cmmm', '-C 2 2', '65', 'D2h^19'], ['Ammm', '-A 2 2', '65:cab', 'D2h^19'], ['Bmmm', '-B 2 2', '65:bca', 'D2h^19'], ['Cccm', '-C 2 2c', '66', 'D2h^20'], ['Amaa', '-A 2a 2', '66:cab', 'D2h^20'], ['Bbmb', '-B 2b 2b', '66:bca', 'D2h^20'], ['Cmma', '-C 2b 2', '67', 'D2h^21'], ['Cmmb', '-C 2b 2b', '67:ba-c', 'D2h^21'], ['Abmm', '-A 2c 2c', '67:cab', 'D2h^21'], ['Acmm', '-A 2 2c', '67:-cba', 'D2h^21'], ['Bmcm', '-B 2 2c', '67:bca', 'D2h^21'], ['Bmam', '-B 2c 2', '67:a-cb', 'D2h^21'], ['Ccca:1', 'C 2 2 -1bc', '68:1', 'D2h^22'], ['Ccca:2', '-C 2b 2bc', '68:2', 'D2h^22'], ['Cccb:1', 'C 2 2 -1bc', '68:1ba-c', 'D2h^22'], ['Cccb:2', '-C 2b 2c', '68:2ba-c', 'D2h^22'], ['Abaa:1', 'A 2 2 -1ac', '68:1cab', 'D2h^22'], ['Abaa:2', '-A 2a 2c', '68:2cab', 'D2h^22'], ['Acaa:1', 'A 2 2 -1ac', '68:1-cba', 'D2h^22'], ['Acaa:2', '-A 2ac 2c', '68:2-cba', 'D2h^22'], ['Bbcb:1', 'B 2 2 -1bc', '68:1bca', 'D2h^22'], ['Bbcb:2', '-B 2bc 2b', '68:2bca', 'D2h^22'], ['Bbab:1', 'B 2 2 -1bc', '68:1a-cb', 'D2h^22'], ['Bbab:2', '-B 2b 2bc', '68:2a-cb', 'D2h^22'], ['Fmmm', '-F 2 2', '69', 'D2h^23'], ['Fddd:1', 'F 2 2 -1d', '70:1', 'D2h^24'], ['Fddd:2', '-F 2uv 2vw', '70:2', 'D2h^24'], ['Immm', '-I 2 2', '71', 'D2h^25'], ['Ibam', '-I 2 2c', '72', 'D2h^26'], ['Imcb', '-I 2a 2', '72:cab', 'D2h^26'], ['Icma', '-I 2b 2b', '72:bca', 'D2h^26'], ['Ibca', '-I 2b 2c', '73', 'D2h^27'], ['Icab', '-I 2a 2b', '73:ba-c', 'D2h^27'], ['Imma', '-I 2b 2', '74', 'D2h^28'], ['Immb', '-I 2a 2a', '74:ba-c', 'D2h^28'], ['Ibmm', '-I 2c 2c', '74:cab', 'D2h^28'], ['Icmm', '-I 2 2b', '74:-cba', 'D2h^28'], ['Imcm', '-I 2 2a', '74:bca', 'D2h^28'], ['Imam', '-I 2c 2', '74:a-cb', 'D2h^28'], ['P4', 'P 4', '75', 'C4^1'], ['P41', 'P 4w', '76', 'C4^2'], ['P42', 'P 4c', '77', 'C4^3'], ['P43', 'P 4cw', '78', 'C4^4'], ['I4', 'I 4', '79', 'C4^5'], ['I41', 'I 4bw', '80', 'C4^6'], ['P-4', 'P -4', '81', 'S4^1'], ['I-4', 'I -4', '82', 'S4^2'], ['P4/m', '-P 4', '83', 'C4h^1'], ['P42/m', '-P 4c', '84', 'C4h^2'], ['P4/n:1', 'P 4ab -1ab', '85:1', 'C4h^3'], ['P4/n:2', '-P 4a', '85:2', 'C4h^3'], ['P42/n:1', 'P 4n -1n', '86:1', 'C4h^4'], ['P42/n:2', '-P 4bc', '86:2', 'C4h^4'], ['I4/m', '-I 4', '87', 'C4h^5'], ['I41/a:1', 'I 4bw -1bw', '88:1', 'C4h^6'], ['I41/a:2', '-I 4ad', '88:2', 'C4h^6'], ['P422', 'P 4 2', '89', 'D4^1'], ['P4212', 'P 4ab 2ab', '90', 'D4^2'], ['P4122', 'P 4w 2c', '91', 'D4^3'], ['P41212', 'P 4abw 2nw', '92', 'D4^4'], ['P4222', 'P 4c 2', '93', 'D4^5'], ['P42212', 'P 4n 2n', '94', 'D4^6'], ['P4322', 'P 4cw 2c', '95', 'D4^7'], ['P43212', 'P 4nw 2abw', '96', 'D4^8'], ['I422', 'I 4 2', '97', 'D4^9'], ['I4122', 'I 4bw 2bw', '98', 'D4^10'], ['P4mm', 'P 4 -2', '99', 'C4v^1'], ['P4bm', 'P 4 -2ab', '100', 'C4v^2'], ['P42cm', 'P 4c -2c', '101', 'C4v^3'], ['P42nm', 'P 4n -2n', '102', 'C4v^4'], ['P4cc', 'P 4 -2c', '103', 'C4v^5'], ['P4nc', 'P 4 -2n', '104', 'C4v^6'], ['P42mc', 'P 4c -2', '105', 'C4v^7'], ['P42bc', 'P 4c -2ab', '106', 'C4v^8'], ['I4mm', 'I 4 -2', '107', 'C4v^9'], ['I4cm', 'I 4 -2c', '108', 'C4v^10'], ['I41md', 'I 4bw -2', '109', 'C4v^11'], ['I41cd', 'I 4bw -2c', '110', 'C4v^12'], ['P-42m', 'P -4 2', '111', 'D2d^1'], ['P-42c', 'P -4 2c', '112', 'D2d^2'], ['P-421m', 'P -4 2ab', '113', 'D2d^3'], ['P-421c', 'P -4 2n', '114', 'D2d^4'], ['P-4m2', 'P -4 -2', '115', 'D2d^5'], ['P-4c2', 'P -4 -2c', '116', 'D2d^6'], ['P-4b2', 'P -4 -2ab', '117', 'D2d^7'], ['P-4n2', 'P -4 -2n', '118', 'D2d^8'], ['I-4m2', 'I -4 -2', '119', 'D2d^9'], ['I-4c2', 'I -4 -2c', '120', 'D2d^10'], ['I-42m', 'I -4 2', '121', 'D2d^11'], ['I-42d', 'I -4 2bw', '122', 'D2d^12'], ['P4/mmm', '-P 4 2', '123', 'D4h^1'], ['P4/mcc', '-P 4 2c', '124', 'D4h^2'], ['P4/nbm:1', 'P 4 2 -1ab', '125:1', 'D4h^3'], ['P4/nbm:2', '-P 4a 2b', '125:2', 'D4h^3'], ['P4/nnc:1', 'P 4 2 -1n', '126:1', 'D4h^4'], ['P4/nnc:2', '-P 4a 2bc', '126:2', 'D4h^4'], ['P4/mbm', '-P 4 2ab', '127', 'D4h^5'], ['P4/mnc', '-P 4 2n', '128', 'D4h^6'], ['P4/nmm:1', 'P 4ab 2ab -1ab', '129:1', 'D4h^7'], ['P4/nmm:2', '-P 4a 2a', '129:2', 'D4h^7'], ['P4/ncc:1', 'P 4ab 2n -1ab', '130:1', 'D4h^8'], ['P4/ncc:2', '-P 4a 2ac', '130:2', 'D4h^8'], ['P42/mmc', '-P 4c 2', '131', 'D4h^9'], ['P42/mcm', '-P 4c 2c', '132', 'D4h^10'], ['P42/nbc:1', 'P 4n 2c -1n', '133:1', 'D4h^11'], ['P42/nbc:2', '-P 4ac 2b', '133:2', 'D4h^11'], ['P42/nnm:1', 'P 4n 2 -1n', '134:1', 'D4h^12'], ['P42/nnm:2', '-P 4ac 2bc', '134:2', 'D4h^12'], ['P42/mbc', '-P 4c 2ab', '135', 'D4h^13'], ['P42/mnm', '-P 4n 2n', '136', 'D4h^14'], ['P42/nmc:1', 'P 4n 2n -1n', '137:1', 'D4h^15'], ['P42/nmc:2', '-P 4ac 2a', '137:2', 'D4h^15'], ['P42/ncm:1', 'P 4n 2ab -1n', '138:1', 'D4h^16'], ['P42/ncm:2', '-P 4ac 2ac', '138:2', 'D4h^16'], ['I4/mmm', '-I 4 2', '139', 'D4h^17'], ['I4/mcm', '-I 4 2c', '140', 'D4h^18'], ['I41/amd:1', 'I 4bw 2bw -1bw', '141:1', 'D4h^19'], ['I41/amd:2', '-I 4bd 2', '141:2', 'D4h^19'], ['I41/acd:1', 'I 4bw 2aw -1bw', '142:1', 'D4h^20'], ['I41/acd:2', '-I 4bd 2c', '142:2', 'D4h^20'], ['P3', 'P 3', '143', 'C3^1'], ['P31', 'P 31', '144', 'C3^2'], ['P32', 'P 32', '145', 'C3^3'], ['R3:H', 'R 3', '146:H', 'C3^4'], ['R3:R', 'P 3*', '146:R', 'C3^4'], ['P-3', '-P 3', '147', 'C3i^1'], ['R-3:H', '-R 3', '148:H', 'C3i^2'], ['R-3:R', '-P 3*', '148:R', 'C3i^2'], ['P312', 'P 3 2', '149', 'D3^1'], ['P321', 'P 3 2"', '150', 'D3^2'], ['P3112', 'P 31 2c (0 0 1)', '151', 'D3^3'], ['P3121', 'P 31 2"', '152', 'D3^4'], ['P3212', 'P 32 2c (0 0 -1)', '153', 'D3^5'], ['P3221', 'P 32 2"', '154', 'D3^6'], ['R32:H', 'R 3 2"', '155:H', 'D3^7'], ['R32:R', 'P 3* 2', '155:R', 'D3^7'], ['P3m1', 'P 3 -2"', '156', 'C3v^1'], ['P31m', 'P 3 -2', '157', 'C3v^2'], ['P3c1', 'P 3 -2"c', '158', 'C3v^3'], ['P31c', 'P 3 -2c', '159', 'C3v^4'], ['R3m:H', 'R 3 -2"', '160:H', 'C3v^5'], ['R3m:R', 'P 3* -2', '160:R', 'C3v^5'], ['R3c:H', 'R 3 -2"c', '161:H', 'C3v^6'], ['R3c:R', 'P 3* -2n', '161:R', 'C3v^6'], ['P-31m', '-P 3 2', '162', 'D3d^1'], ['P-31c', '-P 3 2c', '163', 'D3d^2'], ['P-3m1', '-P 3 2"', '164', 'D3d^3'], ['P-3c1', '-P 3 2"c', '165', 'D3d^4'], ['R-3m:H', '-R 3 2"', '166:H', 'D3d^5'], ['R-3m:R', '-P 3* 2', '166:R', 'D3d^5'], ['R-3c:H', '-R 3 2"c', '167:H', 'D3d^6'], ['R-3c:R', '-P 3* 2n', '167:R', 'D3d^6'], ['P6', 'P 6', '168', 'C6^1'], ['P61', 'P 61', '169', 'C6^2'], ['P65', 'P 65', '170', 'C6^3'], ['P62', 'P 62', '171', 'C6^4'], ['P64', 'P 64', '172', 'C6^5'], ['P63', 'P 6c', '173', 'C6^6'], ['P-6', 'P -6', '174', 'C3h^1'], ['P6/m', '-P 6', '175', 'C6h^1'], ['P63/m', '-P 6c', '176', 'C6h^2'], ['P622', 'P 6 2', '177', 'D6^1'], ['P6122', 'P 61 2 (0 0 -1)', '178', 'D6^2'], ['P6522', 'P 65 2 (0 0 1)', '179', 'D6^3'], ['P6222', 'P 62 2c (0 0 1)', '180', 'D6^4'], ['P6422', 'P 64 2c (0 0 01)', '181', 'D6^5'], ['P6322', 'P 6c 2c', '182', 'D6^6'], ['P6mm', 'P 6 -2', '183', 'C6v^1'], ['P6cc', 'P 6 -2c', '184', 'C6v^2'], ['P63cm', 'P 6c -2', '185', 'C6v^3'], ['P63mc', 'P 6c -2c', '186', 'C6v^4'], ['P-6m2', 'P -6 2', '187', 'D3h^1'], ['P-6c2', 'P -6c 2', '188', 'D3h^2'], ['P-62m', 'P -6 -2', '189', 'D3h^3'], ['P-62c', 'P -6c -2c', '190', 'D3h^4'], ['P6/mmm', '-P 6 2', '191', 'D6h^1'], ['P6/mcc', '-P 6 2c', '192', 'D6h^2'], ['P63/mcm', '-P 6c 2', '193', 'D6h^3'], ['P63/mmc', '-P 6c 2c', '194', 'D6h^4'], ['P23', 'P 2 2 3', '195', 'T^1'], ['F23', 'F 2 2 3', '196', 'T^2'], ['I23', 'I 2 2 3', '197', 'T^3'], ['P213', 'P 2ac 2ab 3', '198', 'T^4'], ['I213', 'I 2b 2c 3', '199', 'T^5'], ['Pm-3', '-P 2 2 3', '200', 'Th^1'], ['Pn-3:1', 'P 2 2 3 -1n', '201:1', 'Th^2'], ['Pn-3:2', '-P 2ab 2bc 3', '201:2', 'Th^2'], ['Fm-3', '-F 2 2 3', '202', 'Th^3'], ['Fd-3:1', 'F 2 2 3 -1d', '203:1', 'Th^4'], ['Fd-3:2', '-F 2uv 2vw 3', '203:2', 'Th^4'], ['Im-3', '-I 2 2 3', '204', 'Th^5'], ['Pa-3', '-P 2ac 2ab 3', '205', 'Th^6'], ['Ia-3', '-I 2b 2c 3', '206', 'Th^7'], ['P432', 'P 4 2 3', '207', 'O^1'], ['P4232', 'P 4n 2 3', '208', 'O^2'], ['F432', 'F 4 2 3', '209', 'O^3'], ['F4132', 'F 4d 2 3', '210', 'O^4'], ['I432', 'I 4 2 3', '211', 'O^5'], ['P4332', 'P 4acd 2ab 3', '212', 'O^6'], ['P4132', 'P 4bd 2ab 3', '213', 'O^7'], ['I4132', 'I 4bd 2c 3', '214', 'O^8'], ['P-43m', 'P -4 2 3', '215', 'Td^1'], ['F-43m', 'F -4 2 3', '216', 'Td^2'], ['I-43m', 'I -4 2 3', '217', 'Td^3'], ['P-43n', 'P -4n 2 3', '218', 'Td^4'], ['F-43c', 'F -4c 2 3', '219', 'Td^5'], ['I-43d', 'I -4bd 2c 3', '220', 'Td^6'], ['Pm-3m', '-P 4 2 3', '221', 'Oh^1'], ['Pn-3n:1', 'P 4 2 3 -1n', '222:1', 'Oh^2'], ['Pn-3n:2', '-P 4a 2bc 3', '222:2', 'Oh^2'], ['Pm-3n', '-P 4n 2 3', '223', 'Oh^3'], ['Pn-3m:1', 'P 4n 2 3 -1n', '224:1', 'Oh^4'], ['Pn-3m:2', '-P 4bc 2bc 3', '224:2', 'Oh^4'], ['Fm-3m', '-F 4 2 3', '225', 'Oh^5'], ['Fm-3c', '-F 4c 2 3', '226', 'Oh^6'], ['Fd-3m:1', 'F 4d 2 3 -1d', '227:1', 'Oh^7'], ['Fd-3m:2', '-F 4vw 2vw 3', '227:2', 'Oh^7'], ['Fd-3c:1', 'F 4d 2 3 -1cd', '228:1', 'Oh^8'], ['Fd-3c:2', '-F 4cvw 2vw 3', '228:2', 'Oh^8'], ['Im-3m', '-I 4 2 3', '229', 'Oh^9'], ['Ia-3d', '-I 4bd 2c 3', '230', 'Oh^10'], ] print """ # This module has been generated automatically from space group information # obtained from the Computational Crystallography Toolbox # from Scientific.Geometry import Vector, Tensor from Scientific.Geometry.Transformation import Rotation, Translation from Scientific import N class SpaceGroup(object): def __init__(self, number, labels, transformations): self.number = number self.labels = labels self.transformations = [] for rot, trans in transformations: self.transformations.append(Translation(trans)*Rotation(Tensor(rot))) _space_group_table = {} def getSpaceGroupTransformations(space_group_label_or_number): try: return _space_group_table[space_group_label_or_number].transformations except KeyError: pass space_group_label = ''.join(space_group_label_or_number.split()) return _space_group_table[space_group_label].transformations """ # The space group label list has many groups more than once (there are only # 230 space groups), so we need to identify the unique space groups first. space_groups = {} space_group_names = {} for labels in space_group_labels: for i in range(len(labels)): if not ':' in labels[i]: l = labels[i] del labels[i] labels.insert(0, l) sgi = space_group_info(labels[0]) unique_name = sgi.symbol_and_number() start = unique_name.find('(No. ') end = unique_name.find(')') number = int(unique_name[start+5:end]) space_groups[number] = sgi space_group_names[number] = \ space_group_names.get(number, []) + labels # Space groups with reflection operations cannot occur in biomolecular # crystals, so remove them. to_remove = [] for number in space_groups.keys(): sgi = space_groups[number] for symmetry_transformation in sgi.group(): rot = symmetry_transformation.as_rational().r rot = N.array(rot) rot.shape = (3, 3) det = rot[0,0] * (rot[1, 1]*rot[2,2]-rot[1,2]*rot[2,1]) \ - rot[0,1] * (rot[1, 0]*rot[2,2]-rot[1,2]*rot[2,0]) \ + rot[0,2] * (rot[1, 0]*rot[2,1]-rot[1,1]*rot[2,0]) assert abs(det) == 1 if det < 0: to_remove.append(number) break for number in to_remove: del space_groups[number] del space_group_names[number] # Generate the code lines for the remaining space groups for number in space_groups.keys(): space_group_table_entry(number, space_group_names[number], space_groups[number]) print """ del transformations del rot del trans """