JAEA-Technology 2010-047

Technical Report on the Korea-Japan Software Collaboration
Yasuhiro INAMURA※, Ji-Yong SO*1, Kenji NAKAJIMA, Jiro SUZUKI*2,
Takeshi NAKATANI, Ryoichi KAJIMOTO, Toshiya OTOMO*3, Myung-Kook MOON*1,
Chang-Hee LEE*1, Yoshiji YASU*4, Kazuo NAKAYOSHI*4, Hiroshi SENDAI*4, Uk-Won NAM*5,
Je-Geun PARK*6 and Masatoshi ARAI
Materials and Life Science Division, J-PARC Center,
Japan Atomic Energy Agency
Tokai-mura, Naka-gun, Ibaraki-ken(Received December 9, 2010)
Both Materials & Life Science Experimental Facility (MLF) of J-PARC and HANARO of KAERI
started new neutron facility projects in 2002 and 2003, respectively. As part of their projects, both institutes
began developments of new Time-of-Flight (ToF) spectrometer including DC-TOF of HANARO,
4SEASONS and AMATERAS of MLF. With this new instrument development, we saw an opportunity forcollaboration between Korea and Japan regarding ToF software.
This Korea-Japan collaboration officially started in 2007 with an initially 6 items as its final goal. The
6 items include i) basic data reduction software, ii) informative visualization software, iii) datavisualization software, iv) decision making & optimization software, v) single crystal alignment software,and vi) advanced analysis software. Using Manyo library developed at J-PARC as our software framework,
we developed our software based on a combination of Python and C++ wrapped under SWIG.
In August 2008 we successfully released a beta-version of basic data reduction software which has
been tested at the 2 beamlines of MLF; 4SEASONS and AMATERAS, and regularly updated. Other 2
beta-versions of informative visualization software and data visualization software have also been released
and are successfully used during experiments at 4SEASONS and AMATERAS. Although we have had
several discussions on the 3 remaining topics of the original goal of this collaboration, progress has beenrather limited on these items. Therefore, we decided to consider them as the subject of the next KoreaJapan collaboration.
This report summarizes the 2-years (2007-2009) activities of Korea-Japan collaboration of chopper
software development. Here we describe the background of the collaboration and the main part of ourwork. We also discuss briefly a future plan of our collaboration starting in 2010. Some of detailed
descriptions on the activities of the collaboration as well as related information are given in appendix.
Keywords: Neutron Scattering, Chopper Spectrometers, J-PARC, HANARO, Data Acquisition, Data
Reduction, Event Mode Data, Manyo Library, Software, Korea-Japan Collaboration※

Research Staff on Loan
Neutron Science Division, Korea Atomic Energy Research Institute, Daejeon, 305-353, Korea*2
Computing Research Center, KEK, Tsukuba 305-0801, Japan*3
Institute of Materials Structure Science, KEK, Tsukuba 305-0801, Japan*4
Institute of Particle and Nuclear Studies, KEK, Tsukuba 305-0801, Japan*5
Korea Astronomy and Space Science Institute, Daejeon 305-348, Korea*6
Department of Physics & Astronomy, Seoul National University, Seoul 151-747, Korea*1i

JAEA-Technology 2010-047

日韓中性子チョッパー型分光器用ソフトウェア共同開発についての技術報告書
日本原子力研究開発機構 J-PARCセンター
物質・生命科学ディビジョン
稲村 泰弘※、Ji-Yong SO*1、中島 健次、鈴木 次郎*2、中谷 健、梶本 亮一、大友 季哉*3、Myung-Kook MOON *1、Chang-Hee LEE*1、安 芳次*4、仲吉 一男*4、千代 浩司*4、
Uk-Won NAM*5、Je-Geun PARK*6、新井 正敏（2010年12月9日受理）
国内では、2002年に物質・生命科学実験施設（MLF）を含むJ-PARCの計画が開始され、韓国
では、2003年に韓国原子力研究所のHANAROでの新たな中性子科学研究の計画が始動した。2つの計画の中には、HANAROにおいてはDC-TOF、そしてMLFでは、4SEASONS、AMATERAS等といった新しいチョッパー型分光器の建設が計画されていた。このような中で我々は日本と韓国の間でチョッパー型分光器のソフトウェアについての共同開発を行うこととなった。
この日韓中性子チョッパー型分光器用ソフトウェア共同開発は、2007年より開始され、当初6つの開発項目の達成が目標とされた。それらは、i) 基本となるリダクションソフトウェア、ii) 実験
情報表示ソフトウェア、iii) データ可視化ソフトウェア、iv) 実験条件最適化、決定支援ソフト
ウェア、v) 単結晶軸立てソフトウェア、vi) その他先進的解析ソフトウェアである。J-PARCで開発されたManyo Libraryをフレームワークとし、PythonとSWINGでラップされたC++でソフトウェアを開発した。
2008年8月には、基本となるリダクションソフトウェアのβ版が完成し、MLFの四季分光器、アマテラスにて試験が開始された。実験情報表示ソフトウェアとデータ可視化ソフトウェアについても、これら2台のチョッパー型分光器での運用が開始された。残る3項目については、さらに引き続き日韓共同開発の項目として開発を続けている。
この報告書は、日韓中性子チョッパー型分光器用ソフトウェア共同開発について2007年から2009年の2年間の活動内容をとりまとめたものである。共同開発の背景、開発作業の内容等について述べている。また、2010年以降に続く次の共同開発についての議論にも触れる。付属する技術情報や活動記録等は、付録として収録している。

J-PARCセンター： 〒319-1195 茨城県那珂郡東海村白方白根2-4
出向職員*1 韓国原子力研究院 中性子科学研究部*2 高エネルギー加速器研究機構 計算科学センター*3 高エネルギー加速器研究機構 物質構造科学研究所*4 高エネルギー加速器研究機構 素粒子原子核研究所*5 韓国天文研究院*6 国立ソウル大学※

ii

JAEA-Technology 2010-047

Contents
1. Introduction ............................................................................................................................... 1
1.1 Background of collaboration ............................................................................................... 1
1.2 Organizational aspects of collaboration .............................................................................. 2
1.3 Final target of collaboration ................................................................................................ 3
2. Background on programming ................................................................................................... 5
2.1 Basic information about ToF inelastic neutron scattering ................................................... 5
2.2 Programming environments ................................................................................................ 5
2.3 Manyo library as tool for data reduction ............................................................................. 7
2.4 Event mode data .................................................................................................................. 8
3. Basic data reduction software development ............................................................................ 11
3.1 Event data to histogram .................................................................................................... 11
3.2 Masking and mapping ....................................................................................................... 13
3.3 ToF to energy conversion .................................................................................................. 15
3.4 Background subtraction .................................................................................................... 16
3.5 Vanadium correction ......................................................................................................... 16
3.6 Detector efficiency correction ........................................................................................... 17
4. Visualization software development ....................................................................................... 19
4.1 Informative visualization software .................................................................................... 19
4.2 Data visualization software ............................................................................................... 20
5. Performance test of software .................................................................................................. 22
5.1 Event data to histogram .................................................................................................... 22
5.2 Masking ............................................................................................................................ 22
5.3 Mapping ............................................................................................................................ 23
5.4 ToF to energy conversion .................................................................................................. 23
5.5 Background subtraction .................................................................................................... 24
5.6 Detector efficiency correction ........................................................................................... 24
5.7 Beta test using pulsed neutrons at MLF ............................................................................ 24
6. Discussion ............................................................................................................................... 26
6.1 Status of progress and remaining issues ............................................................................ 26
6.2 Future plan of KJ collaboration ........................................................................................ 26
Acknowledgement ...................................................................................................................... 28
References ................................................................................................................................... 29
Appendix ..................................................................................................................................... 45iii

JAEA-Technology 2010-047

目次
1. 緒言 ............................................................................................................................................. 1
1.1 背景 ....................................................................................................................................... 1
1.2 共同開発の体制 ................................................................................................................... 2
1.3 共同開発の目標 ................................................................................................................... 3
2. ソフトウェア開発の背景となる情報 ...................................................................................... 5
2.1 中性子非弾性散乱における飛行時間法について ............................................................ 5
2.2 プログラミング環境 ............................................................................................................ 5
2.3 データリダクションと万葉ライブラリ ............................................................................ 7
2.4 イベントデータ ................................................................................................................... 8
3. 基本的なデータリダクションソフトウェアの開発 ............................................................ 11
3.1 イベントデータのヒストグラム化 .................................................................................. 11
3.2 マスク処理とマッピング処理 .......................................................................................... 13
3.3 飛行時間のエネルギー変換 .............................................................................................. 15
3.4 バックグランドの除去 ...................................................................................................... 16
3.5 バナジウム補正 ................................................................................................................. 16
3.6 検出器効率補正 ................................................................................................................. 17
4. 可視化ソフトウェアの開発 .................................................................................................... 19
4.1 実験条件検討用可視化ソフトウェア .............................................................................. 19
4.2 データ用可視化ソフトウェア .......................................................................................... 20
5. ソフトウェアの動作試験 ........................................................................................................ 22
5.1 イベントデータのヒストグラム化 .................................................................................. 22
5.2 マスク処理 ......................................................................................................................... 22
5.3 マッピング処理 ................................................................................................................. 23
5.4 飛行時間のエネルギー変換 .............................................................................................. 23
5.5 バックグランドの除去 ...................................................................................................... 24
5.6 検出器効率補正 ................................................................................................................. 24
5.7 MLFでのパルス中性子を使った動作試験 ....................................................................... 24
6. 議論 ........................................................................................................................................... 26
6.1 開発の状況と問題点 .......................................................................................................... 26
6.2 日韓協力の今後の計画 ...................................................................................................... 26
謝辞 ................................................................................................................................................ 28
参考文献 ........................................................................................................................................ 29
付録 ................................................................................................................................................ 45iv

JAEA-Technology 2010-047

1. Introduction
1.1 Background of collaboration
In 2002, High Energy Accelerator Research Organization (KEK) and Japan Atomic Energy Agency(JAEA) launched a joint project of J-PARC, Japan Proton Accelerator Research Complex. J-PARC is a
research complex using secondary particles produced by 1 MW proton-beam (Figs. 1). One of the 4 main
research facilities of J-PARC is Materials & Life Science Experimental Facility (MLF), at which broad
range of investigations in the area of materials and life sciences will be carried out by using high-intensity
pulsed neutron and muon beam. When the J-PARC project started, a number of new neutron instruments
were proposed including 4SEASONS and AMATERAS (Fig. 2). 4SEASONS is a high-intensity chopper
spectrometer constructed by a joint group from the members of JAEA, KEK, and Tohoku University [1].
AMATERAS is a cold-neutron disk chopper spectrometer constructed by JAEA [2]. Both projects of
4SEASONS and AMATERAS started in 2005 and 2006, respectively, and were expected to be completed
as Day-1 instruments of MLF by the end of Japanese fiscal year 2008.
On the other hand, a cold neutron source project for a 30 MW research reactor, HANARO at Korea
Atomic Energy Research Institute (KAERI) started in 2003 (Fig. 3). The project includes installing a coldneutron source and constructing new experimental hall accommodating new cold instruments. DC-TOF is
one of Day-1 instruments for the cold neutron project at HANARO and it is run by a joint group between
SungKyunKwan University and KAERI with J. -G. Park as project leader (Fig. 4). The project officiallybegan in 2003 and was due to be completed by April, 2010 [3]. However, some problems such as theglobal financial turmoil in 2008 and, to make things worse, a recent hike in 3He price over 2008-2009
forced the DC-TOF team to revise the construction plan. The new plan is now: a first beam test by
December 2010 and a full operation by April 2012.
In above situation, our Korea-Japan (KJ) collaboration began with discussions between 2 members of
the collaboration team: M. Arai and J.-G. Park, in early 2007 at J-PARC. At that time, both teams (MLF, JPARC team led by M. Arai and the DC-TOF team of HANARO, KAERI, led by J-G. Park) were very
actively engaged in instrument developments as described below. Therefore, we saw the opportunity of thejoint collaboration. Furthermore, we thought that some kind of closer collaboration between the 2 countries
will be of mutual benefit once J-PARC and KAERI start the new neutron spectrometers.
Because both teams were by then already working on the hardware side of the project and each
spectrometer has its own unique technical features, we thought that software will be a good topic for thiscollaboration. Apart from this, there are other advantages for us to choose the software development for thejoint collaboration. The main reason was that once we have a clear plan and job assignments software canbe coded by individual persons at one's own office with minimum off-line interaction. Although we wanted
to have as frequent off-line meetings as possible for this collaboration from the beginning, our pastexperience told us that international collaborations based on off-line meeting often led to a very slow
progress. As it turned out, we managed to have 16 monthly online meetings and 7 offline meetings. The
offline meetings were done through either a joint collaboration meeting or visits by individual members totheir own counterparts.
Based on this discussion, M. Arai and J.-G. Park organized the first meeting at J-PARC on 24th July
2007, which was attended by 12 people from both countries: J. -G. Park, M. -K. Moon, K. -C. Jin, J. -Y. So,
M. Arai, K. Nakajima, T. Otomo, J. Suzuki, Y. Inamura, T. Nakatani, S. Itoh, T. Yokoo. After the meeting,
we invited Kenji Nakajima to coordinate this collaboration and assigned J. -Y. So and Y. Inamura to theworking group responsible for writing software. We chose the data reduction software as the key part ofthis collaboration particularly for the following reasons:-1-

JAEA-Technology 2010-047- It is the integral part of the software development- It offers clear benefits to both sides' chopper projects- We anticipated that a full development would take 2 years, which fitted well with the schedule of the
hardware construction on both sides- It was remained to be developed in the J-PARC project.
The first kick-off meeting was organized at J-PARC during 10th-14th September 2007 with thefollowing attendees: K. Nakajima, J. -Y. So, Y. Inamura, M. Arai, J. -G. Park, T. Otomo, T. Nakatani, J.
Suzuki, K. Tomiyasu. At the meeting, we agreed to develop the data reduction software using an eventmode format as the main object of this collaboration. A full list of items considered for this collaboration is
as follows:- Basic data reduction software- Informative visualization (for decision of conditions)- Single crystal alignment software- Data visualization software- Decision making and optimization.
One brief, noteworthy point about the data reduction software is that from the beginning we decided
to write our own program based on an event mode format, for the first time for neutron scatteringexperiments. As discussed in detail subsequently in the report, this decision was shared by many others as
a new direction of future software developments for neutron scattering. This new approach in the data
reduction software is appropriate for the new chopper instruments of J-PARC. It would also offer muchneeded flexibility in data handling and new opportunities of doing neutron sciences because of the inherent
time tagging feature.
Through the 2-years collaboration, we managed to release the beta version of the data reduction
software by August 2008 with the first beam test subsequently made at the 4SEASONS beamline of JPARC in September 2008. Subsequent upgrades have since been made with continual beam tests using
4SEASONS & AMATERAS.
As of writing this report, the data reduction software is not complete yet for the final release for users.
But we will spend continuous effort to correct the codes for problems identified during the on-line use andto make it better. And this report serves as a status report and will be used as a reference material for a
future full user's manual.
When we were preparing this collaboration, we were aware of similar efforts made at the ISIS, UK
and the SNS, USA. Therefore, we thought that it would be useful to have exchanges of information as wellas ideas. For this, we have invited Dr. T. G. Perring of ISIS and Dr. G. E. Granroth of the SNS to participate
in some of our off-line meetings as documented in the appendix. In summary, there were altogether 3 ofsuch kind meetings: twice at J-PARC and one at Fukuroda.
1.2 Organizational aspects of collaboration
Our collaboration was officially conducted within the existing MOU between JAEA, one of the 2 hostorganizations of J-PARC, and KAERI: "ARRANGEMENT FOR COOPERATION IN THE FIELD OF
PEACEFUL USES OF NUCLEAR ENERGY BETWEEN THE JAPAN ATOMIC ENERGY AGENCY AND
THE KOREA ATOMIC ENERGY RESEARCH INSTITUTE." The official name of the collaboration is the-2-

JAEA-Technology 2010-047

Korea-Japan software collaboration.
The structure of the organization is shown in Fig. 5. M. Arai and J. -G. Park as leader initiated andguided the collaboration, while K. Nakajima as coordinator handled day-to-day management of thecollaborations. And Y. Inamura and J. -Y. So formed a working group and were responsible for actual
coding works. For the successful operation of the collaboration, K. Nakajima took the following
responsibilities:- Management of the working group- Maintain the progress of the collaboration- Monthly online meeting- Offline meeting- Running the International Advisory TeamThe 2 members of the international advisory team: T. G. Perring of ISIS, UK and G. E. Granroth ofSNS, USA, participated in the 3 offline meetings and presented the status reports of software developmentsof their own institutes. They also provided valuable inputs as well as suggestions regarding numerous
technical problems occurred throughout the collaborations. We also had an expert group from both Korea
and Japan. For example, our program heavily used Manyo-lib (Manyo library) developed by J. Suzuki andhis co-workers of KEK while T. Otomo, T. Nakatani, R. Kajimoto, Y. Yasu, K. Nakayoshi and H. Sendai
provided advices on the technical as well as architectural issues and M. -K. Moon and U. -W. Nam worked
as experts for the Korean team.
1.3 Final target of collaboration
The aim of this collaboration is to develop software for time-of-flight (ToF) chopper spectrometers
under construction at both KAERI and J-PARC. It was initially agreed that any level of software that was
required for chopper spectrometers should be considered as parts of this Korea-Japan collaboration. Afterseveral times of discussions, it was decided that the following sets of software were included to the wider
scope of the collaboration. Here, the item of "advanced analysis software" was added to the list at the firstkick-off meeting.
i) Basic data reduction software.
Reduction software processing raw data, equivalent of Homer [4] which is the standard reduction
software used at ISIS.
ii) Informative visualization software.
Software to visualize scan area, resolutions at given experimental condition to help users'
decision.
iii) Data visualization software.
The software to visualize data in 3D, 2D and 1D plot with various functions of data manipulation
like Mslice [4] which is the versatile data visualization software used at ISIS.
iv) Decision making & optimization software.
Software to justify or optimize the experimental conditions.
v) Single crystal alignment software.
Software used to align single crystals.
vi) Advanced analysis software.
Sophisticated analysis software including multiple scattering corrections, multiple phonon-3-

JAEA-Technology 2010-047

correction, functions cooperating with simulation software etc.
Our final goal is to develop all the above software for our chopper spectrometers through this KoreaJapan collaboration. However, because of relatively higher urgency, we gave our priority to the data
reduction software. The data reduction software is essential and indispensable parts of data acquisition for
any chopper spectrometers. Furthermore, we decided to use event mode data acquisition, which was aquite new initiative with many conceptual challenges. We emphasize that there was no established data
reduction software for chopper spectrometers using the event mode data in the world when we began thiscollaboration. We also recognize importance of facilitating better science through more effective software
including better visualization program and decision making & optimization program. Software that would
help users with single crystal experiments is also considered to enhance the efficiency of carrying out
experiments. After finishing the above software, we will proceed to develop more advanced data analysis
software.
The rough timeline was set as following. Our spectrometers will be ready in 2008-2009 (4SEASONS
and AMATERAS) and in 2012 (DC-TOF). The data reduction software should be ready (at least in theform of a beta version) in 2008 before 4SEASONS starts its commissioning. The other parts ofdevelopment should be finished before the chopper spectrometers of J-PARC start their full operation in2010. It is our ultimate goal to ensure best performance of the advanced chopper spectrometers at J-PARC
and KAERI with the full development of advanced software.

-4-

JAEA-Technology 2010-047

2. Background on programming
2.1 Basic information about ToF inelastic neutron scattering
Before starting to describe about detail coding of software, we will mention about basic information
about ToF inelastic neutron scattering.
A schematic of a typical time of flight spectrometer is shown in Fig. 6. This type of a spectrometerproduces monochromatic
 neutron pulses using an array of choppers, and measures energy ( ) andmomentum transfer (Q ) with high accuracy. Although both ToF and TAS (Triple-Axis Spectrometer) havemore or less the same (Q , ) coverage and are used for dynamic study of condensed matter sciences,
ToF has an advantage of measuring a large ( Q ,  ) area simultaneously since a wide angle is covered bynumerous detectors.
The basic principle of the ToF technique is shown in Fig. 7. In the case of neutron beams fromreactors such as HANARO of KAERI, after the first chopper-set, neutrons become periodic pulses with aperiod of  and a pulse width of t. Therefore, the first chopper-set is called a pulsing chopper. These
pulsed neutrons have all wavelengths, and after passing through the second and third chopper-sets, they
become monochromatic neutron pulses. In the case where  is too small a value for good energy
resolutions, a slowly rotating chopper with a period of n   must be simultaneously used. Therefore, thesecond and third chopper-sets are often called a frame removal chopper and an order removal chopper,
respectively. The forth chopper-set determines the pulse width in both time and wavelength (energy)
domains [5]. On the other hand, in the case of spallation neutron source one does not need the first
choppers since neutrons at spallation source are produced as bunches of pulses from the beginning.
Otherwise, the remaining process is exactly same for ToF spectrometers at spallation neutron sources as
ToF instruments at reactors.
Traditionally, the scattered neutrons are stored as histograms. However, we intentionally developed
our data reduction software for a so-called event data format for reasons given later in the report. So in ourcase, all the scattered neutrons are stored with their own unique time tag, i.e. I(, t), where  is thescattering angle of pixels of detectors and t is the time of each event of scatterings. These event data arethen processed through our data reduction software, the product of this KJ collaboration, and converted
into histograms. One can further treat the raw data in order to make absolute normalization process byusing vanadium data measured with the same incident energy as a sample in question. In any case,
S(Q , ) will be produced by using the histograms for further analysis. For more details about themathematical formalism, please see the appendix.
2.2 Programming environments
In this development work, we chose to have as programming languages a combination of Python andC++ wrapped under SWIG (Fig. 8). One of the reasons behind our decision was that we use Manyo-lib,which was already under development as the framework of data structure and numerical routines before
our collaboration. Details of Manyo-lib are described in later sections. The class libraries of Manyo-lib are
written in C++ and wrapped by the Python interface that was created by SWIG, which is the major reason
for us to choose the 2 languages as our programming languages. Also, these languages are quite ideal forour purpose for the following reasons. For example, Python, C++ and SWIG are robust, portable and well
documented. They have been widely and successfully used in many scientific applications for more than
10 years. They also support many platforms – Microsoft Windows, Linux, OSX, etc. Sufficient
information and documentations about the languages are available online.
Here, we shortly introduce Python, C++ and SWIG as well as their relations in our development.
-5-

JAEA-Technology 2010-047

Python [6]Python is a programming language invented by Guido van Rossum. The official Python web page
introduces Python programming language as below (http://www.Python.org/about/ ) :Python is a remarkably powerful dynamic programming language that is used in a wide variety of
application domains. Python is often compared to Tcl, Perl, Ruby, Scheme or Java. Some of its key
distinguishing features include:- Very clear, readable syntax- Strong introspection capabilities- Intuitive object orientation- Natural expression of procedural code
- Full modularity, supporting hierarchical packages- Exception-based error handling- Very high level dynamic data types- Extensive standard libraries and third party modules for virtually every task
- Extensions and modules easily written in C, C++ (or Java for Jython, or .NET languages for IronPython)- Embeddable within applications as a scripting interface
In spite of several advantages of Python, native Python has its own drawback: performance for some
application especially for numerical calculation is rather poor. For such scientific applications, it isnecessary to glue Python with Fortran, C or C++. Python is called a "glue language" because one caneasily glue many other programming languages or tools into Python environments. For this purpose, themost widely used method is SWIG as described later.
Another important feature of Python is that it is an interpreter programming language. Python
provides its command line shell, and there exist other shells that have more useful functions, for example,
IPython (http://www.iPython.org). Using these environments, we can easily check the results of ourprogram line by line.
C++
C++ is one of the most popular programming languages. C++ is a general purpose, multi paradigm
low level programming language invented by Bjarne Stroustrup. It succeeds C programming language andimplements many new programming paradigms such as object-oriented, generic programming using
template. C++ is also widely used in the area of numerical calculations because of its high computational
power. One of the important features of C++ is that it is easy to implement C++ module into Python
environments. Many methods have been so far developed and used with SWIG being one such example.
Combination of Python and C/C++ is widely used in neutron scattering communities presently. For
example, they are used for Manyo-lib, DANSE project of SNS, and MANTID project of ISIS [7, 8].
SWIG [9]SWIG (Simplified Wrapper and Interface Generator) is a project to make a tool for building scripting
language interfaces to C and C++. It supports many scripting languages including Python. It enables us to
integrate C/C++'s high performance and Python's productivity and flexibility. By wrapping the classlibraries of Manyo-lib using SWIG, one can access Manyo-lib via Python scripting language.

-6-

JAEA-Technology 2010-047

2.3 Manyo library as tool for data reduction
Manyo-lib is a framework for software development at MLF of J-PARC and provides general-purpose
functions as common modules in manipulating data analysis [10]. It also provides basic environments forsoftware development for each individual instrument. The development of Manyo-lib was managed by agroup of T. Otomo and J. Suzuki of KEK. Manyo-lib was initially used at SWAN, a wide angle
diffractometer at KENS of KEK.
By adapting this common framework of J-PARC for our collaboration, we could economically use theresources of our project. At the same time it made possible for us to share software between other
instrument groups of J-PARC. This development is open not only to instrument scientists at J-PARC and
HANARO, but also to any other persons who may be interested in sharing software through Manyo-lib.
Common functions of Manyo-lib are written in C++, which can be used as coding templates for data
correction, projection and merging.
All functions in Manyo-lib are wrapped into Python by SWIG so that users can easily learn how to
use and execute procedures. By using Manyo-lib and Python, users will be able to write efficiently theirown software. Since our software is based on this framework, we could initially write our codes without
C++, at least at the beginning of the collaboration. We wrote our code in Python using the data container
structure within the framework of Manyo-lib.
The structure of data containers [11]Data container in Manyo-lib is named "ElementContainer," which can store several numerical arrays(vectors) for histogram data and Header information for meta-data about the histograms. The structure of
the ElementContainer is shown in Fig. 9. ElementContainer contains meta-data. Therefore
ElementContainer has 2 roles, 1) storing data and 2) storing parameter files.
Header information can include various types, i.e. real number, integer number, string, and arrays ofthem. It contains the information of histograms to be used during data reduction and data analysis. The
information required in the data processing (the information transmitted between each component in thesoftware) has a large variety of data from the information of detected events, information of instruments toparameters used in specific analysis. This meta-information can be handled by each data container. Data
containers of Manyo-lib provide unified format for handling all the parameters used in the software. Thisfeature is useful both to users and developers. Especially, when several people at different sites work
together on one development as in our collaboration, the data container is also quite helpful in reducing
efforts of managing I/Os or data formats in the program, which is often problematic in such cooperative
works.
All numerical vectors of experimental data (for example, ToF, neutron counts detected by detectors)
are stored in ElementContainer, from which user can define their own "histogram." Histograms as suchdefined from ElementContainer can be used for calculation by using functions of Manyo-lib. In our data
reduction, a single ElementContainer corresponds to a single histogram data for a single pixel of PSD. A
series of ElementContainers can be stored at upper-level container named as ElementContainerArray. Thisis suitable for treating all the data for the entire positions of a single PSD. ElementContainerArrays foreach single PSD are then stored in ElementContainerMatrix for the whole data of a single measurement.
Calculation between histograms
In data reduction, operations between histograms are required. Containers in Manyo-lib have methods
that can execute simple operations (+, -, *, /), although the operations are restricted between containers thathave the same structure of contents.
-7-

JAEA-Technology 2010-047

Header information
Header, data structure in Manyo-lib, contains experimental information (run number, monitor counts,
total number of events and incident neutron energy) and instruments parameters (flight path length
between moderator (1st chopper) and sample, detector position and status). This Header information can beused and subsequently updated at various data reduction steps.
Functions using ElementContainer
Manyo-lib provides Python-wrapped commands to treat histogram and Header information. Users caneasily learn and write Python codes for their own analysis and corrections. But the speed of executing
Python codes is obviously slow, especially for a repeating process. It is clearly an issue of immense
importance when dealing with a large size data. To speed up the performance, Manyo-lib provides users
with an option to write their own routine in C++ using a function template to treat ElementContainers. This
template makes it easy to share the products with other instruments at MLF and to use them for otherdevelopers. It is also allowed a user to add functions to Manyo-lib as new components. A Schematic
structure of an analysis operation and a typical example of an analysis operation for projecting 3dimensional histogram (3D histogram) into 2-dimensional histogram (2D histogram) are shown in Fig. 10(taken after Ref. [11]).
Using ElementContainer and following the formats are also advantageous when several people workin parallel to develop software like this KJ collaboration. In our case, we first determined what kind of
information we wanted to store in Header at the beginning of this KJ collaboration, which is kept as metainformation in data container of Manyo-lib. Therefore we need not consider how to share all theinformation and how to connect them between software components written by different persons
throughout our collaboration. ElementContainer and its format have been proven to be very effective ingluing each product after developed separately at the home institutes of participating groups in Korea andJapan.
2.4 Event mode data
Event Data Recording
The event data recording is a data recording method used in our facilities, J-PARC and HANARO. In
this method, data are stored as neutron events (Fig. 11). In the event data recording method, the histogram
data can be constructed from bunch of event data at any time after measurements. To obtain and use event
data effectively, advanced developments on both electrical hardware and software of DAQ (dataacquisition system) are required. Independently, J-PARC and HANARO decided to employ the event data
recording method instead of the traditional histogram recording method. The event data recording method
was quite, and is still relatively new in neutron scattering communities. In spite of the initial difficulties,
we have benefitted in many ways as described below by choosing the event data recording method. And
we learned during this KJ collaboration that new major facilities and instruments, for example at SNS, also
employed this method of event data recording.
Advantage over histogram recording method
The histogram recording method is a traditional way of storing neutron signal as histograms, which
DAQ generates for an individual pixel of each detector. Basically, this method makes it easy to treat data
after data acquisitions and requires simpler hardware configurations in comparison with that used for the
event-data recording method. On the other hand, there are serious problems as the binning of time and-8-

JAEA-Technology 2010-047

position must be decided before measurements and cannot be changed afterwards once data are taken. In
addition, since there is no information about absolute time in the histogram recording data, it is impossible
to remove some part of the data even if one knows that they are corrupted afterwards. The only way left for
the histogram recording is to throw away the whole data. But if such a situation occurs during themeasurement, then one must simply pause and resume the data taking when one is sure that the source ofcorruption disappears.
In the event data recording method, the time and position information of when and where a single
neutron count is detected at a detector are recorded in the raw data as an event. The resolution for the timeand position of event recording is directly limited by hardware for an associated DAQ, not by the width ofbinning in the time and position ranges. On making histogram for analysis, user can freely decide or
remake the binning of both time and position from event data after measurement. This has several
favourable advantages as described below:- One can remove bad frame due to problems of source, out-phasing of choppers and so on at any timeafter the measurements.
- One can produce several dynamic structure factor data from a single measurement with suitable ToF
binning for the resolutions for each incident energy when using multi-Ei chopper.
Time information in event data keeps not only ToF from T0 of spallation at a neutron source or the
burst time of a pulsing chopper but also absolute time of each measurement. This enables users to track
and see time-dependent phenomena of samples and to remove time-dependent impurity or noise signals
from outer environment, such as out-phasing of chopper rotation, fluctuation for current of neutron bytemperature shift in moderator and so on. Using this advantage, therefore, users can obtain data of better
quality than available at the histogram recording method. One of disadvantage of the event data recordingis that it is not easy to treat and understand the raw data directly. We need more than one step before
actually being able to examine the data, i.e. translation from event data to histograms.
The data volume was also an issue considered during our initial discussion. Histogram recording
requires a fixed memory on PC or a fixed file size, while the volume of data recorded in event mode is
proportional to measurement time and increases with the flux of detected neutrons. In contrast, ToF datastored in histogram mode for a typical inelastic neutron scattering experiment have many zeros, resulting
in a waste of memory on PC.
We considered actual data size for our instruments. For example, 4SEASONS, AMATERAS and DCTOF each will be equiped with more than 300 1-dimensional PSD. Practically, we divided each of PSDs
into more than hundred pixels. Therefore, a total number of detecting pixels is estimated to be in the orderof 104~105. In addition, the effective number of time-of-flight binning for energy resolution with a single
incident energy is in the order of 103. Assuming that the number of PSD is 300, 200 of the pixel number
for a single PSD, 1000 of ToF binning, a typical histogram can easily reach about 1 – 2 Gbytes of the data
size including ToF, counts and errors. We estimate there is a region of trade-off at about 100-200 million
events as far as data size is concerned (Fig. 12).
Data format of event data
Actual data format of event data is shown in Fig. 13. We note that MLF of J-PARC and HANARO of
KAERI use different formats. A major difference between the 2 formats is how to record the real time
-9-

JAEA-Technology 2010-047

information of the events. In the case of MLF format, the real time of events is calculated by combining
the most recent T0 data using Pulse ID or Instrument clock data that are recorded together with event data.
In contrast, the KAERI format keeps the real time recorded as epoch time. The difference between the 2formats is not a major problem in our software development, since both types of data can be handled in oursoftware in the same manner with a simple wrapper.

- 10 -

JAEA-Technology 2010-047

3. Basic data reduction software development
The structure of basic data reduction software is shown in Fig. 14. When all neutron events are stored
as series of events with their own unique time tags, they will be called into the first step of the data
reduction software, "Event to Histogram." Here, it will be converted to histograms, which will be further
checked to discriminate data from bad detectors by so-called masking process. Then the ToF of the data isconverted to the energy transfer by using detector information embedded in a histogram data. After theconversion, the data of individual pixels of detectors will be constructedby using information described ina mapping file. For example, circular averaging (averaging on same | Q | value) can be done at this part.
After that, background treatments (subtraction of empty can data and constant background correction),
normalization by monitor counts, vanadium correction and correction of detector efficiency will be carriedout. Then S( Q ,  ) will be obtained, which will be used in other analysis programs developed byourselves or at other institutes.
3.1 Event data to histogram
Event data should be converted to histogram before being used at further analysis processes. In ourdata reduction software, the histogram data are stored in ElementContainer of Manyo-lib. Manyo-lib
already has base functions for conversion from event data to histogram which are made by using functionsin the GNU Scientific Library [12]. We have either modified the existing functions or added new functions
for our own purpose. Moreover, the MLF computing group of J-PARC decided to use the XML file format
to store all information, which should be communicated across different software using same DAQs and
PSDs regardless of whether it is for inelastic spectrometers or diffractometers. Therefore parameters in the
XML file contains following information:- A number of detectors and a number of pixels for a single detector- Type of detector, 1D (1) or 2D (2)- How to number detector ID and pixel ID- ToF binning patterns for each pixel ID- Position binning pattern for each detector ID- Parameters needed to calculate position from event data
An XML file with the above information will be imported to set parameters that are necessary forconverting event data to histograms.
To define and import the binning information of ToF and position for PSD
In order to convert the raw event data with time and position information to histograms, we need todefine binning in both ToF from T0 time and position at each PSD. The binning pattern of time is simply
given by the data described in an XML file. Numbers of types of time binning patterns are defined by the
MLF computing group. As for the position information, the numbers of pixels of detectors are also
described in the XML file. The whole length of a detector is simply divided by the number of pixels. Thenthe position at a PSD is given by identification number of the pixel, at which a neutron count is detected.
Also, specific pattern of the position binning can be given, which is currently not used in our present
software. This binning information will be retrieved from the XML file when necessary.

- 11 -

JAEA-Technology 2010-047

To cut out event data from an event data file by specifying the time period in absolute time
We can cut out event data, which were taken in certain time period, from a event data file as described
below. There are 3 types of event data, i.e. T0 events, instrument clock events and neutron events. T0 events
contain the IDs of proton beam. T0 events are used to trigger the instrument clock, and then, instrument
clock events are created. Instrument clock event contain time information which are used as common clockof a given instrument. From T0 events and instrument clock events, we can determine absolute time ofneutron events. This function is included in the base functions of Manyo-lib. as one of conversion
functions. Users can pick up neutron events by specifying the event time in absolute time. Users can use
this function when they want to perform time transient experiments. Also, if users know that the data
which were taken at some certain time periods were bad (because of experimental conditions were out of
permitted range, choppers were out of phase, the neutron source had some problems or etc.), they canremove them from original file. Actualy, such operations are carried out by using separate utility programs,
which are under preparation and are not yet included in the current version of data reduction software.
To convert from event data to histogram
In this process, each event data is sorted into time bins of each pixel of detectors. Conversion fromevent data to histogram is carried out by using functions called from Manyo-lib. For this purpose, some offunctions are modified or replaced from the original ones in Manyo-lib or newly prepared by us, and allthese are implemented in Manyo-lib. In the process of conversion from event data to histogram, allhistogram data are stored in a series of ElementContainers, which are constructed using Python code. All
ElementContainers are provided with unique identification number, Pixel-ID and ElementContainerArrays
are PSD-ID.
To put position information to each histogram
The position information at each pixel will be added to each histogram. The information is used indata reduction to calculate a flight path length from a sample to a pixel and a scattering angle. This
information is also stored in an XML file as mentioned before. To calculate the position from Pixel-ID,
coordinates of the origin point on each PSD and the unit vector along PSD are used. The coordinate systemused is described in the appendix. After converting event data to histogram, necessary parameters are also
imported from another XML file and the position is calculated, of which results are written into Header ineach ElementContainer.
To enhance the executing performance
Although the main functions are written in C++, we found it quite time consuming to execute theabove processes especially when working with large size data. We are afraid that it might give badexperiences to users. This problem with data handling will get exacerbated with increasing beam power at
the MLF. Simple test runs at 4SEASONS have proven that it is the case. Therefore it was an important
issue for us to find out an effective method to speed up the execution of process. We have tried toovercome this problem by using a parallel computing method and a multi-threading method. Basefunctions for both methods are already implemented in Manyo-lib. In the parallel computing method,
Python codes are distributed to several servers, so-called 'Python servers' located at other PCs. Then theprocesses are executed in parallel. It is the easiest way for us. On the other hand, in the case of multithreading method executing processes are divided into several threads to utilize multi core CPU effectively.
To use this method, we had to rewrite the codes in C++ to work this method effectively. Although thisrequired another development work for us, we succeeded in writing the code that became very easy to use.
- 12 -

JAEA-Technology 2010-047

Moreover, the multi-threading method allows resources of PC (memory or hard disc) to be kept lower thanin the paralleled method. For actual systems, we should find a way of using these 2 methods effectively
with limited resources. Discussion about this point is added later in the report. For example, the relative
performance of the above methods can be found in Section 5.
3.2 Masking and mapping
Here we discuss the process of masking and mapping (Fig. 15). Masking is used to check whether
spectrums in ElementContainerMatrix are suitable for further data processing. Following situations can beconsidered as reasons for applying masking process:- Data from specific pixels are abnormally noisy.
- Data from specific pixels contain spurious peak.
- Data from specific pixels contain unexpected Bragg reflection in inelastic spectrum.
- Detector efficiency is considered to be changed between several vanadium measurements by any reasons.
In masking, vanadium measurement is used to check bad detectors or pixels. Due to its strong
incoherent scattering cross-section, neutrons scattered from vanadium should be evenly distributed overthe entire solid angle. Therefore, vanadium measurement can be used for this purpose. The choice of bad
detectors can be done either manually or automatically. Automatic selection is just to compare eachdetector's total count (Ci) and median of all total count (Cm). If Ci is much larger or much smaller than Cm,
it is classified as a bad detector. The comparison factors are given by parameters.
For automatic masking, ChopperMaskAuto(ecm, lowerlimit = 10-4, upperlimit = 104, writeonfile =True, filename = None) function can be used. The input parameters are:- ecm : ElementContainerMatrix- lowerlimit : default value = 1.0x10-4- upperlimit : default value = 1.0x104- writeonfile : True if user want to write masking file- filename : filename of masking file.
It returns masked index or masking file.
The lowerlimit and upperlimit are the values used for checking bad spectrum. These limits can bechanged by users, when necessary. Otherwise, the default values are set to 10-4 and 104, respectively. The
processes are as below:
1. Calculate the median value of every detector pixels' total count: Cm
2. Compare Cm and pixel's total count. If total count of i-th pixel Ci < lowerlimit * Cm or Ci >upperlimit*Cm, then the i-th pixel is included in the masking index.
3. If writeonfile is true, it writes masking file as given in filename parameter. If file name parameters are
not given, the default filename "YYYYMMDD_hhmmss.msk" is to be used. YYYY, MM, DD, hh, mm
and ss are the year, month, day, hour, minute and second when the masking file is made.
The masking file is a simple ASCII file and an example is shown below.

- 13 -

JAEA-Technology 2010-047# INSTRUMENT UNKNOWN# DATATYPE ElementContainerMatrix# TIME 2008 3 12 15 8 47
1.4 1.8
4.4 4.6 4.8
78
9.4

The line starting with # is a comment line, which does not affect data processing. One can add
comments using any text editor. The numbers in the file is PSD ID and Pixel number. For example, "1.4"means pixel with PSD ID=1 and Pixel ID=4 to be masked. "7" means every pixels with PSD ID=7 will bemasked.
ChopperMaskAuto function returns masked index as Python's tuple type or writes masking file. It
does not mask the histogram but returns index to be masked.
Manual choice of masked pixel may be necessary because automatic selection is done by simply
comparing the total count of pixels. If there are pixels that have spurious or noisy spectrum, they may not
be masked by automatic masking. For the manual masking, we have prepared a program, ECMInspector. It
can be used also for navigating through all spectrums in ElementContainerMatrix.
ECMInspector has following functions:- Inspect all spectra in the ElementContainerMatrix- Over-plotting of chosen spectra- Normalized plots for comparison with different total count- Selection of plotting range- Saving the masking index
ChopperMask(ecm, masked, maskingfile) is a function for masking. If a masking file already exists,
this can be given by the maskingfile parameter.
One should keep in mind that the masking process does not remove masked spectra from
ElementContainerMatrix, but masking information is written in the Header. After masking, the value ofkey "MASKED" becomes 1 in the Header of ElementContainer and ElementContainerArray.
ElementContainerArray's Header also has a list of maked ElementContainer as an Int4Vector.
Mapping is to collect and/or merge histograms by the description of detector geometry and otherparameters necessary for data reduction. For the mapping process, we need 2 types of the description. One
is a group of parameters to be given to each histogram.
- Sample to detector pixel distance- Electronic time delay of detectors (not implemented yet)
- Detector pixel location- Solid angle of pixel- 14 -

JAEA-Technology 2010-047

These parameters should be stored in the Header information of each element container and aresimply used for the collecting and the merging of histograms. In the present status, only the information of
pixel location is stored in each ElementContainer during the process of converting event data to histogram.
This information can be kept with several description types, the pixel position in rectangle coordinates andthe angle in the spherical polar coordinates. From these stored value, software can calculate the distance
between sample to detected position or scattering vector (momentum transfer) Q using the incident
energy. The other way of producing a mapping file is for users to write their own description of the rules orconditions as to how to collect or merge histograms. But we did not produce a procedure for the second
option yet because the development of mapping function is not clearly defined at the moment. So far wehave succeeded in producing
the merging function for powder or glassy samples, which collects andmerges histograms with | Q | value at elastic scattering for a given | Q | range (circular averaging).
This function is based on the merging framework of Manyo-lib. The function in this framework firstcollects histograms suitable to given parameters and then merges them. Upon merging, the function justsums and averages the collected histograms if all of histograms have the same ToF binning. If they havedifferent ToF binnings, the function calculates each value of time binning by the summation with weightreflecting the different binning width. The merging function for powder/glassy sample produces a single
ElementContainerArray as a final result.
3.3 ToF to energy conversion"ToF to energy conversion" is a process to determine neutron's energy transfer from the ToF
measurement. (For the scattering geometry, see Fig. 16.) Let's assume that P is a position of a pixel in PSD
and that R is the reference position as explained below.
The parameters required for ToF to energy conversions functions are:v0 : incident neutron velocity
LPSD : distance between sample to detector pixeltP : ToF measured at pixel
LR : distance between reference position to sampletR : ToF at reference point.
Then the final neutron velocity (v) and energy transfer (  ) (= incident neutron energy (Ei) - final neutronenergy (Ef)) can be calculated as below,

LP SD,
t P  t R  LR /v 01
12
  E i  E f  m N v0  m N v 2 ,
2
2

v

(1)
(2)

where mN is the neutron mass.
The reference point might be a chopper or monitor. In the case of a chopper, tR is the chopper opening
time in each frame. If the reference is the monitor, then tR is the elastic peak center of monitor spectrum ineach frame. Sample to detector pixel distance (LPSD) is different among pixels. Therefore, it must be
carefully considered in data reduction and analysis process that spatial resolutions and energy resolutions
are different among pixels.

- 15 -

JAEA-Technology 2010-047

3.4 Background subtraction
Background in neutron scattering measurements comes from many sources such as sample
environment, neighboring instruments, electrical noise, etc. There are 2 types of background subtraction.
One is subtracting the background data taken by 'background run.' The other one is simply subtracting
constant. A background run is, in general, an empty run – a measurement with the same sample
environment but without the sample. In that case, the background subtracted spectrum is given by
IP (t P [i])  I 0 P (t P [i])    I B P (t P [i])  BC ,(3)

where I0P is the sample run, IBP is the empty run,  is the subtraction ratio calculated from sample
environment properties, and BC is the constant background. If there is time independent constantbackground, our background subtraction function provides some ways of determining constant background.
Although it is not described in Fig. 14, this function can be easily prepared also by users, if necessary. The
parameters for these calculations are listed in Table 1.
3.5 Vanadium correction
White or monochromatic vanadium measurements are used for correcting detector efficiency
fluctuation and for getting absolute physical value from neutron scattering experiments. As we havediscussed for a masking process before, the strong incoherent scattering cross-section of vanadium also canbe used for detector efficiency correction.
White vanadium data
White vanadium data (data from white beam vanadium runs) are used to perform corrections for theefficiency differences of each detector from the averaged value. The data are also used for the corrections
for the solid angle defences of each pixel. The detail algebra of the neutron counts is described inAppendix v. We can introduce the parameter P, the efficiency difference from the averaged value for thedetector which contains the pixel P. Then the efficiency of the detector can be written as (Ef)  P, whichshould be replaced with (Ef) in eqs. (A.1) and (A.4). Also, for the pixel P, the solid angle  in in eqs.
(A.1) and (A.4) should be replaced with the solid angle for the pixel P,  P . Since both neutron countsof the sample runs and neutron counts of the white beam vanadium runs contain P and  P , by dividing
the counts from the sample by the counts from a white beam vanadium run, the differences in thesensitivity and solid angle on each pixel will be cancelled out.
Monochromatic vanadium data
To obtain absolute quantities from measured data, the monochromatic vanadium data is needed.
Especially, the correction of the transmission of the components on the beamline (chopper and any otherdevices) is done by this data. The transmission of devices on the beamline at Ei is the term T(Ei) in eqs.
(A.1) and (A.3). Therefore, by dividing the measured intensity by the counts from a monochromatic
vanadium run, the corrected intensity can be obtained.
Vanadium module
The diagram of the vanadium module is shown in Fig. 17. The actual module for this process consistsof 2 different data treatments, which depend on data type to be processed. One is to calculate the integralof counts and the other is to correct the sample data by using this integral result.
In the "Prepare vanadium procedure" in Fig. 17, the raw event data of white vanadium and- 16 -

JAEA-Technology 2010-047

monochromatic vanadium run can also be treated by the data reduction steps just as done for the sample
data, i.e. conversion translating to histograms, masking, converting ToF to energy, mapping, normalizationand subtracting background.
After processing these steps, the calculation is done for the integral of the intensity in histograms overthe given energy region. The result is stored in ElementContainer with pixel-ID. In "Sample procedure",
the vanadium module executes this correction with dividing sample data by the integral value stored in the
ElementContainer, which is kept on memory or stored on the hard disc.
3.6 Detector efficiency correction
Detectors of chopper spectrometers use 3He gas sealed by thin metal wall. Absorption cross-sectionsof materials have certain energy dependence, therefore detector efficiency also has similar energy
dependence. The definition of detector efficiency is as following: (E f ) 

Number of neutrons detected by detector
Number of incident neutrons at detector(4)

Detector efficiency depends on the average thickness of 3He and detector wall. Therefore, if PSD
stands vertically as above, efficiency also depends on the angle between the incident direction of neutronsand PSD direction (  ) (see Fig. 18).
Fig. 19 shows a cross-sectional view of a 3He detector and the detector wall with respect to theincident neutrons. The detector efficiency is averaged over all cross-section with the following detector
efficiency along neutron path (red line) : ( x )  exp(  ncell   cell  2l cell )  (1  exp(  n He   He  2l He )
3

3

3

,

(5)

where ncell, cell, nHe and He are numbers of atoms and cross sections of length of cell(lcell) and length of3
He (l3He) are as below
1
cos 
1
l He 
cos lcell 3 d  x  (d  d )  x 
 (d  d )  x 
2

2

2

(6)

2

cell

2

(7)

2

cell

.

Absorption cross-section for 3He has the following energy dependence: He ( E f ) 35.024
E f (meV ) He (25.247 meV )

(8)

3

.

Therefore, energy dependent detector efficiency can be calculated from integration of equation (5) byusing equations (6) - (8).

- 17 -

JAEA-Technology 2010-047

 (E f ) d d1 ( x)dx( d  d )2(d  d cell )
cell

cell

(9)
.

Calculated detector efficiencies for some 3He pressures and wall thicknesses are shown in Fig. 20.

- 18 -

JAEA-Technology 2010-047

4. Visualization software development
4.1 Informative visualization software
Informative visualization software is a utility to help users in their making decision on theexperimental conditions such as chopper frequencies, choice of incident energies, choices of slit packages
of Fermi-choppers or slit width of disk-choppers and so on. Using this software, before
 their measurements,
users can consider experimental parameters by referring visual information in Q - space, which isdetermined by certain crystal orientation and instrumental
conditions given. This software can display Q  space, expected flux at sample position and Q and  resolution at the specific point. By using
device control environments interfacing between the devices concerned and the software, this informativevisualization software can also control devices directly or indirectly. At ISIS, there are already many handy
utilities for determining such measurement conditions, e.g. CHOP and TOBYPLOT [13]. However, theseutilities are completely independent from each other. User should use several software sets and should
transfer the data resulted from one utility to the other by manual. And finally user should input the
optimized conditions to the hardware controller again by manual. These situations cause uneasiness and, insometime, pain to users, and are apparently not effective. In our new software development, we are aiming
to make integrated decision making and optimization utility, which is combined with hardware control
software tightly. Then setting-up the experimental conditions becomes easier.
Visualization of scan trajectory
At the beginning of a run, one should determine the incident energy. Scattered neutrons withsomefinal energy Ef are detected by PSDs covering a large area of solid angle. The momentum transfer Q andenergy transfer  by scattering at the sample are calculated as below:  
Q  ki  k f ,(10)

 2  2
 k i  k f 2 ,  
 2m N 







(11)



where ki is the incident wave-vector and k f the final wave-vector. Equation (11) is another expressionof equation (2) describing the neutron energy transfer.
The accessible region of a pixel of a detector corresponds to a line (so-called scan trajectory) in the(Qx, Qy, Qz, ) space, which depends on the chosen incident energy and the scattering angle of that pixel.
By viewing the projection of scan trajectories from all pixels of all detectors on reciprocal lattice space
defined by the sample, which can be calculated by this software, users see immediately which (Qx, Qy, Qz,
 ) region in the Brillion zone can be covered by the measurement.
Features of functions
At the beginning of measurements, users may want to know an expected flux at the sample position
and an expected energy resolution for a given setting. This information are required in choosing chopper
conditions such as chopper frequencies, slit packages of Fermi-choppers or slit widths of disk-choppers.
After selecting these chopper conditions on the left top panel of the main view in Fig. 21, several lines areplotted at the bottom of the left panel where horizontal axis indicates the incident energy. These lines showa series of the flux and energy resolution with selected chopper frequencies. The incident energy can be
determined by typing values in the box at the left-middle panel or clicking on the plot directly.

- 19 -

JAEA-Technology 2010-047

Lattice parameters and orientations of the sample are shown on the top right panel. Then the sample
information is used in calculating the scan trajectory on the right-bottom panel. This plot indicates theBrillion zone of sample and all scan trajectories projected on the horizontal plane including the sample
position. By clicking a position on the plot and by pushing the "vertical plane" button, the scan trajectoryon the vertical plane including this position will appear in another window. By pushing "Plot Resolution"
button, the plot of Q and energy resolutions versus  can also be drawn. If users want to change
sample orientations and incident energy, they can write required values in each box or drag and drop
directly the lattice point. Then both of the orientations of sample and incident energy are automaticallycalculated for the chosen point. As mentioned above, presently this software can be controlled by mouse.
Using this software, therefore, the first step of each measurement can be carried out intuitively by not only
expert users but also beginners.
4.2 Data visualization software
Visualization for data reduction
Visualization software helps users to treat and visualize any data at data reduction steps, i.e. thesimple ToF data and the S(Q , ) data measured in inelastic neutron scattering instruments, which havethe 5 dimensions (3 axes for Qx, Qy, Qz,, 1 axis for  and 1 axis for the intensity). Functions ofvisualization program are mainly consisted of several parts, 1) 1D-Plotter (X and Y axes), 2) 2D-Plotter (X,Y axes and the intensity) and 3) the data management including slicing a higher dimensional data into
lower dimensional ones. These 2 plotters are independent software and can also be controlled individuallyby Python
 command line or other software.
S(Q , ) data from all detectors, which are produced by the data reduction software, are loaded bythis software both to visualize and to analyze themselves. Some parameters are read from Header
information of ElementContainerMatrix. By inputting sample lattice parameters and parameters for
projection, users can slice and plot the data. At the present status, this software can only slice and plot thedata. Any functions for advanced analysis, e.g. fitting and convolution of resolution are not prepared yet
and will be parts of future project.
Functions and interfaceIn the main panel, users can handle up to 5 individual data sets of S( Q ,  ). See the left figure in
Fig. 22. Users can choose each data by clicking tabs on GUI. In addition, it is possible to calculatearithmetic operation between 2 data sets and to put the result into another tab. Slicing and plotting
functions are also included in this panel. For given parameters, projecting and slicing are carried out tosend the results to the outer 2D-Plotter for display on the screen.
2D-Plotter can plot not only the sliced data of single crystal sample but also the powder/glassy sample
by given ElementContainerArray. Using the 2D-plotter, users can cut the 2D data by mouse on GUI andthe resulting data is then sent to the outer 1D-plotter for display on screen.
1D-Plotter, called MPlot, is usually used just to plot the histogram in ElementContainer. As otherordinary plotters, this plotter has several basic functions such as changing types of lines and markers,
scaling plot region and so on. Also this plotter can read and write text data file to import/export any
histogram data. More advanced functions for data analysis will be implemented in future.
Future plan
Most parts of the software are ready to use and user can handle the data processed by the reduction
software. However, functions are still limited to basic ones and may not be sophisticated enough for more
- 20 -

JAEA-Technology 2010-047

advanced requests of users. Also, the software has several other problems to be improved. At this moment,
we can point out following problems with the current version of the software:- An input procedure of sample parameters is still primitive. Presently user manually provides the lattice
parameters and the lattice vector to indicate the sample direction. This information should be shared withother software, for example the informative visualization software or experimental information
management system. And we need to improve how to input the setting parameters.
- Cut and sliced data are independent from the command line system. This series of software can be calledfrom the command line interface on Python. Currently, the interchangeability is rather low between thecommand line system and GUI. To solve this problem, we should connect GUI to command line system
directly. However, at this moment, it is not clear whether our users prefer to use the visualization
functions from the command line interface.
- More functions for plotting are required depending on the requests from users.
- We should implement 3D visualization plot.

- 21 -

JAEA-Technology 2010-047

5. Performance test of software
5.1 Event data to histogram
From the beginning of Manyo-lib developments the MLF computing group has considered the issuesof handling large data produced at MLF with high flux of neutrons. Then, the computing group prepared afunction to distribute some processes of data treatment over several servers, called "Python Server," inManyo-lib. This server can be executed in multiple PCs connected to a host PC by networks. In this way,
one can basically use many severs at the same time. While developing our software, we realized that theprocess of converting raw event data to histograms takes particularly long time for real data. Therefore, wedeveloped another converting method using a multi-threading technique, which was then implemented for
Manyo-lib.
We were particularly interested in the speed of these methods for the converting process. In Table 2,
we compare the 2 methods to identify which new coding is required.
We checked the performance of both methods in terms of speed and memory resources withconditions as given below.
- Test environment:
PC:
Quad-core with 2.0 GHz.
Data size:
8 raw event data files (in total 1.0 GB on hard disc)- Program environment:
Distributed processes:
Multh-threading:

4 Python Servers on 1 PC
4 threads on 1 PC

We show the test results with different conditions about ToF binning.
Condition 1: Number of Pixels: 9600, Number of ToF bins: 400(Table 3)
Condition 2: Number of Pixels: 9600, Number of ToF bins: 8000
(Table 4)
For each test, we included a single thread results as a reference. In terms of speed both methods are 23 times faster than a single thread with a distributed processes method being a little faster than multithreads for Condition 1. On the other hand, there is a big difference in the memory size. A distributed
processes method occupies 2-3 times larger memory size than that required for a multi-threading. The
reason for the large memory for the distributed process is simply explained by the fact that 4 processes are
executed in parallel in this method.
For Condition 2, the multi-thread method becomes better in terms of both speed and memory. One
disadvantage with the distributed processes is that it should have additional file access process in order tocombine several data produced by each server, as shown in Fig. 23. Table 3 and 4 show the file access time.
It is obvious that if file access process gets much faster, the distributed method might become better.
For practical purposes, we may use both methods together. For example, we can distribute several
process of multi-thread conversion into several servers on other PCs. Most effective way to use bothmethods should be found in near future.
5.2 Masking
Testing conditions are following.
- OS: OSX 10.5
- 22 -

JAEA-Technology 2010-047- CPU: Intel Core 2 Duo 2.4 G Hz
- Memory: 2GB, 667 MHz DDR2 SDRAM
A masking function is tested using dummy vanadium data. Each pixel has similar spectrum except forsome pixels to be masked. We assumed that 300 PSDs are installed and every PSD has 100 pixels. Eachpixel has a spectrum with 600 energy bins. For the test of the automatic masking function, we arbitrarilychoose 50 ElementContainers and put extremely small or large values in to them. We expected that these
50 pixels would be automatically masked. Automatic masking written in Python took just 0.5 seconds tofind bad pixels and to generate a masking file. The process speed of the Python module is satisfiable.
5.3 Mapping
For the test of the mapping function, we prepared a function including collection and merging of
histograms for data taken on a powder or glassy sample along a Debye-Sherrer ring. This is a built-infunction of Manyo-lib, which is written in C++.
Brief descriptions of a sample data and conditions for merging are as shown below.
Test environment: Quad-core with 2.0 GHz, 8GB of memory
Sample data:- The number of pixels = 16000- The number of ToF bins at each pixel = 1500
Merging:- to merge 16000 pixels into 54 pixels.
This merging process took 9.1 seconds.
5.4 ToF to energy conversion
For this process, we have prepared a function in Python. However, we found that this function tookmuch longer than we expected for actual measured data. So we then converted it into a C++ code, which
made significant improvement in speed.
To show the performance of the C++ code, we used the sample data as shown below and checked theperformance.
Test environment: Quad-core with 2.0 GHz, 8GB of memory
Sample data:- The number of pixels = 16000- The number of ToF bins at each pixel = 1000
Conversion steps:
Step 1: Conversion from each ToF to energy transfer
Step 2: Re-binning them so that all pixels have same array of energy transfer
Results are shown in Table 5.
In step 1, the code of C++ is 100 times faster than that of Python while there is a small difference instep 2. This difference comes from the way of coding with Manyo-lib commands (see notes below). This- 23 -

JAEA-Technology 2010-047

result indicates that developers should be more careful about execution time when they develop newcoding using Manyo-lib.
Notes: In step 2, both coding call the same function written in C++, and the difference is where thefunction is called. On the other hand, in step 1, the codes must treat the data in ElementContainer. There,
the C++ code can directly treat data of ElementContainer on memory, while the Python code cannot do it
and needs to copy the data for further treatments. Although Python takes longer executing time than C++,it also has an advantage that there is no risk of destroying the original data. For general users, therefore, we
recommend to use Python for safety.
5.5 Background subtraction
In order to test the function for background subtraction, we used the same testing condition as
Masking. We considered 2 kinds of background subtraction. The first one is to subtract one
ElementContainerMatrix from another ElementContainerMatrix directly. The other way is to calculate
constant background and subtract it from an ElementContainerMatrix.
Direct subtraction using 2 ElementContainerMatrix's is provided by SubtractTwoECM(ecm1, ecm2,
factor) function. The results are ecm1-factor*ecm2, where ecm1 and ecm2 are ElementContainerMatrix's
and factor is a real number. To test the speed of both methods, 2 ElementContainerMatrix's are made with
300 PSDs, where each PSD has 100 pixels and each pixel has 100 bins. It took 14.3 seconds to perform
SubtractTwoECM(ecm1, ecm2, 0.3). The obtained results are shown in Fig. 24.
A function of finding constant background was also tested using the same size of
ElementContainerMatrix. The results can be summarized below:
 Background subtraction by given constant: 18 seconds
 Background subtraction by calculating constant background for each spectrum. Number of points
at both ends to be used for the estimation of constant background are given: 42 seconds
 Background subtraction by calculating constant background for each spectrum. Range ofspectrum used for the estimation of constant background is given: 120 seconds.
5.6 Detector efficiency correction
We used the same testing conditions as the Masking process. Detector efficiency correction using 300
PSDs, 100 pixel per PSD and 100 energy binnings per pixel took about 8 min. Figure 25 shows an example
after detector efficiency corrections. We note that our current code written in Python for detector efficiency
correction took much longer than we would like. Therefore, we are considering writing a new function
using C++ in order to speed up the process.
Overall, we conclude that the current masking code is sufficiently fast but both background correction
and detector efficiency correction need to be improved probably by writing new codes in C++.
5.7 Beta test using pulsed neutrons at MLF
In June 2009, we measured a single crystal of CuGeO3 on 4SEASONS at MLF, J-PARC. Using thesereal data, we checked parts of the data reduction process. The data used consists of separated 20 event files
with a total size of 2.0 GB. The following steps of data reduction were executed in this test:- Event data to histogram- Translation from ToF to energy transfer- Correction for kf/ki term
- 24 -

JAEA-Technology 2010-047

Results are shown in Table 6. In "Event Data to Histogram," we used 2 Python servers running at 2
different PCs for distributed methods (Fig. 26). After these processes, results stored in
ElementContainerMatrix are sent to Data visualization software to be visualized. It took 2 seconds toimport data into Data visualization software. Once imported, the projection, slicing and plotting using thissoftware is sufficiently fast enough for users to use. Figure 27 shows an example plot from thisvisualization. In the lower part of plot, we show data for 4 different incident energies, which were obtainedin a single measurement. For each incident energy of neutrons, we need to repeat these processes one by
one to get the final data set.

- 25 -

JAEA-Technology 2010-047

6. Discussion
6.1 Status of progress and remaining issues
As stated in Section 1.3, we originally had 6 development items as targets for this collaboration. The
achievements of these development works are summarized as following:- Basic data reduction software: Beta-version released- Informative visualization software: Beta-version released- Data visualization software: Beta-version released- Decision making & optimization software: Conceptual study done
- Single crystal alignment software: Conceptual study done
- Advanced analysis software: Conceptual study done
Most parts of "Basic data reduction software" have already been completed. And a beta-version iscurrently running on 4SEASONS and AMATERAS of J-PARC. However, the following components arestill missing.
- Monitor counter normalization-related components- Vanadium normalization- Check of histogram for masking
A beta-version of "Informative visualization software," was already released. We consider that thebeta-version is only for a demonstration of our concept and needs to be upgraded in order to be used forreal experiments.
A beta-version of "Data visualization software" already has most of functions we wanted to
implement. For example, users of 4SEASONS already used this software for experiments and publishedtheir results. Remaining issues concerning with "Data visualization software" are to improve the interface
and add more functions.
We have not yet started coding of "decision making & optimization software" and "single-crystalalignment software." We only finished conceptual design of both sets of software. We have also discussedwith the single-crystal diffractmeter team of J-PARC how to initiate collaboration with them for thedevelopment of "single-crystal alignment software.""Advanced analysis software" is also left for future work. This part is one of the main targets of ournext collaboration work.
In summary, we released beta-version software for 3 items, but they have some remaining issues to besolved. The other 3 items are left for future development.
6.2 Future plan of KJ collaboration
Future plan of KJ collaboration software development has been discussed during both offline and online meetings on several occasions. Since our development work is not yet completed, finishing current
work and preparing the documents have been agreed as next targets of this current collaboration. We havealso agreed on continuing this KJ collaboration in software development as long-term targets.
- 26 -

JAEA-Technology 2010-047

Short-term plan: We should correct problems already identified by the recent test results of the data
reduction software. Some of them have been found during the commissioning of 4SEASONS. By the endof 2009, we performed further extensive commissioning on both 4SEASONS and AMATERAS of J-PARC
with real neutron events and checked some problems. By using these test results, we have improved theperformance of the software by writing some of the core codes in C++ instead of Python. This work
includes upgrading the current programs. We can envision that it will take most of our time until proven to
be fully user friendly, which is expected to be sometime in 2010. In parallel with efforts on both tests andimprovements, we will prepare 2 separate manuals, one for users and another for professional developers
as reference (technical) manual.
Mid- and long-term plan: The key plan of the future direction of this KJ collaboration was discussed
by core members during an offline meeting on 9 July 2009, which was accepted and was broken down into
the action plan during the following on-line meeting attended by all KJ collaboration members. With the
1st phase of the current development nearing to the end, we have more or less a complete set of basic
software, which can be used to produce S( Q ,  ) from raw data. So, the next target of this KJ
collaboration will be to develop advanced analysis software, which is strongly science-oriented.
Furthermore, we agreed that it requires some strategic thinking as to which unique tools we want todevelop by ourselves. Also, during our discussion, we came to conclusion that our level of softwaredevelopment is still relatively low compared with the situations at ISIS and ILL. Therefore, we agreed toadapt a catching-up approach for some years until we are confident enough that our level of software are
mature enough to begin true collaborations with institutes outside the current KJ collaboration. We alsodecided that we should soon bring together core groups of collaborating team from outside for both scienceand software developments.
Here is the summary of our conclusion for the next phase of the KJ collaboration:- We decided that for some time we will continue in the current mode.
- For the beginning, we will start from general analysis software, not too advanced or specific one.
- We plan to involve new members into this KJ collaboration in addition to J. -Y. So and Y. Inamura since
they are expected to become busier with responsibilities at J-PARC and HANARO beginning in 2010.
- During user program that already started at J-PARC, we will have to look for "good" potentialcollaborators regarding advanced software development.
- After the end of the second phase of this KJ collaboration, we will discuss our strategy again regarding
the future direction of analysis software development with other foreign institutes.

- 27 -

JAEA-Technology 2010-047

Acknowledgement
We acknowledge J-PARC and KAERI for their generous supports for this Korea-Japan collaboration
on ToF software development. Throughout this collaboration, we have benefited from discussions withnumerous people. In particular, we should thank T. G. Perring of ISIS and G. E. Granroth of SNS for theirhelpful comments and discussions. One of us (J. -G. Park) acknowledges supports by the KAERI throughthe CNRF project for DC-TOF. This work was supported by a Grant-in-Aid for Specially Promoted
Research (No. 17001001) from the Ministry of Education, Culture, Sports, Science and Technology ofJapan and the Cold Neutron Research Facility project of the Ministry of Education, Science andTechnology, Korean government.

- 28 -

JAEA-Technology 2010-047

References[1] R. Kajimoto, T. Yokoo, K. Nakajima, M. Nakamura, K. Soyama, T. Ino, S. Shamoto, M. Fujita, K.
Ohoyama, H. Hiraka, K. Yamada, M. Arai, J. Neutron Res. 15 (2007) p. 5[2] K. Nakajima, M. Nakamura, R. Kajimoto, T. Osakabe, K. Kakurai, M. Matsuda, M. Metoki,
S.Wakimoto, T. J. Sato, S. Itoh, M. Arai, K. Yoshida, and K. Niita: J. Neutron Res. 15 (2007) p. 13.
[3] KAERI Technical Report, KAERI/RR-3156/2009, "Development of Cold Neutron Research Facility
and Utilization Technology"; KAERI Commission Report , KAERI/CM-1241/2009, "Development of
inelastic neutron spectrometer (DC-TOF) & utilizations."[4] Detail of Mslice and Homer can be found at the software reference site of the excitation group at ISIS,
http://www.isis.stfc.ac.uk/groups/excitations/software/.
[5] R. E. Lechner, Physica B 180&181 (1992) p. 973.
[6] See http://www.Python.org/about/.
[7] See http://wiki.cacr.caltech.edu/danse/.
[8] See http://www.mantidproject.org.
[9] See http://www.swig.org.
[10] J. Suzuki, K. Murakami, A. Manbe, S. Kawabata, T. Otomo, M. Furusaka, Nucl. Instrum. Methods
Phys. Res., A 534 (2004) p. 175.
[11] J. Suzuki, T. Nakatani, T. Ohhara, Y. Inamura, M. Yonemura, T. Morishima, T. Aoyagi, A. Manabe, T.
Otomo, Nucl. Instrum. Methods Phys. Res., A 600 (2009) p. 123.
[12] See http://www.gnu.org/software/gsl.
[13] See http://www.isis.stfc.ac.uk/groups/excitations/downloads/downloads4639.html.
[14] M. Nakamura, R. Kajimoto, Y. Inamura, F. Mizuno, M. Fujita, T. Yokoo, M. Arai, J. Phys. Soc. Jpn 78(2009) p. 093002.
[15] R. Osborn, R. S. Eccleston, S. M. Bennington, B. G. B. Kitchener, Data Reduction on HET and MARI,HET & MARI User Manual, ISIS Report (1995).

- 29 -

JAEA-Technology 2010-047

FiguresFig.1 Overview of J-PARC (upper panel) and Materials & Life Science Facility (lower panel).

- 30 -

JAEA-Technology 2010-047

4SEASONS (JAEA, KEK, Tohoku Univ.)
Construction 2006 ~ 2008
L(moderator-sample)=18m
L(sample-detector)=2.5m
Ei=5~300 meVEnergy Resolution: E/Ei=5~6%
Horizontal Scat. Ang.: -30˚ < 2 < 120˚
Vertical Scat. Ang.: -25˚ < 2 < 26.7˚

AMATERAS (JAEA)
Construction 2006 ~ 2009
L(moderator-sample)=30m
L(sample-detector)=4m
Ei=1~80 meV (at its best @ 1~20 meV)
Energy Resolution: E/Ei>1% @ Ei=20meVHorizontal Scat. Ang.: -40˚ < 2 < 140˚
Vertical Scat. Ang.: -16˚ < 2 < 22˚Fig. 2 4SEASONS (upper panel) [1] & AMATERAS (lower panel) at J-PARC. [2].

Fig. 3 30 MW research reactor, HANARO (left) and new HANARO cold-neutron guide hall.

- 31 -

JAEA-Technology 2010-047

DC-TOF (KAERI & Sungkyunkwan Univ.)
Construction 2006 ~ 2010
L(1st chopper-sample)=10.5m
L(sample-detector)=2.5m
Ei=1~20 meVEnergy Resolution: E/Ei=2~10%
Horizontal Scat. Ang.: -91.4˚ < 2 < 136.6˚
Vertical Scat. Ang.: -21.8˚ < 2 < 21.8˚

Fig. 4 DC-TOF at HANARO cold-neutron guide hall [3].

Fig. 5 Organization chart of the collaboration team.

- 32 -

JAEA-Technology 2010-047

DetectorshieldDetectorarray

choppere
guid

Samplechamber

Incident
neutronFig. 6 Schematic figure of time of flight spectrometer.

Distance
Detector

Sample4th chopper

3rd chopper

2nd chopper

1st chopperTime of flight

Fig. 7 Conceptual diagram describing the basic principles of the ToF technique.

- 33 -

JAEA-Technology 2010-047

Fig. 8 Roles of Python, C++, SWIG and Manyo-lib in our software development.

Fig. 9 Structure of a data container in Manyo-lib. Data container has a hierarchical structure of
ElementContainer<ElementContainerArray<ElementContainerMatrix. This hierarchical class structure
makes it possible that each of containers can hold numerous lower level containers with easy access to thelower level containers. Each data container can also store the meta-information of subjected containers inthe Header. The lowest level container is ElementContainer that contains arrays of histogram data (ToF,
intensity, errors and energy transfer values).

- 34 -

JAEA-Technology 2010-047

Fig. 10 (a) A schematic structure of an analysis operation. The template in the diagram is a template class,and consists of input and output ports and a module connector. The module describes the operation
procedure. (b) A typical example of an analysis operation for projecting 3-dimensional histogram (3Dhistogram) into 2-dimensional histogram (2D histogram), taken after Ref. [11].

Fig. 11 Diagram of event data recording method (upper panel) and histogram recording method (lower
panel).

- 35 -

JAEA-Technology 2010-047

Fig. 12 Comparison of data size for event recording (red) and histogram recording (blue).
MLF Event data Format
8bytes (64bits) for one event

Header: discrimination for event type#module, #PSD: discrimination for amp box and psd
Pulse height: A/D converted electric signal from both terminals of PSD
Pulse ID: Unique ID of each occurrence of neutron
KAERI Event data Format
Raw data : 14 bytes for 1 event

STX: Event data frame
ID: PSD ID (1 to 352)
ToF: Time-of-flight (50 nsec unit)
PL, PR: Positions of pixel
E. time: Epoch time (real time in sec)
Fig. 13 Event data formats used at MLF of J-PARC and KAERI.
- 36 -

JAEA-Technology 2010-047

Fig. 14 Structure of basic data reduction software

Fig. 15 Figure for Masking and Mapping processes.

- 37 -

JAEA-Technology 2010-047

Fig. 16 Schematic diagram for experimental configuration.

- 38 -

JAEA-Technology 2010-047

Fig. 17 Diagram of procedures of modules for data reduction process.

Fig. 18 Detector geometry used in the software.

- 39 -

JAEA-Technology 2010-047

lcell

x
d
d celldcos
Fig. 19 Diamgram of 3He detectors.

Fig. 20 Detector efficiency calculation results.

- 40 -

JAEA-Technology 2010-047

Fig. 21 Screenshots of (left) flux, resolution, and Q-coverage for horizontal detectors; (right) Q & energy
resolutions at the selected position of PSD.

Fig. 22 Screenshot of Data visualization program.
- 41 -

JAEA-Technology 2010-047

Fig. 23 Diagram for methods of converting event data to histogram.

Fig. 24 The blue line is the original spectrum and the green line is subtracted one.

Fig. 25 Data before (open) and after (closed) detector efficiency correction.

- 42 -

JAEA-Technology 2010-047

Fig. 26 Structure for the sequence of "Event data To Histogram" step in 4SEASONS. We use 2 PCs: CPU#1 is a host PC to run multi-thread methods and collect the results from distributed processes. CPU #2 runs
4 processes to execute commands distributed from the host PC.

Fig. 27 Data of CuGeO3 taken at 4SEASONS using Data visualization software for different Ei of RRM [14].

- 43 -

JAEA-Technology 2010-047

TablesTable 1: The parameters for calculations of "Background subtraction" in data reduction.
Method No.
Parameter
Description
0
DoubleConstant background value are given by parameter
1
Int, Int
Constant background is calculated by average of both ends
point.
The first, last integer parameters are number of points inlower and higher ends.
2
Float, Float
Constant background is the average value calculated fromgiven range.
3
DoubleVector
or Backgrounds are given by DoubleVector or array with thearraysame size as the ElementContainer.
Table 2: Comparison of "Distributed process" method and "Multi-threading" method in view of new
cording to be required.
New coding in C++

New coding in Python

Multipurpose

Distributed processes

not required

Requiredyes

Multi-threading

required

not required

noTable 3: Details of the results of performance check on condition 1 (Number of Pixels: 9600, Number of
ToF bin: 400).
Single thread
Multi-threadDistributed
File accesstime(sec)
707
210
198
67
memory(MB)
350
300
900
Table 4: Details of the results of performance check on condition 2 (Number of Pixels: 9600, Number of
ToF bin: 8000).
Single thread
Multi-threadDistributed
File accesstime(sec)
743
248
302
160
memory(MB)2400 – 4200
2400 - 4200
3000 - 6000
Table 5: Results of performance check of "ToF to energy conversion."
PythonC++
Step 1 (Conversion)
79.0 sec
0.7 sec
Step 2 (Re-binning)
17.8 sec
15.8 sec
Table 6: Results of performance check using real data.
Reduction stepTime (sec)

Event data to histogram

320

ToF to energy transfer

16

Correction for kf/ki

2

Total

338

- 44 -

JAEA-Technology 2010-047

Appendixi. Glossary
ii. Records of meetings and personnel exchangeiii. Summary materials of meetings
iv. Choice of coordinates
v. Mathematical backgroundvi. List of publications and presentations- 45 -

JAEA-Technology 2010-047

i. Glossary
4SEASONS:
A Fermi-chopper spectrometer at MLF, J-PARC. Operation has been started from 2008.
AMATERAS:
A disk-chopper spectrometer at MLF, J-PARC. Operation has been started from 2009.
Binning:
Data handling process to sorting the data by specific physical quantity (in time, energy, wave lengthand etc.) into legs with certain width. Each leg is called 'bin.' By this binning, a set of histogram will
be made.
CHOP:
A tool program to calculate energy resolution and neutron flux at sample position for given chopper
conditions developed at ISIS.
Chopper:
Device to cut the neutron beam at certain time window. At a chopper spectrometer, a chopper with ashort burst time is the key component of the spectrometer to select the incident neutron energy.
Chopper Spectrometer:
One of types of instruments performing inelastic neutron scattering experiments. With pulsed neutron
beam (at steady neutron source, a pulse generating chopper is included in an instrument),
spectroscopy is measured by ToF technique. At least one chopper is place before the sample to selectthe incident neutron energy.
CUI:
Character-based user interface.
DC-TOF:A ToF spectrometer at a cold-neutron guide hall at HANARO. It is expected to start operation from2010.
Event Data:
As opposed to the conventional data taking in histogram, each event of neutron detections is recorded
individually with its own unique time tag.
Framework:
In software engineering, framework means a collection of reusable class and library providing API(Application Protocol Interface), executive files and other resources for the specified purpose. It isalso referred as development environment.
GUI:
Graphical user interface.

- 46 -

JAEA-Technology 2010-047

HANARO:
High-flux Advanced Neutron Application ReactOr. A multipurpose research reactor in Korea
constructed and owned by KAERI. Completion of construction is in April of 1995. Operating power
is 30MW. From 2003, upgrading program has been lunched and a cold-neutron source and a related
experimental hall are under construction.
Homer:
Basic reduction software at ISIS. It converts raw detector data into S(,  ) on inelastic scattering
measurements. Various corrections depending on instruments are included.
ISIS:
The experimental facility at the Rutherford Appleton Laboratory in United Kingdom providing pulsed
muon and neutron beam. The first neutron beam was emerged in 1985. Recently, ISIS has started theoperation of 2nd target station (TS2) from 2009 in addition to original 1st target station (TS1) and has
increases its proton beam power. Current operation mode is that 240 kW proton beam produces 50 Hz(40 Hz for TS1 and 10 Hz for TS2) pulse neutron beam which is delivered to 18 (TS1) + 18 (TS2)beam ports.
JAEA:
Japan Atomic Energy Agency.
J-PARC:Japan Proton Accelerator Research Complex. A Japanese joint project of JAEA and KEK. J-PARC has
3 proton accelerators and 4 experimental facilities, one of which is MLF. The project has been started
from 2002 and user program has been started from 2008.
KAERI:
Korea Atomic Energy Research Institute.
KEK:High Energy Accelerator Research Organization.
KENS:
Neutron Science Laboratory of KEK. KENS operated an experimental facility with a spallation
neutron source in KEK site, which was closed in 2006.
MLF:
Materials & Life Science Experimental Facility. One of facilities of J-PARC providing pulsed muonand neutron beam for experiments. The neutron source at MLF is 1 MW (in proton beam power) at
the final goal with the repetition of 25Hz providing neutrons to 23 beam ports. The first neuron at
MLF has emerged in 2008.
Mslice:Visualization software for inelastic scattering measurement at ISIS. This software is used to display- 47 -

JAEA-Technology 2010-047

and visualize data analysed on Homer.
Pixel:
Separated area of a PSD. Minimum detecting area.
PSD:
Position Sensitive Detector.
SNS:
A spallation neutron source facility in Oak Ridge National Laboratory in the United States. Proton
beam power is 1.4 MW at the final goal. Repetition rate is 60Hz. Number of beam ports is 18 (someof beam ports are spilt in to 2 beamlines and 24 beamlines are planned). The first neuron at MLF has
emerged in 2006.
SWAN:
A small and wide angle scattering neutron instrument which existed at a neutron facility at KEK. The
data from SWAN are often used in developments of software including Manyo-lib. and sometimes it
acted as a test bed for new data acquisition systems. The spectrometer was decommissioned in 2006
when a neutron facility at KEK was closed.
T0 :Because of the time structure inherent at spallation neutron sources, the experiment clock is set by theevent of proton hitting the target. This time is defined as T0. In case of DC-TOF in reactor source,
master pulse signal from chopper generate T0.
TAS:
Triple-Axis Spectrometer. One of typical neutron instruments installed at continuous neutron sources.
Since it has 3 primal rotating axes for a monochrometor crystal, sample and an analyzer crystal, it iscalled a triple-axis spectrometer. Versatile instrumentsperforming inelastic, quasi-elastic and elastic
neutron scattering experiments. TAS can measure S( Q , ) precisely with well studied resolutionfunction but measurements on TAS is point-by-pint in Q -  space (recently, many of TASs withmultiple analyzer-detector systems to overcome this disadvantage).
TOBYFIT:A utility program for simulations and fitting of single crystal neutron scattering data developed at
ISIS.
ToF:
Time-of-flight.

- 48 -

JAEA-Technology 2010-047

ii. Records of meetings and personnel exchange
A. Offline meetings
No
1

Title
KJ-Collaboration Kick-off
Meeting

Date
24 July, 2007

Venue
J-PARC,
Tokai,
Japan

Participants
M.-K. Moon, K.-C. Jin, S.-Y. So,
J.-G. Park, M. Arai, K. Nakajima,
Y. Inamura, T. Nakatani,
T. Otomo, Jiro Suzuki, S. Itoh (JPARC), T. Yokoo (J-PARC)

2

K-J Software Collaboration
Working Week 2007

10-14 September,
2007

J-PARC,
Tokai,Japan

S.-Y. So, J.-G. Park, M. Arai, K.
Nakajima, Y. Inamura,
T. Nakatani, T. Otomo,
Jiro Suzuki, K. Tomiyasu(Tohoku Univ.)

3

1st International miniWorkshop on Chopper
Software Development

10-13 December,
2007

J-PARC,
Tokai,Japan

S.-Y. So, J.-G. Park, M. Arai,
K. Nakajima, Y. Inamura,
T. Nakatani, M. Nakamura,
Jyunichi Suzuki (J-PARC),
T. Otomo, Jiro Suzuki, S. Itoh (JPARC), K. Tomiyasu (Tohoku
Univ.), M. Takahashi (Tsukuba
Univ.), T. G. Perring (ISIS),
G. E. Granroth (SNS)4

K-J Software Collaboration
Tokyo Meeting

5 April, 2008

JAEA,
Tokyo,Japan

S.-Y. So, J.-G. Park, M. Arai,
K. Nakajima, Y. Inamura,
T. Nakatani, R. Kajimoto5

2nd International miniWorkshop on Chopper
Software Development

26-27 May, 2008

J-PARC,
Tokai,Japan

S.-Y. So, J.-G. Park, M. Arai,
K. Nakajima, Y. Inamura,
T. Nakatani, R. Kajimoto,K. Shibata(J-PARC),
N. Takahashi, T. Aoyagi (JAEA),
T. Otomo, T. G. Perring (ISIS),
G. E. Granroth (SNS)6

3rd International miniWorkshop on Chopper
Software Development

8-9 December,
2008

Fukuroda,
Ibaraki,Japan

S.-Y. So, J.-G. Park, M. Arai,
K. Nakajima, Y. Inamura,
T. Nakatani, R. Kajimoto,T. Otomo, N. Kawakita (Kyushu
Univ.), T. G. Perring (ISIS),
G. E. Granroth (SNS)7

KJ Collaboration Core
Meeting

9 July, 2009

IQBRC,
Tokai,Japan

J.-G. Park, M. Arai, K. Nakajima*IQBRC: Ibaraki Quantum Beam Research Center- 49 -

JAEA-Technology 2010-047

K-J Software Collaboration Tokyo Meeting (5 April, 2008, JAEA, Tokyo, Japan)

K-J Software Collaboration Tokyo Meeting (5 April, 2008, JAEA, Tokyo, Japan)

2nd International mini-Workshop on Chopper Software Development (26-27 May, 2008, J-PARC, Tokai, Japan)- 50 -

JAEA-Technology 2010-047

B. Online meetings
No
1Time / Date
10 August, 2007

Participants
J.-G. Park, J.-Y. So, Y. Inamura, K. Nakajima*There is no record about other participants.

2

10:00-12:00, 5 September, 2007

J.-G. Park, J.-Y. So, Y. Inamura, K. Nakajima*There is no record about other participants.

3

10:30-11:30, October 9, 2007

J.-G. Park, J-Y. So, M. Arai, Y. Inamura, T. Nakatani,
K. Nakajima

4

13:25-14:45, November 14, 2007

J.-G. Park, J-Y. So, Y. Inamura, T. Nakatani, K. Nakajima

5

13:45-15:30 January 22, 2008

J.-G. Park, M. Arai, Y. Inamura, T. Nakatani, K. Nakajima

6

10:00-11:30 February 13, 2008

J.-G. Park, M. Arai, Y. Inamura, T. Nakatani, K. Nakajima,
J.-Y. So7

13:30-15:00 March 13, 2008

J.-G. Park, J.-Y. So, M. Arai, Y. Inamura, Jiro Suzuki,
K. Shibata, K. Nakajima

8

13:30-14:50 April 21, 2008

J.-G. Park, J.-Y. So, R. Kajimoto, Y. Inamura, K. Nakatani,
K. Nakajima

9

13:30-15:00 May 19, 2008

J.-G. Park, J.-Y. So, R. Kajimoto, Y. Inamura, K. Nakajima

10

16:00-17:30, July 29, 2008

J.-G. Park, J.-Y. So, M. Arai, T. Nakatani, R. Kajimoto,Y. Inamura, K. Nakajima

11

10:00-12:00, August 25, 2008

J.-G. Park, J.-Y. So, M. Arai, T. Nakatani, R. Kajimoto,Y. Inamura, K. Nakajima

12

15:00-17:00, September 18, 2008

J.-G. Park, J.-Y. So, Y. Inamura, K. Nakajima*There is no record about other participants.

13

17:15-18:15, November 27, 2008

J.-Y. So, M. Arai, T. Nakatani, Y. Inamura, K. Nakajima

14

14:05-15:15 April 2, 2009

J.-G. Park, J.-Y. So, M. Arai, R. Kajimoto, Y. Inamura,
K. Nakajima

15

13:30-14:30 June 29, 2009

J.-Y. So, R. Kajimoto, Y. Inamura, T. Nakatani, K. Nakajima

16

10:00- July 22, 2009

J.-G. Park, J.-Y. So, M. Arai, R. Kajimoto, Y. Inamura,
T. Nakatani, K. Nakajima

C. Exchange of staff supported by J-PARC & KAERIJi-Yong So (KAERI) visited to J-PARC: 9-15 September, 2007
Ji-Yong So (KAERI) visited to J-PARC: 9-15 December, 2007
Yasuhiro Inamura (JAEA) visited to KARI: 19-22 February, 2008
Ji-Yong So (KAERI) visited to J-PARC: 25-29 May, 2008
Ji-Yong So (KAERI) visited to J-PARC: 7-15 December, 2008

- 51 -

JAEA-Technology 2010-047

iii. Summary materials of meetings
Here we give show materials used at the summary sessions of offline meetings. These materials
describe summary of discussion we had during meetings.
A. KJ-Collaboration Kick-off Meeting
Date: 24 July, 2007
Venue: J-PARC, Tokai, Japan

K-J Collaboration on Chopper Software
24 Ju ly, 2007 (13:30-17:30)@HENDEL building of JAEA
K: J-G. Park , M. Moon, K . C. Jin, S-Y. So
J: M. Ar ai, K . Naka jima, T. Otom o, J. S uzuk i, Y. Ina mur a, T. Nakatani, S. Itoh, T. Yok oo

We have generally agreed that we will collaborate in soft ware development .
level o f software
Pre-meeting @KEK (27 June) (J-G.P., T.O., T.N., Y.I., K.N.): Anyshould b e subjected
We should work on developing some specific software in K-J collaboration.
Some (advanced) analysis softwar e should be developed in K-J collabor ation.
We can fix some contact points (I/F?), and development can done at either sides.
・Easiness of handling project.
・Diﬀerence in the time-line of both sides. (J;2008, K;2 010)
・Even though, short-term exchange of members (short-term stay) will benefit ourcollaboration. (May be, Ji-Yong will come to stay for several months?)

Are above understandings OK?
What software should be targeted?
Category of Software
1. Experimental condition
2. data reduction
3. visualization
4. simulation
5. crystal alignment

OK!
・Most impo rtant・Benefits bo thsides ' chopper pro jects
ood time spanan・Dev elo pmentm ay ta ke 2 y ears ← g oo
・J-Y.S.is ver y inter ested in.
・no t supp
ppo rted in cur rent J-PA
PARC pr oj ect

Data reduction components
・Defining Raw data format
・Vanadium calibration
・energy determination
・background subtraction・masking & mapping file・convert to SPE・projection on lower dimension
Also following applications are expected to be developed...
・Basic visualization program for reduction components
・MSLICE-like app. containing visualization(It should be integrated in WORKING DESKTOP)

How we should move into action in K-J collaboration?
J-Y.S. and Y.I. will prepare reports by 7 Aug.
・J-Y.S.'s report: list of components to be developed.
・Y.I.'s report: what are missing in his scope.
Listing up & checking up items to be developed.
Web meeting @16:00 10 August.

Formalism
KAERI staﬀ may needs formalism to visit JAEA.
MOU does already exist? --> Masa will check it.

Do we think about existing & expected collaborations between other facilities?
May be no at this moment.

- 52 -

JAEA-Technology 2010-047

B. K-J Software Collaboration Working Week 2007
Date: 10-14 September, 2007
Venue: J-PARC, Tokai, JapanK-J Software Collaboration Working Week 2007
Sep. 10 - 14, 2007 at JAEA

Reported by Kenji Nakajima, Ji-Yong So and Yasuhiro Inamura

Participants• M. Arai• Je-Geun Park
• T. Otomo• T. Nakatani• J. Suzuki• K. Tomiyasu

Contents• Draft schedule• Meetings & discussion subjects• References

(p.2)
(p.3)
(p.7)

1

Draft Schedule of K-J Collaboration Week '07(Sept. 10-14, 2007)
MondayTuesday

WednesdayThursdayFriday9:00-10:00

10:00-11:00

Major Meeting I

11:00-12:00-Schedule (Agenda)-Ground Design of MLF
Software (by T.O.)-Concept (by Y.I. & ALL)

12:00-13:00

Lunch

Major Meeting IV
Summary
Daily Meeting I

Working Time
(J-Y. S)

Daily Meeting II

Lunch

Lunch

Lunch

Lunch

13:00-14:00

14:00-15:00

Working Time
(J-Y.S, Y.I., K.N.)

15:00-16:00
16:00-17:00
17:00-18:00

Working Time
(J-Y.S, Y.I., K.N.)

Major Meeting II

Working Time
(J-Y.S, Y.I., K.N.)

Working Time
(J-Y.S, Y.I., K.N.)

Major Meeting III* Major Meeting will call All Major Participants.
* All Major Meetings will be held at the Small Meeting Room on the 2nd Floor of HENDEL BLDG.
*"Working Time" includes i) practical work, ii) study on J-side materials (Manyo-lib., Frame-Work, KCS results & etc.) and iii) extraordinary meetings.
*J-side's fixed schedule: i) 13:30-15:30 of Sept. 11: Commissioning Task Meeting, ii) 10:00-12:00 of Sept. 11: Chopper Task Meeting,iii) 15:30-17:30 of Sept. 12: Grand Design Meeting, iv) 10:00-12:00 of Sept. 14: Neutron Science Section Meeting,v) 16:- 53 -

2

JAEA-Technology 2010-047

K-J Software Collaboration Working Week 2007
Meetings
4 Major Meetings & 2 Daily Meetings
Major Meeting I & II
10 Sept., 2007
10:00-12:00, 13:30-16:00
J-Y.S., Y.I., M.A., J-G.P., T.O., T.N., J. S., K.T., K.N.
 Frame Work Architecture (T.O.) [1] Image of Our Chopper Software [2]>> What Components should be added to FW?
>> S-Xtal Arraignment, Decision Makign & Exp. Optimization, Infromative Visualization, Adv. MSLICE.....

 etc.

Tuesday's Daily Meeting
11 Sept., 2007
10:30-12:00
J-Y.S., Y.I., M.A., J-G.P., T.O., K.N.
 Where required components should be accommodate in FW-> almost software are covered by FW but need checking whole functions [2] Discussion about 'Standard Window‘ -> discussion after J-Y.S. & Y.I. started to summarize the inside of each components (functions).[3] We confirmed that Discussion about Concept might be over.
3

Wednesday's Daily Meeting
12 Sept., 2007
9:15-10:20
J-Y.S., Y.I., M.A., J-G.P., T.N., K.N.
 Brief look at J-Y.S. & Y.I.'s works
>> Show Flow diagram for data reduction part [4]>> add “Estimate resolution to decide time-binning” function

Major Meeting III
12 Sept., 2007
17:00-19:00
J-Y.S., Y.I., M.A., J-G.P., T.O., T.N., K.N.
 What should be done by Friday? -> refer to “Future….” page need to discuss about Event Data Format
 Data Reduction & Analysis Component
We have to add some functions (Resolution Calc., Channel Width Decision...)Event Data Treatment
Background Trick...
 Show flow diagram for Single Crystal Alignment software
We need functions for “peak search”, ”fitting whole PSDs data”
try to search the results of Single Crystal group in J-PARC

 Collaboration between ISIS Man Power -> core development members are J-Y.S., Y.I, Minakawa(KCS).
 Schedule of monthly TV-meetings & real meetings -> refer to “Future…” page
 Communication Tools (SW Development Env.)-> We can use environments prepared by MFL Comp. Group. (T.O.)

4- 54 -

JAEA-Technology 2010-047

Thursday's Daily Meeting
13 Sept., 2007
15:30-16:30
J-Y.S., Y.I., M.A., J-G.P., K.N.
 We asked J-Y.S. & Y.I. to prepare the material for the final meeting.
List or Map of SW items with allocation, priority, due dates....

Major Meeting IV
14 Sept., 2007
9:30-10:45
J-Y.S., Y.I., M.A., J-G.P., T.N., J.S., K.N.
 What SW do we need; listed up them by J-Y.S. & Y.I. [5]five software :1) Homer-like Software2) Informative visualization for decision of conditions3) Single crystal alignment software
4) MSLIC-like software5) Decision making and optimization

Functions, due date, allocation, priorities of Homer-like SW part
How to manage future works.
-> refer to “Future…” page 4

Discussion & Inquirer of necessary information for J-Y.S. & Y.I.'s actual work-> refer to “Future…” page 4

5

Future...
Job-allocation & Schedule
We will start from HOMER-like part
Detail is Listed by J-Y.S. & Y.I. and discussed
Informative visualization: Done by KCS (Y.I.)
S-Xtal alignment: Y.I. will take initiative
Decision making & optimization: Difficult. Done by task team. (K.N.)
MSLICE: need study & discussion, ISIS people will be involved (M.A.)
We need manager!! K.N. will watch J-Y.S. & Y.I.' s progress
Mac will be used in Working-level KJ Collaboration (*MLF supports Intel Mac only)

How to communicate each otherWe can use development environments prepared by MFL comp. G. (T.N.)
Web-server, mailing-list, software repository...
Of course, we have to prepare the contents by ourselves!!

Monthly TV-meetings
In the Afternoon On Every 1st Wednesday (K.N.)
Time should be determined for each meetings
We'd better to have caretaker of the meetings. Who?

Real Meetings
We will have 2 Real Meetings before Day-1 of J-PARC. (K.N.)
1st: 10th week of next December 2007
2nd: April 2008

- 55 -

6

JAEA-Technology 2010-047

References[1] Frameworks Architecture (T. Otomo) … p8[2] Image of our chopper software (Y. Inamura)… p9 : “User Login”, “ Spectrometer Control and monitor of devices”,“Supports for decision of experimental Conditions”, “Sequence Control”… p10 : “RAW data to SQE on Manyo-Lib”, “Analysis and Visualization”[3] Listed functions (JY.So, Y. Inamura)… p11 : required information… p12 : Function list for data reduction and analysis… p13 : Virtual experiments and optimization, Single crystal alignment[4] Diagram and data flow for data reduction and single crystal alignment (JY.So, Y. Inamura)… p14 left : Diagram for data reduction… p14 right : Diagram for single crystal alignment[5] What SW do we need in J-K collaboration (JY.So, Y. Inamura)… p15 : List of software developed for J-K collaboration… p16-17 : Pseudo code for data reduction functions in developer’s view
… p18 : Allocation of data reduction functions

7

8- 56 -

JAEA-Technology 2010-047

9

1010

- 57 -

JAEA-Technology 2010-047

Information required for functions
Instrument Information
Instrument Name
Primary Flight Path
Secondary Flight Path
Location of the Chopper
Detector Geometry
Chopper Geometry
Other Instrument Informations
Experiment Information
User Information
Local Contact Name
Sample Information
Time
Proton beam current(?)/Monitor Count
Real time information of accelarater(mode)
Run Numbers
Chopper Configuration
Assumed Incident Energy
Temperature
External Field
Pressure
Polarized Neutron Conditions
Other Experimental Conditions

Radius, Slit width, Slit Phase

Name, Affiliation, ID number
Mass, Elements, Volume, Shape, Orientation,
Lattice Parameters, Cross-section etc
for the estimation of flux
moderator condition(tempereture)
Chopper Speed, Phase

11

Function List for Reduction and Analysis

BeforeExperiment

Funtion List
Virtual Experiment
Condition Optimization( Ei, Resolution, Flux etc)
Determine Experiment Condition
Single Crystal Alignment

Input

Scripts
Scripts
Scripts, parameter files
RD, INI, EXI, Log files

Experiment

Make SPE

Incident Energy Correction(Determine Precise Ei,
Considering RRM)
Make Histogram(Considering RRM)
TOF correction [tof align, t to E conversion]
Make Mask File [Decision of Good Detectors]
Make Map File
Detector Efficiency Correction
Vanadium Correction
Background Subtraction
Self Shielding Correction
Transmission/Absorption Correction
Multiple Scattering Correction
Absolute Value Normalization
Make SPE

Make SQE

Make SQE

After
Experiment

OutputRD,INI,EXI
USI, RD, INI, EXI, Log files
USI, HIST0, INI, EXI

HIST0
HIST1
Masking file
Map file

SPE file
SQE file

RD=Raw Data, INI=Instrument Information,
EXI=Experiment Information, USI=User Input,
HIST=Histogram

12- 58 -

JAEA-Technology 2010-047

Virtual Experiments and optimization
Function List

Input

OutputCalculate Energy, Momentum Range
Calculate Flux/Resolution
Calculate Momentum Range in Reciprocal Space [Q, (hkl)]

INI, USI
INI, USI
INI, USI, Sample Informations

Listing Possible Experimental Conditions

Chopper condition for
INI, USI, Sample informations Experiments

Single Crystal Alignment and Check
Function Lists

Inputs

Outputs

Calculate UB matrix and refinement
Calculate goniometer angles to measure specified points in
Momentum Space
Calculation and Visualization of Momentum Range [(hkl)]
Making Script for Goniometer Control
Comparing Expecting and Experimental Results(Overplot)

13

Extract, dvide combine of RAW DATA by conditions

S : Sample
V : Vanadium
E : Empty Can•RAW Data-S, V, E
•Instrument Info.
•Experiment Info.

RAW data(event)Log data(devices)

Estimate resolution to decide time-binningRow data to Histogram
User input(Local storages)

DB(Instrument)

Histogram 0
S, V, EDB
(Experiment)

TOF correction [tof align]
Histogram 1
S, V, E

Histogram 1 V

Make Mask, Map
fileHistogram 1 S

Mask
Map

Detector Efficiency
Calculation

Efficiency

Incident Energy correction(Determine Precise Ei,
considering RRM)

Histogram 1 E

VanadiumEmpty can –Detector-Correction

Histogram 2

T to E Conversion
User input(Local storages)

Background Subtraction
Histogram to SPE conversion

14

SPE

- 59 -

JAEA-Technology 2010-047

J-K collaboration for software[1] HOMER-like software
1. List up required functions
2. Diagram for relations between functions
3. Allocate functions and start development[2] Informative visualization (for decision of conditions)
Already started with company for first version.

[3] Single crystal alignment software
1. List up required functions
2. Diagram for relations between functions but not enough.
3. Shall start to search and contact with Single Crystal group’s software[4] MSLICE-like software
1. Start list up required functions
2. Need training and experiences to analysis real data of single crystal[5] Decision making and optimization
1. This is heavy task. If we want, we need to make task team.
15
2. Need concept, need people who have experiences about real experiments# ! / usr/ bin/ env pyt hon######################################################### This is not execut able pyt hon file.
# Just Pseudo code
# For Considering Funct ions required for Dat a Reduct ions
# Made by Y. I nam ura and J- Y So########################################################

def Convert _t o_Hist ogram ( self, ext ernal_param et er ) :"""convert raw dat a t o Hist ogram Dat a
I t needs som e ext ernal param et ers"""
ret urn Cont ainer_Hist ogram _Classim port Manyoim port GUI m odule

def showGUI ( self) :# show Raw dat a array using GUI m odules
ret urnclass PSDdat a( obj ect ) :""" class for t he raw dat a of single PSD"""def __init __( self) :I D_det ect orPosit ion= [ ]Tof= [ ]class Rawdat a( obj ect ) :# I ncluded in Manyo Library
def __init __( self) :Dat as = [ PSDdat a_class ]def showGUI ( self) :# show Raw dat a and inform at ion using GUI m odule
ret urnclass Cont ainer_RawDat a( obj ect ) :# I ncluded in Many Library
def __init __( self) :Dat as= [ list _of_Rawdat a_class ]I nfo_I nst rum ent s= { }I nfo_Experim ent s= { }def Read_Raw_Dat a( self, raw_dat a_file ) :"""read raw dat a and save it in cont ainer class"""
ret urn 0
def Read_I nst rum ent _I nform at ions( self, inst rum ent _inform at ion_file ) :"""read inst rum ent inform at ion file : XML and save it in cont ainer class"""
ret urn 0
def Read_Experim ent _I nform at ions( self, experim ent _inform at ion_file ) :"""read Experim ent inform at ion file( XML) and save in in cont ainer class"""
ret urn 0class Cont ainer_Hist ogram ( obj ect ) :# basic funct ions are defined in Manyo Library
def __init __( self) :Dat as= [ list _of_Hist ogram ]I nfo_I nst rum ent s= { }I nfo_Experim ent s= { }def showGUI ( self) :# show Hist ogram using GUI m odules
ret urndef __add__( self, ops) :ret urndef __sub__( self, ops) :ret urndef __m ul__( self, ops) :ret urndef __div__( self, ops) :ret urndef Do_TOF_Correct ions( self, som e_param et ers ) :"""t of_correct ions"""
# shift and align t of spect rum according t o it s posit ion, Ei, et c
ret urndef Make_Mask_Files( self, som e param et ers) :"""Make Mask Files"""# I t Requires GUI
ret urn Make_I nform at ions

- 60 -

16

JAEA-Technology 2010-047

def Norm alizat ions( self, val) :"""m ake it self as Norm alized_Hist ogram"""
ret urn 0

def Em pt y_Can_Correct ions( Hist 0, Hist _E) :# code for Em pt y can correct ions
Result _Hist = Hist 0- Hist _E
ret urn Result _Hist

def Tim e_t o_Energy_Conversions( self, param et ers , Ei, Mode) :"""perform t im e t o energy conversions"""
if Mode = = "Tof_Aligned" :# do t 2e conversion wit h previous t of- aligned process

def Det ect or_Efficiency_Correct ions ( Hist ogram s, Masks, Det ect or_Efficiency, param et ers ) :Result _Hist = Correct _Det ect or_Efficiency_Using_Hist ogram _Mask_param et ers
ret urn Result _Hist

else :# do t 2e conversion wit hout previous t of- alignm ent process# I n t his case, t _0( t of of elast ic peak cent er) is different am ong PSDs
# Then, we should have inform at ions about each PSD's t _0
ret urn 0
def Background_Correct ions( self, param et ers_background) :## I n first phase, j ust consider const ant background# aft er beam com ing, we m ust consider non- linear background#ret urn 0
def Det erm ine_I ncident _Neut ron_Energy( I nform at ions of Monit or)# Calculat e I ncident Neut ron Energy
ret urn Ei
def Read_Dat as_From _DB( som e_param et ers )get _RawDat aFile_From _DB( run_num ber)
# Raw dat a Files : Sam ple , Vanadium , Em pt y Can, et c Measurem ent s,
get _I nst rum ent I nform at ions_From _DB( inst rum ent _nam e)
get _Experim ent sI nform at ions_From _DB ( run_num ber )get _Experim ent sLog_From _DB ( run_num ber )ret urn Cont ainer_RawDat a_Class

def MakeSPE( Hist ogram , Mapfiles) :SPE = Manyo.Elem ent Cont ainer( )# calculat e SPE from Hist ogram
ret urn SPE_Dat as############################################################# from t his, codes are com m ands############################################################
Ei = Calculat e_I ncident _Neut ron_Energy ( m onit or_info)
RawDat a_Sam ple= get _RawDat a_From _DB( sam ple_run_num ber)
RawDat a_Vanadium = get _Raw _Dat a_From _DB( vanadium _run_num ber)
RawDat a_Em pt y = get _Raw_Dat a_From _DB( em pt y_can_run_num ber)Hist _S= RawDat a_Sam ple.Convert _t o_Hist ogram ( param et ers )Hist _V= RawDat a_Vanadium .Convert _t o_Hist ogram ( param et ers )Hist _E= RawDat a_Em pt y.Convert _t o_Hist ogram ( param et ers )Hist _S.Do_TOF_Correnct ions( * args )Hist _V.Do_TOF_Correnct ions( * args )Hist _E.Do_TOF_Correnct ions( * args )Masks = Hist _V.Make_Mask_Files( * args)
Maps = Make_Map_Files( * args)
Effs = Make_Det ect or_Effiency( * args )def Make_Map_Files( som e_param et ers) :"""Make Map Files"""
ret urn Map_I nform at ionsHist _S1= Em pt y_Can_Correct ions( Hist _S, Hist _E)
Hist _S2= Det ect or_Efficiency_Correct ions( Hist _S1, Masks, * args)
Hist _S2.Tim e_t o_Energy_Conversions( * args, Ei)Hist _S2.Background_Cor rect ion( * args)
Hist _S3= Absolut e_Norm alize( Hist _S2, Hist _V, Effs)

def Make_Det ect or_Efficiency( som e param et ers ) :"""m ake det ect or efficiency t ables
using Whit e Vanadium Dat a"""
ret urn Efficiency_Table

Functionsdef Absolut _Norm alize( Hist _Sam ple, Hist _Vanadium ) :# code for Absolut e Norm alizat ion
ret urn Norm alized_Hist

SPE = Make_SPE( Hist _S2, Maps)

17

rank

Who

Do_TOF_Corrections
Make_Mask_Files
Normalizations

2
3
1

J
K
J

Due time
2008.01
2008.01
2008.01

Time_to_Energy_Conversions
Background_Corrections

1
1

K
K

2008.01
2008.02

Determine_Incident_Neutron_Energy
Read_Datas_From_DB
Make_Map_Files

3
2
3

J
J
K

2008.022008.022008.02

Make_Detector_Efficiency
Empty_Can_Corrections
Detector_Efficiency_Corrections

2
1
2

K
J
K

2008.022008.032008.03

Absolut_Normalize
MakeSPE

2
3

J
JK

2008.032008.0418- 61 -

JAEA-Technology 2010-047

C. 1st International mini Workshop on Chopper Software Development
Date: 10-13 December, 2007
Venue: J-PARC, Tokai, JapanThe 1st Workshop on Chopper Software Development
for Next Generation@J‐PARC Center
10‐12 December, 2007

December '07 Chopper Software Meeting(Dec. 10-13, 2007)
10-DecOpening Meeting(@small meeting
10:00-11:00 room at HENDEL
bldg.)
1. Welcome

11-Dec12-DecMeeting II(@small meeting

Meeting III

room at HENDEL
bldg.)(@small meetingroom at HENDEL
bldg.)

11:00-12:00 2. Status & Issues
2-1. K-J collaboration

12:00-13:30

Lunch

13-Dec

Lunch

Lunch

Lunch

Meeting IV(@small meeting

13:30-14:30

room at HENDEL
bldg.)

Opening Meetingcont.
~18:00
14:30-15:30 (@small meetingroom at HENDEL
bldg.)
15:30-16:30 2-2. ISIS
2-3. SNS

Summary
J-PARC & Related(@small meetingroom at HENDEL

Facilities Tour

bldg.)

16:30-17:30
Get Together
Party@Shu-Sen-Bou
19:00~- 62 -

Chopper Hardware
Meeting(@small meetingroom or rm. 103 at
HENDEL bldg.)

JAEA-Technology 2010-047

The 1st Workshop on Chopper Software Development for Next Generation@J‐PARC Center, 10‐13 December, 2007
Day‐1 (10:00‐12:15, 13:30‐19:00, 10 December, 2007)
S. Itoh, T. Otomo, J‐Y. So, M. Arai, J‐G. Park, T. Perring, G. Granroth, Y. Inamura, T. Nakatani,
M. Nakamura, J. Suzuki , K. Nakajima

Welcome (by MA)
Status of Korea‐Japan Collaboration Work (KN, YI, JYS)
Korea‐Japan Collaboration
Software Components & Structure Planned
Objectives & Schedule of KJ Collaboration
Data Reduction & Manyo‐Lib.
Status of ISIS Excitation Group (TP)Existing Soft wares & those under development (planned)
HOMER, Mslice, Tobyfit
LIBISIS, Horace, Grig Tobyfit (Matlib & Fortran 90)
Mantid Project
Donʹt reinvent the wheel→Network & Communication
Discussion on Sharing works, Sharing Codes in World Neutron Community
Status of SNS (GG)Over View of SNS Software
PortalData Reduction Software
Advanced Analysis Software

The 1st Workshop on Chopper Software Development for Next Generation@J‐PARC Center, 10‐13 December, 2007
Day‐2 (10:00‐11:30, 11 December, 2007)
J‐Y. So, J‐G. Park, T. Perring, G. Granroth, Y. Inamura, K. Nakajima

Summary of Day‐1
Development Environment
Matlab ‐> ISIS Exc. G
Python+C++ ‐‐> SNS, J‐PARC, Mantid
MATLAB is perfect
Many good public domain soft
Python is Key (glue) to share the resources
J‐PARC TourDay‐3 (10:10‐11:45, 13:30‐16:00 12 December, 2007)
M. Takahashi, K. Tomisasu, J‐Y. So, J‐G. Park, T. Perring, G. Granroth, Y. Inamura, M. Arai, M. Nakamura,
K. Nakajima

Use AMATERAS as a Single Crystal Diffractometer (MT)Single Crystal equivalent Data from Powder Sample (KT)
Summary
Next Gen. Chopper Software Development Activity in World Neutron Community- 63 -

JAEA-Technology 2010-047

Key Words in the Presentations

Arignment, Reduction, Visualization, Analysis ....
Miwakoʹs Talk
Keisukeʹs Talk

Single Crystal

Generalization (data format & applications)
Error (definition, propagation)

Development Environment (do we use commercial software?)Data Size
TeraGrid

Matlab, Python+ Public Domain...
↓↓
LIBISIS, Horace, Grig Tobyfit... SNS, Mantid, MLF, Manyo‐lib.

Network & Communication

Genrarization in Data Fromat
Python is Key!

Sharing Basic Codes
Sharing development work
RRM or Any multiple measurements

Advanced Data Correction (absorption, multiple, phonon....) & Simulation
We will keep in touch.
Next meeting in May 2007
Exchange Persons
etc.

Memo for
Next Gen. Chopper Software Development Activity
in World Neutron Community
Where we should go...?
What we should do...?
What we can do together...?
What we should develop...?
ʺDonʹt reinvent the wheel.ʺ

How we can keep in touch...
 Communication
Mailing List
Web Site
Web meeting Real Meeting Exchange Persons
 Other Ideas...

- 64 -

JAEA-Technology 2010-047

Time Line of Chopper Groupvery crowded in the next year!!

KJ Collaboration Schedule
DC‐TOF Ready
1st Neutron @ MLF ４S, AMR Ready
↓
↓
↓
SNS
CNSC SEQUIA
ARCS is present↓↓
What can be...?
need Mslice‐like
NeXUS SPE!!
Advanced Analysis
ISIS

MERLIN↓

MAPS, MARI

LET↓

Decision Making

MSLICE‐like

ISIS
Revised HOMER
standardized SPE

Efficiency is important
Advices rather than cop
Individual effort unti
Someone between us
Software Work Shop at
Exchange People for a f
Advisory Meeting for K
Several Levels of Comm
Difference in level of pr(J&K are at bottom, sCommunication is very
meetings, exchange p
Software Review at SN
lack in the lower leve

Informative Visualization
New HORACE↓

Generalized Toby Fit↓

HOMER‐like・Histgraming from Event Data
Working Desk Top

....

....

....

We will keep in touch!
1. Next Meeting :26‐27
2. Exchange Persons :list up items to be dis
short term till by ne
3. Formalism would be
4. Contact Persons
TB, GG, JGP, KN, MA
5. Use KJ Web site
Issue Accounts for GG

The 1st Workshop on Chopper Software Development for Next Generation
Next Meeting :26‐27 May
Exchange Persons :Some of persons of KJ Group will visit SNS, ISIS.
Short term visit.
It should be done till next March.
Long term visit should be discussed in future.
Formalism would be OK
We will use existing agreements.
Contact Persons of this activity:
TB, GG, JGP, KN, MA, JYS, YI
KJ Collaboration Web site will be used for this Activity.
Accounts and Password will be issued to GG & TP. (by YI)- 65 -

JAEA-Technology 2010-047

D. 3rd International mini-Workshop on Chopper Software Development
Date: 8-9 December, 2008
Venue: Fukuroda, Ibaraki, Japan

UK-US-K-J Collaboration; the 3rd Chopper Software Mini-Workshop
8-9 December, 2008
Kajika-en at Fukuroda, Ibaraki

8 December, 2008
Persons in Present: T. Perring., G. Granroth, J-G. Park, J-Y. So, M. Arai, Y. Inamura, T. Nakatani,
R. Kajimoto, T. Otomo, S. Kawamura, K. Nakajima.

J-PARC & KAERI DC-TOF Status (by K.N. & J-G.P.)- J-PARC had the first neutron beam on 30 May- 7 instruments have already start their commissioning and 5 will join soon
- Construction of DC-TOF at KARI is progressing and the spectrometer will be ready in the
beginning of 2010
- Especially, significant effort has been done in DAQ-electronics by KAERI in-house people.

J-PARC new DAQ (by T.N.)- New DAQ system has been developed for J-PARC neutron instruments.
- New DAQ system is using new technology, such as SiTCP and RT middleware.
- Some issues about event data have been discussed.
- Pulse ID delivered by the accelerator should be used.
- Some consideration should be done for data format.

SNS status (by G.G.)- Status of 4 choppers in SNS was reported.
- Dｒ CHOP tools- Code developed by SNS data analysis group- PDOS analysis tool developed by DANSE- Software modules for single crystal experiments- New software show its power in some of measurements including Iron superconductor systems- Discussion on NeXus file format has been done
- NeXus for general distribute files- Internal files may have original formats

ISIS status (by T.P.)- Status of Chopper Status: MARI, MAPS, MERLIN(~July, 2008), LET(~Oct., 2009)- Libisis- MSLICE & HORACE: HORECE is porwerful tool for 4D visualization- CASTEP: ab initio Phonon calculation software with compatibility to available visualization tools- Tobyfit: already available, well tested, distributed computing capability- Mantid Project: Whole ISIS project; next generation of OpenGENIE- 66 -

JAEA-Technology 2010-047

KJ Collaboration (Y.I. & J-Y.S.)- Current Status of KJ Collaboration Work- HOMER-like software: 80% ready- Informative visualization (for decision of conditions): beta version is available- Single crystal alignment software: Some modules are borrowed from SXD group- MSLICE-like software (Visualization): beta version is available- Commissioning tools developed in 4SEASONS commissioning- Some of Remaind issues- Event Mode Data Reduction for Chopper Spectrometer- Considerations on event data collection on Chopper Spectrometer- Reduce the file size, process time and also error bars!

UK-US-K-J Collaboration; the 3rd Chopper Software Mini-Workshop
8-9 December, 2008
Kajika-en at Fukuroda, Ibaraki

9 December, 2008
Persons in Present: T. Perring., G. Granroth, J-G. Park, J-Y. So, M. Arai, Y. Inamura, T. Nakatani,
R. Kajimoto, Y. Kawakita, S. Kawamura, F. Mizuno, K. Nakajima.

4SEASONS current status & commissioning
KCS Software Demo-Commissioning tools including visualization (detector calibration, sequencer tester)-Single Crystal Software

Remained Issues-Single Crystal Issues-Combining multiple runs to cover large Q, E space-User support tools to find good experimental conditions

Future Collaboration
Summary- 67 -

JAEA-Technology 2010-047

UK-US-K-J Collaboration; the 3rd Chopper Software Mini-Workshop
8-9 December, 2008
Kajika-en at Fukuroda, Ibaraki
Future Collaboration
The level of KJ collaboration might be rising a little bit...
Actual production of specific software in the frame work of UK-US-K-J Coll.
 Single Crystal Treatment
 Experimental Condition Multi-orientation measurements to cover large Q, E・・
for single crystal; to be done in future Multiple Scattering
after finishing the development of basic software Multi Phonon
we can start thinking....
Keeping sharing the information
Regular meeting; once per 6 months
Next meeting will be held in USA (Thanks, Garrett!)
We can open and enlarge this collaboration
Open meeting in the next WINS (ICNS)Current core members will keep spending effort in core-activity of this collab.
Some of new members can join

UK-US-K-J Collaboration; the 3rd Chopper Software Workshop@ Fukuroda
Thank you for your participation!!

Good CollaborationNEXT

See youin Smokey Mountain (ORNL) !?

- 68 -

JAEA-Technology 2010-047

iv. Choice of coordinates
We are using 2 coordinates systems to represent a position of the instrument as shown in Fig. A1. One
is the rectangle coordinates system, in which the direction of incident beam is on z-axis, anti-gravity
direction on y-axis and x-axis are defined by a right-hand system. The other is the polar coordinates system,
in which the position is described by a distance from the sample position and the polar angle from the zaxis of the rectangle coordinates system. Both definitions have been used in many fields, especially for themeasurement system of X-ray diffraction. ISIS group has also adopted the polar coordinate to express the
position and ambiguities for the area of detecting neutrons in data reduction and analysis. Following the
popular use of both coordinates in various fields, we also chose these 2 coordinate systems for oursoftware.
On the other hands, it is not a simple problem to decide which expression is better from a view pointof users' understanding and of accurate data treatments. We considered the ambiguities of detector positionin our instruments, whose PSDs are standing along perpendicular to horizontal (x-z) plane. We considered
3 expressions for the center position and ambiguities of the area of detectors viewed by scattered neutrons(Fig. A2). Each definition has its own advantages and disadvantages.
(i) Rectangular coordinates
Advantage:-It achieves the most correct expression of ambiguities whose shape is very close to that of actual detector,
sample or other object on spectrometer.

-It looks easy to calculate errors on Q -vector (Qx,Qy,Qz) by direct translation.
Disadvantage:-It is not simple to get actual image about the position from this information.
(ii) Pseudo-spherical polar coordinates
Advantage:-It is easy for users to image the actual position used in the experiment. And it gives more or less correct
description when converting the shape of PSD to that of ambiguities on the polar coordinates.
Disadvantage:-At large elevation angle, a difference between the actual shape of PSD and calculated error shape getincreased.
(iii) Spherical polar coordinates
Advantage:-This choice of coordinate directly includes the scattering angle theta and is the same as the ISIS format. It
looks easy to treat data for circular averaging and to correct some errors such as the divergence ofincident beam.
Disadvantage:-The error shape is not suitable for PSD standing along y-axis.
Fig. A3 shows examples for the difference of ambiguity area at one pixel on a PSD between
coordinate systems of (ii) and (iii). Different 2 ambiguity-areas at a pixel of a PSD expressed with each- 69 -

JAEA-Technology 2010-047

coordinates systems are projected on the same sphere surface (corresponding to a solid angle) withdifferent colours.
It is obvious that the ambiguity expression with (ii) is more suitable for our arrangement of PSD thanthat with (iii). After the discussions, we concluded that (ii) is the most preferable for our works. On theother hand, we are also aware of the fact that (ii) is rather difficult to be used for actual coding. Therefore,
currently we decided to use (iii).

Fig. A1 Coordinates systems used in MLF, J-PARC.

- 70 -

JAEA-Technology 2010-047

Fig. A2 Possible coordinates systems.

Fig. A3 Ambiguity area at one pixel on PSD in the coordinate systems of (ii) (left) and (iii) (right) as used in Fig. 29- 71 -

JAEA-Technology 2010-047

v. Mathematical backgroundWe note that the following discussion is adapted and modified from an ISIS report [15] for our own
descriptions. The neutron counts at arbitrary neutron detector pixel are given byC  ( )   ( Ei )  T ( Ei )    N  f ( Ei , E f , ) kfki S ( ,  )    E   ( ) ( E f ) ,(A.1)

where Φ(τ)φ(Ei) is the neutron flux just before neutron monitor in n/sr/cm2 /s, ∆Ei is the spread in incident
energy, ∆τ is the counting time, T(Ei) is the transmission due to neutron optics device such as chopper,
guide, etc, which are located after monitor. Multiplying the double differential cross section are N, thenumber of scattering centers in the sample, and f(Ei, Ef, φ), the self-shielding factor. ξ(τ)ε(Ef) is theefficiency of the detectors measuring over the solid angle ∆Ω with energy bin ∆E.
The terms in the above formula can be divided as
Incident neutron flux:  ( )   ( Ei )  T ( Ei )  
Sample correction term: N  f ( E i , E f ,  )kf
 S ( ,  )    E
Scattering Function:ki
Detector correction term:  ( ) ( E f ).
Neutron monitor count can be describes asM   ( )     ( ) Measure ( Ei )   M ( Ei )dEi   M   ( )     ( ) ,(A.2)

where M is the integral part.
Monochromatic vanadium run for normalization is used as integrated over all energy transfer.

CV  ( )   ( Ei )  T ( Ei )    N V  fV ( Ei ,  ) V    ( ) ( E f ) .
4

(A.3)

White beam vanadium runs are used for detector efficiency estimations.

V ( Ei )  T0 ( Ei )  f ( Ei ,  )   ( E f )dEi
    ( ) Measure4  W   ( )    NV  V     ( ),4W   ( )    NV 

(A.4)

where αW is a constant including an integral part and T0(Ei) is the transmission for white vanadium
measurement. After normalization using measuring time, white beam vanadium and monochromatic
vanadium the results become:- 72 -

JAEA-Technology 2010-047

R, t  

C S  MS  M W  W  S M S   M W  S
CV  MV  M W  W  V M V   M W  V

N S 4 f S ( Ei , E f , ) k f
 S ( ,  )  E f   ( E f ) ,N V  V f V ( Ei ,  )
ki

(A.5)

where ∆τ is measurement time for sample (∆τS), monochromatic vanadium (∆τV), white vanadium (∆τM),
M W  W
is the ratio between
monitor for sample run (∆τMS), for monochromatic vanadium run (∆τMV).
 M W
white vanadium run and its monitor count normalized with its counting time for sample run (subscriptionS) and monochromatic vanadium run (subscription V). Therefore, the scattering function S(,ω) can becalculated from the following equations,
S ( ,  ) 

N V  V f V ( Ei , ),k ( E f )  i R(,  ) ,N S 4 f S ( Ei , E f , )
kf

(A.6)

where   Ei  E f is the energy transfer.
This formula means that 3 independent measurements (Sample, white vanadium, and monochromatic
vanadium) with monitor counts and self attenuation factor are enough to calculate scattering functionS(, ). This can be transformed to a general scattering function S( Q ,  ) by converting polar and



azimuthal angle to momentum transfer Q  ki  k f .

- 73 -

JAEA-Technology 2010-047

vi. List of publications and presentations
1. "Current Status of Software Development on Chopper Spectrometers for MLF, J-PARC"
Y. Inamura, K. Nakajima, R. Kajimoto, T. Nakatani and M. Arai, KAERI J. -Y. So, J. -G. ParkNOBUGS 2008 Conference
3-5 November, 2008
Australia
2. "Current Status of Chopper Spectrometer Software Development at MLF, J-PARC"
2008 Meeting of the Japanese Society of Neutron Science
Y. Inamura, K. Nakajima, R. Kajimoto, M. Arai, J. -Y. So, J. -G. Park
1-2 December, 2008
Nagoya, Japan
3. "Event Mode Data Reduction and Analysis for Time-of-flight Neutron Spectrometer"
J. -Y. So
Hanaro Symposium 2009
Daejon, Korea
4. "Development of DC- TOF: Current Status and Perspective"
J. -Y. So
The 9-th Japan-Korea Meeting on Neutron Science
Busan, Korea
5. "Korea-Japan Collaboration on Software Development for New Chopper Spectrometer at HANARO &J-PARC"Y. Inamura, J. -Y. So, K. Nakajima, J. Suzuki, T. Nakatani, R. Kajimoto, T. Otomo, M. -K. Moon, C. -H.
Lee, Y. Yasu, K. Nakayoshi, K. Sendai, U. W. Nam, J. -G. Park and M. Arai
Trend in Cold Neutron Time-of-Flight Spectroscopy Workshop
ILL, Grenoble, France- 74 -

国際単位系（SI）
表１．SI 基本単位
SI 基本単位

基本量

名称
記号
長
さメ ートル m
質
量 キログラム kg
時
間
秒
s
電
流ア ンペア A
熱力学温度 ケ ル ビ ン K
物 質 量モル mol
光度 カ ン デ ラ cd

表２．基本単位を用いて表されるSI組立単位の例
SI 基本単位
組立量
名称
記号
面
積 平方メートルm2
体
積 立法メートルm3
速 さ ， 速 度 メートル毎秒m/s
加速度 メートル毎秒毎秒
m/s2
波
数 毎メートルm-1
密 度 ， 質 量 密 度 キログラム毎立方メートル
kg/m3
面
積
密
度 キログラム毎平方メートル
kg/m2
比
体
積 立方メートル毎キログラム
m3/kg
電
流
密
度 アンペア毎平方メートル
A/m2
磁 界 の 強 さ アンペア毎メートル
A/m
(a)
量 濃度
， 濃 度 モル毎立方メートル
mol/m3
質量
濃度 キログラム毎立法メートル
kg/m3
輝
度 カンデラ毎平方メートル
cd/m2
1
屈
折
率 (b) （数字の） １(b)（数字の） １1
比 透 磁 率

乗数
1024
1021
1018
1015
1012
109
106
103
102
101

活

性 カタール

kat

d

Ｚ
Ｅ

10-2

セ ン チ
ミ
リ

c
m

ペ
テ

タ
ラ

Ｐ
Ｔ

µ
n

ギ
メ

ガ
ガ

Ｇ
Ｍ

マイクロ
ノ
10-9 ナコ
10-12 ピ
10-15 フェムト

キ
ロ
ヘ ク ト
デ
カ

ｋ
ｈ

ト
10-18 ア
10-21 ゼ プ ト
10-24 ヨ ク ト

a
z
y

da

d
°
’

10-3
10-6

p
f

1 d=24 h=86 400 s
1°=(π/180) rad1’=(1/60)°=(π/10800) rad”1”=(1/60)’=(π/648000) radha 1ha=1hm2=104m2
L，l 1L=11=1dm3=103cm3=10-3m3t
1t=103 kg

秒
ヘクタール
リットル
トン

表７．SIに属さないが、SIと併用される単位で、SI単位で表される数値が実験的に得られるもの
名称
記号
SI 単位で表される数値
1eV=1.602 176 53(14)×10-19J

電 子 ボ ル ト
ダ ル ト ン
統一原子質量単位eVDa
u

1Da=1.660 538 86(28)×10-27kg
1u=1 Da天

ua

1ua=1.495 978 706 91(6)×1011m

文

単

位

表８．SIに属さないが、SIと併用されるその他の単位
名称
記号
SI 単位で表される数値
バー
ル bar １bar=0.1MPa=100kPa=105Pa
水銀柱ミリメートル mmHg 1mmHg=133.322Pa

s-1 mol(a)SI接頭語は固有の名称と記号を持つ組立単位と組み合わせても使用できる。しかし接頭語を付した単位はもはや
コヒーレントではない。
(b)ラジアンとステラジアンは数字の１に対する単位の特別な名称で、量についての情報をつたえるために使われる。
実際には、使用する時には記号rad及びsrが用いられるが、習慣として組立単位としての記号である数字の１は明示されない。
(c)測光学ではステラジアンという名称と記号srを単位の表し方の中に、そのまま維持している。
(d)ヘルツは周期現象についてのみ、ベクレルは放射性核種の統計的過程についてのみ使用される。
(e)セルシウス度はケルビンの特別な名称で、セルシウス温度を表すために使用される。セルシウス度とケルビンの単位の大きさは同一である。したがって、温度差や温度間隔を表す数値はどちらの単位で表しても同じである。
(f)放射性核種の放射能（activity referred to a radionuclide）は、しばしば誤った用語で”radioactivity”と記される。
(g)単位シーベルト（PV,2002,70,205）についてはCIPM勧告2（CI-2002）を参照。

表４．単位の中に固有の名称と記号を含むSI組立単位の例
SI 組立単位
組立量
SI 基本単位による
名称
記号
表し方
-1
粘
度 パスカル秒
Pa s
m kg s-1
力 の モ ー メ ン ト ニュートンメートル
Nm
m2 kg s-2
表面
張力 ニュートン毎メートル
N/m
kg s-2角
速度 ラジアン毎秒
rad/s
m m-1 s-1=s-1
角
加速度 ラジアン毎秒毎秒
rad/s2
m m-1 s-2=s-2
熱 流 密 度 , 放 射 照 度 ワット毎平方メートル
kg s-3
W/m2
熱 容 量 , エ ン ト ロ ピ ー ジュール毎ケルビン
J/K
m2 kg s-2 K-1
比 熱 容 量 ， 比 エ ン ト ロ ピ ー ジュール毎キログラム毎ケルビン J/(kg K)
m2 s-2 K-1
比 エ ネ ルギ ー ジュール毎キログラム
J/kg
m2 s-2
熱伝
導率 ワット毎メートル毎ケルビン W/(m K) m kg s-3 K-1
体 積 エ ネ ル ギ ー ジュール毎立方メートル J/m3
m-1 kg s-2
電界の強さ ボルト毎メートル
V/m
m kg s-3 A-1
電荷密
度 クーロン毎立方メートル C/m3
m-3 sA
表面
電
荷 クーロン毎平方メートル C/m2
m-2 sA
電 束 密 度 ， 電 気 変 位 クーロン毎平方メートル C/m2
m-2 sA誘
電率 ファラド毎メートル
F/m
m-3 kg-1 s4 A2
透磁率 ヘンリー毎メートル
H/m
m kg s-2 A-2
モ ル エ ネ ル ギ ー ジュール毎モル
J/mol
m2 kg s-2 mol-1
モルエントロピー, モル熱容量 ジュール毎モル毎ケルビン J/(mol K) m2 kg s-2 K-1 mol-1
照 射 線 量 （ Ｘ 線 及 び γ 線 ） クーロン毎キログラム
C/kg
kg-1 sA
吸収線
量率 グレイ毎秒
Gy/s
m2 s-3放射
強度 ワット毎ステラジアン
W/srm4 m-2 kg s-3=m2 kg s-3
放射輝
度 ワット毎平方メートル毎ステラジアン W/(m2 sr) m2 m-2 kg s-3=kg s-3
酵 素 活 性濃 度 カタール毎立方メートル kat/m3
m-3 s-1 mol

記号

ゼ
タ
エ ク サ

日
度
分

表３．固有の名称と記号で表されるSI組立単位
SI 組立単位
組立量
他のSI単位による SI基本単位による
名称
記号
表し方
表し方
（ｂ）
平
面
角 ラジアン(ｂ)
rad
m/m
1
（ｂ）
2/ 2
立
体
角 ステラジアン(ｂ) sr(c)
1
m m
周
波
数 ヘルツ（ｄ）
Hz
s-1
力
ニュートン
N
m kg s-2
圧力
応
力 パスカル,Pa
m-1 kg s-2
N/m2
エ ネ ル ギ ー , 仕 事 , 熱 量 ジュールJNm
m2 kg s-2
仕 事 率 ， 工 率 ， 放 射 束 ワット
WJ/s
m2 kg s-3
電
荷
電気量 クーロン,
CsA
電 位 差 （ 電 圧 ） , 起 電 力 ボルト
VW/A
m2 kg s-3 A-1
静電
容量 ファラドF
C/V
m-2 kg-1 s4 A2
電
気
抵
抗 オーム
Ω
V/A
m2 kg s-3 A-2
コ ン ダ ク タ ン ス ジーメンス
S
A/V
m-2 kg-1 s3 A2
磁
束 ウエーバWb
Vs
m2 kg s-2 A-1
磁
束
密
度 テスラ
T
Wb/m2
kg s-2 A-1
イ ン ダ ク タ ン ス ヘンリーH
Wb/A
m2 kg s-2 A-2
セ ル シ ウ ス 温 度 セルシウス度(ｅ)℃K
光
束 ルーメンlm
cd
cd sr(c)
2
照
度 ルクス
lx
lm/m
m-2 cdBqs-1
放 射 性 核 種 の 放 射 能 （ ｆ ） ベクレル（ｄ）
吸収線量, 比エネルギー分与,
グレイ
Gy
J/kg
m2 s-2カーマ
線量当量, 周辺線量当量, 方向
Sv
J/kg
m2 s-2シーベルト（ｇ）
性線量当量, 個人線量当量
素

表５．SI 接頭語
記号 乗数
接頭語
Ｙ
シ
10-1 デ

表６．SIに属さないが、SIと併用される単位
名称
記号
SI 単位による値
分
min 1 min=60s
時h
1h =60 min=3600 s（a）量濃度（amount concentration）は臨床化学の分野では物質濃度（substance concentration）ともよばれる。
（b）これらは無次元量あるいは次元１をもつ量であるが、そのことを表す単位記号である数字の１は通常は表記しない。

酸

接頭語
ヨ
タ

オングストローム
海
里
バ
ー
ン

Å
Ｍ

１Å=0.1nm=100pm=10-10m
１M=1852m

b

ノ
ネ
ベ

ト
パ
ル

kn
Np
Ｂ

１b=100fm2=(10-12cm)2=10-28m2
１kn=(1852/3600)m/s

ル

dB

ッ
ー

デ

ジ

ベ

SI単位との数値的な関係は、対数量の定義に依存。

エ

表９．固有の名称をもつCGS組立単位
名称
記号
SI 単位で表される数値
ル
グ erg 1 erg=10-7 J

ダ
ポ

イ
ア

ス
ス

ト ー ク
チ
ル

フ
ガ

ォ

ン dyn 1 dyn=10-5N
ズ P 1 P=1 dyn s cm-2=0.1Pa s
ス St 1 St =1cm2 s-1=10-4m2 s-1
ブ sb 1 sb =1cd cm-2=104cd m-2
ト ph 1 ph=1cd sr cm-2 104lx
ル Gal 1 Gal =1cm s-2=10-2ms-2

マ ク ス ウ ｪ ルガ
ウス
エルステッド（ ｃ）

Mx
G
Oe

1 Mx = 1G cm2=10-8Wb
1 G =1Mx cm-2 =10-4T
1 Oe (103/4π)A m-1（c）３元系のCGS単位系とSIでは直接比較できないため、等号「は対応関係を示すものである。

キ
レ
ラ

名称
ュ
リ
ン

レ
ガ

ト

表10．SIに属さないその他の単位の例
記号
SI 単位で表される数値
ー Ci 1 Ci=3.7×1010Bq

ゲ

ン

ン R
ド rad
ム rem
マ γ

1 R = 2.58×10-4C/kg
1 rad=1cGy=10-2Gy
1 rem=1 cSv=10-2Sv
1γ=1 nT=10-9T
1フェルミ=1 fm=10-15m

フェルミ
メートル系カラット

1メートル系カラット = 200 mg = 2×10-4kg

気

ル Torr 1 Torr = (101 325/760) Pa
圧 atm 1 atm = 101 325 Pa

ロ

リ

ー

cal

ク

ロ

ン

µ

ト
標

準

カ
ミ

大

」

1cal=4.1858J（｢15℃｣カロリー），4.1868J（｢IT｣カロリー）4.184J（｢熱化学｣カロリー）

1 µ =1µm=10-6m（第8版，2006年改訂）

この印刷物は再生紙を使用しています