//
// The AcCoRD Simulator
// (Actor-based Communication via Reaction-Diffusion)
//
// Copyright 2016 Adam Noel. All rights reserved.
// 
// For license details, read LICENSE.txt in the root AcCoRD directory
// For user documentation, read README.txt in the root AcCoRD directory
//
// HOWTO_READ_OUTPUT.txt - explains how to read the primary (data) output file
// Last revised for AcCoRD v0.4.1
//
// Revision history:
//
// Revision v0.4.1
// - changed output filename convention and possible location
//
// Revision v0.3.1
// - header added
//
// WARNING: THIS IS NOT A REAL OUTPUT FILE!!!
// THE "COMMENTS" IN THIS FILE MAKE IT UNREADABLE BY THE ACCORD MATLAB IMPORT FUNCTION!
// BUT ... THIS FILE DESCRIBES HOW TO READ A VALID OUTPUT FILE
//
// With that out of the way, welcome to this "tutorial" for examining proper
// AcCoRD output files.
//
// This document is current as of v0.4.1 (2016-02-18).
//
// Please note that output files will not have these comments
// preceded by "//". 
// Please refer to README.txt for instructions on running a simulation and
// importing output into MATLAB.
//
// AcCoRD simulations generate two types of file. Each simulation has a corresponding
// "output" file and "summary output" file in the "results" folder. The output file
// contains mostly raw simulation
// data, whereas the summary output file has simulation meta-data, including information
// about the amount of data in the output file.
//
// If the output filename (as defined by
// "Output Filename" in the simulation config file) is FILENAME.txt, then the output
// filename in the results folder will be saved as FILENAME_SEEDX.txt, where "X" is the
// seed value specified as a command line argument when the simulation was ran (or by the
// parameter "Random Number Seed" in the config file if no seed number was provided
// as an argument). Similarly, the summary filename will be FILENAME_SEEDX_summary.txt.
//
// AcCoRD input and summary output files (but not data output files)
// use the JSON format. JSON stands for
// JavaScript Object Notation and it is defined at json.org.
// JSON is a way of organizing data into an object.
//
// AcCoRD output files use a custom ASCII format that is more compact than JSON and therefore
// more suitable for storing very large amounts of data.
//
// Names in AcCoRD output files do not have white space in them so that they can be
// cleanly imported into MATLAB.
//
// Read below to see how a data file is organized

Realization 0: 			// One simulation can generate multiple independent realizations. All
						// simulation output is stored by realization.
						
	ActiveActor 0:		// Actors (both active and passive) are numbered in the same order that
						// they were defined in the config file. In the output file, the bit stream
						// of each active actor is listed, in the sequence that the bits were
						// transmitted
		1 1 1 
	PassiveActor 1:
		MolID 0:		// Each passive actor might track multiple molecule types, so the results
						// for each molecule type are listed separately.
						
			Count:		// The number of molecules of the current type counted in each observation
				0 0 0 0 0 0 0 2 2 1 
			Position:	// If the molecule type for this actor has its molecule positions recorded,
						// then there is a set of round brackets for each observation, and within
						// each set are sets of round brackets with the cartesian coordinates
						// of every molecule observed (the number of coordinates will match the
						// the values in "Count")
				()
				()
				()		// There were no molecules counted for these observations
				()
				()
				()
				()
						// The following three observations had molecules observed so their
						// coordinates are listed
				((2.067619e-005, 8.661346e-006, 7.565874e-006) (2.286934e-005, 9.720073e-006, 8.564995e-006) )
				((2.059462e-005, 9.839858e-006, 9.123956e-006) (2.287780e-005, 9.223588e-006, 9.905855e-006) )
				((2.265028e-005, 9.244800e-006, 9.280057-006) )
	PassiveActor 2:
		Time:			// If the observation times for an actor are recorded, then they are listed
						// first (before any of the observation details associated with specific
						// molecule types)
			1.0000e-006 1.0010e-003 2.0010e-003 3.0010e-003 4.0010e-003 5.0010e-003 6.0010e-003 7.0010e-003 8.0010e-003 9.0010e-003 
		MolID 0:
			Count:
				10 10 10 10 10 20 20 18 18 19 

Realization 1:			// Data for the second independent realization
	ActiveActor 0:
		1 1 1 
	PassiveActor 1:
		MolID 0:
			Count:
				0 0 0 0 0 1 2 1 1 1 
			Position:
				()
				()
				()
				()
				()
				((2.513999e-005, 6.431998e-006, 9.857445e-006) )
				((2.086086e-005, 3.955539e-006) (2.627005e-005, 6.416771e-006, 6.365854e-006) )
				((2.621028e-005, 5.436915e-006, 8.084725e-006) )
				((2.549234e-005, 8.197377e-006, 7.699565e-006) )
				((2.414901e-005, 9.918234e-006, 6.856744e-006) )
	PassiveActor 2:
		Time:
			1.0000e-006 1.0010e-003 2.0010e-003 3.0010e-003 4.0010e-003 5.0010e-003 6.0010e-003 7.0010e-003 8.0010e-003 9.0010e-003 
		MolID 0:
			Count:
				10 10 10 10 10 19 18 19 19 19