<commit_before>#
# Scoring function for asteroid objects
#
from bigfloat import *   # TODO use this
import math

def closeness_weight(obj):
  emoid = 1 if isinstance(obj['GM'], basestring) else obj['moid']
  s = (10-emoid) * 3
  """
  if obj['neo'] != 'N':
    s = s * 1.4
  if obj['pha'] != 'N':
    s = s * 1.2
    """
  s = s * ((1/obj['ad']) * 100)    # penalize aphelion distance
  return s

def price(obj):
  G = 6.67300e-20   # km^3 / kgs^2

  # mass in kg
  exactmass = False
  if isinstance(obj['GM'], basestring):
    mass = 1.47e15
  else:
    exactmass = True
    mass = obj['GM'] / G


  # radius in m
  if obj['diameter'] == '':
    if exactmass:
      # If we know the mass, don't make assumptions about radius
      print 'Disqualified', obj['full_name']
      return -1

    # 5km radius by default
    radius = 5
  else:
    if not exactmass:
      # If we know the radius, don't make assumptions about mass
      print 'Disqualified', obj['full_name']
      return -1

    radius = obj['diameter'] / 2

  # vol in km^3
  vol = 4/3 * math.pi * math.pow(radius, 3) # model as sphere

  # density in kg/km^3
  density = mass / vol

  return density

def score(obj):
  #return price(obj) + closeness_weight(obj)
  return price(obj)<commit_msg>messing with scoring<commit_after>#
# Scoring function for asteroid objects
#
from bigfloat import *   # TODO use this
import math

DEFAULT_RADIUS = 5  # km
DEFAULT_MASS = 1.47e15  # kg

def closeness_weight(obj):
  emoid = 1 if isinstance(obj['GM'], basestring) else obj['moid']
  s = (10-emoid) * 3
  """
  if obj['neo'] != 'N':
    s = s * 1.4
  if obj['pha'] != 'N':
    s = s * 1.2
    """
  s = s * ((1/obj['ad']) * 100)    # penalize aphelion distance
  return s

def price(obj):
  G = 6.67300e-20   # km^3 / kgs^2

  # mass in kg
  exactmass = False
  if isinstance(obj['GM'], basestring):
    mass = DEFAULT_MASS
  else:
    exactmass = True
    mass = obj['GM'] / G

  # radius in m
  if isinstance(obj['diameter'], basestring):
    if exactmass:
      # If we know the mass, don't make assumptions about radius
      print 'Disqualified', obj['full_name']
      return -1

    # 5km radius by default
    radius = DEFAULT_RADIUS
  else:
    if not exactmass:
      # If we know the radius, don't make assumptions about mass
      # a lot of things meet this test
      #print 'Disqualified', obj['full_name']
      radius = DEFAULT_RADIUS
    else:
      radius = obj['diameter'] / 2

  # vol in km^3
  vol = 4/3 * math.pi * math.pow(radius, 3) # model as sphere

  # density in kg/km^3
  density = mass / vol

  return density

def score(obj):
  #return price(obj) + closeness_weight(obj)
  return price(obj)
{'fraction_non_alphanumeric': 0.13069454817027631, 'fraction_numerical': 0.02725914861837192, 'mean_word_length': 2.6598360655737703, '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': '3888769', 'n_tokens_mistral': 1011, 'n_tokens_neox': 935, 'n_words': 306}