semvec/pypi-packages huggingface dataset:
crystalipf 0.0.6
Easy-to-use library for calculating the rgb values of the IPF map of cubic materials.
Requires Python: >=3.9

# Inverse Pole-Figure for Cubic Symmetry
This is an easy-to-use library to create inverse
pole-figures (ipf) for crystal lattices with
cubic symmetry.

## Installation
The library can be installed in three different ways:
1. Install it from the Python Package Index.
    ```bash
    pip install crystalipf
    ```
2. Clone the repository and install it.
    ```bash
    git clone https://github.com/silvioachilles/crystalipf.git
    cd crystalipf
    pip install .
    ``` 
3. Copy the `ipf/cubic.py` to your project and include it in your code.


## Usage
An orientation must be expressed as an orientation matrix.
In the code snippet below it is shown how to retrieve
the rgb color of the orientation and its position in the ipf.

```python
import numpy as np
import matplotlib.pyplot as plt

from crystalipf.cubic import position, rgb, image, image_plt, edges

# Example orientation matrix of a grain
grain = np.array([
    [ 0.71825437, -0.68019413,  0.14644661],
    [ 0.68019413,  0.6421339,  -0.35355339],
    [ 0.14644661,  0.35355339,  0.92387953]
])

# sample direction
g = np.array([0, 0, 1])

# ipf position
grain_ipf_x, grain_ipf_y = position(grain, g)

# ipf color
grain_ipf_rgb = rgb(grain, g)

# To illustrate, the grain's orientation is plotted
# in the ipf with respective coloring.
fig, ax = plt.subplots()
ax.scatter([grain_ipf_x], [grain_ipf_y], c=[grain_ipf_rgb])

# The edges of the ipf
ipf_edges_xs, ipf_edges_ys = edges()
ax.plot(ipf_edges_xs, ipf_edges_ys)

ax.axis('off')
plt.show()
```
<img src="https://github.com/silvioachilles/crystalipf/blob/Rework/doc/ipf_grain.png?raw=true" width="300" height="200" />

Using the `image_plt` function, you can create a matplotlib plot of a fully
colored ipf with annotations for the corners.

```python
fig, ax = plt.subplots()
image_plt(ax)
plt.show()
```

<img src="https://github.com/silvioachilles/crystalipf/blob/Rework/doc/ipf_colored_annotations.png?raw=true" width="300" height="200" />

An raw image of a fully colored ipf can be retrieved with the `image` function,
allowing to create a customized ipf plot.

```python
fig, ax = plt.subplots()

ipf_image, xmax, ymax = image()
ax.imshow(ipf_image, extent=0, xmax, 0, ymax)
ax.plot(ipf_edges_xs, ipf_edges_ys, c='black')

plt.show()
```

<img src="https://github.com/silvioachilles/crystalipf/blob/Rework/doc/ipf_colored.png?raw=true" width="300" height="200" />

## Troubleshooting
Please open a github issue if anything appears not correct.
atom2vec 1.1.0
A python implement of Atom2Vec: a simple way to describe atoms for machine learning
Requires Python: >=3.8
Keywords: material science,machine learning

# Atom2Vec
A python implement of Atom2Vec: a simple way to describe atoms for machine learning

(*Updated 06/21/2021*: We refactored the code with `pymatgen`, you can find old version in branch `old_version`. Now the code is fully typed and tested.)
## Background
Atom2Vec is first proposed on [Zhou Q, Tang P, Liu S, et al. Learning atoms for materials discovery[J]. Proceedings of the National Academy of Sciences, 2018, 115(28): E6411-E6417.](https://www.pnas.org/content/115/28/E6411#page)

## Demo
[![Atom Similarity Demo](docs/atom_sim_vis.png)](https://old.yuxingfei.com/src/similarity.html)

## Installation
```shell
pip install atom2vec
```

## Usage
### Generating atom vectors and atom similarity matrix
We use `pymatgen.core.Structure` to store all the structures. 
```python
from atom2vec import AtomSimilarity
from pymatgen.core import Structure
from typing import List

structures: List[Structure]
atom_similarity = AtomSimilarity.from_structures(structures, 
                                                 k_dim=100, max_elements=3)
```

### Query atom vectors
```python
from atom2vec import AtomSimilarity
from pymatgen.core import Element
from typing import List

atom_similarity: AtomSimilarity
atom_vector: List[float]

atom_vector = atom_similarity.get_atom_vector(1)  # atomic index
atom_vector = atom_similarity.get_atom_vector("H")  # atom's name
atom_vector = atom_similarity.get_atom_vector(Element("H"))  # pymatgen Element Enum
```

### Query atom similarity
```python
from atom2vec import AtomSimilarity
from pymatgen.core import Element

atom_similarity: AtomSimilarity
similarity: float

similarity = atom_similarity["Ca", "Sr"]
```
lmm-tools 0.0.8
Toolset for Large Multi-Modal Models
Requires Python: >=3.10,<4.0

# Large Multimodal Model Tools
LMM-Tools (Large Multmodal Model Tools) is a minimal library that helps you utilize multimodal models to organize and structure your image data. One of the problems of dealing with image data is it can be difficult to organize and quickly search. For example, you might have a bunch of pictures of houses and want to count how many yellow houses you have, or how many houses with adobe roofs. This library utilizes LMMs to help create these tags or descriptions and allow you to search over them, or use them in a database to do other operations.

## Getting Started
### LMMs
To get started you can create an LMM and start generating text from images. The following code will grab the LLaVA-1.6 34B model and generate a description of the image you pass it.

```python
import lmm_tools as lmt

model = lmt.lmm.get_model("llava")
model.generate("Describe this image", "image.png")
>>> "A yellow house with a green lawn."
```

**WARNING** We are hosting the LLaVA-1.6 34B model, if it times out please wait ~5-10 min for the server to warm up as it shuts down when usage is low.

### DataStore
You can use the `DataStore` class to store your images, add new metadata to them such as descriptions, and search over different columns.

```python
import lmm_tools as lmt
import pandas as pd

df = pd.DataFrame({"image_paths": ["image1.png", "image2.png", "image3.png"]})
ds = lmt.data.DataStore(df)
ds = ds.add_lmm(lmt.lmm.get_model("llava"))
ds = ds.add_embedder(lmt.emb.get_embedder("sentence-transformer"))

ds = ds.add_column("descriptions", "Describe this image.")
```

This will use the prompt you passed, "Describe this image.", and the LMM to create a new column of descriptions for your image. Your data will now contain a new column with the descriptions of each image:

| image\_paths | image\_id | descriptions |
| --- | --- | --- |
| image1.png | 1 | "A yellow house with a green lawn." |
| image2.png | 2 | "A white house with a two door garage." |
| image3.png | 3 | "A wooden house in the middle of the forest." |

You can now create an index on the descriptions column and search over it to find images that match your query.

```python
ds = ds.build_index("descriptions")
ds.search("A yellow house.", top_k=1)
>>> [{'image_paths': 'image1.png', 'image_id': 1, 'descriptions': 'A yellow house with a green lawn.'}]
```

You can also create other columns for you data such as `is_yellow`:

```python
ds = ds.add_column("is_yellow", "Is the house in this image yellow? Please answer yes or no.")
```

which would give you a dataset similar to this:

| image\_paths | image\_id | descriptions | is\_yellow |
| --- | --- | --- | --- |
| image1.png | 1 | "A yellow house with a green lawn." | "yes" |
| image2.png | 2 | "A white house with a two door garage." | "no" |
| image3.png | 3 | "A wooden house in the middle of the forest." | "no" |