def genSpecDistribute(): allModelList = util.listDirFiles(sourceDir) dic = {} for modelPath in allModelList: specType = getSpecType(modelPath) util.addItemToDic(dic, specType[0], modelPath) avgCount = int(modelCount / 7) for key in dic.keys(): modelMatchFileCopy(dic, key, avgCount, modelDir_avg) disCount = 0 for key in dic_dis.keys(): disCount += dic_dis[key] for key in dic.keys(): typeCount = int(float(dic_dis[key]) / disCount * modelCount) if typeCount == 0: typeCount = 1 modelMatchFileCopy(dic, key, typeCount, modelDir_dis) for key in dic.keys(): modelMatchFileCopy(dic, key, 10, targetFitsDir)
def getCoordinateMap(data): """ get dictionary of ra and dec ra - dec """ dic_radec = {} for row in data: ra = int(row[0]) dec = int(row[1]) util.addItemToDic(dic_radec, ra, dec) return dic_radec
import CodeLib.Util.PlotUtil as plotUtil import CodeLib.Util.CommonUtil as util sql_select_distance = "select mag3,teff from dr3.All_Distance where mag3>0" sql_count_distance = "select count(*) from dr3.All_Distance where mag3>0" rs, teffs, count = dfh.get2FieldsData(sql_select_distance, sql_count_distance) dic = {} for i in range(count): k = int(teffs[i]) k1 = int(k / 100) k2 = k1 + 1 r = float(rs[i]) util.addItemToDic(dic, k1, r) util.addItemToDic(dic, k2, r) x_mean = [] y_mean = [] x_3std1 = [] y_3std1 = [] x_3std2 = [] y_3std2 = [] for key in dic.keys(): value = dic[key] std = np.std(value) value_new = value / std dic[key] = value_new