// // framework.java // // M.Lampton UCB SSL 2003: mlampton@SSL.berkeley.edu // // // // One systematic parameter + 3*NFILT filter parms; NFILT=9 filters // // >> assume that filter centerLam and widthLam are *given* // not determined by joint stellar photometry // // >> assume that filter grasp is totally unknown, except for // its concordance with stellar photometry. // // Estimates filter parm errors from the one systematic error // plus a collection of photometry errors, e.g. standards // // ** this example: all photometry errors are equal, 1%rms // ** this example: systematic error 1%rms linear in wavelength // // // Method: Parameters => Jacobian => Fisher matrix => covariance matrix // // Datum 0 is one SYSCAL observation of overall slope coefficient. // this datum does not involve any of the filters. // this datum is obtained outside the system of filter determination. // its SNR is set by SYSSNR = 100.0 and SIGMA=1.0 // // Data 1...10 are ten photometry stars seen through filter 1. // data 11..20 the same photometry stars in filter 2. // data 21..30 the same photometry stars in filter 3. etc // // Parameter 0 is overall systematic slope parameter // Parameters 1,2,3 are filter1 throughput, lambdaPeak, width. // parameters 4,5,6 are filter2 throughput, lambdaPeak, width. // parameters 7,8,9 are filter3. etc // // // // This code evaluates fluxes, Jacobian, Fisher matrix, covariance matrix. // // ///////////// A Stellar Spectral Flux Library, 1150-25000A //////////////////////// // // A.J. Pickles, PASP 110, 863, 1998 // http://www.ifa.hawaii.edu/~pickles/AJP/hilib.html // //****************************************************************************** // HILIB Stellar Flux library contents, procedures and summary. HILIB consists of: // UVILIB (1150-10620/5A, 131 spectra), // UVKLIB (1150-25000/5A, 66 with ir spectra, rest with JHK continuum), // UVMLIB (1150-52000/5A, 16 spectra). //****************************************************************************** // // The first column is wavelength in Angstrom, always 1150 - 25000A in steps of 5A. // The second column is F(lambda) for the spectrum, normalised to unity at 5556A. import java.io.*; import java.util.*; import java.text.DecimalFormat; public class framework { static PrintWriter pw; static FileOutputStream fos; ////////// photometry and spectra ////////////////////// static final int NFILTS = 9; // how many filters static final int NPPF = 3; // how many parms per filter static final int NSTARS = 10; // how many stellar spectra static final int NSYS = 1; // how many systematic parms static final int NPTS = NSYS + NSTARS*NFILTS; // total data points static final int NPARMS = NSYS + NPPF*NFILTS; // total parameters static final int NADJ = 10; // how many parms are active static final int[] which = {0,1,4,7,10,13,16,19,22,25}; // sys + 9 throughputs static final double SYSSNR = 100; // systematic slope SNR static final double PHOSNR = 100; // photom SNR, each star, each band static final double SIGMA = 1.0; // std deviation everywhere static final int NWAVES = 2501; // how many wavelengths per star static final double DELTAP = 1e-6; // for two sided derivatives static double[][] spectra= new double[NSTARS][NWAVES]; // photons/nm each star static double[][] coefs = new double[NSTARS][NFILTS]; // makes SNRs = 100.0 static double[] error = new double[NPTS]; // the error vector //////////////////// create the true parameters //////////////////////////// static final double[] truep = {0.0, // systematic slope 1.0, 0.42, 0.095, // filter at 0.42 um 1.0, 0.48, 0.11, 1.0, 0.56, 0.13, 1.0, 0.64, 0.15, 1.0, 0.73, 0.17, 1.0, 0.85, 0.20, 1.0, 0.97, 0.23, 1.0, 1.12, 0.26, 1.0, 1.29, 0.39}; // filter at 1.4 um static final String picklenames_three[] = { "UKO5V.DAT", "UKK0III.DAT", "UKM7III.DAT" }; static final String picklenames_ten[] = { "UKO5V.DAT", "UKB9V.DAT", "UKA7V.DAT", "UKF5V.DAT", "UKK0III.DAT", "UKK5III.DAT", "UKK7V.DAT", "UKM2V.DAT", "UKM5III.DAT", "UKM7III.DAT" }; static double T10[] = {3000,4000,5000,6000,8000,10000,15000,20000,40000,80000}; static double T4[] = {3000, 5000, 10000, 80000}; static final String plancknames_four[] = {"3000", "5000", "10000", "80000"}; static void setupspectrum_Planck(int istar, double t ) // sets up one spectrum, temperature t kelvins. // Planck: 2*h*c2/lam^5 * 1/(exp(hc/(kt*lam))-1) joules/m wavel // Planck: 2*c/lam^4 * 1/(exp(hc/(kt*lam))-1) photons/m wavel // but here we normalize the overall coefficient to unity at 1000nm // Note: hc/k = 0.0144 meter-kelvins = 14400 micron kelvins { for (int nm=0; nm smax) smax = spectra[i][nm]; // normalize at peak for (int nm=1; nm0) && (i<2500)) flux[i] = d; nfield++; } } } catch (FileNotFoundException e) { System.out.println(fname + " is unavailable"); beep(); } return nrecords; } static void prenormalize() // initializes the array of coefficients to unity before initial photometry { for (int istar=0; istar 560.0) return 0.0; if (nm < 420.0) return 1./(1. + Math.exp(-0.17*(nm-390.0))) + 0.006*(nm-390.0)/30.0; double cosfun = Math.cos(1.57079633*(nm-420.0)/140.0); return Math.pow(cosfun, 2.4); } static double filter(double microns, double p[]) // chuckb filter form, made tunable: 3 filter parms // M.Lampton UCB SSL 2003 // p[0] = integrated filter throughput // p[1] = filter peak microns; // p[2] = filter band width, nominally 0.2262*peakmicrons. { double arg = 0.42 + (microns - p[1]) * (0.0945/p[2]); return chuckb(arg) * (p[0]/p[2]); } static void setupNineFilters() // sets up parameters for nine photometric filters { for (int i=0; i<9; i++) { double wavel = 0.42 * Math.pow(1.15, (double) i); double width = 0.234 * wavel; int index = 1 + 3*i; truep[index] = 1.0; truep[index+1] = wavel; truep[index+2] = width; } } static double systematic(double microns, double parms[]) // systematic linear wavelength-dependent calibration error // uses only parms[0] for overall slope; that is, NSYS=1 { return 1.0 + microns * parms[0]; } static double f(int idat, double p[]) // noiseless photometry for one filt, one star, given parameters p[] { if (idat < NSYS) return 1.0; // determine which star, which filter, is this datum int istar = (idat - NSYS) % NSTARS; int jfilt = (idat - NSYS) / NSTARS; // get this filter's parms from our parm vector... double tp[] = new double[NPPF]; for (int j=0; jk) for (j=0; jk) for (i=0; ik) for (i=0; ik) for (j=0; j w) { s = ""; for (int i=0; i0.0) return Math.log(arg)/2.302585092994046; return -999.9; } static double dex(double arg) { if (arg > 300.0) arg = 300.0; if (arg < -300.0) arg = -300.0; return Math.pow(10.0, arg); } static void beep() { char c = 7; String s = ""+c; System.out.print(s); } }