def set_windows_env_variables(config): import winpaths config.set('DEFAULT', 'common_app_data_folder', winpaths.get_common_appdata()) config.set('DEFAULT', 'win_local_appdata', winpaths.get_local_appdata()) config.set('DEFAULT', 'win_appdata', winpaths.get_appdata()) config.set('DEFAULT', 'win_desktop', winpaths.get_desktop()) config.set('DEFAULT', 'win_programs', winpaths.get_programs()) config.set('DEFAULT', 'win_common_admin_tools', winpaths.get_common_admin_tools()) config.set('DEFAULT', 'win_common_documents', winpaths.get_common_documents()) config.set('DEFAULT', 'win_cookies', winpaths.get_cookies()) config.set('DEFAULT', 'win_history', winpaths.get_history()) config.set('DEFAULT', 'win_internet_cache', winpaths.get_internet_cache()) config.set('DEFAULT', 'win_my_pictures', winpaths.get_my_pictures()) config.set('DEFAULT', 'win_personal', winpaths.get_personal()) config.set('DEFAULT', 'win_my_documents', winpaths.get_my_documents()) config.set('DEFAULT', 'win_program_files', winpaths.get_program_files()) config.set('DEFAULT', 'win_program_files_common', winpaths.get_program_files_common()) config.set('DEFAULT', 'win_system', winpaths.get_system()) config.set('DEFAULT', 'win_windows', winpaths.get_windows()) config.set('DEFAULT', 'win_startup', winpaths.get_startup()) config.set('DEFAULT', 'win_recent', winpaths.get_recent())
def documents_path(): """On windows, returns the path to My Documents. On OSX, returns the user's Documents folder. For anything else, returns the user's home directory.""" if is_windows: path = winpaths.get_my_documents() elif is_mac: path = os.path.join(os.path.expanduser("~"), "Documents") else: path = os.path.expanduser("~") return path
def documents_path(): """On windows, returns the path to My Documents. On OSX, returns the user's Documents folder. For anything else, returns the user's home directory.""" plat = platform.system() if plat == 'Windows': import winpaths path = winpaths.get_my_documents() elif plat == 'Darwin': path = os.path.join(os.path.expanduser('~'), 'Documents') else: path = os.path.expanduser('~') return path
def plot_Tpidl(): H, T_i_ch, T_pidl_list = make_data() #T_pidl = T_pidl[.92] R = 2 is_print = True plt.close('all') for epsilon, T_pidl in T_pidl_list.items(): for i in range(4): if i < 3: if R == 1: if not i: rcParams.update({'font.size': 8, 'axes.titlesize': 7}) fig = plt.figure() gs = gridspec.GridSpec(2, 2) gs.update(left=0.07, right=0.97, wspace=0.2, top=.95, bottom=.05, hspace=.5) ax = plt.subplot(gs[i]) else: if not i: rcParams.update({ 'font.size': 10, 'axes.titlesize': 10, 'axes.titleweight': 'bold' }) fig = plt.figure() ax = fig.add_subplot(111) if i in (1, 2): plt.subplots_adjust(left=0.15, right=0.95, top=0.9, bottom=0.05) plt.plot(H, T_pidl[i]) plt.title(r'$T_{підл.}$, К при $T_{і.ч.}' + (r' = {}$ К та $\varepsilon' + r' = {}$').\ format(T_i_ch[i], epsilon)) plt.xticks(H) plt.xlabel(r'$H$, м') plt.ylabel(r'$T_{підл.}$, К') else: fig = plt.figure() ax = Axes3D(fig) HH, TT_i_ch = np.meshgrid(H, T_i_ch) ax.plot_surface(HH, TT_i_ch, T_pidl, rstride=1, cstride=1, cmap=jet) ax.set_title(r'Зміна температури підлоги $T_{підл.}$, К при $\epsilon' + r' = {}$'.\ format(epsilon)) ax.set_xticks(H) ax.set_yticks(T_i_ch) ax.set_xlabel(r'$H$, м') ax.set_ylabel(r'$T_{і.ч.}$, К') ax.set_zlabel(r'$T_{підл.}$, К') ax.grid(True) if is_print: img_name = 'graph_{}__eps_{}.png'.format(i + 1, epsilon) dir_name = 'st_Tpidls_Num' if sys.platform == 'win32': winpaths.get_my_documents() path_name = os.path.join(winpaths.get_my_documents(), dir_name) else: path_name = os.path.join('/home/kavedium/Documents', dir_name) if not os.path.exists(path_name): try: os.makedirs(path_name) except OSError as exc: # Guard against race condition if exc.errno != errno.EEXIST: raise plt.savefig(os.path.join(path_name, img_name), format='png') plt.show()
I300 = 300 I600 = 600 I900 = 900 I = I600 is_canonic = False is_print = True R = 2 fig_data = dict(figsize=(12.5, 6), dpi=100) grid_color = '#ABB2B9' ax_pos = (0.09, .23, .88, .71) if is_canonic: if sys.platform == 'win32': winpaths.get_my_documents() path_name = os.path.join(winpaths.get_my_documents(), dir_name) else: path_name = os.path.join('/home/kavedium/Documents', dir_name) if not os.path.exists(path_name): try: os.makedirs(path_name) except OSError as exc: # Guard against race condition if exc.errno != errno.EEXIST: raise with open(os.path.join(path_name, 'data.txt'), 'r') as f: data = np.array([[float(v) for v in row.split('\t')] for row in f]) data = data[..., (0, -3, -2, -1)]
See TestDetectInstalledSites.py Todo: replace hardcoded site list with something more subtle """ import platform import os import Configuration if platform.system() == 'Windows': import winpaths PROGRAM_FILES = winpaths.get_program_files() LOCAL_APPDATA = winpaths.get_local_appdata() MY_DOCUMENTS = winpaths.get_my_documents() class DetectInstalledSites(): def __init__(self, sitename="All"): self.Config = Configuration.Config() # # objects returned # self.sitestatusdict = {} self.sitename = sitename self.heroname = "" self.hhpath = "" self.tspath = "" self.detected = ""
See TestDetectInstalledSites.py Todo: replace hardcoded site list with something more subtle """ import platform import os import Configuration if platform.system() == 'Windows': import winpaths PROGRAM_FILES = winpaths.get_program_files() LOCAL_APPDATA = winpaths.get_local_appdata() MY_DOCUMENTS = winpaths.get_my_documents() class DetectInstalledSites(): def __init__(self, sitename = "All"): self.Config=Configuration.Config() # # objects returned # self.sitestatusdict = {} self.sitename = sitename self.heroname = "" self.hhpath = "" self.tspath = "" self.detected = ""