<commit_before>--[[==========================================================================#
# This is a program to automate the alignment of a raw tilt series, use the   #
# program RAPTOR to make a final alignment, use IMOD to estimate the defocus  #
# and then correct the CTF by appropriate phase flipping, and then finally    #
# using eTomo to create the reconstruction.                                   #
#-----------------------------------------------------------------------------#
# Author: <NAME>                                                       #
# Written: February 27th 2014                                                 #
# Contact: <EMAIL>                                          #
#-----------------------------------------------------------------------------#
# Arguments: arg[1] = image stack file <filename.st>                          #
#            arg[2] = fiducial size in nm <integer>                           #
#            arg[3] = table with option flags from getOpts                    #
#==========================================================================--]]
local tomoAutoDir = os.getenv('TOMOAUTOROOT')
package.path = package.path .. ';' .. tomoAutoDir .. '/lib/?.lua;'
local comWriter = require 'comWriter'
local MRCIOLib  = require 'MRCIOLib'
local tomoLib   = require 'tomoLib'
local lfs, os, string = lfs, os, string

local tomoAuto = {}

local function run(funcString)
   local status, err = pcall(function()
      local success, exit, signal = os.execute(funcString .. '&> /dev/null')
      if (not success) or (signal ~= 0) then 
         error('\nError: ' .. funcString .. ' failed.\n\n', 0)
      end
   end)
   return status, err
end

local function cleanOnFail(filename)
   run(string.format('mv tomoAuto.log finalFiles/tomoAuto_%s.log',
      os.date('%d.%m.%y')))
   run(string.format('rm -rf *.com *.log %s* raptor*',
      filename))
   run(string.format('mv finalFiles/* ..'))
   run(string.format('rmdir finalFiles'))
   lfs.chdir('..')
   run(string.format('rmdir %s'), filename)
end

function tomoAuto.reconstruct(stackFile, fidNm, Opts)
   -- These are all of the files created and used throughout
   local filename = string.sub(stackFile, 1, -4)
   local rawTiltFile    = filename .. '.rawtlt'
   local ccdErasedFile  = filename .. '_fixed.st'
   local origFile       = filename .. '_orig.st'<commit_msg>fixed typo<commit_after>--[[==========================================================================#
# This is a program to automate the alignment of a raw tilt series, use the   #
# program RAPTOR to make a final alignment, use IMOD to estimate the defocus  #
# and then correct the CTF by appropriate phase flipping, and then finally    #
# using eTomo to create the reconstruction.                                   #
#-----------------------------------------------------------------------------#
# Author: <NAME>                                                       #
# Written: February 27th 2014                                                 #
# Contact: <EMAIL>                                          #
#-----------------------------------------------------------------------------#
# Arguments: arg[1] = image stack file <filename.st>                          #
#            arg[2] = fiducial size in nm <integer>                           #
#            arg[3] = table with option flags from getOpts                    #
#==========================================================================--]]
local tomoAutoDir = os.getenv('TOMOAUTOROOT')
package.path = package.path .. ';' .. tomoAutoDir .. '/lib/?.lua;'
local comWriter = require 'comWriter'
local MRCIOLib  = require 'MRCIOLib'
local tomoLib   = require 'tomoLib'
local lfs, os, string = lfs, os, string

local tomoAuto = {}

local function run(funcString)
   local status, err = pcall(function()
      local success, exit, signal = os.execute(funcString .. '&> /dev/null')
      if (not success) or (signal ~= 0) then 
         error('\nError: ' .. funcString .. ' failed.\n\n', 0)
      end
   end)
   return status, err
end

local function cleanOnFail(filename)
   run(string.format('mv tomoAuto.log finalFiles/tomoAuto_%s.log',
      os.date('%d.%m.%y')))
   run(string.format('rm -rf *.com *.log %s* raptor*',
      filename))
   run(string.format('mv finalFiles/* ..'))
   run(string.format('rmdir finalFiles'))
   lfs.chdir('..')
   run(string.format('rmdir %s', filename))
end

function tomoAuto.reconstruct(stackFile, fidNm, Opts)
   -- These are all of the files created and used throughout
   local filename = string.sub(stackFile, 1, -4)
   local rawTiltFile    = filename .. '.rawtlt'
   local ccdErasedFile  = filename .. '_fixed.st'
   local origFile       = filename .. '_orig.st'
{'fraction_non_alphanumeric': 0.2347990742688828, 'fraction_numerical': 0.00547022932884494, 'mean_word_length': 1.8467065868263473, 'pattern_counts': {'":': 0, '<': 11, '<?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': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '757896', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1236, 'n_words': 372}