예제 #1
0
def getTemp(flux1,flux2,wave1,wave2,beta):
   """Use Newton-Raphson method to calculate temperature between 2 lambdas"""
   
   out = zeros(len(flux1))
   for i in range(len(flux1)):
      
      convergeFlag = False
      x0 = _initialTemp(flux1[i],flux2[i],wave1[i],wave2[i],beta)
#      print x0
      for j in range(100):
         junk = _func(x0,flux1[i],flux2[i],wave1[i],wave2[i],beta)
         junk = junk/_dfunc(x0,flux1[i],flux2[i],wave1[i],wave2[i],beta)
         x1 = x0 - junk
         if abs(x1-x0) <= 0.01:
            convergeFlag = True
            break
         x0 = x1
      out[i] = x1
      if not convergeFlag:
         nlclib.warning('Temp did not converge for wavelength %f!' %wave1[i])
#   print out
   return out
예제 #2
0
파일: p6ds9.py 프로젝트: nlchap0/nlctools
          in      = None # Input data file
          window  = ds9  # Name of DS9 window
          nframes = 1    # Number of frames in DS9 window"""

from readcmd import ReadCmd
import os,ds9
import readin,nlclib
try:
   from Tkinter import *
except ImportError:
   nlclib.error('You need Tkinter installed in python to use p6_ds9.py')
try:
   from pywip import *
   _plotFlag = True
except ImportError:
   nlclib.warning('Cannot find module pywip.  Plotting is disabled.')
   _plotFlag = False

from tkMessageBox import showwarning
from tkMessageBox import askokcancel
from tkSimpleDialog import askinteger
from mytkinter import genericDialog
from mytkinter import inputFile
from mytkinter import myOptionMenu
from mytkinter import _HIGHLIGHT_COLOR
from mytkinter import _THEME_COLOR
from mytkinter import _CHROME_COLOR

#   some global variables (private to this code though)
_version     = "8.1 (02-June-2010)"
_maxframe    = 9           # maximum number of frames allowed