def getAllContribsOutputStrFromSpectraOutput( spectraOutput, energyFmt=None, intensityFmt=None ):
	""" Gets a str to write all contributions to spectraOutput (e.g. fragA-S-3p contribution)
	
	Args:
		spectraOutput: (GenSpectraOutput object) This contains all information for a generated spectrum
		energyFmt: (Str, optional) The format string for the energies. Default = "{:.9g}"
		intensityFmt: (Str, optional) The format string for the intensities. Default = "{:.9g}"
			 
	Returns
		 outStr: (Str) String containing data on the contributions to the spectrum
 
	"""
	energyFmt = "{:.9g}" if energyFmt is None else energyFmt
	intensityFmt = "{:.9g}" if intensityFmt is None else intensityFmt

	labelList = spectraOutput.label
	dataList = spectraOutput.spectralContributions

	#Get the labels
	labelStrs = ", ".join( ["{}-{}-{}".format(x.fragKey, x.eleKey, x.aoKey) for x in labelList] )
	labelStrs = "#labels = " + labelStrs

	outStrList = [labelStrs]
	outStrList.append( "#Energy, Intensities" )
	dataStrFmt = energyFmt + ", " + ", ".join( [intensityFmt for x in range(len(dataList))] )

	for idx,x in enumerate(dataList[0]):
		energy = x[0]
		currData = [ a[idx][1] for a in dataList ]
		outStrList.append( dataStrFmt.format( energy, *currData) )

	return "\n".join(outStrList)