<commit_before>import HistogramToolComponent from '../../components/tools/HistogramToolComponent';
import gio from '@geotiff/gio';
import _ from 'underscore';
import { unmount_tool } from '../../actions/active-tool-actions';
import { set_results } from '../../actions/results-actions';
import { connect } from 'react-redux';
import { compose, withState, withHandlers } from 'recompose';

const mapStateToProps = state => { 
    return {
        results: state.results,
        drawing: state.drawing,
        geometry: state.geometry,
        raster: state.raster
    }
};

const mapDispatchToProps = dispatch => {
    return {
        close: () => dispatch(unmount_tool()),
        get_histogram: (raster, geometry, options) => {
            return dispatch(get_histogram(raster, geometry, options))
        }
    }
}

const get_histogram = (raster, geometry, options) => {
    let { scale_type, num_classes, class_type } = options;

    // make sure parameters are valid
    if (!num_classes % 1) {
        alert('Please make sure the number of classes is an integer.');
        return;<commit_msg>made sure integer check in get_histogram was accurate and more readable<commit_after>import HistogramToolComponent from '../../components/tools/HistogramToolComponent';
import gio from '@geotiff/gio';
import _ from 'underscore';
import { unmount_tool } from '../../actions/active-tool-actions';
import { set_results } from '../../actions/results-actions';
import { connect } from 'react-redux';
import { compose, withState, withHandlers } from 'recompose';

const mapStateToProps = state => { 
    return {
        results: state.results,
        drawing: state.drawing,
        geometry: state.geometry,
        raster: state.raster
    }
};

const mapDispatchToProps = dispatch => {
    return {
        close: () => dispatch(unmount_tool()),
        get_histogram: (raster, geometry, options) => {
            return dispatch(get_histogram(raster, geometry, options))
        }
    }
}

const get_histogram = (raster, geometry, options) => {
    let { scale_type, num_classes, class_type } = options;

    // make sure parameters are valid
    if (num_classes % 1 !== 0) {
        alert('Please make sure the number of classes is an integer.');
        return;
{'fraction_non_alphanumeric': 0.1254971277065842, 'fraction_numerical': 0.0013256738842244808, 'mean_word_length': 3.1088929219600727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '6329146', 'n_tokens_mistral': 640, 'n_tokens_neox': 636, 'n_words': 178}