Trees | Indices | Help |
|
---|
|
1 """Top level of the application QUB Express. 2 3 Copyright 2008-2015 Research Foundation State University of New York 4 This file is part of QUB Express. 5 6 QUB Express is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 QUB Express is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License, 17 named LICENSE.txt, in the QUB Express program directory. If not, see 18 <http://www.gnu.org/licenses/>. 19 20 21 """ 22 23 #!/usr/bin/env python 24 25 # before top-level imports: 26 import uuid # glibc bug, needs first in some linuxes 27 import gobject 28 import multiprocessing 29 import os 30 import sys 31 32 QUBX_HOME_PATH = os.path.expanduser('~/.qub-express') 33 APPNAME = 'QUB Express' 34 38 actual_stdout, actual_stderr = sys.stdout, sys.stderr 39 sys.stdout, sys.stderr = StdNull(), StdNull() 40 41 multiprocessing.freeze_support() 42 gobject.threads_init() 43 44 import qubx.splash_main 45 qubx.splash_main.show_splash('Loading %s...' % APPNAME) 46 47 import qubx.tree 48 qubx.tree.CHOOSE_FLAVOR('numpy') 49 50 # top-level utilities and global imports: 51 from qubx.cube import * 52 53 VERSION = "1.12.10" 54 QUBX_VERSION = qubx.global_namespace.QUBX_VERSION = VERSION 5574 75 76 if __name__ == '__main__': 77 run_me_first() 78 79 parser = argparse.ArgumentParser() 80 parser.add_argument("-t", "--trace", dest="trace", 81 action="store_true", 82 default=False, 83 help="prints line-by-line trace for debug") 84 parser.add_argument("-s", "--startup-script", dest="startup_script", 85 action="store", default="", 86 help="on startup, executes a python file") 87 (args, extras) = parser.parse_known_args() 88 qubx.global_namespace.args = args 89 qubx.global_namespace.extras = extras 90 qubx.global_namespace.unknown_args = extras 91 92 qubx.global_namespace.DEBUG = DEBUG = False 93 if args.trace: 94 qubx.global_namespace.DEBUG = True 95 tracelog = open('trace', 'w')58 try: 59 readme = open(os.path.join(qubx.global_namespace.app_path, 'README.txt'), 'r').read() 60 except: 61 readme = """ QUB Express 62 63 """ 64 try: 65 changelog = open(os.path.join(qubx.global_namespace.app_path, 'QUB_Express_change_log.txt'), 'r').read() 66 except: 67 traceback.print_exc() 68 changelog = '\n(no change log found)\n' 69 try: 70 license = open(os.path.join(qubx.global_namespace.app_path, 'LICENSE.txt'), 'r').read() 71 except: 72 license = "" 73 self.cube.Tools.About.set_text(readme + changelog + license)97 if event == "line": 98 lineno = frame.f_lineno 99 try: 100 filename = frame.f_globals["__file__"] 101 if filename == "<stdin>": 102 filename = "<stdin> " 103 if (filename.endswith(".pyc") or 104 filename.endswith(".pyo")): 105 filename = filename[:-1] 106 name = frame.f_globals["__name__"] 107 line = linecache.getline(filename, lineno) 108 except: 109 name = '<?>' 110 line = '' 111 tracelog.write("%s:%s: %s\n" % (name, lineno, line.rstrip())) 112 tracelog.flush() 113 return traceit114 sys.settrace(traceit) 115 116 try: 117 app = ExpressApp(APPNAME, VERSION, '.qub-express', has_modeling=True, DEBUG=DEBUG) 118 app.main(startup_script=args.startup_script or os.path.join(qubx.pyenv.env.folder, 'startup_script.py')) 119 except KeyboardInterrupt: 120 pass # quit like they want 121 except Exception, e: 122 dlg = gtk.MessageDialog(None, buttons=gtk.BUTTONS_OK, flags=gtk.DIALOG_MODAL, 123 message_format = traceback.format_exc()) 124 dlg.run() 125 dlg.destroy() 126 127 run_me_last() 128 129 130 131 132 # Fitness 3 docs and videos 133 134 # some qubx docs: 135 # qubx for qub classic users: 136 # Notebook; its menus; direct-writing panel (use throughout to annotate session) 137 # menu triangles 138 # Tables, and clicks leading thereto 139 # Layout, and where things have moved to 140 # model undo 141 # different model mousing (r-drag, l-hold, constraints, wheel/mods on rates) 142 # grabbing amps 143 # model via tables; constraints as generalized 144 # how to use Ligand and Voltage columns 145 # Stimuli, Constants, Modeling: Stimulus 146 # v-sensitive current 147 # Simulation file and panel; wheel on constant; vary/steps 148 # navigate files and segments; zoom; wheel/mod or click on signal controls 149 # data exclusion 150 # Curve fitting 151 # measurement 152 # live amphist, durhist 153 # Charts, select, user-tables 154 # Extract 155 # Modeling: Idealize, Rates, MacRates 156 # Tools:Idealization 157 # Colors, font size, ... 158 # plugins and scripts 159 # show off auto-notebook at end 160 161 # lists, chopping 162 # baseline 163 164 165 ## Release 166 # update the welcome message 167 # update the wiki 168 # update the videos 169 # update the docstrings 170 # write out more math 171 172 173 174 ## the only known use case would be a bad idea? 175 # rates: events e.g. onIteration; properties e.g. LL, iterations 176 # notebook figures on-face-show 177 # conductance or fractional activation instead of current? 178 # extract: join segments (stacked | zero/cls0 between) 179 # ->dwt: optionally fill time gaps with cls 0? 180 181 182 ### Thinking/Working... 183 # jumptrack into table(s) usable by select 184 # sel list undo? 185 # Gleak? (not Cond[0] since it's not per-ion-channel) 186 # user-oriented tables in QubX.Tables: del field? 187 # scriptable qubx.optimizeGTK method and options: reflect changes onscreen 188 # Record button for each AltKey? 189 # CurveFit segments together: capture separate ssr? 190 # helpful messages in idlize, rates, etc.: "check the stimulus" 191 # messages when constraints don't work? 192 # Messages window? 193 # measurement keys? 194 # macosx command lines require full paths (--no-chdir)? 195 # durhist dies if onscreen during startup? 196 # bs exception crap in strategy window 197 # track down doubled scriptable show_file 198 # fix: list bead geometry breaks down at high mag 199 # data_fit: curve-fitting keyboard? 200 # strategy OnLine() etc. 201 # write "Data Source" in green? 202 # "make install" chown root:root 203 # shorthand names for common objects? 204 # how does the relation go between current, noise, Popen? 205 # chop with busy/progress: raise exception to forestall post-processing? 206 # dataview list group menu as enlargeable grid? layer-popup if nec? 207 # data tool cursors? need custom because stock are no good (maybe just different-colored pointer?) 208 # data hires: fix quirk: resize -> change divs -> reset signal 0 from time.sel (or time.sel from signal 0?) 209 210 # scriptable clicks acting on "onscreen, measured in divs from center? left? e.g. baseline nodes by sel 211 # def add_baseline_node(..., timebase=TIMEBASE_LEFT, ...) delegating to add_baseline_nodes_tb? using all keywords in scripts anyway? 212 # distance between e.g. events of class 0? 213 214 # mmap size limits? 215 216 # data undo: zoom, baseline, nodes, ...? 217 218 ## for test script: 219 # extract custom signals func, multi-file 220 221 222 223 224 225 226 # IO exceptions in save etc 227 # stoppable list-fit? 228 # Trials and notebook_table_extensions? 229 # time.Gseg and notebook_table_extensions? 230 # NbChart -> Excel with point-colors 231 # guard against zillion-point curve fitting 232 # bother-me-not checkbox 233 234 # "Start" as perma-column in Lists? 235 236 # script (notebook?) of Data measurement notes 237 # Trials of Star/Chain 238 239 240 # model search: 241 # faster with suppressed iterations? 242 # reliable stopping 243 # message on run/no models 244 245 # [ Presets... |v] [ Discard... ] (tooltip) [ Run Search ] 246 # [ x ] keep only the top [ 20 ] trials 247 # Discard trials with: 248 # [ ] any k0 < [ 1.0e-5 ] 249 # [ x ] any k0 > [ 1.0e5 ] 250 # [ ] any k1 < [ 1.0e-5 ] 251 # [ ] any k1 > [ 2.0 ] 252 # [ ] Amp (open) <, > 253 # Cond (open) <, > 254 # Channel count <, > 255 # LL <, > 256 # [ x ] [ LL > 0.0 ] (tooltip: write an expression using the column names from Trials, e.g. "LL > 0.0") 257 # show_message(exc) only on first error, then ignore/print the rest 258 259 # Survey 260 261 262 # macrates update Classes:Std 263 # macrates/opencl segfault on free data (irregular segments?) 264 # fractional channel count in mac/opencl 265 266 # what fraction of sim/mil/theoretical was missed events? 267 # iter v LL plot while optimizing 268 # state occupancy graph(s)? 269 270 # CurveFit segments together: reset ODEs to t0 271 272 # notebook of picture, arbitrary other size (e.g. overridden by target?) 273 274 # power spectrum log/rebinning a la qub classic? 275 # spectrum: dc-corrected? 276 277 278 # docs 279 280 # which data formats missing? any model formats? 281 # is Chop too hidden? 282 283 # Plugin/Scripting 284 # api guide and regularization 285 # samples and skeletons 286 287 # scriptable baseline nodes: add, relative to screen 288 289 ### scripts not recorded (yet?): 290 # charts palette color 291 # change-event after editing idl or fit 292 # various robots' sync: FitControls, HistFace, Simulation, ...? 293 # model:grab (just final numbers?) 294 # any files requiring user interaction to open or close... 295 296 297 298 # demo script? (main menu -> run demo) 299 300 # also repkg fitness3, build QUB-Fitness.app 301 # fitness replace data-open menuitems to prompt sampled on large files 302 303 304 305 # Scripting 306 # cluster control 307 308 # NbChart -> QtiPlot: honor line color, thickness 309 310 # data markers? 311 # stimulus shapers: Tension 312 # stimulus shaper wizard preview? 313 # bgk sub 314 # custom graphics 315 # energy landscape 316 # idl,data -> wav? 317 # Rates 318 # single: override stop more usefully e.g. mac's stop flag? 319 # doc qubx.fast.model and clients 320 # File List results into Data table? 321 # Notebook 322 # Targets: 323 # linux, mac qtiplot 324 # UNO? 325 # xmeans web app? 326 # min/max image dim? 327 328 # dose-response and other wizardry 329 330 ## Hype 331 # data with picture track e.g. simdata with state images 332 # pytables or something 333 # ghmm:xml or something 334 # unit tests and other standards 335 # nonhomogeneous data: different everything each segment 336 # 1-D LL surface slice live display? 337 338 339 ### maybe never: 340 # obscure extractions: 341 # congruent selections/lists 342 # multiple text layouts 343 # staircase 344 # acquisition? maybe as visual control of daemon process? 345 346 347 ## Survey: 348 # what in About.Data? 349 # what in Default measurement? 350 # priority features? 351 352 353 ## QUB in general: 354 # HMM simulation 355 # HMM event detection 356 # MLL opt for single/ensemble, with constraints 357 # burst statistics and clustering 358 # baseline correction 359 # measurement and histograms 360 361 362 ## Why switch: 363 # zero-click simulation 364 # msl 365 # auto stimulus 366 # model undo 367 # custom measurement 368 # custom auto lab notebook 369 # fewer clicks, fewer legacy options 370 # available for Linux, MacOS X 371 # more multi-core algorithms (Simulation, Rates (MIL), Mac Rates) 372 # record scripts 373 # write plugins 374 375 ## Why classic: 376 # energy landscape 377 # bkg sub 378 # some extract options 379 # some figures 380 # data acquisition 381 # staircase 382 383 384 385 386 387 # QUBIO: Auto-chop at protocol bounds? 388 389 390 391 # invalidate optimizer model on edit constraint field: apparently constraints_kin.OnEdit doesn't fire OnSet because of enforcing bogus constraints... 392 # macrates v-sensitivity, added one-by-one with pressure, doesn't work like opening fully formed model 393 # automate gain-table scaling? 394 # MILRates: use qubopt for MIL (or secretly to start, when num grad dx == 0) 395 # MSL: singular matrix in gauss-j, positive eigenvalues (loop model) 396 # automate measurement and fitting of V vs. single-channel-I (I = G * (V - Vrev)) to find G and Vrev 397 # MILRates: optional switch to DurHist? 398 399 # any way to rename a list? 400 # tableGTK: We should have a TIP marker over each heading as default with the option of turningit off for experienced users. 401 402 # scriptable measure: return meas. index in table 403 404 # read file names from cmdline args and open them 405 406 # check plugin versions, show updates? 407 408 # to fix: undo is making all constraints "generalized" 409 410 # ctrl-click list bead to delete quickly 411 412 # add baseline node every k points? 413 414 415 # trials: no undo buttons 416 # button: copy to new model/replace one that's open? 417 # move the trial viewer to its own pane? 418 419 420 # patchmaster union of present signals (not just signals of first segment) 421 # scaling of patchmaster files 422 423 # penalize mac likelihood by variance of per-point likelihood 424 # or mil: variance of scale array 425 # alt: use it to measure stationarity 426 # plus wald-wolfowitz runs probability of point likelihood 427 428 # ??: stimulus names from Signals or Scope table? 429 # it gets messed up when you change Scope names then use them for model variables 430 431 432 # QubX.Simulation.reset() 433 # sim: multi model 434 # sim: small N-channel idealization? 435 436 # lose Classes:Vrev? 437 438 # auto graph (model) layout? 439 440 441 442 # MPLRates 443 444 # for alab: 445 # quality histogram output 446 # extract/merge 447 # save as text options (segments in columns? x column? delimiter?) 448 449 450 # who uses which eigenvector routine? 451 # qubopt -> scipy if registered as custom, else gsl 452 # qubfast -> old recipe in matrixutil; also called eigen_vals_vecs with boost::ublas types 453 # ratesm -> scipy if provided as custom, else eigen_vals_vecs 454 455 # All Exponentials (DurHist): 456 # how many dwells are needed to resolve all components of a certain distribution (e.g. from model rates)? 457 # (eq. 3, discussion on p.6(2388)) of LandowneMagleby 458 # - simulate lots (1e7 events) 459 # - N(req) = N(sim) * target_llr / llr 460 # as layer on .controls (right of back arrow) until change curve: 461 # "need %i events to resolve these %i components" 462 463 # some confusion on .showing? the sidebar is more populous than it should be in "Windowed" preset 464 465 466 # hassle the user when stimulus is auto-assigned 467 468 469 # just dose-response 470 # take it in steps 471 # 1. pick or build a model with stimulus dependence 472 # 2. pick a standard protocol, or use the ladder wizard, or build freeform 473 # 3. see traces and a table of dose, peak, normalized peak, t_peak, integral 474 # 4. see plots of dose vs. ... 475 # 5. fit them 476 # maybe as a separate panel which orchestrates the others e.g. 477 # 1. You need to build a model in the model window (click to show) 478 # Here's how to add states, connections, stimulus, 479 # and anything else that might be good to know 480 # [ Next ] 481 # 2. You need a stimulus protocol for [name signals here] 482 # (take the liberty of setting up the signals if missing; removing superfluous) 483 # Pick one of these to start with: [ladder etc] 484 # Or use the [ ladder wizard ] 485 # Or build a custom one in the [ Simulation ] window 486 # (You can also edit the standard and wizard outputs here) 487 # [ Prev ] [ Next ] 488 # 3. Results: 489 # See the traces in the [ Data ] window 490 # - [ one at a time ] (faster) 491 # - [ all at once ] 492 # [ See a table of statistics ] (peak current and time, integral) 493 # [ Plot ] * vs. ([x] log10) dose 494 # To fit any plot to a curve, click its fitting icon ([]) 495 496 497 498 499 # mysterious wrong mac curve until reload 500 501 # fix grab v-sens 502 # which v-sens idl amps are final? 503 504 # mac: link opt of channel count and variance (ask fred?) 505 506 # automated mac with 3..2..1 delta resample 507 508 # mismatch between mac txtLL and scrolling text ll? 509 510 #iteration trials: 511 # hold offscreen/offthread until post optimization 512 # ignore when building session 513 514 # pulsate bg of editing table cell 515 516 #dose-response peak/integral as drug discriminator 517 518 # script model saveas 519 520 521 #ext: avg and sum are wrong with custom signal list 522 523 524 # sometimes balance loops prevents rate setting correctly 525 # quick click ieqfv on off with mac live, hangs 526 527 # safer save qsf 528
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Dec 15 19:07:38 2017 | http://epydoc.sourceforge.net |