Example #1
0
            # Get the filterid filter.
            f.read(filter_file, path='/%s/%s' % (filterid, ccd))
            
            # For each defined redshift, eval the photometry and store on the database.
            db_m = db.get('/%s/%s/%s' % (filterid, ccd, 'library'))
            i_z = 0
            for z in np.arange(z_from, z_to, z_step):
                
                if z == 0:
                    d_L = 3.08567758e19 # 10 parsec in cm
                else:
                    d_L = cosmocalc.cosmocalc(z)['DL_cm']
                    
                k_cosmo = L_sun  / ( 4 * np.pi * np.power(d_L,2) ) 
    
                O = zcor(obs_spec, z)
                O['flux'] = O['flux'] * k_cosmo

                x = spec2filterset(f.filterset, O, dlambda_eff = 3.0)
                
#                print 'z', z
#                print aux0[i_base]
#                
#                plt.figure(1)
#                plt.clf()
#                plt.plot(O['wl'][kk], O['flux'][kk])
#                plt.figure(2)
#                plt.clf()
#                plt.plot(f.filteravgwls, x, '.')
     
                
Example #2
0
            # Get the filterid filter.
            f.read(filter_file, path='/%s/%s' % (filterid, ccd))
            
            # For each defined redshift, eval the photometry and store on the database.
            db_m = db.get('/%s/%s/%s' % (filterid, ccd, 'library'))
            i_z = 0
            for z in np.arange(z_from, z_to, z_step):
                
                if z == 0:
                    d_L = 3.08567758e19 # 10 parsec in cm
                else:
                    d_L = cosmocalc.cosmocalc(z)['DL_cm']
                    
                k_cosmo = L_sun  / ( 4 * np.pi * np.power(d_L,2) ) 

                O = zcor(obs_spec, z)
                O['flux'] = O['flux'] * k_cosmo
                O['error'] = O['error'] * k_cosmo
                
                M = zcor(model_spec, z)
                M['flux'] = M['flux'] * k_cosmo

                x = spec2filterset(f.filterset, O, M, dlambda_eff = 3.0) 
                
                db_m[i_z, i_file] = x
                i_z = i_z + 1
            

    db.close()
    
    log.debug('Took %3.2f seconds.' % (time.time() - t_start))