<commit_before>package controllers.isoshader

import akka.actor._
import akka.dispatch._
import scala.concurrent.duration._
import play.api._
import play.api.mvc._
import play.api.data._
import play.api.libs.json.Json._
import play.api.libs.iteratee._
import play.api.libs.concurrent._
import play.libs.Akka._
import play.api.Play.current
import models.binary._
import akka.util.Timeout
import oxalis.binary._
import braingames.mvc.Controller
import play.api.i18n.Messages
import braingames.geometry._
import akka.pattern.ask
import akka.pattern.AskTimeoutException
import scala.collection.mutable.ArrayBuffer
import play.api.libs.concurrent.Execution.Implicits._
import braingames.binary.DataRequestSettings
import braingames.image.{JPEGWriter, ImageCreator, ImageCreatorParameters}
import braingames.reactivemongo.GlobalDBAccess

object BinaryData extends Controller with GlobalDBAccess{
  val conf = Play.current.configuration
  implicit val timeout = Timeout((conf.getInt("actor.defaultTimeout") getOrElse 20) seconds) // needed for `?` bel

  def requestImage(dataSetName: String, dataLayerName: String, imagesPerRow: Int, x: Int, y: Int, z: Int, resolution: Int) = Action {
    implicit request =>
      Async {
        val cubeSize = 128
        val settings = DataRequestSettings(useHalfByte = false, skipInterpolation = false)
        for {
          dataSet <- DataSetDAO.findOneByName(dataSetName) ?~> Messages("dataSet.notFound")
          dataLayer <- dataSet.dataLayer(dataLayerName) ?~> Messages("dataLayer.notFound")
          params = ImageCreatorParameters(dataLayer.bytesPerElement, cubeSize, cubeSize, imagesPerRow)<commit_msg>moved controller<commit_after>package controllers.isoshader

import akka.actor._
import akka.dispatch._
import scala.concurrent.duration._
import play.api._
import play.api.mvc._
import play.api.data._
import play.api.libs.json.Json._
import play.api.libs.iteratee._
import play.api.libs.concurrent._
import play.libs.Akka._
import play.api.Play.current
import models.binary._
import akka.util.Timeout
import oxalis.binary._
import play.api.i18n.Messages
import braingames.geometry._
import akka.pattern.ask
import akka.pattern.AskTimeoutException
import scala.collection.mutable.ArrayBuffer
import play.api.libs.concurrent.Execution.Implicits._
import braingames.binary.DataRequestSettings
import braingames.image.{JPEGWriter, ImageCreator, ImageCreatorParameters}
import braingames.reactivemongo.GlobalDBAccess
import controllers.Controller
import play.api.mvc.Controller

object BinaryData extends controllers.Controller with GlobalDBAccess{
  val conf = Play.current.configuration
  implicit val timeout = Timeout((conf.getInt("actor.defaultTimeout") getOrElse 20) seconds) // needed for `?` bel

  def requestImage(dataSetName: String, dataLayerName: String, imagesPerRow: Int, x: Int, y: Int, z: Int, resolution: Int) = Action {
    implicit request =>
      Async {
        val cubeSize = 128
        val settings = DataRequestSettings(useHalfByte = false, skipInterpolation = false)
        for {
          dataSet <- DataSetDAO.findOneByName(dataSetName) ?~> Messages("dataSet.notFound")
          dataLayer <- dataSet.dataLayer(dataLayerName) ?~> Messages("dataLayer.notFound")
          params = ImageCreatorParameters(dataLayer.bytesPerElement, cubeSize, cubeSize, imagesPerRow)
{'fraction_non_alphanumeric': 0.09379682349415643, 'fraction_numerical': 0.004195385076415942, 'mean_word_length': 4.8664323374340945, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '7057696', 'n_tokens_mistral': 1010, 'n_tokens_neox': 972, 'n_words': 224}