diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..2e67d72 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ + +recursive-include xijafit * +include README.md diff --git a/setup.py b/setup.py index a0bea49..2632751 100644 --- a/setup.py +++ b/setup.py @@ -17,8 +17,7 @@ url='http://cxc.cfa.harvard.edu/mta/ASPECT/tool_doc/xijafit/', license='BSD', description='Tool for automating the Xija model fitting process', - long_description=open('README.md').read(), - package_data={'xijafit': ['example_data/*.json']}, + package_data={'xijafit.tests': ['*.json']}, tests_require=['pytest'], ) \ No newline at end of file diff --git a/xijafit/fit.py b/xijafit/fit.py index 229e5cc..ff27fa5 100644 --- a/xijafit/fit.py +++ b/xijafit/fit.py @@ -11,12 +11,18 @@ import io import os - import sherpa.ui as ui from Chandra.Time import DateTime -import Chandra.taco import xija +try: + import Chandra.taco + # Enable fully-randomized evaluation of ACIS-FP model which is desirable + # for fitting. + Chandra.taco.taco.set_random_salt(None) +except ImportError: + pass + try: import plot_cxctime_custom as plot_cxctime except ImportError: @@ -114,9 +120,6 @@ def __init__(self, modelobject, days=180, stop=None, start=None, set_data_exprs= sch.setFormatter(sformatter) self.sherpa_logger.addHandler(sch) - # Enable fully-randomized evaluation of ACIS-FP model which is desirable - # for fitting. - Chandra.taco.taco.set_random_salt(None) # Set initial times. if stop and not start: diff --git a/xijafit/tests/tcylaft6_fit_snapshots.json b/xijafit/tests/tcylaft6_fit_snapshots.json new file mode 100644 index 0000000..f3358de --- /dev/null +++ b/xijafit/tests/tcylaft6_fit_snapshots.json @@ -0,0 +1,275 @@ +[ + { + "coupling__tcylaft6__tcylaft6_0__tau": 145.69950031390493, + "date": "2016:314:20:12:48.025", + "fit_stat": 7799038.8503582375, + "heatsink__tcylaft6_0__T": 7.202258699852631, + "heatsink__tcylaft6_0__tau": 19.035016415258287, + "method": null, + "solarheat__tcylaft6_0__P_100": 2.1838378986950344, + "solarheat__tcylaft6_0__P_110": 2.144604786302296, + "solarheat__tcylaft6_0__P_120": 1.970065963040971, + "solarheat__tcylaft6_0__P_130": 1.6078783440418365, + "solarheat__tcylaft6_0__P_140": 1.2241867286557584, + "solarheat__tcylaft6_0__P_150": 0.7555935830951949, + "solarheat__tcylaft6_0__P_160": 0.10565686619997607, + "solarheat__tcylaft6_0__P_180": 0.0, + "solarheat__tcylaft6_0__P_45": 1.7472813482784069, + "solarheat__tcylaft6_0__P_60": 2.0886699321070847, + "solarheat__tcylaft6_0__P_80": 2.2140298941667096, + "solarheat__tcylaft6_0__P_90": 2.37050012773606, + "solarheat__tcylaft6_0__ampl": 0.08125105152845383, + "solarheat__tcylaft6_0__bias": 0.0, + "solarheat__tcylaft6_0__dP_100": 0.2, + "solarheat__tcylaft6_0__dP_110": 0.16733738555674266, + "solarheat__tcylaft6_0__dP_120": 0.11837692281328732, + "solarheat__tcylaft6_0__dP_130": 0.11, + "solarheat__tcylaft6_0__dP_140": 0.11614117573923835, + "solarheat__tcylaft6_0__dP_150": 0.09141459271880145, + "solarheat__tcylaft6_0__dP_160": 0.045477378820906286, + "solarheat__tcylaft6_0__dP_180": 0.0, + "solarheat__tcylaft6_0__dP_45": 0.03924789356239728, + "solarheat__tcylaft6_0__dP_60": 0.15248924198683483, + "solarheat__tcylaft6_0__dP_80": 0.2, + "solarheat__tcylaft6_0__dP_90": 0.2595462502455334, + "solarheat__tcylaft6_0__tau": 365.0, + "solarheat_off_nom_roll__tcylaft6__P_minus_y": -0.015183175540065026, + "solarheat_off_nom_roll__tcylaft6__P_plus_y": -0.013433326104032245, + "tstart": "2014:300:12:02:40.816", + "tstop": "2016:300:11:53:27.816" + }, + { + "coupling__tcylaft6__tcylaft6_0__tau": 127.14013238048582, + "date": "2016:314:20:30:14.991", + "fit_stat": 4348431.223261227, + "heatsink__tcylaft6_0__T": 7.202258699852631, + "heatsink__tcylaft6_0__tau": 19.035016415258287, + "method": "moncar", + "solarheat__tcylaft6_0__P_100": 2.359720285283332, + "solarheat__tcylaft6_0__P_110": 2.3064538526792386, + "solarheat__tcylaft6_0__P_120": 2.0473226461437735, + "solarheat__tcylaft6_0__P_130": 1.6458783588760666, + "solarheat__tcylaft6_0__P_140": 1.3693067570725783, + "solarheat__tcylaft6_0__P_150": 0.8739376085166018, + "solarheat__tcylaft6_0__P_160": 0.4509071715782094, + "solarheat__tcylaft6_0__P_180": 1.999991811115132, + "solarheat__tcylaft6_0__P_45": 1.8196489546184027, + "solarheat__tcylaft6_0__P_60": 1.9850262775410807, + "solarheat__tcylaft6_0__P_80": 2.196123302096948, + "solarheat__tcylaft6_0__P_90": 2.295447520811069, + "solarheat__tcylaft6_0__ampl": 0.06900189386119292, + "solarheat__tcylaft6_0__bias": 0.0, + "solarheat__tcylaft6_0__dP_100": 0.2, + "solarheat__tcylaft6_0__dP_110": 0.16733738555674266, + "solarheat__tcylaft6_0__dP_120": 0.11837692281328732, + "solarheat__tcylaft6_0__dP_130": 0.11, + "solarheat__tcylaft6_0__dP_140": 0.11614117573923835, + "solarheat__tcylaft6_0__dP_150": 0.09141459271880145, + "solarheat__tcylaft6_0__dP_160": 0.045477378820906286, + "solarheat__tcylaft6_0__dP_180": 0.0, + "solarheat__tcylaft6_0__dP_45": 0.03924789356239728, + "solarheat__tcylaft6_0__dP_60": 0.15248924198683483, + "solarheat__tcylaft6_0__dP_80": 0.2, + "solarheat__tcylaft6_0__dP_90": 0.2595462502455334, + "solarheat__tcylaft6_0__tau": 365.0, + "solarheat_off_nom_roll__tcylaft6__P_minus_y": 0.16689009199097632, + "solarheat_off_nom_roll__tcylaft6__P_plus_y": 0.11162655576785337, + "tstart": "2014:300:12:02:40.816", + "tstop": "2016:300:11:53:27.816" + }, + { + "coupling__tcylaft6__tcylaft6_0__tau": 127.14013238048582, + "date": "2016:314:20:31:05.237", + "fit_stat": 4307847.047874413, + "heatsink__tcylaft6_0__T": 5.569929542217925, + "heatsink__tcylaft6_0__tau": 20.15042136773322, + "method": "moncar", + "solarheat__tcylaft6_0__P_100": 2.359720285283332, + "solarheat__tcylaft6_0__P_110": 2.3064538526792386, + "solarheat__tcylaft6_0__P_120": 2.0473226461437735, + "solarheat__tcylaft6_0__P_130": 1.6458783588760666, + "solarheat__tcylaft6_0__P_140": 1.3693067570725783, + "solarheat__tcylaft6_0__P_150": 0.8739376085166018, + "solarheat__tcylaft6_0__P_160": 0.4509071715782094, + "solarheat__tcylaft6_0__P_180": 1.999991811115132, + "solarheat__tcylaft6_0__P_45": 1.8196489546184027, + "solarheat__tcylaft6_0__P_60": 1.9850262775410807, + "solarheat__tcylaft6_0__P_80": 2.196123302096948, + "solarheat__tcylaft6_0__P_90": 2.295447520811069, + "solarheat__tcylaft6_0__ampl": 0.06900189386119292, + "solarheat__tcylaft6_0__bias": 0.0, + "solarheat__tcylaft6_0__dP_100": 0.2, + "solarheat__tcylaft6_0__dP_110": 0.16733738555674266, + "solarheat__tcylaft6_0__dP_120": 0.11837692281328732, + "solarheat__tcylaft6_0__dP_130": 0.11, + "solarheat__tcylaft6_0__dP_140": 0.11614117573923835, + "solarheat__tcylaft6_0__dP_150": 0.09141459271880145, + "solarheat__tcylaft6_0__dP_160": 0.045477378820906286, + "solarheat__tcylaft6_0__dP_180": 0.0, + "solarheat__tcylaft6_0__dP_45": 0.03924789356239728, + "solarheat__tcylaft6_0__dP_60": 0.15248924198683483, + "solarheat__tcylaft6_0__dP_80": 0.2, + "solarheat__tcylaft6_0__dP_90": 0.2595462502455334, + "solarheat__tcylaft6_0__tau": 365.0, + "solarheat_off_nom_roll__tcylaft6__P_minus_y": 0.16689009199097632, + "solarheat_off_nom_roll__tcylaft6__P_plus_y": 0.11162655576785337, + "tstart": "2014:300:12:02:40.816", + "tstop": "2016:300:11:53:27.816" + }, + { + "coupling__tcylaft6__tcylaft6_0__tau": 127.14013238048582, + "date": "2016:314:20:48:06.148", + "fit_stat": 3890438.9619049416, + "heatsink__tcylaft6_0__T": 5.569929542217925, + "heatsink__tcylaft6_0__tau": 20.15042136773322, + "method": "moncar", + "solarheat__tcylaft6_0__P_100": 2.359720285283332, + "solarheat__tcylaft6_0__P_110": 2.3064538526792386, + "solarheat__tcylaft6_0__P_120": 2.0473226461437735, + "solarheat__tcylaft6_0__P_130": 1.6458783588760666, + "solarheat__tcylaft6_0__P_140": 1.3693067570725783, + "solarheat__tcylaft6_0__P_150": 0.8739376085166018, + "solarheat__tcylaft6_0__P_160": 0.4509071715782094, + "solarheat__tcylaft6_0__P_180": 1.999991811115132, + "solarheat__tcylaft6_0__P_45": 1.8196489546184027, + "solarheat__tcylaft6_0__P_60": 1.9850262775410807, + "solarheat__tcylaft6_0__P_80": 2.196123302096948, + "solarheat__tcylaft6_0__P_90": 2.295447520811069, + "solarheat__tcylaft6_0__ampl": 0.08180666551528686, + "solarheat__tcylaft6_0__bias": 0.0, + "solarheat__tcylaft6_0__dP_100": 0.3720713685223887, + "solarheat__tcylaft6_0__dP_110": 0.2644579491781834, + "solarheat__tcylaft6_0__dP_120": 0.1144833668957015, + "solarheat__tcylaft6_0__dP_130": 0.2195716605258796, + "solarheat__tcylaft6_0__dP_140": 0.19478060206023165, + "solarheat__tcylaft6_0__dP_150": 0.17972724995448328, + "solarheat__tcylaft6_0__dP_160": 0.17040133590772377, + "solarheat__tcylaft6_0__dP_180": 0.37377028528242995, + "solarheat__tcylaft6_0__dP_45": 0.12701041370474794, + "solarheat__tcylaft6_0__dP_60": 0.13457158835135793, + "solarheat__tcylaft6_0__dP_80": 0.1193312617757476, + "solarheat__tcylaft6_0__dP_90": -0.01981232994686787, + "solarheat__tcylaft6_0__tau": 365.0, + "solarheat_off_nom_roll__tcylaft6__P_minus_y": 0.16689009199097632, + "solarheat_off_nom_roll__tcylaft6__P_plus_y": 0.11162655576785337, + "tstart": "2014:300:12:02:40.816", + "tstop": "2016:300:11:53:27.816" + }, + { + "coupling__tcylaft6__tcylaft6_0__tau": 127.14013238048582, + "date": "2016:322:19:07:57.922", + "fit_stat": 5427875.1673000958, + "heatsink__tcylaft6_0__T": 5.569929542217925, + "heatsink__tcylaft6_0__tau": 20.15042136773322, + "method": null, + "solarheat__tcylaft6_0__P_100": 2.173683902751355, + "solarheat__tcylaft6_0__P_110": 2.1742243817787541, + "solarheat__tcylaft6_0__P_120": 1.9900807478436202, + "solarheat__tcylaft6_0__P_130": 1.5360921165403683, + "solarheat__tcylaft6_0__P_140": 1.2719160904953795, + "solarheat__tcylaft6_0__P_150": 0.78407364624308296, + "solarheat__tcylaft6_0__P_160": 0.36570618383012454, + "solarheat__tcylaft6_0__P_180": 1.8131059670147571, + "solarheat__tcylaft6_0__P_45": 1.7561435094040678, + "solarheat__tcylaft6_0__P_60": 1.917740230813294, + "solarheat__tcylaft6_0__P_80": 2.1364574472586693, + "solarheat__tcylaft6_0__P_90": 2.3053537229665393, + "solarheat__tcylaft6_0__ampl": 0.08180666551528686, + "solarheat__tcylaft6_0__bias": 0.0, + "solarheat__tcylaft6_0__dP_100": 0.3720713685223887, + "solarheat__tcylaft6_0__dP_110": 0.2644579491781834, + "solarheat__tcylaft6_0__dP_120": 0.1144833668957015, + "solarheat__tcylaft6_0__dP_130": 0.2195716605258796, + "solarheat__tcylaft6_0__dP_140": 0.19478060206023165, + "solarheat__tcylaft6_0__dP_150": 0.17972724995448328, + "solarheat__tcylaft6_0__dP_160": 0.17040133590772377, + "solarheat__tcylaft6_0__dP_180": 0.37377028528242995, + "solarheat__tcylaft6_0__dP_45": 0.12701041370474794, + "solarheat__tcylaft6_0__dP_60": 0.13457158835135793, + "solarheat__tcylaft6_0__dP_80": 0.1193312617757476, + "solarheat__tcylaft6_0__dP_90": -0.01981232994686787, + "solarheat__tcylaft6_0__tau": 365.0, + "solarheat_off_nom_roll__tcylaft6__P_minus_y": 0.16689009199097632, + "solarheat_off_nom_roll__tcylaft6__P_plus_y": 0.11162655576785337, + "tstart": "2013:300:12:04:32.816", + "tstop": "2016:300:11:53:27.816" + }, + { + "coupling__tcylaft6__tcylaft6_0__tau": 125.96144553374542, + "date": "2016:322:19:26:14.256", + "fit_stat": 4974477.0631486671, + "heatsink__tcylaft6_0__T": 5.5699295422179249, + "heatsink__tcylaft6_0__tau": 20.15042136773322, + "method": "moncar", + "solarheat__tcylaft6_0__P_100": 2.083008048907744, + "solarheat__tcylaft6_0__P_110": 2.0653885234151499, + "solarheat__tcylaft6_0__P_120": 1.8805422067103001, + "solarheat__tcylaft6_0__P_130": 1.5915423543126397, + "solarheat__tcylaft6_0__P_140": 1.2622202698765079, + "solarheat__tcylaft6_0__P_150": 0.84423924123394822, + "solarheat__tcylaft6_0__P_160": 0.39048601746353478, + "solarheat__tcylaft6_0__P_180": 1.9606928178598484, + "solarheat__tcylaft6_0__P_45": 1.7367913537610207, + "solarheat__tcylaft6_0__P_60": 1.9052084417852613, + "solarheat__tcylaft6_0__P_80": 2.0399587551118676, + "solarheat__tcylaft6_0__P_90": 2.0506214255373116, + "solarheat__tcylaft6_0__ampl": 0.081806665515286855, + "solarheat__tcylaft6_0__bias": 0.0, + "solarheat__tcylaft6_0__dP_100": 0.3720713685223887, + "solarheat__tcylaft6_0__dP_110": 0.26445794917818338, + "solarheat__tcylaft6_0__dP_120": 0.1144833668957015, + "solarheat__tcylaft6_0__dP_130": 0.21957166052587959, + "solarheat__tcylaft6_0__dP_140": 0.19478060206023165, + "solarheat__tcylaft6_0__dP_150": 0.17972724995448328, + "solarheat__tcylaft6_0__dP_160": 0.17040133590772377, + "solarheat__tcylaft6_0__dP_180": 0.37377028528242995, + "solarheat__tcylaft6_0__dP_45": 0.12701041370474794, + "solarheat__tcylaft6_0__dP_60": 0.13457158835135793, + "solarheat__tcylaft6_0__dP_80": 0.1193312617757476, + "solarheat__tcylaft6_0__dP_90": -0.019812329946867869, + "solarheat__tcylaft6_0__tau": 365.0, + "solarheat_off_nom_roll__tcylaft6__P_minus_y": 0.11922566959054204, + "solarheat_off_nom_roll__tcylaft6__P_plus_y": 0.1313792852252203, + "tstart": "2013:300:12:04:32.816", + "tstop": "2016:300:11:53:27.816" + }, + { + "coupling__tcylaft6__tcylaft6_0__tau": 125.96144553374542, + "date": "2016:322:19:45:32.361", + "fit_stat": 4840922.7281041685, + "heatsink__tcylaft6_0__T": 5.5699295422179249, + "heatsink__tcylaft6_0__tau": 20.15042136773322, + "method": "moncar", + "solarheat__tcylaft6_0__P_100": 2.083008048907744, + "solarheat__tcylaft6_0__P_110": 2.0653885234151499, + "solarheat__tcylaft6_0__P_120": 1.8805422067103001, + "solarheat__tcylaft6_0__P_130": 1.5915423543126397, + "solarheat__tcylaft6_0__P_140": 1.2622202698765079, + "solarheat__tcylaft6_0__P_150": 0.84423924123394822, + "solarheat__tcylaft6_0__P_160": 0.39048601746353478, + "solarheat__tcylaft6_0__P_180": 1.9606928178598484, + "solarheat__tcylaft6_0__P_45": 1.7367913537610207, + "solarheat__tcylaft6_0__P_60": 1.9052084417852613, + "solarheat__tcylaft6_0__P_80": 2.0399587551118676, + "solarheat__tcylaft6_0__P_90": 2.0506214255373116, + "solarheat__tcylaft6_0__ampl": 0.081806665515286855, + "solarheat__tcylaft6_0__bias": 0.0, + "solarheat__tcylaft6_0__dP_100": 0.25059384088956638, + "solarheat__tcylaft6_0__dP_110": 0.24785320978196304, + "solarheat__tcylaft6_0__dP_120": 0.17728335178136606, + "solarheat__tcylaft6_0__dP_130": 0.22183956807374561, + "solarheat__tcylaft6_0__dP_140": 0.19927551656668463, + "solarheat__tcylaft6_0__dP_150": 0.17465518078563746, + "solarheat__tcylaft6_0__dP_160": 0.17841576619195629, + "solarheat__tcylaft6_0__dP_180": 0.49999711514768763, + "solarheat__tcylaft6_0__dP_45": 0.13633667968033217, + "solarheat__tcylaft6_0__dP_60": 0.090896114439088044, + "solarheat__tcylaft6_0__dP_80": 0.1290713098416999, + "solarheat__tcylaft6_0__dP_90": 0.16070368647255273, + "solarheat__tcylaft6_0__tau": 365.0, + "solarheat_off_nom_roll__tcylaft6__P_minus_y": 0.11922566959054204, + "solarheat_off_nom_roll__tcylaft6__P_plus_y": 0.1313792852252203, + "tstart": "2013:300:12:04:32.816", + "tstop": "2016:300:11:53:27.816" + } +] \ No newline at end of file diff --git a/xijafit/tests/tcylaft6_model_spec.json b/xijafit/tests/tcylaft6_model_spec.json new file mode 100644 index 0000000..7fde243 --- /dev/null +++ b/xijafit/tests/tcylaft6_model_spec.json @@ -0,0 +1,447 @@ +{ + "comps": [ + { + "class_name": "Node", + "init_args": [ + "tcylaft6_0" + ], + "init_kwargs": { + "sigma": 100000.0 + }, + "name": "tcylaft6_0" + }, + { + "class_name": "Pitch", + "init_args": [], + "init_kwargs": {}, + "name": "pitch" + }, + { + "class_name": "Eclipse", + "init_args": [], + "init_kwargs": {}, + "name": "eclipse" + }, + { + "class_name": "HeatSink", + "init_args": [ + "tcylaft6_0" + ], + "init_kwargs": { + "T": 20.0, + "tau": 30.0 + }, + "name": "heatsink__tcylaft6_0" + }, + { + "class_name": "SolarHeat", + "init_args": [ + "tcylaft6_0", + "pitch", + "eclipse", + [ + 45, + 60, + 80, + 90, + 100, + 110, + 120, + 130, + 140, + 150, + 160, + 180 + ], + [ + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ], + "init_kwargs": { + "ampl": 0.003851, + "epoch": "2015:117", + "tau": 365, + "var_func": "linear" + }, + "name": "solarheat__tcylaft6_0" + }, + { + "class_name": "Node", + "init_args": [ + "tcylaft6" + ], + "init_kwargs": {}, + "name": "tcylaft6" + }, + { + "class_name": "Coupling", + "init_args": [ + "tcylaft6", + "tcylaft6_0" + ], + "init_kwargs": { + "tau": 100.0 + }, + "name": "coupling__tcylaft6__tcylaft6_0" + }, + { + "class_name": "Roll", + "init_args": [], + "init_kwargs": {}, + "name": "roll" + }, + { + "class_name": "SolarHeatOffNomRoll", + "init_args": [ + "tcylaft6" + ], + "init_kwargs": { + "P_minus_y": 0.0, + "P_plus_y": 0.0, + "eclipse_comp": "eclipse", + "pitch_comp": "pitch", + "roll_comp": "roll" + }, + "name": "solarheat_off_nom_roll__tcylaft6" + } + ], + "datestart": "2013:300:12:04:32.816", + "datestop": "2016:300:11:53:27.816", + "dt": 328.0, + "mval_names": [], + "name": "tcylaft6", + "pars": [ + { + "comp_name": "heatsink__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "heatsink__tcylaft6_0__T", + "max": 100.0, + "min": -100.0, + "name": "T", + "val": 5.5699295422179249 + }, + { + "comp_name": "heatsink__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "heatsink__tcylaft6_0__tau", + "max": 100.0, + "min": 2.0, + "name": "tau", + "val": 20.15042136773322 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_45", + "max": 3.0, + "min": 0.0, + "name": "P_45", + "val": 1.7367913537610207 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_60", + "max": 3.0, + "min": 0.0, + "name": "P_60", + "val": 1.9052084417852613 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_80", + "max": 3.0, + "min": 0.0, + "name": "P_80", + "val": 2.0399587551118676 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_90", + "max": 3.0, + "min": 0.0, + "name": "P_90", + "val": 2.0506214255373116 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_100", + "max": 3.0, + "min": 0.0, + "name": "P_100", + "val": 2.083008048907744 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_110", + "max": 3.0, + "min": 0.0, + "name": "P_110", + "val": 2.0653885234151499 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_120", + "max": 3.0, + "min": 0.0, + "name": "P_120", + "val": 1.8805422067103001 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_130", + "max": 3.0, + "min": 0.0, + "name": "P_130", + "val": 1.5915423543126397 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_140", + "max": 3.0, + "min": 0.0, + "name": "P_140", + "val": 1.2622202698765079 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_150", + "max": 2.0, + "min": 0.0, + "name": "P_150", + "val": 0.84423924123394822 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_160", + "max": 2.0, + "min": 0.0, + "name": "P_160", + "val": 0.39048601746353478 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__P_180", + "max": 2.0, + "min": 0.0, + "name": "P_180", + "val": 1.9606928178598484 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_45", + "max": 0.5, + "min": -0.5, + "name": "dP_45", + "val": 0.13633667968033217 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_60", + "max": 0.5, + "min": -0.5, + "name": "dP_60", + "val": 0.090896114439088044 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_80", + "max": 0.5, + "min": -0.5, + "name": "dP_80", + "val": 0.1290713098416999 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_90", + "max": 0.5, + "min": -0.5, + "name": "dP_90", + "val": 0.16070368647255273 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_100", + "max": 0.5, + "min": -0.5, + "name": "dP_100", + "val": 0.25059384088956638 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_110", + "max": 0.5, + "min": -0.5, + "name": "dP_110", + "val": 0.24785320978196304 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_120", + "max": 0.5, + "min": -0.5, + "name": "dP_120", + "val": 0.17728335178136606 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_130", + "max": 0.5, + "min": -0.5, + "name": "dP_130", + "val": 0.22183956807374561 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_140", + "max": 0.5, + "min": -0.5, + "name": "dP_140", + "val": 0.19927551656668463 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_150", + "max": 0.5, + "min": -0.5, + "name": "dP_150", + "val": 0.17465518078563746 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_160", + "max": 0.5, + "min": -0.5, + "name": "dP_160", + "val": 0.17841576619195629 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__dP_180", + "max": 0.5, + "min": -0.5, + "name": "dP_180", + "val": 0.49999711514768763 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__tau", + "max": 365.25, + "min": 365.0, + "name": "tau", + "val": 365.0 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__ampl", + "max": 1.0, + "min": -1.0, + "name": "ampl", + "val": 0.081806665515286855 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__bias", + "max": 2.0, + "min": -1.0, + "name": "bias", + "val": 0.0 + }, + { + "comp_name": "coupling__tcylaft6__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "coupling__tcylaft6__tcylaft6_0__tau", + "max": 300.0, + "min": 50.0, + "name": "tau", + "val": 125.96144553374542 + }, + { + "comp_name": "solarheat_off_nom_roll__tcylaft6", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat_off_nom_roll__tcylaft6__P_plus_y", + "max": 1.0, + "min": -1.0, + "name": "P_plus_y", + "val": 0.1313792852252203 + }, + { + "comp_name": "solarheat_off_nom_roll__tcylaft6", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat_off_nom_roll__tcylaft6__P_minus_y", + "max": 1.0, + "min": -1.0, + "name": "P_minus_y", + "val": 0.11922566959054204 + } + ], + "tlm_code": null +} \ No newline at end of file diff --git a/xijafit/tests/tcylaft6_model_spec_roll_base.json b/xijafit/tests/tcylaft6_model_spec_roll_base.json new file mode 100755 index 0000000..2b40082 --- /dev/null +++ b/xijafit/tests/tcylaft6_model_spec_roll_base.json @@ -0,0 +1,462 @@ +{ + "comps": [ + { + "class_name": "Node", + "init_args": [ + "tcylaft6_0" + ], + "init_kwargs": { + "sigma": 100000.0 + }, + "name": "tcylaft6_0" + }, + { + "class_name": "Pitch", + "init_args": [], + "init_kwargs": {}, + "name": "pitch" + }, + { + "class_name": "Eclipse", + "init_args": [], + "init_kwargs": {}, + "name": "eclipse" + }, + { + "class_name": "HeatSink", + "init_args": [ + "tcylaft6_0" + ], + "init_kwargs": { + "T": 20.0, + "tau": 30.0 + }, + "name": "heatsink__tcylaft6_0" + }, + { + "class_name": "SolarHeat", + "init_args": [ + "tcylaft6_0", + "pitch", + "eclipse", + [ + 45, + 60, + 80, + 90, + 100, + 110, + 120, + 130, + 140, + 150, + 160, + 180 + ], + [ + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1, + 0.1 + ] + ], + "init_kwargs": { + "ampl": 0.003851, + "epoch": "2013:182", + "tau": 365, + "var_func": "linear" + }, + "name": "solarheat__tcylaft6_0" + }, + { + "class_name": "Node", + "init_args": [ + "tcylaft6" + ], + "init_kwargs": {}, + "name": "tcylaft6" + }, + { + "class_name": "Coupling", + "init_args": [ + "tcylaft6", + "tcylaft6_0" + ], + "init_kwargs": { + "tau": 100.0 + }, + "name": "coupling__tcylaft6__tcylaft6_0" + }, + { + "class_name": "Roll", + "init_args": [], + "init_kwargs": {}, + "name": "roll" + }, + { + "class_name": "SolarHeatOffNomRoll", + "init_args": [ + "tcylaft6" + ], + "init_kwargs": { + "P_minus_y": 0.0, + "P_plus_y": 0.0, + "eclipse_comp": "eclipse", + "pitch_comp": "pitch", + "roll_comp": "roll" + }, + "name": "solarheat_off_nom_roll__tcylaft6" + } + ], + "datestart": "2013:365:12:04:48.816", + "datestop": "2015:050:11:53:28.816", + "dt": 328.0, + "gui_config": { + "filename": "/home/mdahmer/ThermalModels/xija_model_updates/tcylaft6/chandra_models/chandra_models/xija/tcylaft6/tcylaft6_spec_linear.json", + "plot_names": [ + "tcylaft6 data__time", + "tcylaft6 resid__time", + "tcylaft6 resid__data" + ], + "set_data_vals": { + "tcylaft6_0": 30.0 + }, + "size": [ + 1680, + 870 + ] + }, + "mval_names": [], + "name": "tcylaft6", + "pars": [ + { + "comp_name": "heatsink__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "heatsink__tcylaft6_0__T", + "max": 100.0, + "min": -100.0, + "name": "T", + "val": 7.2022586998526306 + }, + { + "comp_name": "heatsink__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "heatsink__tcylaft6_0__tau", + "max": 100.0, + "min": 2.0, + "name": "tau", + "val": 19.035016415258287 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_45", + "max": 3.0, + "min": 0.0, + "name": "P_45", + "val": 1.6560973456389605 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_60", + "max": 3.0, + "min": 0.0, + "name": "P_60", + "val": 1.7343941179997904 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_80", + "max": 3.0, + "min": 0.0, + "name": "P_80", + "val": 1.7493730967542329 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_90", + "max": 3.0, + "min": 0.0, + "name": "P_90", + "val": 1.7675004806385257 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_100", + "max": 3.0, + "min": 0.0, + "name": "P_100", + "val": 1.7191811012825577 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_110", + "max": 3.0, + "min": 0.0, + "name": "P_110", + "val": 1.7558325180014314 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_120", + "max": 3.0, + "min": 0.0, + "name": "P_120", + "val": 1.6950427538311408 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_130", + "max": 3.0, + "min": 0.0, + "name": "P_130", + "val": 1.3523171054649743 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_140", + "max": 3.0, + "min": 0.0, + "name": "P_140", + "val": 0.95435779482218774 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_150", + "max": 2.0, + "min": 0.0, + "name": "P_150", + "val": 0.54321152364777392 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_160", + "max": 2.0, + "min": 0.0, + "name": "P_160", + "val": 2.1179450250347989e-10 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": false, + "full_name": "solarheat__tcylaft6_0__P_180", + "max": 2.0, + "min": 0.0, + "name": "P_180", + "val": 0.0 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_45", + "max": 0.3, + "min": 0.0, + "name": "dP_45", + "val": 0.03924789356239728 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_60", + "max": 0.3, + "min": 0.0, + "name": "dP_60", + "val": 0.15248924198683483 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_80", + "max": 0.3, + "min": 0.0, + "name": "dP_80", + "val": 0.20000000000000001 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_90", + "max": 0.3, + "min": 0.0, + "name": "dP_90", + "val": 0.25954625024553341 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_100", + "max": 0.3, + "min": 0.0, + "name": "dP_100", + "val": 0.20000000000000001 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_110", + "max": 0.3, + "min": 0.0, + "name": "dP_110", + "val": 0.16733738555674266 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_120", + "max": 0.3, + "min": 0.0, + "name": "dP_120", + "val": 0.11837692281328732 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_130", + "max": 0.3, + "min": 0.0, + "name": "dP_130", + "val": 0.11 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_140", + "max": 0.3, + "min": 0.0, + "name": "dP_140", + "val": 0.11614117573923835 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_150", + "max": 0.3, + "min": 0.0, + "name": "dP_150", + "val": 0.091414592718801452 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_160", + "max": 0.3, + "min": 0.0, + "name": "dP_160", + "val": 0.045477378820906286 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__dP_180", + "max": 0.3, + "min": 0.0, + "name": "dP_180", + "val": 0.0 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__tau", + "max": 365.25, + "min": 365.0, + "name": "tau", + "val": 365.0 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__ampl", + "max": 1.0, + "min": -1.0, + "name": "ampl", + "val": 0.081251051528453827 + }, + { + "comp_name": "solarheat__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat__tcylaft6_0__bias", + "max": 2.0, + "min": -1.0, + "name": "bias", + "val": 0.0 + }, + { + "comp_name": "coupling__tcylaft6__tcylaft6_0", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "coupling__tcylaft6__tcylaft6_0__tau", + "max": 300.0, + "min": 50.0, + "name": "tau", + "val": 145.69950031390493 + }, + { + "comp_name": "solarheat_off_nom_roll__tcylaft6", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat_off_nom_roll__tcylaft6__P_plus_y", + "max": 1.0, + "min": -1.0, + "name": "P_plus_y", + "val": -0.013433326104032245 + }, + { + "comp_name": "solarheat_off_nom_roll__tcylaft6", + "fmt": "{:.4g}", + "frozen": true, + "full_name": "solarheat_off_nom_roll__tcylaft6__P_minus_y", + "max": 1.0, + "min": -1.0, + "name": "P_minus_y", + "val": -0.015183175540065026 + } + ], + "tlm_code": null +} \ No newline at end of file diff --git a/xijafit/tests/test_xijafit.py b/xijafit/tests/test_xijafit.py index 314048d..1d6e6c1 100644 --- a/xijafit/tests/test_xijafit.py +++ b/xijafit/tests/test_xijafit.py @@ -1,15 +1,15 @@ import pytest import sys from pathlib import Path # if you haven't already done so -root = str(Path(__file__).resolve().parents[2]) +root = str(Path(__file__).resolve().parents[0]) sys.path.append(root) -from xijafit import XijaFit +import xijafit -BASE_MODEL = root + '/example_data/tcylaft6_model_spec_roll_base.json' +BASE_MODEL = root + '/tcylaft6_model_spec_roll_base.json' def test_fit(): - model = XijaFit(BASE_MODEL, set_data_exprs=(u'tcylaft6_0=22.0',), start='2013:300', + model = xijafit.XijaFit(BASE_MODEL, set_data_exprs=(u'tcylaft6_0=22.0',), start='2015:300', stop='2016:300',quiet=False, name='tcylaft6') model.freeze_all() @@ -22,4 +22,4 @@ def test_fit(): assert model.snapshots[0]['fit_stat'] > model.snapshots[1]['fit_stat'] if __name__ == "__main__": - test_fit() \ No newline at end of file + test_fit() \ No newline at end of file