<commit_before>from __future__ import division

import os

import libtbx.load_env
from libtbx import easy_run

dials_regression = libtbx.env.find_in_repositories('dials_regression')

def exercise_export_bitmaps():
  data_dir = os.path.join(dials_regression, 'centroid_test_data')
  if data_dir is None:
    print 'Skipping exercise_export_bitmaps(): dials_regression not available'

  cmd = 'dials.export_bitmaps %s/centroid_0001.cbf' %data_dir
  print cmd
  result = easy_run.fully_buffered(cmd).raise_if_errors()

  assert os.path.exists('image0000.png')

  cmd = ' '.join([
    'dials.export_bitmaps', '%s/datablock.json' %data_dir, 'prefix=variance_',
    'binning=2', 'display=variance', 'colour_scheme=inverse_greyscale',
    'brightness=25', 'kernel_size=5,5'])
  print cmd
  result = easy_run.fully_buffered(cmd).raise_if_errors()

  for i in range(7):
    assert os.path.exists('variance_000%i.png' %i)

def run():
  exercise_export_bitmaps()

if __name__ == '__main__':
  from dials.test import cd_auto
  with cd_auto(__file__):
    run()
    print "OK"
<commit_msg>missing return if dials_regression not present<commit_after>from __future__ import division

import os

import libtbx.load_env
from libtbx import easy_run

dials_regression = libtbx.env.find_in_repositories('dials_regression')

def exercise_export_bitmaps():
  data_dir = os.path.join(dials_regression, 'centroid_test_data')
  if data_dir is None:
    print 'Skipping exercise_export_bitmaps(): dials_regression not available'
    return

  cmd = 'dials.export_bitmaps %s/centroid_0001.cbf' %data_dir
  print cmd
  result = easy_run.fully_buffered(cmd).raise_if_errors()

  assert os.path.exists('image0000.png')

  cmd = ' '.join([
    'dials.export_bitmaps', '%s/datablock.json' %data_dir, 'prefix=variance_',
    'binning=2', 'display=variance', 'colour_scheme=inverse_greyscale',
    'brightness=25', 'kernel_size=5,5'])
  print cmd
  result = easy_run.fully_buffered(cmd).raise_if_errors()

  for i in range(7):
    assert os.path.exists('variance_000%i.png' %i)

def run():
  exercise_export_bitmaps()

if __name__ == '__main__':
  from dials.test import cd_auto
  with cd_auto(__file__):
    run()
    print "OK"

{'fraction_non_alphanumeric': 0.11839708561020036, 'fraction_numerical': 0.015482695810564663, 'mean_word_length': 5.223796033994335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '398165', 'n_tokens_mistral': 829, 'n_tokens_neox': 790, 'n_words': 158}