Dear all, I wanted to know if it's already implemented to plot two observables against each other with the combination of pyalps.collectXY and pyalps.plot.plot. As an example I would like to be able to plot energy vs. magnetization in an example like MC-07. This mainly arises as a question if I want to use the exchange Monte Carlo formalism (thanks for that, it seems to work great with very little modification to my code). There the optimized temperature set is saved as an observable. If I still want to be able to plot M vs. T I would need the ability to plot two observables against each other. However it crashes in alps/lib/pyalps/tools.py in the function collectXY at the line xvalue = np.array([data.props[x] for i in range(len(data.y))]) Is what I intend to do possible with collectXY? Best, Dominik
There a function for this, but it is note used a lot.
Here the doc string:
def ResultsToXY(sets,x,y,foreach=[]): """ combines observable x and y to build a list of DataSet with y vs x
this function is used to collect data from a hierarchy of DataSet objects, to prepare plots or evaluation. the inner-most list has to contain one DataSet with props['observable'] = x and one props['observable'] = y, this will be the pair x-y used in the collection.
The parameters are: sets: hierarchy of datasets where the inner-most list must contain to pair x-y x: the name of the observable to be used as x-value of the collected results y: the name of the observable to be used as y-value of the collected results foreach: an optional list of properties used for grouping the results. A separate DataSet object is created for each unique set of values of the specified parameers.
The function returns a list of DataSet objects. """
Best, Michele
On 28 Mar 2017, at 15:23, Dominik Schildknecht dominik.schildknecht@psi.ch wrote:
Dear all, I wanted to know if it's already implemented to plot two observables against each other with the combination of pyalps.collectXY and pyalps.plot.plot. As an example I would like to be able to plot energy vs. magnetization in an example like MC-07. This mainly arises as a question if I want to use the exchange Monte Carlo formalism (thanks for that, it seems to work great with very little modification to my code). There the optimized temperature set is saved as an observable. If I still want to be able to plot M vs. T I would need the ability to plot two observables against each other. However it crashes in alps/lib/pyalps/tools.py in the function collectXY at the line xvalue = np.array([data.props[x] for i in range(len(data.y))]) Is what I intend to do possible with collectXY? Best, Dominik
-- Paul Scherrer Institut Dominik Schildknecht PhD Student WHGA/129 CH-5232 Villigen-PSI Phone: +41 56 310 55 68
Comp-phys-alps-users Mailing List for the ALPS Project http://alps.comp-phys.org/
List info: https://lists.phys.ethz.ch//listinfo/comp-phys-alps-users Archive: https://lists.phys.ethz.ch//pipermail/comp-phys-alps-users
Unsubscribe by writing a mail to comp-phys-alps-users-leave@lists.phys.ethz.ch.
Dear Michele,
thanks a lot. This helped. However I think I found a bug in this function. The sort in the end of the function is non-functional as there is no sort in the class MCScalarData (totally understandable why). I assume the python interpreter will work with a default for the comparison rather than raise an error. In the case of EXMC the error of all the x-values are 0, such that the sort function shows undefined behavior.
To circumvent the problem I propose to change the following line in the ResultsToXY function
order = np.argsort(res.x, kind = 'mergesort')
To:
order = np.argsort([x.mean for x in res.x], kind = 'mergesort')
This would fix the bug locally (to give the expected result), without changing the rest of the code basis. Is it possible to incorporate this change in the code basis?
Best,
Dominik
On 29.03.2017 07:45, Michele Dolfi wrote:
There a function for this, but it is note used a lot.
Here the doc string:
def ResultsToXY(sets,x,y,foreach=[]): """ combines observable x and y to build a list of DataSet with y vs x
this function is used to collect data from a hierarchy of DataSet
objects, to prepare plots or evaluation. the inner-most list has to contain one DataSet with props['observable'] = x and one props['observable'] = y, this will be the pair x-y used in the collection.
The parameters are: sets: hierarchy of datasets where the inner-most list must
contain to pair x-y x: the name of the observable to be used as x-value of the collected results y: the name of the observable to be used as y-value of the collected results foreach: an optional list of properties used for grouping the results. A separate DataSet object is created for each unique set of values of the specified parameers.
The function returns a list of DataSet objects. """
Best, Michele
On 28 Mar 2017, at 15:23, Dominik Schildknecht <dominik.schildknecht@psi.ch mailto:dominik.schildknecht@psi.ch> wrote:
Dear all, I wanted to know if it's already implemented to plot two observables against each other with the combination of pyalps.collectXY and pyalps.plot.plot. As an example I would like to be able to plot energy vs. magnetization in an example like MC-07. This mainly arises as a question if I want to use the exchange Monte Carlo formalism (thanks for that, it seems to work great with very little modification to my code). There the optimized temperature set is saved as an observable. If I still want to be able to plot M vs. T I would need the ability to plot two observables against each other. However it crashes in alps/lib/pyalps/tools.py in the function collectXY at the line xvalue = np.array([data.props[x] for i in range(len(data.y))]) Is what I intend to do possible with collectXY? Best, Dominik
-- Paul Scherrer Institut Dominik Schildknecht PhD Student WHGA/129 CH-5232 Villigen-PSI Phone: +41 56 310 55 68
Comp-phys-alps-users Mailing List for the ALPS Project http://alps.comp-phys.org/
List info: https://lists.phys.ethz.ch//listinfo/comp-phys-alps-users Archive: https://lists.phys.ethz.ch//pipermail/comp-phys-alps-users
Unsubscribe by writing a mail to comp-phys-alps-users-leave@lists.phys.ethz.ch.
Comp-phys-alps-users Mailing List for the ALPS Project http://alps.comp-phys.org/
List info: https://lists.phys.ethz.ch//listinfo/comp-phys-alps-users Archive: https://lists.phys.ethz.ch//pipermail/comp-phys-alps-users
Unsubscribe by writing a mail to comp-phys-alps-users-leave@lists.phys.ethz.ch.
Well, the fix then will break other codes that don’t have error and mean.
The proper one is pyalps.mean(x). I will try to push the change tomorrow.
Best, Michele
On 29 Mar 2017, at 08:52, Dominik Schildknecht dominik.schildknecht@psi.ch wrote:
Dear Michele,
thanks a lot. This helped. However I think I found a bug in this function. The sort in the end of the function is non-functional as there is no sort in the class MCScalarData (totally understandable why). I assume the python interpreter will work with a default for the comparison rather than raise an error. In the case of EXMC the error of all the x-values are 0, such that the sort function shows undefined behavior. To circumvent the problem I propose to change the following line in the ResultsToXY function order = np.argsort(res.x, kind = 'mergesort')
To: order = np.argsort([x.mean for x in res.x], kind = 'mergesort')
This would fix the bug locally (to give the expected result), without changing the rest of the code basis. Is it possible to incorporate this change in the code basis?
Best,
Dominik
On 29.03.2017 07:45, Michele Dolfi wrote:
There a function for this, but it is note used a lot.
Here the doc string:
def ResultsToXY(sets,x,y,foreach=[]): """ combines observable x and y to build a list of DataSet with y vs x
this function is used to collect data from a hierarchy of DataSet objects, to prepare plots or evaluation. the inner-most list has to contain one DataSet with props['observable'] = x and one props['observable'] = y, this will be the pair x-y used in the collection. The parameters are: sets: hierarchy of datasets where the inner-most list must contain to pair x-y x: the name of the observable to be used as x-value of the collected results y: the name of the observable to be used as y-value of the collected results foreach: an optional list of properties used for grouping the results. A separate DataSet object is created for each unique set of values of the specified parameers. The function returns a list of DataSet objects. """
Best, Michele
On 28 Mar 2017, at 15:23, Dominik Schildknecht <dominik.schildknecht@psi.ch mailto:dominik.schildknecht@psi.ch> wrote:
Dear all, I wanted to know if it's already implemented to plot two observables against each other with the combination of pyalps.collectXY and pyalps.plot.plot. As an example I would like to be able to plot energy vs. magnetization in an example like MC-07. This mainly arises as a question if I want to use the exchange Monte Carlo formalism (thanks for that, it seems to work great with very little modification to my code). There the optimized temperature set is saved as an observable. If I still want to be able to plot M vs. T I would need the ability to plot two observables against each other. However it crashes in alps/lib/pyalps/tools.py in the function collectXY at the line xvalue = np.array([data.props[x] for i in range(len(data.y))]) Is what I intend to do possible with collectXY? Best, Dominik
-- Paul Scherrer Institut Dominik Schildknecht PhD Student WHGA/129 CH-5232 Villigen-PSI Phone: +41 56 310 55 68
Comp-phys-alps-users Mailing List for the ALPS Project http://alps.comp-phys.org/ http://alps.comp-phys.org/
List info: https://lists.phys.ethz.ch//listinfo/comp-phys-alps-users https://lists.phys.ethz.ch//listinfo/comp-phys-alps-users Archive: https://lists.phys.ethz.ch//pipermail/comp-phys-alps-users https://lists.phys.ethz.ch//pipermail/comp-phys-alps-users
Unsubscribe by writing a mail to comp-phys-alps-users-leave@lists.phys.ethz.ch mailto:comp-phys-alps-users-leave@lists.phys.ethz.ch.
Comp-phys-alps-users Mailing List for the ALPS Project http://alps.comp-phys.org/ http://alps.comp-phys.org/
List info: https://lists.phys.ethz.ch//listinfo/comp-phys-alps-users https://lists.phys.ethz.ch//listinfo/comp-phys-alps-users Archive: https://lists.phys.ethz.ch//pipermail/comp-phys-alps-users https://lists.phys.ethz.ch//pipermail/comp-phys-alps-users
Unsubscribe by writing a mail to comp-phys-alps-users-leave@lists.phys.ethz.ch mailto:comp-phys-alps-users-leave@lists.phys.ethz.ch.
-- Paul Scherrer Institut Dominik Schildknecht PhD Student WHGA/129 CH-5232 Villigen-PSI Phone: +41 56 310 55 68
Comp-phys-alps-users Mailing List for the ALPS Project http://alps.comp-phys.org/
List info: https://lists.phys.ethz.ch//listinfo/comp-phys-alps-users Archive: https://lists.phys.ethz.ch//pipermail/comp-phys-alps-users
Unsubscribe by writing a mail to comp-phys-alps-users-leave@lists.phys.ethz.ch.
comp-phys-alps-users@lists.phys.ethz.ch