<commit_before>#!/usr/bin/env python
# mxdatareduction.py
#
#    Copyright (C) 2017 Diamond Light Source, <NAME>
#    
# 2017-02-03 
#
# Methods to store data from MX screening pipelines
#

import string
import logging
import time
import os
import sys
import datetime
from logging.handlers import RotatingFileHandler
from collections import OrderedDict
import copy
from ispyb.ExtendedOrderedDict import ExtendedOrderedDict
from astropy.io.ascii.tests.common import assert_equal

class MXScreening:
  '''MXScreening provides methods to store MX characterisations and strategies.'''

  def __init__(self):
    pass

  def first_item_in_cursor(self, cursor):
    rs = cursor.fetchone()
    if len(rs) == 0:
        return None
    elif isinstance(cursor, mysql.connector.cursor.MySQLCursorDict):
        return rs.iteritems().next()[1]
    else:
        try:
            return int(rs[0])
        except:
            return rs[0]
  
  _screening_params = ExtendedOrderedDict([('id',None), ('dcgid',None), ('program_version',None), ('short_comments',None), ('comments',None)]) 
  _screening_input_params = ExtendedOrderedDict([('id',None), ('screening_id',None), ('beamx',None), ('beamy',None), ('rms_err_lim',None), ('min_fraction_indexed',None), ('max_fraction_rejected',None), ('min_signal2noise',None)])
  _screening_output_params = ExtendedOrderedDict([('id',None), ('screening_id',None), ('status_description',None), ('rejected_reflections',None), ('resolution_obtained',None), ('spot_deviation_r',None), ('spot_deviation_theta',None), ('beam_shift_x',None), ('beam_shift_y',None), ('num_spots_found',None), ('num_spots_used',None), ('num_spots_rejected',None), ('mosaicity',None), ('i_over_sigma',None), ('diffraction_rings',None), ('mosaicity_estimated',None), ('ranking_resolution',None), ('program',None), ('dose_total',None), ('total_exposure_time',None), ('total_rotation_range',None), ('total_no_images',None), ('rfriedel',None), ('indexing_success',None), ('strategy_success',None)])<commit_msg>Remove unused/unnecessary import<commit_after>#!/usr/bin/env python
# mxdatareduction.py
#
#    Copyright (C) 2017 Diamond Light Source, <NAME>
#    
# 2017-02-03 
#
# Methods to store data from MX screening pipelines
#

import string
import logging
import time
import os
import sys
import datetime
from logging.handlers import RotatingFileHandler
from collections import OrderedDict
import copy
from ispyb.ExtendedOrderedDict import ExtendedOrderedDict

class MXScreening:
  '''MXScreening provides methods to store MX characterisations and strategies.'''

  def __init__(self):
    pass

  def first_item_in_cursor(self, cursor):
    rs = cursor.fetchone()
    if len(rs) == 0:
        return None
    elif isinstance(cursor, mysql.connector.cursor.MySQLCursorDict):
        return rs.iteritems().next()[1]
    else:
        try:
            return int(rs[0])
        except:
            return rs[0]
  
  _screening_params = ExtendedOrderedDict([('id',None), ('dcgid',None), ('program_version',None), ('short_comments',None), ('comments',None)]) 
  _screening_input_params = ExtendedOrderedDict([('id',None), ('screening_id',None), ('beamx',None), ('beamy',None), ('rms_err_lim',None), ('min_fraction_indexed',None), ('max_fraction_rejected',None), ('min_signal2noise',None)])
  _screening_output_params = ExtendedOrderedDict([('id',None), ('screening_id',None), ('status_description',None), ('rejected_reflections',None), ('resolution_obtained',None), ('spot_deviation_r',None), ('spot_deviation_theta',None), ('beam_shift_x',None), ('beam_shift_y',None), ('num_spots_found',None), ('num_spots_used',None), ('num_spots_rejected',None), ('mosaicity',None), ('i_over_sigma',None), ('diffraction_rings',None), ('mosaicity_estimated',None), ('ranking_resolution',None), ('program',None), ('dose_total',None), ('total_exposure_time',None), ('total_rotation_range',None), ('total_no_images',None), ('rfriedel',None), ('indexing_success',None), ('strategy_success',None)])
{'fraction_non_alphanumeric': 0.15928535480624056, 'fraction_numerical': 0.008555611474584801, 'mean_word_length': 6.673745173745174, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4399163', 'n_tokens_mistral': 1315, 'n_tokens_neox': 1221, 'n_words': 249}