Example #1
0
def update_target(out):
    target_db = dlite.target_db(file_name="tmp_dlite")
    pair_info = target_db.pair_info(source_path="tmp_source",
                                    target_path="tmp_target")
    update_done = False
    if (pair_info.needs_update):
        pair_info.start_building_target()
        open(pair_info.target.path,
             "w").write(open(pair_info.source.path).read().upper())
        pair_info.done_building_target()
        update_done = True
    target_db.write()
    target_db.show(out=out)
    return update_done
Example #2
0
def update_target(out):
  target_db = dlite.target_db(file_name="tmp_dlite")
  pair_info = target_db.pair_info(
    source_path="tmp_source",
    target_path="tmp_target")
  update_done = False
  if (pair_info.needs_update):
    pair_info.start_building_target()
    open(pair_info.target.path, "w").write(
      open(pair_info.source.path).read().upper())
    pair_info.done_building_target()
    update_done = True
  target_db.write()
  target_db.show(out=out)
  return update_done
def run():
    starting_dir = os.getcwd()
    #---Find cablam_data dir---
    cablam_dir = libtbx.env.find_in_repositories(
        os.path.join('chem_data', 'cablam_data'))
    if cablam_dir is None:
        cablam_dir = libtbx.env.find_in_repositories('cablam_data')
        if cablam_dir is None:
            cablam_dir = libtbx.env.find_in_repositories(
                os.path.join('ext_ref_files', 'cablam_data'))
            if cablam_dir is None:
                raise Sorry("""\
Cannot find chem_data/cablam_data directory.
  CaBLAM contours not rebuilt.
""")
    #---end find cablam_data_dir---
    rebuild_pickle_files(data_dir=cablam_dir,
                         file_prefix='cablam.8000.',
                         target_db=dlite.target_db(
                             os.path.join(cablam_dir, 'cablam.dlite')),
                         suffixes=file_suffixes)
    os.chdir(starting_dir)
    print format_cpu_times()
def run():
  starting_dir = os.getcwd()
  #---Find cablam_data dir---
  cablam_dir = libtbx.env.find_in_repositories(
    os.path.join('chem_data','cablam_data'))
  if cablam_dir is None:
    cablam_dir = libtbx.env.find_in_repositories('cablam_data')
    if cablam_dir is None:
      cablam_dir = libtbx.env.find_in_repositories(
        os.path.join('ext_ref_files','cablam_data'))
      if cablam_dir is None:
        raise Sorry("""\
Cannot find chem_data/cablam_data directory.
  CaBLAM contours not rebuilt.
""")
  #---end find cablam_data_dir---
  rebuild_pickle_files(
    data_dir=cablam_dir,
    file_prefix='cablam.8000.',
    target_db=dlite.target_db(os.path.join(cablam_dir,'cablam.dlite')),
    suffixes=file_suffixes)
  os.chdir(starting_dir)
  print format_cpu_times()
def run():
    starting_dir = os.getcwd()
    #---Find cablam_data dir---
    cablam_dir = libtbx.env.find_in_repositories(
        os.path.join('chem_data', 'cablam_data'))
    if cablam_dir is None:
        cablam_dir = libtbx.env.find_in_repositories('cablam_data')
        if cablam_dir is None:
            cablam_dir = libtbx.env.find_in_repositories(
                os.path.join('ext_ref_files', 'cablam_data'))
            if cablam_dir is None:
                print(
                    '  Rebuilding CaBLAM contours skipped. Needs chem_data/cablam_data directory.'
                )
                return
    #---end find cablam_data_dir---
    rebuild_pickle_files(data_dir=cablam_dir,
                         file_prefix='cablam.8000.',
                         target_db=dlite.target_db(
                             os.path.join(cablam_dir, 'cablam.dlite')),
                         suffixes=file_suffixes)
    os.chdir(starting_dir)
    print(format_cpu_times())
Example #6
0
def open_rotarama_dlite(rotarama_data_dir=None):
    if rotarama_data_dir is None:
        rotarama_data_dir = find_rotarama_data_dir()
    return dlite.target_db(os.path.join(rotarama_data_dir, "rotarama.dlite"))
Example #7
0
def open_rotarama_dlite(rotarama_data_dir=None):
    if (rotarama_data_dir is None):
        rotarama_data_dir = find_rotarama_data_dir()
    return dlite.target_db(os.path.join(rotarama_data_dir, "rotarama.dlite"))