sandy.core.records module

sandy.core.records.line_numbers(length)

Line number creator

Parameters:
length‘int’

Number of lines.

Returns:
ilineslist

List containing the number of each line.

Examples

>>> np.array(line_numbers(1.0e6)).max()
99999
>>> np.array(line_numbers(1.0e6+1)).min()
1
>>> np.array(line_numbers(1.0e4+1)).max()
10001
>>> len(sandy.records.line_numbers(1.0e6))
1000000
>>> len(sandy.records.line_numbers(1.0e6+1))
1000001
sandy.core.records.read_cont(df, ipos)

Read ENDF-6 CONT record in formatted fortran.

Returns:
`CONT`collections.namedtuple
  • C1float

    first element of string

  • C2float

    second element of string

  • L1int

    third element of string

  • L1int

    fourth element of string

  • N1int

    fifth element of string

  • N2int

    sixth element of string

Found error in:
  • n-17-Cl-035.jeff32

  • n-3-Li-007.jeff32

  • n-63-Eu-152.jeff32

  • n-63-Eu-153.jeff32

  • n-64-Gd-155.jeff32

  • n-77-Ir-193.jeff32

  • n-90-Th-229.jeff32

  • n-94-Pu-238.jeff32

  • n-94-Pu-241.jeff32

  • n-94-Pu-242.jeff32

  • n-97-Bk-250.jeff32

  • n-98-Cf-254.jeff32

sandy.core.records.read_list(df, ipos)
sandy.core.records.read_tab1(df, ipos)

Read ENDF-6 tab1 record. These records are used for one-dimensional tabulated functions such as \(y(x)\).

The data needed to specify a one-dimensional tabulated function are the interpolation tables nbt and int for each of the nr ranges, and the np tabulated pairs of \(x(n)\) and \(y(n)\).

Returns:
`TAB1`collections.namedtuple
  • C1float

    first element of string

  • C2float

    second element of string

  • L1int

    third element of string

  • L1int

    fourth element of string

  • NBTlist of int

    upper limits of the interpolation ranges

  • INTlist of int

    interpolation functions

  • x, ynumpy.ndarray

    tabulated pairs of \(x(n)\) and \(y(n)\)

sandy.core.records.read_tab2(df, ipos)

Read ENDF-6 tab2 record. This record is used to control the tabulation of a 2-dimensional function \(y(x,z)\). It specifies how many values of z are to be given and how to interpolate between the successive values of \(z\). Tabulated values of \(y_l(x)\) at each value of \(z_l\) are given in ENDF-6 tab1 or list records following the ENDF-6 tab2 record, with the appropriate value of \(z\) in the field designated as c2.

Returns:
`TAB1`collections.namedtuple
  • C1float

    first element of string

  • C2float

    second element of string

  • L1int

    third element of string

  • L1int

    fourth element of string

  • NRint

    number of interpolation ranges

  • NZint

    number of \(z\) to be given

  • NBTlist of int

    upper limits of the interpolation ranges

  • INTlist of int

    interpolation functions

sandy.core.records.read_text(df, ipos)

Read ENDF-6 TEXT record in formatted fortran.

Returns:
`TEXT`collections.namedtuple
  • HLstr

    66-character string

sandy.core.records.write_cont(C1, C2, L1, L2, N1, N2)

Write ENDF-6 cont record.

Returns:
list of str

list of 66-characters-long ENDF-6 formatted string

Warns:
This function will produce strings longer than 66 characters if integers
> 99999999999 are given.
sandy.core.records.write_eol(lines, mat, mf, mt, istart=1)

Add end-of-line flags MAT, MF, MT and line number to list of strings.

Returns:
str

A string that is the sum of the list of strings, i.e. including eol falgs, separated by the newline character `

`.
Warns:
This function does not check if the strings are in ENDF-6 format
or longer than 66 characters.
sandy.core.records.write_float(x)
sandy.core.records.write_float_list(lst)

Write list of floats into ENDF-6 format.

Returns:
list of str

list of 66-characters-long ENDF-6 formatted string

sandy.core.records.write_int(x)

Examples

>>> sandy.write_int(10)
'         10'
>>> sandy.write_int(-1e5)
'    -100000'
>>> import pytest
>>> with pytest.raises(ValueError): sandy.write_int(-1e10)
sandy.core.records.write_integer_list(lst)

Write list of integers into ENDF-6 format.

Returns:
list of str

list of 66-characters-long ENDF-6 formatted string

sandy.core.records.write_line(string, mat, mf, mt, iline)
sandy.core.records.write_list(C1, C2, L1, L2, N2, B)

Write ENDF-6 list record.

Outputs:
  • list of string

sandy.core.records.write_tab1(C1, C2, L1, L2, NBT, INT, x, y)

Write ENDF-6 tab1 record.

Returns:
list of str

list of 66-characters-long ENDF-6 formatted string

sandy.core.records.write_tab2(C1, C2, L1, L2, N2, NBT, INT)

Write ENDF-6 tab2 record.

Returns:
list of str

list of 66-characters-long ENDF-6 formatted string

sandy.core.records.write_text(text)

Write ENDF-6 TEXT record in formatted fortran.

Returns:
str

list of 66-characters-long ENDF-6 formatted string