Commit bb95df24 authored by Philipp Oleynik's avatar Philipp Oleynik
Browse files

Minor changes

parent f5e0d552
......@@ -53,6 +53,17 @@ def set_log_axes_simple(axes):
axes.set_yscale("log", nonposy = 'clip')
axes.grid(True, which = 'both', alpha = 0.3, zorder = 0)
def set_time_log_axes_simple(axes):
axes.tick_params(direction = 'in', which = 'both', zorder = 4)
axes.set_yscale("log", nonposy = 'clip')
axes.grid(True, which = 'both', alpha = 0.3, zorder = 0)
def set_lin_axes_simple(axes):
axes.tick_params(direction = 'in', which = 'both', zorder = 4)
axes.set_yscale("linear")
axes.set_xscale("linear")
axes.grid(True, which = 'both', alpha = 0.3, zorder = 0)
def set_log_axes_2048(axes):
axes.tick_params(direction = 'in', which = 'both', zorder = 4)
......
......@@ -4,6 +4,7 @@ import scipy.special as scs
import socket
import scipy.constants as const
import math
# import fitsio
# from fitsio import FITS, FITSHDR
......@@ -32,6 +33,12 @@ def get_basepath( ):
else:
return "/home/pholey/Geant4/"
def get_datapath( ):
if socket.gethostname() == 'spicule' or socket.gethostname() == 'philyra':
return "/home/phil/Work/SIXS/bc_mpo_sixs/data_calibrated/"
else:
return "/home/pholey/SIXS_Data/bc_mpo_sixs/data_calibrated/"
def saturate2048_(x):
"""
......@@ -140,6 +147,7 @@ def get_energy_grid(*, channels_per_decade = 256, min_energy = 0.01, max_energy
:param min_energy: Starting energy. Can be anything, not necessarily powers of 10
:param max_energy: Upper limit of energy. Can be anything, not necessarily powers of 10
:return: An integer and three float arrays: number_of_energy_steps, energy_midpoint, energy_cut, energy_bin_width
The cuts are the upper limits.
"""
emin_start = (np.floor(np.log10(min_energy) * channels_per_decade) / channels_per_decade)
emax_stop = (np.floor(np.log10(max_energy) * channels_per_decade) / channels_per_decade)
......@@ -223,3 +231,28 @@ def generate_integral_powerlaw(*, energy_grid = None, grid_bin_width = None,
spectrum[energy_i] = integral_sp
return np.array(spectrum, dtype = float)
def core_11bit_to_64(core11):
"""
Converts ADC of the core detector to a 6-bit value by the algorithms of SIXS.
:param radiated_energy: Input energy in ADC bins.
:return: An output channel, 0..63 integer value.
"""
core_instr_offset = 166
adc_11 = saturate2048(int(core11)) - core_instr_offset
adc_8 = logbit11to8(adc11 = int(adc_11))
return int(adc_8) // 4
def side_11bit_to_64(side11, side): # MeV to 6 bit side
"""
Converts ADC a side detector to a 6-bit value by the algorithms of SIXS.
:type side: Side number, integer 0..4. Side 0 is the top one.
:param energy: Input energy in ADC bins.
:return: An output channel, 0..63 integer value.
"""
side_instr_offset = np.array([168, 159, 174, 167, 175])
adc_11 = saturate2048(int(side11)) - side_instr_offset[side]
adc_8 = logbit11to8(adc11 = int(adc_11))
return int(adc_8) // 4
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment