diff --git a/paper/paper.bib b/paper/paper.bib index 8e02b29..582d38c 100644 --- a/paper/paper.bib +++ b/paper/paper.bib @@ -84,6 +84,7 @@ @article{ELATE2016 number={27}, pages={275201}, year={2016}, + doi = {10.1088/0953-8984/28/27/275201}, publisher={IOP Publishing} } @@ -101,7 +102,7 @@ @book{Giacovazzo2011 % ? unused Number of pages ("842") @article{Goodwin2008a, - title = {Large Negative Linear Compressibility of {{Ag3}}[{{Co}}({{CN}})6].}, + title = {Large Negative Linear Compressibility of {{Ag{{$_3$}}}}[{{Co}}({{CN}}){{$_6$}}].}, author = {Goodwin, Andrew L and Keen, David A and Tucker, Matthew G}, year = {2008}, month = dec, diff --git a/paper/paper.md b/paper/paper.md index 9521cae..650b46d 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -50,7 +50,7 @@ The strain matrix is then diagonalised, to yield the principal strains (eigenval These matched and sorted strain eigenvalues are then fitted to equations of state appropriate to the data type. All data types are first fitted linearly. Pressure datasets, which are highly non-linear, are additionally fitted to the widely used empirical equation-of-state: $\epsilon(p) = \epsilon_0 + \lambda (p - p_c)^\nu$ [@Goodwin2008a]. For electrochemical datasets, where datasets are non-linear but analytic equations-of-state are not widely used, the data are fitted by Chebyshev polynomials with an appropriate regularisation procedure. -Linear fits are carried out on volumetric data, with additional fitting carried out for pressure datasets to the Birch-Murnaghan equations of state (second order, third order, and third order with critical pressure correction) [@Birch1947; @Sata2002] and for electrochemical datasets using Chebyshev polynomials. The errors in calculated parameters and their derivatives with respect to the stimuli (i.e., compressibilities) are calculated using the residuals of the fits, as propagation of crystallographic errors through to the strain is not in general well-defined. Errors in the stimulus are used solely to weight the relative importance of data points. +Linear fits are carried out on volumetric data, with additional fitting carried out for pressure datasets to the Birch-Murnaghan equations of state (second order, third order, and third order with critical pressure correction) [@Birch1947; @Sata2002] and for electrochemical datasets using Chebyshev polynomials. The errors in calculated parameters and their derivatives with respect to the stimuli (i.e., compressibilities) are calculated using the residuals of the fits, as the propagation of the errors in the unit cell parameters through to the errors in the diagonalised strain is not well-defined in general. Errors in the stimulus are used solely to weight the relative importance of data points. The output page consists of a number of tables of physically meaningful coefficients and interactive graphics [@plotlytechnologiesincCollaborativeDataScience2015] showing the stimuli dependence of the principal strains, their derivatives (for pressure and electrochemical data), and an indicatrix represention of the expansivity/compressibility. diff --git a/src/PASCal/core.py b/src/PASCal/core.py index 87d764e..3f6f6f7 100644 --- a/src/PASCal/core.py +++ b/src/PASCal/core.py @@ -265,7 +265,7 @@ def _set_named_coeffs(self): [d[2] if len(d) > 2 else "n/a" for d in sigmas], dtype=object ) self.named_coefficients["PcCoef"] = np.array( - [0.0, 0.0, self.options.pc_val] + [0.0, 0.0, self.options.pc_val if self.options.pc_val else 0.0] ) self.named_coefficients["CalPress"] = np.zeros( (len(self.volume_fits), len(self.cell_volumes)) diff --git a/src/PASCal/options.py b/src/PASCal/options.py index 121e9d4..797ee40 100644 --- a/src/PASCal/options.py +++ b/src/PASCal/options.py @@ -72,8 +72,13 @@ def from_dict(options: Dict[str, Any]) -> "Options": if options.get("data_type"): options["data_type"] = PASCalDataType[options["data_type"].upper()] - if options.get("pc_val"): - options["pc_val"] = float(options["pc_val"]) + if options.get("pc_val") is not None: + if not options.get("pc_val"): + options["pc_val"] = None + else: + options["pc_val"] = float(options["pc_val"]) + if options.get("pc_val") is None: + options["use_pc"] = False if options.get("deg_poly_strain"): options["deg_poly_strain"] = int(options["deg_poly_strain"]) if options.get("deg_poly_vol"): diff --git a/tests/test_app.py b/tests/test_app.py index 1c376e9..6d6963c 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -207,6 +207,33 @@ def test_q_sample_data( ), "Volumes table failed" +def test_p_no_pc_sample_data( + client, + sample_p, + parser, +): + post_parameters = { + "DataType": "Pressure", + "EulerianStrain": "True", + "FiniteStrain": "True", + "DegPolyCap": "", + "DegPolyVol": "", + "UsePc": "False", + "PcVal": "", + "data": sample_p, + } + + response = client.post("/output", data=post_parameters) + assert response.status_code == 200 + + html_response = [d for d in response.response] + assert len(html_response) == 1 + + soup = parser(html_response[0]) + tables = soup.find_all("table") + assert len(tables) == 7 + + def test_parse_options(): from PASCal.options import Options, PASCalDataType @@ -227,3 +254,21 @@ def test_parse_options(): assert options.deg_poly_strain == 12 assert options.deg_poly_vol == 10 assert not options.finite_strain + + form_example = { + "DataType": "Temperature", + "UsePc": "False", + "PcVal": "", + "EulerianStrain": "True", + "DegPolyVol": "10", + "DegPolyCap": "12", + "FiniteStrain": "False", + } + options = Options.from_form(form_example) + assert options.data_type == PASCalDataType.TEMPERATURE + assert options.use_pc is False + assert options.pc_val is None + assert options.eulerian_strain + assert options.deg_poly_strain == 12 + assert options.deg_poly_vol == 10 + assert not options.finite_strain