include define SG_NLINES 2500 define SG_SCALE 10000.0 # RV_SPECGEN - Generate two artificial spectra for a demo run. procedure rv_specgen (object, template) char object[SZ_FNAME] #o object filename char template[SZ_FNAME] #o object filename begin # Generate the artificial line list. call sg_mkline_list ("lines", SG_NLINES, SG_SCALE) # Create the object spectrum and add noise. # Create the template spectrum and add noise. end # SG_MKLINE_LIST - Generate a list of wavelengths to be used in the art- # ificial line list. Wavelengths generated are in the range 1 to scale_ # factor. procedure sg_mkline_list (fname, nlines, scale_factor) char fname[ARB] #i file name of spectral lines int nlines #i number of lines to generate real scale_factor #i wavelength scale factor pointer sp, nums int fd long i, seed int open(), access() real urand() begin # Open the requested file name. if (access(fname,0,0) == YES) { call error (2, "Requested wavelength filename already exists.") } else { iferr (fd = open (fname, NEW_FILE, TEXT_FILE)) call error (3, "Error opening wavelength list file.") } call smark (sp) call salloc (nums, nlines, TY_REAL) # Generate the random numbers. seed = 1 for (i=0; i 0) && (r < 1)) fac = sqrt (-2. * log (r) / r) iset = 1 return (v1 * fac) } else { iset = 0 return (v2 * fac) } end