github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

famulus / decawell

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 1
    • 0
  • Source
  • Commits
  • Network (0)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (4)
    • dielectric_test_stubby
    • fusor_sphereical
    • master ✓
    • thermal_shell
  • Tags (0)
Sending Request…
Click here to lend your support to: decawell and make a donation at www.pledgie.com ! Edit Pledgie Setup

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Building an Open Source Bussard Reactor (Polywell) — Read more

  cancel

http://prometheusfusionperfection.com/

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

small changes, does not work yet 
temp (author)
Sat Nov 28 11:45:50 -0800 2009
commit  0a008f6543f0f8b84e69aeaf68ef39e375f5b52e
tree    f4adb0fdfefcac6620e41a001100ebe203de58d2
parent  29ed91c629611e0f6ab39c925c90b7bae04b7282
decawell / fusor_controller / google_chart.rb fusor_controller/google_chart.rb
100644 31 lines (21 sloc) 1.366 kb
edit raw blame history
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# http://chart.apis.google.com/chart?cht=lc&chs=200x125&chd=t:40,60,60,45,47,75,70,72
 
require 'rubygems'
require 'activerecord'
require 'devices'
 
ActiveRecord::Base.establish_connection(
:adapter => 'mysql',
:database => 'fusion',
:username => 'root',
:host => 'localhost')
 
class Sample < ActiveRecord::Base
end
 
 
# samples = Sample.find(:all, :conditions => {:channel =>0, :created_at => (Time::now - 2000.minutes .. Time::now)}).map{|r| r.sample}
 
number_of_data_points = 250
 
CHANNEL_BANK.each_with_index do |@channel_proc, index| #generate a chart for each channel
sample_records = Sample.find(:all,:conditions => {:created_at => (("november 15 2009 16:50:29 ".to_time)..("november 15 2009 19:11:29".to_time)),:channel => index, },:order => "created_at ASC")
samples = sample_records.map{|r| @channel_proc.interpret_voltage(r.sample)}
resamples = samples.in_groups_of(samples.size/number_of_data_points).map{|slice| slice.average.round_to(4) rescue 0}
url = "http://chart.apis.google.com/chart?cht=lc&chs=438x125&chd=t:#{resamples.join(",")}&chds=#{resamples.min},#{resamples.max}&chxt=y,x&chxr=0,#{resamples.min},#{resamples.max}|1,0,#{(sample_records.last.created_at - sample_records.first.created_at)/60.to_i}&chxl=0:test&chtt=#{@channel_proc.title.gsub(" ","+")}"
puts "<img src=\"#{url}\" alt=\"\" />"
  # puts `open -a Safari '#{url}'`
end
 
 
 
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server