n = 2; Prop = {{{157.428, -44.486, 180}, {50.674, -37.208, 105}, {160.641, 65.830, 50}, {260.758, 65.830, 50}, {120.896, -40.003, 180}, {20.674, 37.208, 105}, {60.641, 35.830, 50}, {260.758, 65.830, 50}, {120.896, -40.003, 180}, {20.896, -10.003, 180}, {320.896, 60.003, 180}, {157.428, -44.486, 180}, {34.674, -57.208, 105}, {20.896, -10.003, 180}}, {{157.428, -44.486, 180}, {50.674, -37.208, 105}, {160.641, 65.830, 50}, {260.758, 65.830, 50}, {120.896, -40.003, 180}, {20.674, 37.208, 105}, {60.641, 35.830, 50}, {260.758, 65.830, 50}, {120.896, -40.003, 180}, {20.896, -10.003, 180}, {320.896, 60.003, 180}, {157.428, -44.486, 180}, {34.674, -57.208, 105}, {20.896, -10.003, 180}}} Bin = Range[1, 52, 1]; \[Lambda]BinWidth = 30; \[Beta]BinWidth = 15; ImgSize = 590; MinCold = 140; MaxCold = 160; \[Lambda]range = Range[0, 360, \[Lambda]BinWidth]; \[Beta]range = Range[-90, 90, \[Beta]BinWidth]; Table[RAcount[i] = Prop[[i]][[All, 1]], {i, 1, n}]; Table[DECcount[i] = Prop[[i]][[All, 2]], {i, 1, n}]; Table[Timecount[i] = Prop[[i]][[All, 3]], {i, 1, n}]; Table[\[Beta]deg[i] = ArcSin[Cos[ 23.439281 \[Degree]] Sin[DECcount[i] \[Degree]] - Sin[RAcount[i] \[Degree]] Cos[DECcount[i] \[Degree]] Sin[ 23.439281 \[Degree]]]*180/\[Pi], {i, 1, n}];(*DEC*) Table[pre\[Lambda]deg[i] = ArcTan[(Cos[23.439281 \[Degree]] Sin[RAcount[i] \[Degree]] + Tan[DECcount[i] \[Degree]] Sin[23.439281 \[Degree]])/ Cos[RAcount[i] \[Degree]]]*180/\[Pi], {i, 1, n}];(*RA*) Table[preupdate\[Lambda]deg[i] = MapThread[ If[# < 0 , #2 + 180, #2] &, {Cos[RAcount[i] \[Degree]], pre\[Lambda]deg[i]}], {i, 1, n}]; Table[\[Lambda]deg[i] = MapThread[If[# < 0, # + 360, #] &, {preupdate\[Lambda]deg[i]}], {i, 1, n}]; Cold = Range[MinCold, MaxCold, (MaxCold - MinCold)]; Table[diffsun[i] = (7*(360/365))*i, {i, 0, 52}]; Table[Solar\[Lambda]week[i, j, k] = Abs[\[Lambda]deg[i][[j]] - diffsun[k]], {i, 1, n}, {j, 1, Length[Prop[[i]][[All, 1]]]}, {k, 0, Max[Bin]}]; (*indeces start at i=1,j=1,k=0*) Table[Solar\[Beta]week[i, j] = Abs[\[Beta]deg[i][[j]]], {i, 1, n}, {j, 1, Length[Prop[[i]][[All, 1]]]}]; Table[SolarPitch [i, j, k] = ArcCos[Cos[Solar\[Lambda]week[i, j, k] \[Degree]] Cos[ Solar\[Beta]week[i, j] \[Degree]]]*180/\[Pi], {i, 1, n}, {j, 1, Length[Prop[[i]][[All, 1]]]}, {k, 0, Max[Bin]}]; Table[\[Lambda]time[j, i] = Select[Thread[{\[Lambda]deg[j], Timecount[j]}], Between[ First[#], {\[Lambda]range[[i]], \[Lambda]range[[ i + 1]]}] &], {i, 1, Length[\[Lambda]range] - 1}, {j, 1, n}]; (*element 1 is proposal #, element 2 is iteration through \ range*) Table[\[Lambda]count[j, i] = Select[\[Lambda]deg[j], Between[ #, {\[Lambda]range[[i]], \[Lambda]range[[ i + 1]]}] &], {i, 1, Length[\[Lambda]range] - 1}, {j, 1, n}]; Table[\[Beta]time[j, i] = Select[Thread[{\[Beta]deg[j], Timecount[j]}], Between[ First[#], {\[Beta]range[[i]], \[Beta]range[[i + 1]]}] &], {i, 1, Length[\[Beta]range] - 1}, {j, 1, n}]; (*element 1 is proposal #, element 2 is iteration through \ range*) Table[\[Beta]count[j, i] = Select[\[Beta]deg[j], Between[ #, {\[Beta]range[[i]], \[Beta]range[[i + 1]]}] &], {i, 1, Length[\[Beta]range] - 1}, {j, 1, n}]; collate[data_] := Block[{res = ConstantArray[0, 52]}, res[[#1]] += #2 & @@@ Level[data, {-3}]; res] SolarPitchBins = Table[Flatten[ Position[ Table[SolarPitch [i, j, k], {k, 1, Length[Bin]}], _?(Min[Cold] <= # <= Max[Cold] &)]], {i, 1, n}, {j, 1, Length[Prop[[i]][[All, 1]]]}]; PitchTime = Table[Thread[{{SolarPitchBins[[i, j]]}, Timecount[i][[j]]}], {i, 1, n}, {j, 1, Length[Prop[[i]][[All, 1]]]}]; Table[PitchTimeSum[i] = collate[PitchTime[[i]]], {i, 1, n}]; Table[\[Lambda]timedata[i] = Table[Total[\[Lambda]time[i, k][[All, 2]]], {k, 1, Length[\[Lambda]range] - 1}], {i, 1, n}]; Table[\[Lambda]countdata[i] = Table[Length[\[Lambda]count[i, k][[All]]], {k, 1, Length[\[Lambda]range] - 1}], {i, 1, n}]; Table[\[Beta]timedata[i] = Table[Total[\[Beta]time[i, k][[All, 2]]], {k, 1, Length[\[Beta]range] - 1}], {i, 1, n}]; Table[\[Beta]countdata[i] = Table[Length[\[Beta]count[i, k][[All]]], {k, 1, Length[\[Beta]range] - 1}], {i, 1, n}]; Table[\[Lambda]timehist[j] = BarChart[\[Lambda]timedata[j], PlotRangePadding -> {{.1, 0.3}, {45, Max[\[Lambda]timedata[j]]/4}}, ImageSize -> ImgSize, ChartLabels -> \[Lambda]range, LabelingFunction -> (Placed[Rotate[#, \[Pi]/3], Above] &), Frame -> True, FrameLabel -> {Style["\[Lambda] bins", Bold], Style["Total time (ks)", Bold]}, PlotLabel -> Style["Total Time vs. \[Lambda]", Bold], ChartStyle -> Darker[Green], BarSpacing -> Medium], {j, 1, n}]; Table[\[Lambda]hist[j] = BarChart[\[Lambda]countdata[j] , PlotRangePadding -> {{0.1, 0.3}, {.5, Max[Length[\[Lambda]countdata[j]]]/.8}}, ImageSize -> ImgSize, Frame -> True, ChartLabels -> \[Lambda]range, LabelingFunction -> Above, FrameLabel -> {Style["\[Lambda] bins", Bold], Style["\[NumberSign] targets", Bold]}, PlotLabel -> Style["Target Count vs. \[Lambda]", Bold], ChartStyle -> Darker[Orange], BarSpacing -> Medium], {j, 1, n}]; Table[\[Beta]timehist[j] = BarChart[\[Beta]timedata[j], PlotRangePadding -> {{.1, 0.3}, {45, Max[\[Beta]timedata[j]]/4}}, ImageSize -> ImgSize, ChartLabels -> \[Beta]range, LabelingFunction -> (Placed[Rotate[#, \[Pi]/3], Above] &), Frame -> True, FrameLabel -> {Style["\[Beta] bins", Bold], Style["Total time (ks)", Bold]}, PlotLabel -> Style["Total Time vs. \[Beta]", Bold], ChartStyle -> Darker[Blue], BarSpacing -> Medium], {j, 1, n}]; Table[\[Beta]hist[j] = BarChart[\[Beta]countdata[j] , PlotRangePadding -> {{0.1, 0.3}, {.5, Max[Length[\[Beta]countdata[j]]]/.8}}, ImageSize -> ImgSize, Frame -> True, ChartLabels -> \[Beta]range, LabelingFunction -> Above, FrameLabel -> {Style["\[Beta] bins", Bold], Style["\[NumberSign] targets", Bold]}, PlotLabel -> Style["Target Count vs. \[Beta]", Bold], ChartStyle -> Darker[Red], BarSpacing -> Medium], {j, 1, n}]; Table[ColdTime[j] = BarChart[RotateRight[PitchTimeSum[j], 0], PlotRangePadding -> {{0, 1}, {0, Max[PitchTimeSum[j]]/4}}, ImageSize -> 2*ImgSize, ChartLabels -> Bin, LabelingFunction -> (Placed[Rotate[#, \[Pi]/2], Above] &), Frame -> True, FrameLabel -> {Style["Bins", Bold], Style["Time (ks)", Bold]}, PlotLabel -> Style["Total Cold Time Per Bin", Bold], ChartStyle -> Lighter[Blue], BarSpacing -> Small, AspectRatio -> 1/3.3], {j, 1, n}]; Table[ColdTargets[j] = BarChart[ RotateRight[ BinCounts[ SolarPitchBins[[j, All]] // Flatten, {1, Max[Bin] + 1, 1}], 0], PlotRangePadding -> {{0, 1}, {0, Max[BinCounts[ SolarPitchBins[[j, All]] // Flatten, {1, Max[Bin] + 1, 1}]]/ 5}}, ImageSize -> 2*ImgSize, ChartLabels -> Bin, LabelingFunction -> (Placed[Rotate[#, \[Pi]/2], Above] &), Frame -> True, FrameLabel -> {None, Style["\[NumberSign] targets", Bold]}, PlotLabel -> Style["Total Cold Targets Per Bin", Bold], ChartStyle -> Lighter[Red], BarSpacing -> Small, AspectRatio -> 1/3.3], {j, 1, n}]; Table[MeanTime[i] = Mean[Timecount[i]], {i, 1, n}] ;(*Mean by proposal*) Table[MedianTime[i] = Median[Timecount[i]], {i, 1, n}]; (*Median by proposal*) Table[Maxtime[i] = Max[Timecount[i]], {i, 1, n}] (*Max by proposal*) Table[Mintime[i] = Min[Timecount[i]], {i, 1, n}];(*Min by proposal*) Table[Numtarg[i] = Length[Prop[[i]]], {i, 1, n}]; (*# targets by proposal*) Table[Tottime[i] = Total[Timecount[i]], {i, 1, n}];(*Total time by proposal*) Table[MyGrid[i] = Grid[{{"Mean", MeanTime[i] "ks"}, {"Median", MedianTime[i] "ks"}, {"Max Time", Maxtime[i] "ks"}, {"Min Time", Mintime[i] "ks"}, {"Total Time", Tottime[i] "ks"}, {"Total Targets", Numtarg[i]}}, BaseStyle -> {FontFamily -> "Arial"}, ItemStyle -> {20, Bold}, Frame -> {All, All}, Background -> {None, {{Lighter[LightBlue]}}}, Spacings -> {.9, 10.5}], {i, 1, n}]; AllHist = TabView[{"Proposal 1" -> TabView[{"Coordinate View" -> Panel[Row[{Grid[{{\[Lambda]hist[1], \[Lambda]timehist[ 1]}, {\[Beta]hist[1], \[Beta]timehist[1]}}, Alignment -> Center], , MyGrid[1]}], Background -> White], "Pitch View" -> Panel[Row[{Grid[{{ColdTargets[1]}, {ColdTime[1]}}, Alignment -> Center], , MyGrid[1]}], Background -> White]}], "Proposal 2" -> TabView[{"Coordinate View" -> Panel[Row[{Grid[{{\[Lambda]hist[2], \[Lambda]timehist[ 2]}, {\[Beta]hist[2], \[Beta]timehist[2]}}, Alignment -> Center], , MyGrid[2]}], Background -> White], "Pitch View" -> Panel[Row[{Grid[{{ColdTargets[10]}, {ColdTime[10]}}, Alignment -> Center], , MyGrid[10]}], Background -> White]}]}, FrameMargins -> 30, LabelStyle -> Bold];