phitonthel / mcnpx-generator-reader Goto Github PK
View Code? Open in Web Editor NEWRead MCNPX outputs and calculate its variables
Read MCNPX outputs and calculate its variables
""" This program : 1. Read a MCNPX output and calculate its variables. 2. Write 2 text files, containing: a. Tallies, with the following outputs: - Conversion ratio*, ** - Fission rate of U-235 - Absorption rate of Th-232 - Neutron spectrum (energy vs flux) *the conversion ratio is an approximation **uncompleted b. keff and its standard deviation 3. Plot multiples graphs: a. keff b. conversion ratio c. flux (tally) d. cross section @author: phitonthel [email protected] """
I think it's better to save the CAMOP input into a file and then use pythonic way to read and write or replace specific line for better code
def replace_specific_line(line_number, read_file_name, line_content, write_file_name, save_path=DIRECTORY):
read_file = open(read_file_name, "r")
list_of_lines = read_file.readlines()
list_of_lines[line_number - 1] = f"{line_content}\n"
read_file.close()
write_file_name = os.path.join(save_path, write_file_name)
write_file = open(write_file_name, "w+") #will create if there is no file
write_file.writelines(list_of_lines)
write_file.close()
and also i see there is quite long output in the jupyter cell, for the example the following code
files.upload
maybe you can see something like this for better readability
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.